Supplier section management improvements

This commit is contained in:
2014-07-01 15:18:51 +02:00
parent 588139eb54
commit de576d54d9
23 changed files with 180 additions and 25 deletions
@@ -3,10 +3,4 @@ Qsupplier.App.DropdownLink = Ember.Component.extend
active: false
classNames: ['dropdown-container']
classNameBindings: ['active']
didInsertElement: ->
@$('.dropdown-trigger').click (e)=>
e.preventDefault()
@set 'active', !@get('active')
click: -> @set 'active', !@get('active')
@@ -0,0 +1,4 @@
Qsupplier.App.ModalDialogComponent = Ember.Component.extend
actions:
close: ->
@sendAction()
@@ -0,0 +1,8 @@
Qsupplier.App.ModalConfirmController = Ember.ObjectController.extend
actions:
close: ->
@get('model.cancel').call(@) if @get('model.cancel')
@send 'closeModal'
confirm: ->
@get('model.ok').call(@)
@send 'closeModal'
@@ -0,0 +1,4 @@
Qsupplier.App.ModalController = Ember.ObjectController.extend
actions:
close: ->
@send 'closeModal'
@@ -0,0 +1,5 @@
Qsupplier.App.ModalInfoController = Ember.ObjectController.extend
actions:
close: ->
@get('model.cancel').call(@) if @get('model.cancel')
@send 'closeModal'
@@ -0,0 +1,25 @@
Qsupplier.App.ModalSectionAddTablesController = Ember.ObjectController.extend
number_start: 100
number_end: 110
actions:
close: ->
@get('model.cancel').call(@) if @get('model.cancel')
@send 'closeModal'
confirm: ->
@get('model.ok').call(@)
@send 'closeModal'
addTables: ->
s = parseInt(@get('number_start'))
e = parseInt(@get('number_end'))
if e < s
@set 'number_start', e
@set 'number_end', s
s = @get('number_start')
e = @get('number_end')
Ember.$.post Routes.add_tables_suppliers_section_path(@get('model.id')),
number_start: s
number_end: e
, (result,state,xhr)=>
@store.pushPayload 'table', result
@send 'close'
@@ -9,8 +9,8 @@ Qsupplier.App.SectionController = Ember.ObjectController.extend
@set('editmode', false)
@get('model').save()
addTables: ->
debugger
$('#add-tables-modal').modal()
#$('#add-tables-modal').modal()
@send 'openModal', 'modal_section_add_tables', @get('model')
arrangeTables: ->
$('#arrange-tables-modal').modal()
textures: ['wood1', 'wood2']
@@ -6,3 +6,19 @@ Qsupplier.App.ApplicationRoute = Ember.Route.extend
setupController: (controller)->
@store.find 'list', state: 'active'
controller.set 'product_categories', @store.all('product_category')
actions:
openModal: (modalName, model)->
@controllerFor(modalName).set('model', model)
@render modalName,
into: 'application'
outlet: 'modal'
closeModal: ->
@disconnectOutlet
outlet: 'modal'
parentView: 'application'
confirm: (options = {})->
@send 'openModal', 'modal_confirm', Ember.Object.create
title: options.title
body: options.body
cancel: options.cancel
ok: options.ok
@@ -0,0 +1,2 @@
= outlet
= outlet modal
@@ -1 +0,0 @@
{{outlet}}
@@ -0,0 +1,2 @@
.overlay{action "close"}
.modal{action bubbles=false preventDefault=false}= yield
@@ -0,0 +1,4 @@
modal-dialog action="close"
h3.flush--top Alert
p= body
button{action "close"} Done
@@ -0,0 +1,6 @@
modal-dialog action="close"
h3.flush--top= title
p=body
hr
button.confirm-cancel{action "close"}= t 'confirm.cancel'
button.confirm-ok.right{action 'confirm'}= t 'confirm.confirm'
@@ -0,0 +1,5 @@
modal-dialog action="close"
h3.flush--top= title
p==body
hr
button{action 'close'}= t 'modal.info.close'
@@ -0,0 +1,24 @@
modal-dialog action="close"
.modal-header
h3.flush--top=t 'section.add_tables.modal.title'
hr
.modal-body
p=t 'section.add_tables.modal.body_header'
form.form-horizontal
.control-group
.form-row
.form-label
label for='add-tables-number-start'
=t 'section.add_tables.modal.number_start'
.form-field
Qsupplier.App.NumberField valueBinding="number_start"
.form-row
.form-label
label for='add-tables-number-end'
=t 'section.add_tables.modal.number_end'
.form-field
Qsupplier.App.NumberField valueBinding="number_end"
.modal-footer
hr
button.confirm-cancel{action "close"}=t 'section.add_tables.modal.close_button'
button.confirm-ok.right{action "addTables"}=t 'section.add_tables.modal.add_button'
@@ -19,13 +19,21 @@
Qsupplier.App.DropdownLink title="Action"
ul
li
a{action addTables} {{t 'section.add_tables.button_label'}}
a{action addTables}
span.section-add-tables-icon
=t 'section.add_tables.button_label'
li
a{action arrangeTables} {{t 'section.arrange_tables.modal.title'}}
a{action arrangeTables}
span.section-arrange-tables-icon
=t 'section.arrange_tables.modal.title'
li
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}" {{t 'tables.qr_codes.link'}}
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}"
span.table-qr-codes
=t 'tables.qr_codes.link'
li
a href="{{route 'suppliers_section_path' id}}" data-method="delete" data-confirm="{{t 'helpers.links.are_you_sure' bare=true}}" {{t 'helpers.links.destroy'}}
a.section-destroy href="{{route 'suppliers_section_path' id}}" data-method="delete" data-confirm="{{t 'helpers.links.are_you_sure' bare=true}}"
span.section-remove-icon
=t 'helpers.links.destroy'
Ember.TextField valueBinding="title" class="section-edit-title-field"
Qsupplier.App.NumberField valueBinding="width" class="dimension section-edit-width-field"
span.fa.fa-lg.fa-times
@@ -52,7 +52,7 @@ Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
#@$('.table-actions .title').remove()
content.hide()
@$el.on 'click', =>
content.toggle() if @$el.hasClass('occupied')
content.toggle() if @$el.hasClass('occupied') and not @get('controller.editmode')
#@$el.qtip
#content:
#text: content