Add user product info
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
App.ModalInfoController = Ember.ObjectController.extend
|
||||
actions:
|
||||
close: ->
|
||||
@get('model.cancel').call(@) if @get('model.cancel')
|
||||
@send 'closeModal'
|
||||
@@ -28,3 +28,7 @@ App.TableController = Ember.ObjectController.extend
|
||||
@set 'join_request_sent', true # keeps the button deactivated
|
||||
toggleProductCategory: (product_category)->
|
||||
product_category.set 'collapsed', not product_category.get('collapsed')
|
||||
showProductDescription: (product)->
|
||||
@send 'openModal', 'modal_info', Ember.Object.create
|
||||
title: product.get('name')
|
||||
body: textile(product.get('description'))
|
||||
|
||||
@@ -2,5 +2,6 @@ attr = DS.attr
|
||||
App.Product = DS.Model.extend
|
||||
name: attr 'string'
|
||||
price: attr 'number'
|
||||
description: attr 'string'
|
||||
product_category: DS.belongsTo('product_category')
|
||||
product_orders: DS.hasMany('product_order')
|
||||
|
||||
@@ -6,6 +6,11 @@ ControllerExtensions = Ember.Mixin.create
|
||||
if jqXHR.status == 401
|
||||
App.__container__.lookup('route:application').unauthorized()
|
||||
handler
|
||||
showModal: (options={})->
|
||||
$(document).foundation('reflow') # needed (stupid!!!)
|
||||
@confirm_cancel = options.cancel
|
||||
@set 'controllers.application.modal.title', options.title if options.title
|
||||
@set 'controllers.application.modal.content', options.content if options.content
|
||||
Ember.ArrayController.reopen ControllerExtensions
|
||||
Ember.Controller.reopen
|
||||
needs: ['application']
|
||||
@@ -47,13 +52,6 @@ Ember.Controller.reopen
|
||||
##@set 'controllers.application.confirm.content', options.content if options.content
|
||||
##$('#confirm-modal').foundation('reveal', 'open') # this kills the ember actions
|
||||
##$('#confirm-modal').css('visibility', 'visible').show()
|
||||
showModal: (options={})->
|
||||
#this.container.lookup('view:modal', {title:'Test title'})
|
||||
#debugger
|
||||
$(document).foundation('reflow') # needed (stupid!!!)
|
||||
@confirm_cancel = options.cancel
|
||||
@set 'controllers.application.modal.title', options.title if options.title
|
||||
@set 'controllers.application.modal.content', options.content if options.content
|
||||
#$('#confirm-modal').foundation('reveal', 'open') #this kills the ember actions
|
||||
#$('#confirm-modal').css('visibility', 'visible').show()
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
modal-dialog action="close"
|
||||
h3.flush--top= title
|
||||
p==body
|
||||
hr
|
||||
button{action 'close'}= t 'modal.info.close'
|
||||
@@ -25,9 +25,16 @@
|
||||
unless product_category.collapsed
|
||||
ul.product_category-products
|
||||
each product in product_category.products
|
||||
li
|
||||
li class="order-product-#{unbound product.id}"
|
||||
if product.description
|
||||
button.show-product-description{action showProductDescription product}
|
||||
span
|
||||
else
|
||||
span.no-product-description
|
||||
a{action addProduct product}= product.name
|
||||
span.right.currency=currency product.price
|
||||
button.add-product-to-list{action addProduct product}
|
||||
span
|
||||
span.product-price.currency=currency product.price
|
||||
.large-6.columns= render 'product_orders'
|
||||
else
|
||||
.large12
|
||||
@@ -39,5 +46,8 @@
|
||||
ul.product_category-products
|
||||
each product in product_category.products
|
||||
li
|
||||
if product.description
|
||||
button.show-product-description{action showProductDescription product}
|
||||
span
|
||||
span= product.name
|
||||
span.right.currency=currency product.price
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#= require translations
|
||||
#= require js-routes
|
||||
#= require_directory .
|
||||
#= require textile-js
|
||||
#= require_self
|
||||
#
|
||||
# (($) ->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import foundation_and_overrides
|
||||
@import ./foundation_and_overrides
|
||||
|
||||
.form-row
|
||||
@extend .row
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
// $rem-base: 16px;
|
||||
|
||||
// Allows the use of rem-calc() or lower-bound() in your settings
|
||||
a.unused-class
|
||||
display: inline-block
|
||||
@import "foundation/functions"
|
||||
|
||||
// $experimental: true;
|
||||
|
||||
@@ -8,8 +8,8 @@ header.top-menu
|
||||
background-position: left bottom, right bottom
|
||||
background-image: image-url('theme1/button-bar-left.png'), image-url('theme1/button-bar-right.png')
|
||||
color: $green
|
||||
padding-left: 49px
|
||||
padding-right: 52px
|
||||
padding-left: 48px
|
||||
padding-right: 52px
|
||||
.menu-content
|
||||
background-color: white
|
||||
background-repeat: repeat-x
|
||||
|
||||
@@ -1,12 +1,37 @@
|
||||
@import font-awesome
|
||||
ul.product_category-products
|
||||
list-style: none
|
||||
.product_category-title
|
||||
cursor: pointer
|
||||
.icon
|
||||
@extend .fa
|
||||
@extend .fa-arrow-down
|
||||
color: #ccc
|
||||
padding-right: 10px
|
||||
&.collapsed
|
||||
@extend .fa-arrow-right
|
||||
//@import ./foundation_and_overrides
|
||||
//@import font-awesome
|
||||
//ul.product_category-products
|
||||
//list-style: none
|
||||
//.product_category-title
|
||||
//cursor: pointer
|
||||
//.icon
|
||||
//@extend .fa
|
||||
//@extend .fa-arrow-down
|
||||
//color: #ccc
|
||||
//padding-right: 10px
|
||||
//&.collapsed
|
||||
//@extend .fa-arrow-right
|
||||
//.product_category-products
|
||||
//.product-price
|
||||
//float: right
|
||||
//.show-product-description
|
||||
//+button($bg: $secondary-color)
|
||||
//+button-icon-only
|
||||
//margin-right: 7px
|
||||
//span
|
||||
//@extend .fa
|
||||
//@extend .fa-info
|
||||
//@extend .fa-lg
|
||||
//.no-product-description
|
||||
//// Empty space to match the product description for layout
|
||||
//display: inline-block
|
||||
//width: 1.65rem
|
||||
//.add-product-to-list
|
||||
//+button($bg: $secondary-color)
|
||||
//+button-icon-only
|
||||
//float: right
|
||||
//margin-left: 5px
|
||||
//span
|
||||
//@extend .fa
|
||||
//@extend .fa-plus
|
||||
//@extend .fa-lg
|
||||
|
||||
@@ -95,7 +95,7 @@ module Suppliers
|
||||
private
|
||||
|
||||
def product_params
|
||||
params.require(:product).permit(:name, :code, :price, product_category_ids: [])
|
||||
params.require(:product).permit(:name, :code, :price, :description, product_category_ids: [])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
module Users
|
||||
class ApplicationController < ::ApplicationController
|
||||
before_action :user_authentication, :unless => ->(c){ %w(obtain_token).include?(c.action_name) || c.request.format.symbol == :html } # , except: [:obtain_token, :index]
|
||||
|
||||
private
|
||||
|
||||
def user_authentication
|
||||
|
||||
@@ -5,6 +5,7 @@ class Product
|
||||
property :name
|
||||
property :code
|
||||
property :price, type: Float
|
||||
property :description
|
||||
|
||||
#belongs_to :product_category
|
||||
has_and_belongs_to_many :product_categories, storing_keys: false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class ProductSerializer < Qwaiter::Serializer
|
||||
embed :ids, include: true
|
||||
attributes :name, :price
|
||||
attributes :name, :price, :description
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ html lang="en"
|
||||
title Qwaiter
|
||||
= stylesheet_link_tag "user/foundation/application"
|
||||
= javascript_include_tag "vendor/modernizr"
|
||||
/= javascript_include_tag 'http://connect.facebook.net/en_US/all.js'
|
||||
= javascript_include_tag 'http://connect.facebook.net/en_US/all.js'
|
||||
= javascript_include_tag "user/flat/application"
|
||||
- if ENV['QWAITER_MOBILE_EXPORT'] == 'yes'
|
||||
javascript:
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
= form_for [:suppliers, @product] do |f|
|
||||
= render 'error_messages', target: @product
|
||||
.form-row
|
||||
.form-row class=(f.object.errors[:name].any? ? 'error' : nil)
|
||||
.form-label
|
||||
= f.label :name, data: {t: 'attributes.product.name'}
|
||||
.form-field
|
||||
= f.text_field :name
|
||||
.form-row
|
||||
.form-row class=(f.object.errors[:code].any? ? 'error' : nil)
|
||||
.form-label
|
||||
= f.label :code, data: {t: 'attributes.product.code'}
|
||||
.form-field
|
||||
= f.text_field :code
|
||||
.form-row
|
||||
.form-row class=(f.object.errors[:price].any? ? 'error' : nil)
|
||||
.form-label
|
||||
= f.label :price, data: {t: 'attributes.product.price'}
|
||||
.form-field
|
||||
= f.text_field :price
|
||||
.form-row class=(f.object.errors[:description].any? ? 'error' : nil)
|
||||
.form-label
|
||||
= f.label :description, data: {t: 'attributes.product.description'}
|
||||
.form-field
|
||||
= f.text_area :description
|
||||
/= f.input :name
|
||||
/= f.input :code
|
||||
/= f.input :price
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
-# DEPRICATED
|
||||
= form_for [:suppliers, @section], html: {class: 'form-horizontal' } do |f|
|
||||
= render 'error_messages', target: @section
|
||||
.form-row class=(@section.errors[:title].any? ? 'error' : nil)
|
||||
.form-row class=(f.object.errors[:title].any? ? 'error' : nil)
|
||||
.form-label
|
||||
= f.label :title
|
||||
.form-field
|
||||
= f.text_field :title
|
||||
.form-row class=(@section.errors[:width].any? ? 'error' : nil)
|
||||
.form-row class=(f.object.errors[:width].any? ? 'error' : nil)
|
||||
.form-label
|
||||
= f.label :width
|
||||
.form-field
|
||||
= f.number_field :width
|
||||
.form-row class=(@section.errors[:height].any? ? 'error' : nil)
|
||||
.form-row class=(f.object.errors[:height].any? ? 'error' : nil)
|
||||
.form-label
|
||||
= f.label :height
|
||||
.form-field
|
||||
|
||||
Reference in New Issue
Block a user