User style fixes for fixed top menu and list cached supplier loading
This commit is contained in:
@@ -10,11 +10,13 @@ App.List = DS.Model.extend
|
||||
extended_version: attr('boolean')
|
||||
supplier_orders_in_process_count: attr('number')
|
||||
supplier_orders_placed_count: attr('number')
|
||||
cached_supplier_name: attr('string')
|
||||
|
||||
supplier: DS.belongsTo('supplier')
|
||||
table: DS.belongsTo('table')
|
||||
join_requests: DS.hasMany('join_request')
|
||||
users: DS.hasMany('user')
|
||||
supplier_name: (-> @get('cached_supplier_name') or @get('supplier.name')).property('cached_supplier_name', 'supplier.name')
|
||||
|
||||
is_extended_version: ->
|
||||
@get('extended_version')
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
App.ResetScroll = Ember.Mixin.create
|
||||
activate: ->
|
||||
@_super()
|
||||
window.scrollTo 0, 0
|
||||
@@ -1,4 +1,4 @@
|
||||
App.ActiveListRoute = Ember.Route.extend {}
|
||||
App.ActiveListRoute = Ember.Route.extend App.ResetScroll
|
||||
#model: ->
|
||||
#@get('controllers.application.list')
|
||||
#afterModel: ->
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
App.IndexRoute = Ember.Route.extend App.ResetScroll
|
||||
@@ -1,4 +1,4 @@
|
||||
App.ListRoute = Ember.Route.extend
|
||||
App.ListRoute = Ember.Route.extend App.ResetScroll,
|
||||
model: (options)->
|
||||
@store.find 'list', options.list_id
|
||||
afterModel: (model)->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
App.ListsRoute = Ember.Route.extend
|
||||
App.ListsRoute = Ember.Route.extend App.ResetScroll,
|
||||
model: ->
|
||||
@store.find 'list'
|
||||
setupController: (controller, model)->
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
span.created_at=time list.created_at
|
||||
span.price.currency= currency list.price
|
||||
span.name= list.supplier.name
|
||||
span.name= list.supplier_name
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
App.ApplicationView = Ember.View.extend
|
||||
didInsertElement: ->
|
||||
$('.main-section').css 'min-height', ($(window).height() - $('.tab-bar:first').outerHeight())
|
||||
$('.main-section').css 'min-height', $(window).height() - $('.top-menu').outerHeight()
|
||||
|
||||
$('.toggle-side-menu,.side-menu').click ->
|
||||
menu = $('aside.side-menu')
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
html, body
|
||||
overflow-x: hidden
|
||||
margin: 0
|
||||
padding: 0
|
||||
body
|
||||
overflow-x: hidden
|
||||
@media #{$small-only}
|
||||
font-size: 14px
|
||||
#ember-app-container
|
||||
@@ -12,9 +12,11 @@ body
|
||||
|
||||
main.main-section
|
||||
+panel($bg:rgba(200,200,200,0.8))
|
||||
height: 100%
|
||||
// height: 100%
|
||||
padding: 0
|
||||
margin: 0
|
||||
.main-section-content
|
||||
min-height: calc(100% - #{$top-menu-height})
|
||||
span.icon
|
||||
@extend .fa
|
||||
@extend .fa-lg
|
||||
|
||||
@@ -18,7 +18,7 @@ class DashboardController < ApplicationController
|
||||
if Rails.env.test?
|
||||
@tables = Table.all
|
||||
else
|
||||
@tables = (current_supplier || Supplier.first).tables.sample(5) | List.active.map(&:table)
|
||||
@tables = (current_supplier || Supplier.first).tables.sample(5) | List.active.map(&:table) | Supplier.find_by_email('supplier2@mozo.bar').tables.sample(3)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { render layout: 'phone' }
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
class UserListSerializer < Qwaiter::Serializer
|
||||
# user ids for facebook pictures
|
||||
embed :ids, include: true
|
||||
attributes :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, :table_id, :table_number, :section_id, :user_ids, :supplier_name, :closed_at, :supplier_id
|
||||
attributes :state, :needs_help, :needs_payment, :user_requests_closing,
|
||||
:is_paid, :price, :table_id, :table_number, :section_id, :user_ids,
|
||||
:cached_supplier_name, :closed_at, :supplier_id, :extended_version
|
||||
|
||||
#def has_active_orders
|
||||
#object.has_active_orders?
|
||||
#end
|
||||
def supplier_name
|
||||
def cached_supplier_name
|
||||
object.supplier.name
|
||||
end
|
||||
has_many :users, serializer: UserUserSerializer
|
||||
has_many :orders
|
||||
has_one :supplier, serializer: UserSupplierSerializer
|
||||
|
||||
def extended_version
|
||||
false
|
||||
end
|
||||
# has_many :users, serializer: UserUserSerializer
|
||||
# has_many :orders
|
||||
# has_one :supplier, serializer: UserSupplierSerializer
|
||||
end
|
||||
|
||||
@@ -19,9 +19,13 @@
|
||||
= label_tag nil, ProductCategory.human_attribute_name(:week_days), class: 'control-label'
|
||||
.form-field.full
|
||||
ul#week_days-group.button-group
|
||||
- day_names = week_days.dup; day_names << day_names.shift if current_supplier.week_starts_on_monday?
|
||||
- day_names.each do |day_name|
|
||||
li: button.week-day-toggle.tiny type="button" data-day=day_name data-t="product_category.week_days.abbreviation.#{day_name}"
|
||||
- day_titles = (t('date.day_names') || []).dup
|
||||
- day_names = week_days.dup
|
||||
- if current_supplier.week_starts_on_monday?
|
||||
- day_names << day_names.shift
|
||||
- day_titles << day_titles.shift
|
||||
- day_names.each.with_index do |day_name, i|
|
||||
li: button.week-day-toggle.tiny type="button" data-day=day_name data-t="product_category.week_days.abbreviation.#{day_name}" title=day_titles[i]
|
||||
|
||||
|
||||
span#full_day-controller: span
|
||||
|
||||
Reference in New Issue
Block a user