From 640dbc37b8da2437c095b307f8cad8b6621a4558 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 29 Jul 2014 22:01:46 +0200 Subject: [PATCH] End of day commit --- .../tables_index_controller.js.coffee | 2 + .../javascripts/supplier/app/router.js.coffee | 2 + .../app/routes/tables_index_route.js.coffee | 2 + .../supplier/app/templates/tables.emblem | 1 + .../app/templates/tables/index.emblem | 18 +++++ .../app/views/application_view.js.coffee | 1 + app/controllers/dashboard_controller.rb | 4 +- app/views/suppliers/tables/index.html.slim | 72 ++++++++++--------- wip.md | 8 ++- 9 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 app/assets/javascripts/supplier/app/controllers/tables_index_controller.js.coffee create mode 100644 app/assets/javascripts/supplier/app/routes/tables_index_route.js.coffee create mode 100644 app/assets/javascripts/supplier/app/templates/tables.emblem create mode 100644 app/assets/javascripts/supplier/app/templates/tables/index.emblem diff --git a/app/assets/javascripts/supplier/app/controllers/tables_index_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/tables_index_controller.js.coffee new file mode 100644 index 00000000..553bb3b1 --- /dev/null +++ b/app/assets/javascripts/supplier/app/controllers/tables_index_controller.js.coffee @@ -0,0 +1,2 @@ +Qsupplier.App.TablesIndexController = Ember.ArrayController.extend + tables: (-> @get('model')).property('model') diff --git a/app/assets/javascripts/supplier/app/router.js.coffee b/app/assets/javascripts/supplier/app/router.js.coffee index e9714c62..bbbf929f 100644 --- a/app/assets/javascripts/supplier/app/router.js.coffee +++ b/app/assets/javascripts/supplier/app/router.js.coffee @@ -8,6 +8,8 @@ Qsupplier.App.Router.map -> @route '/', queryParams: ['section_id'] @resource 'sections', -> @resource 'section', path: ':section_id' + @resource 'tables', -> + @resource 'table', path: ':table_id' @resource 'lists', -> @resource 'list', path: ':list_id' @route 'settings' diff --git a/app/assets/javascripts/supplier/app/routes/tables_index_route.js.coffee b/app/assets/javascripts/supplier/app/routes/tables_index_route.js.coffee new file mode 100644 index 00000000..0034b009 --- /dev/null +++ b/app/assets/javascripts/supplier/app/routes/tables_index_route.js.coffee @@ -0,0 +1,2 @@ +Qsupplier.App.TablesIndexRoute = Ember.Route.extend + model: -> @store.all('table') diff --git a/app/assets/javascripts/supplier/app/templates/tables.emblem b/app/assets/javascripts/supplier/app/templates/tables.emblem new file mode 100644 index 00000000..26191258 --- /dev/null +++ b/app/assets/javascripts/supplier/app/templates/tables.emblem @@ -0,0 +1 @@ += outlet diff --git a/app/assets/javascripts/supplier/app/templates/tables/index.emblem b/app/assets/javascripts/supplier/app/templates/tables/index.emblem new file mode 100644 index 00000000..086503b5 --- /dev/null +++ b/app/assets/javascripts/supplier/app/templates/tables/index.emblem @@ -0,0 +1,18 @@ +h1=t 'models.plural.table' +if tables + table.table + thead + tr + th=t 'attributes.table.number' + th.link=t 'models.section' + th.timestamp= t 'attributes.table.created_at' + th.actions=t 'helpers.actions.title' + tbody + each table in tables + tr + td: a= table.number + td.link + if table.section + = link-to 'sections:section' table.section + td.numeric=time table.created_at + td.actions diff --git a/app/assets/javascripts/supplier/app/views/application_view.js.coffee b/app/assets/javascripts/supplier/app/views/application_view.js.coffee index 09ed4b6c..e4048c27 100644 --- a/app/assets/javascripts/supplier/app/views/application_view.js.coffee +++ b/app/assets/javascripts/supplier/app/views/application_view.js.coffee @@ -5,6 +5,7 @@ Qsupplier.App.ApplicationView = Ember.View.extend '.top-menu-root': '/' '.top-menu-lists': 'lists' '.top-menu-sections': 'sections' + '.top-menu-tables': 'tables' '.top-menu-lists': 'lists' '.supplier-settings-link': 'settings' diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index af29f3c9..07aed8a2 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -26,13 +26,13 @@ class DashboardController < ApplicationController def table_qr_image @table = Table.find(params[:table_id]) #code = [get_the_app_url, {table_id: @table.id}.to_json].join('?') - code = "q.qwaiter.nl/s?t=#{@table.id}" + code = "q.qwaiter.com/s?t=#{@table.id}" size = RQRCode.minimum_qr_size_from_string(code) respond_to do |format| format.html format.svg { render qrcode: code, level: :l, unit: 10, table_number: @table.number, qcontainer: true } format.png do - #render qrcode: code, level: :l, table_number: @table.number, qcontainer: true + #render qrcode: code, level: :l, table_number: @table.number, qcontainer: true size = RQRCode.minimum_qr_size_from_string(code) level = :l qrcode = RQRCode::QRCode.new(code, size: size, level: level) diff --git a/app/views/suppliers/tables/index.html.slim b/app/views/suppliers/tables/index.html.slim index f9796457..e96a7f6d 100644 --- a/app/views/suppliers/tables/index.html.slim +++ b/app/views/suppliers/tables/index.html.slim @@ -1,35 +1,37 @@ -- model_class = Table -div.page-header= title :index, model_class -= form_tag({}, method: :get) do - label.number for="filter-from_number" data-t="attributes.table.from_number" - input#filter-from_number.number type="number" size=4 value=params[:from_number] name="from_number" - label.number for="filter-to_number" data-t="attributes.table.to_number" - input#filter-to_number.number type="number" size=4 value=params[:to_number] name="to_number" - ' - = submit_tag 'Filter', class: 'apply-filter' -- if @tables.any? - = paginate @tables - table.table - thead - tr - th.link data-t="attributes.table.number"= model_class.human_attribute_name(:number) - th.link data-t="models.section"= Section.model_name.human - th.timestamp data-t="attributes.table.created_at"= model_class.human_attribute_name(:created_at) - th.actions data-t="helpers.actions.title"=t 'helpers.actions.title' - tbody - - @tables.each do |table| - tr - td.link= link_to table.number, [:suppliers, table] - td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section] - td.timestamp data-time=table.created_at.try(:utc).try(:iso8601) - td.actions - = link_to [:edit, :suppliers, table], class: 'table-edit' do - span data-title="helpers.links.edit" - = link_to [:suppliers, table], method: :delete, data: {confirm: are_you_sure? }, class: 'table-destroy' do - span data-title="helpers.links.destroy" -- else - = no_content_given model_class - -= supplier_form_actions :new, for: :tables do - = link_to qr_codes_suppliers_tables_path(params.slice(:from_number, :to_number)), class: 'form-action-qr-codes', target: :_blank - span data-t="tables.qr_codes.link" +- content_for :head do + = javascript_include_tag 'supplier/app/application' +/ - model_class = Table +/ div.page-header= title :index, model_class +/ = form_tag({}, method: :get) do +/ label.number for="filter-from_number" data-t="attributes.table.from_number" +/ input#filter-from_number.number type="number" size=4 value=params[:from_number] name="from_number" +/ label.number for="filter-to_number" data-t="attributes.table.to_number" +/ input#filter-to_number.number type="number" size=4 value=params[:to_number] name="to_number" +/ ' +/ = submit_tag 'Filter', class: 'apply-filter' +/ - if @tables.any? +/ = paginate @tables +/ table.table +/ thead +/ tr +/ th.link data-t="attributes.table.number"= model_class.human_attribute_name(:number) +/ th.link data-t="models.section"= Section.model_name.human +/ th.timestamp data-t="attributes.table.created_at"= model_class.human_attribute_name(:created_at) +/ th.actions data-t="helpers.actions.title"=t 'helpers.actions.title' +/ tbody +/ - @tables.each do |table| +/ tr +/ td.link= link_to table.number, [:suppliers, table] +/ td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section] +/ td.timestamp data-time=table.created_at.try(:utc).try(:iso8601) +/ td.actions +/ = link_to [:edit, :suppliers, table], class: 'table-edit' do +/ span data-title="helpers.links.edit" +/ = link_to [:suppliers, table], method: :delete, data: {confirm: are_you_sure? }, class: 'table-destroy' do +/ span data-title="helpers.links.destroy" +/ - else +/ = no_content_given model_class +/ +/ = supplier_form_actions :new, for: :tables do +/ = link_to qr_codes_suppliers_tables_path(params.slice(:from_number, :to_number)), class: 'form-action-qr-codes', target: :_blank +/ span data-t="tables.qr_codes.link" diff --git a/wip.md b/wip.md index cff41b43..5cc14c02 100644 --- a/wip.md +++ b/wip.md @@ -12,6 +12,7 @@ Supplier - Side menu - Open shop button nice - Close shop button nice + - Title mooi en zichtbaar - Product category looks for foundation - form action button looks (Roos) - Dashboard @@ -33,8 +34,10 @@ User - Cleanup UserController - translate join table strings - test met veel producten -- lists#show goto list button better - side menu cleaner + - Title zichtbaar + - Icons before texts +- remove debugger link General ------- @@ -45,8 +48,7 @@ Bugs ---- - Dragging supplier table from one section to the other fails -- Supplier section print qr codes does not give proper images -- Supplier tables pagination styling +- Supplier tables pagination styling (make ember!) - supplier counters in user view (no supplier in active list?) - supplier main board section selector selects first section option and not the supplier name, which is added using prompt thingy. Maybe setting ApplicationController.active_section in stead of IndexController.active_section for scope locking - Supplier