Fixes for displaying categories
This commit is contained in:
+2
-2
@@ -126,7 +126,7 @@ GEM
|
|||||||
jquery-rails (2.2.1)
|
jquery-rails (2.2.1)
|
||||||
railties (>= 3.0, < 5.0)
|
railties (>= 3.0, < 5.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
json (1.6.8)
|
json (1.6.7)
|
||||||
kaminari (0.14.1)
|
kaminari (0.14.1)
|
||||||
actionpack (>= 3.0.0)
|
actionpack (>= 3.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
@@ -147,7 +147,7 @@ GEM
|
|||||||
mime-types (1.21)
|
mime-types (1.21)
|
||||||
mini_magick (3.5.0)
|
mini_magick (3.5.0)
|
||||||
subexec (~> 0.2.1)
|
subexec (~> 0.2.1)
|
||||||
multi_json (1.6.1)
|
multi_json (1.5.0)
|
||||||
mustache (0.99.4)
|
mustache (0.99.4)
|
||||||
nokogiri (1.5.6)
|
nokogiri (1.5.6)
|
||||||
orm_adapter (0.0.7)
|
orm_adapter (0.0.7)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Suppliers
|
|||||||
# GET /products
|
# GET /products
|
||||||
# GET /products.json
|
# GET /products.json
|
||||||
def index
|
def index
|
||||||
@products = ProductDecorator.decorate(current_supplier.products)
|
@products = ProductDecorator.decorate_collection(current_supplier.products)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class ProductDecorator < Draper::Base
|
class ProductDecorator < Draper::Decorator
|
||||||
decorates :product
|
decorates :product
|
||||||
|
delegate_all
|
||||||
|
|
||||||
def category_links(options = {})
|
def category_links(options = {})
|
||||||
if namespace = options[:namespace]
|
if namespace = options[:namespace]
|
||||||
@@ -9,6 +10,12 @@ class ProductDecorator < Draper::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def display
|
||||||
|
|
||||||
|
"#{model.name} (#{h.currency(model.price)})".html_safe
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# Accessing Helpers
|
# Accessing Helpers
|
||||||
# You can access any helper via a proxy
|
# You can access any helper via a proxy
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class Supplier
|
|||||||
property :name
|
property :name
|
||||||
property :open, type: :boolean, default: false
|
property :open, type: :boolean, default: false
|
||||||
property :time_zone, default: 'UTC'
|
property :time_zone, default: 'UTC'
|
||||||
property :night_offset, type: Float
|
property :night_offset, type: Fixnum, default: 0 # Hours
|
||||||
|
|
||||||
#LOCATION
|
#LOCATION
|
||||||
property :lat, type: Float, default: 52.08062426379751
|
property :lat, type: Float, default: 52.08062426379751
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
- content_for :head do
|
/- content_for :head do
|
||||||
= javascript_include_tag 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false'
|
= javascript_include_tag 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false'
|
||||||
|
|
||||||
= form_for @supplier, url: supplier_update_settings_path, html: {class: 'form-horizontal'} do |f|
|
= form_for @supplier, url: supplier_update_settings_path, html: {class: 'form-horizontal'} do |f|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
= hidden_field_tag 'product_category[product_ids][]', ''
|
= hidden_field_tag 'product_category[product_ids][]', ''
|
||||||
= label_tag nil, Product.model_name.human_plural, class: 'control-label'
|
= label_tag nil, Product.model_name.human_plural, class: 'control-label'
|
||||||
.controls
|
.controls
|
||||||
- for product in current_supplier.products
|
- for product in ProductDecorator.decorate_collection(current_supplier.products)
|
||||||
= check_box_tag "product_category[product_ids][]", product.id, @product_category.product_ids.to_a.include?(product.id), id: "product-checker-#{product.id}"
|
= check_box_tag "product_category[product_ids][]", product.id, @product_category.product_ids.to_a.include?(product.id), id: "product-checker-#{product.id}"
|
||||||
= label_tag "product-checker-#{product.id}", product.name
|
= label_tag "product-checker-#{product.id}", product.display
|
||||||
br
|
br
|
||||||
.control-group
|
.control-group
|
||||||
#week_days-group.btn-group data-toggle="buttons-checkbox"
|
#week_days-group.btn-group data-toggle="buttons-checkbox"
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ dl.dl-horizontal.show-list
|
|||||||
'
|
'
|
||||||
= link_to t("helpers.links.destroy"), [:suppliers, @product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
|
= link_to t("helpers.links.destroy"), [:suppliers, @product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
|
||||||
- content_for :row do
|
- content_for :row do
|
||||||
- @products = ProductDecorator.decorate(@product_category.products)
|
- @products = ProductDecorator.decorate_collection(@product_category.products)
|
||||||
= render template: 'suppliers/products/index'
|
= render template: 'suppliers/products/index'
|
||||||
|
|||||||
Reference in New Issue
Block a user