Fixes for displaying categories
This commit is contained in:
@@ -4,7 +4,7 @@ module Suppliers
|
||||
# GET /products
|
||||
# GET /products.json
|
||||
def index
|
||||
@products = ProductDecorator.decorate(current_supplier.products)
|
||||
@products = ProductDecorator.decorate_collection(current_supplier.products)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class ProductDecorator < Draper::Base
|
||||
class ProductDecorator < Draper::Decorator
|
||||
decorates :product
|
||||
delegate_all
|
||||
|
||||
def category_links(options = {})
|
||||
if namespace = options[:namespace]
|
||||
@@ -9,6 +10,12 @@ class ProductDecorator < Draper::Base
|
||||
end
|
||||
end
|
||||
|
||||
def display
|
||||
|
||||
"#{model.name} (#{h.currency(model.price)})".html_safe
|
||||
|
||||
end
|
||||
|
||||
# Accessing Helpers
|
||||
# You can access any helper via a proxy
|
||||
#
|
||||
|
||||
@@ -7,7 +7,7 @@ class Supplier
|
||||
property :name
|
||||
property :open, type: :boolean, default: false
|
||||
property :time_zone, default: 'UTC'
|
||||
property :night_offset, type: Float
|
||||
property :night_offset, type: Fixnum, default: 0 # Hours
|
||||
|
||||
#LOCATION
|
||||
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'
|
||||
|
||||
= 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][]', ''
|
||||
= label_tag nil, Product.model_name.human_plural, class: 'control-label'
|
||||
.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}"
|
||||
= label_tag "product-checker-#{product.id}", product.name
|
||||
= label_tag "product-checker-#{product.id}", product.display
|
||||
br
|
||||
.control-group
|
||||
#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'
|
||||
- content_for :row do
|
||||
- @products = ProductDecorator.decorate(@product_category.products)
|
||||
- @products = ProductDecorator.decorate_collection(@product_category.products)
|
||||
= render template: 'suppliers/products/index'
|
||||
|
||||
Reference in New Issue
Block a user