diff --git a/app/assets/stylesheets/_items.sass b/app/assets/stylesheets/_items.sass index 71aeadde..1083a4db 100644 --- a/app/assets/stylesheets/_items.sass +++ b/app/assets/stylesheets/_items.sass @@ -1,6 +1,6 @@ @import "partials/campaign-progress" -body.items, body.item_trades +body.items-index, body.items-show, body.items-needed, body.item_trades +campaign-progress text-align: center diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 9b59e604..f41d3445 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -112,6 +112,22 @@ class ItemsController < ApplicationController end end + def sources + item_ids = params[:ids].split(",") + @items = Item.where(id: item_ids).order(:name) + + if @items.empty? + render file: "public/404.html", status: :not_found, layout: nil + return + end + + @nc_items = @items.select(&:nc?) + @np_items = @items.select(&:np?) + @pb_items = @items.select(&:pb?) + + render layout: "application" + end + protected def assign_closeted! diff --git a/app/models/item.rb b/app/models/item.rb index 582d9e0b..6db92d53 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -158,6 +158,10 @@ class Item < ApplicationRecord I18n.with_locale(:en) { self.description == PAINTBRUSH_SET_DESCRIPTION } end + def np? + !nc? && !pb? + end + def owned? @owned || false end diff --git a/app/views/items/sources.html.haml b/app/views/items/sources.html.haml new file mode 100644 index 00000000..0fe98f94 --- /dev/null +++ b/app/views/items/sources.html.haml @@ -0,0 +1,14 @@ +- title "Item Getting Guide" +%h1#title Item Getting Guide + +- if @nc_items.present? + %h2 Neocash items + = render @nc_items + +- if @np_items.present? + %h2 Neopoint items + = render @np_items + +- if @pb_items.present? + %h2 Paintbrush items + = render @pb_items diff --git a/config/routes.rb b/config/routes.rb index 240cf790..96a62347 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,6 +27,7 @@ OpenneoImpressItems::Application.routes.draw do collection do get :needed + get "sources/:ids", action: :sources end end resources :species, only: [] do