diff --git a/.gitignore b/.gitignore index 6e8cc1a3..e674de6e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ /tmp .sass-cache/ *.swp +.idea *~ db/xapian_db company_logo* diff --git a/Gemfile.lock b/Gemfile.lock index 34278d8e..04e31264 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -101,7 +101,7 @@ GEM factory_girl_rails (4.1.0) factory_girl (~> 4.1.0) railties (>= 3.0.0) - ffi (1.2.0) + ffi (1.1.5) fssm (0.2.9) guard (1.5.4) listen (>= 0.4.2) @@ -143,7 +143,7 @@ GEM mime-types (1.19) mini_magick (3.4) subexec (~> 0.2.1) - multi_json (1.4.0) + multi_json (1.5.0) mustache (0.99.4) nokogiri (1.5.5) orm_adapter (0.0.7) diff --git a/app/assets/javascripts/supplier/list.js.coffee b/app/assets/javascripts/supplier/list.js.coffee index 093cb8eb..d61b7dde 100644 --- a/app/assets/javascripts/supplier/list.js.coffee +++ b/app/assets/javascripts/supplier/list.js.coffee @@ -8,5 +8,12 @@ class List needs_payment: -> @attributes.needs_payment active: -> @attributes.state == 'active' products: -> @attributes.products || [] + supplier_name: -> @attributes.supplier_name + created_at: -> @attributes.created_at + display: -> + txt = @supplier_name() + txt += ' - ' + txt += Quser.format_date(@created_at()) + txt @List = List diff --git a/app/assets/javascripts/user/application.js.erb b/app/assets/javascripts/user/application.js.erb index cfd7246e..11667034 100644 --- a/app/assets/javascripts/user/application.js.erb +++ b/app/assets/javascripts/user/application.js.erb @@ -28,6 +28,7 @@ //= require bootstrap //= require qwaiter //= require supplier/order +//= require supplier/list //= require mustache //= require faye //= require_directory . diff --git a/app/assets/javascripts/user/quser.js.coffee b/app/assets/javascripts/user/quser.js.coffee index d2bd225a..38369c70 100644 --- a/app/assets/javascripts/user/quser.js.coffee +++ b/app/assets/javascripts/user/quser.js.coffee @@ -95,7 +95,7 @@ class Quser $('.table-number').text(response.table_number) if response.table_number $('.supplier-name').text(response.supplier_name) if response.supplier_name - if response.not_present || response.list_active == false then $('.home-link').hide() else $('.home-link').show() + if response.not_present || response.list_active == false then $('.home-link').removeClass('active') else $('.home-link').addClass('active') @list_needs_payment_default_action(response) @list_needs_help_default_action(response) @@ -209,13 +209,7 @@ class Quser @paginate(res, @load_list_history) container = $('#list-history-container').html('') for list in res.lists - li = $('
').appendTo(container) - link = $('').appendTo(li) - link.click(-> redirect_to 'history_list', list_id: list._id) - txt = list.supplier_name - txt += ' - ' - txt += @format_date(list.created_at) - link.text(txt) + container.append @mustache('#list-history-template', new List(list) ) ) paginate: (wrapper, callback) -> container = $('nav.pagination') diff --git a/app/assets/stylesheets/user/list_products.css.sass b/app/assets/stylesheets/user/list_products.css.sass index 71aa35e7..9278d03f 100644 --- a/app/assets/stylesheets/user/list_products.css.sass +++ b/app/assets/stylesheets/user/list_products.css.sass @@ -3,3 +3,4 @@ #products-table .order-product-button +wood-button + color: white diff --git a/app/assets/stylesheets/user/structure.css.sass b/app/assets/stylesheets/user/structure.css.sass index e990f0aa..00ebb2a4 100644 --- a/app/assets/stylesheets/user/structure.css.sass +++ b/app/assets/stylesheets/user/structure.css.sass @@ -37,14 +37,22 @@ body margin-left: auto margin-right: auto width: 262px + text-align: center a +user-button + float: none + display: none + width: 34px + height: 34px + &.active + display: inline-block span display: block width: 28px height: 26px background-repeat: no-repeat background-position: center center + margin: 4px auto auto auto &.home-list-link span background-image: image-url('icons/list.png') diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 05f8867f..4c0ae973 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -1,6 +1,6 @@ class UserController < ApplicationController before_filter :allow_mobile - before_filter :user_authentication, except: :obtain_token + before_filter :user_authentication, except: [:obtain_token, :index] layout 'phone' def user_authentication diff --git a/app/templates/user/_list-history.mustache b/app/templates/user/_list-history.mustache new file mode 100644 index 00000000..d1e2654c --- /dev/null +++ b/app/templates/user/_list-history.mustache @@ -0,0 +1,3 @@ +