End of train commit
This commit is contained in:
+23
-4
@@ -1,7 +1,8 @@
|
|||||||
Qsupplier.App.ModalSectionArrangeTablesController = Ember.ObjectController.extend
|
Qsupplier.App.ModalSectionArrangeTablesController = Ember.ObjectController.extend
|
||||||
|
alert_message: null
|
||||||
arrange_type: 'distributed' # can be distributed, by_row or by_column
|
arrange_type: 'distributed' # can be distributed, by_row or by_column
|
||||||
by_row_count: 0
|
row_count: 2
|
||||||
by_column_count: 0
|
column_count: 2
|
||||||
isDistributed: (->@get('arrange_type') is 'distributed').property('arrange_type')
|
isDistributed: (->@get('arrange_type') is 'distributed').property('arrange_type')
|
||||||
isByRow: (->@get('arrange_type') is 'by_row').property('arrange_type')
|
isByRow: (->@get('arrange_type') is 'by_row').property('arrange_type')
|
||||||
isByColumn: (->@get('arrange_type') is 'by_column').property('arrange_type')
|
isByColumn: (->@get('arrange_type') is 'by_column').property('arrange_type')
|
||||||
@@ -13,8 +14,26 @@ Qsupplier.App.ModalSectionArrangeTablesController = Ember.ObjectController.exten
|
|||||||
@get('model.ok').call(@)
|
@get('model.ok').call(@)
|
||||||
@send 'closeModal'
|
@send 'closeModal'
|
||||||
arrangeTables: ->
|
arrangeTables: ->
|
||||||
debugger
|
Ember.$.post Routes.arrange_tables_suppliers_section_path(@get('model.id')),
|
||||||
3
|
option: @get('arrange_type')
|
||||||
|
row_count: @get('row_count')
|
||||||
|
column_count: @get('column_count')
|
||||||
|
, (result,state,xhr)=>
|
||||||
|
#@store.pushPayload 'table', result
|
||||||
|
@store.pushPayload result
|
||||||
|
@send 'close'
|
||||||
|
|
||||||
|
##TODO remove followin code if Ember pushPayload is working
|
||||||
|
##properly with associations
|
||||||
|
#section_id = @get('model.id')
|
||||||
|
#tables_that_should_be_in_section = @store.all('table').filter((t)->t.get('section.id') == section_id)
|
||||||
|
#current_table_ids = @get('model.tables').mapProperty('id')
|
||||||
|
#for table in tables_that_should_be_in_section.toArray()
|
||||||
|
#@get('model.tables').pushObject(table) unless table.get('id') in current_table_ids
|
||||||
|
##TODO it still does not work for the second client side action,
|
||||||
|
##soo the good old reload for now for the failing case
|
||||||
|
#window.location.reload() if result.tables.length != tables_that_should_be_in_section.toArray().length
|
||||||
|
return
|
||||||
makeDistributed: -> @set 'arrange_type', 'distributed'
|
makeDistributed: -> @set 'arrange_type', 'distributed'
|
||||||
makeByRow: -> @set 'arrange_type', 'by_row'
|
makeByRow: -> @set 'arrange_type', 'by_row'
|
||||||
makeByColumn: -> @set 'arrange_type', 'by_column'
|
makeByColumn: -> @set 'arrange_type', 'by_column'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
a.dropdown-trigger.button.tiny.dropdown href="#"
|
span.dropdown-trigger.button.tiny.dropdown
|
||||||
span.dropdown-trigger-text= view.title
|
span.dropdown-trigger-text= view.title
|
||||||
/span.dropdown-trigger-icon
|
/span.dropdown-trigger-icon
|
||||||
.dropdown-list-container
|
.dropdown-list-container
|
||||||
|
|||||||
@@ -3,31 +3,32 @@ modal-dialog action="close"
|
|||||||
h3.flush--top=t 'section.arrange_tables.modal.title'
|
h3.flush--top=t 'section.arrange_tables.modal.title'
|
||||||
hr
|
hr
|
||||||
.modal-body
|
.modal-body
|
||||||
|
.modal-alert== alert_message
|
||||||
p=t 'section.arrange_tables.modal.body_header'
|
p=t 'section.arrange_tables.modal.body_header'
|
||||||
.arrange-type-buttons
|
.arrange-type-buttons
|
||||||
if isDistributed
|
if isDistributed
|
||||||
span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed'
|
span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed.title'
|
||||||
else
|
else
|
||||||
button.arrange-tables-type-button.distributed{action 'makeDistributed'}=t 'section.arrange_tables.modal.distributed'
|
button.arrange-tables-type-button.distributed{action 'makeDistributed'}=t 'section.arrange_tables.modal.distributed.title'
|
||||||
if isByRow
|
if isByRow
|
||||||
span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row'
|
span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row.title'
|
||||||
else
|
else
|
||||||
button.arrange-tables-type-button.by_row{action 'makeByRow'}=t 'section.arrange_tables.modal.by_row'
|
button.arrange-tables-type-button.by_row{action 'makeByRow'}=t 'section.arrange_tables.modal.by_row.title'
|
||||||
if isByColumn
|
if isByColumn
|
||||||
span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column'
|
span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column.title'
|
||||||
else
|
else
|
||||||
button.arrange-tables-type-button.by_column{action 'makeByColumn'}=t 'section.arrange_tables.modal.by_column'
|
button.arrange-tables-type-button.by_column{action 'makeByColumn'}=t 'section.arrange_tables.modal.by_column.title'
|
||||||
.arrange-content
|
.arrange-content
|
||||||
if isDistributed
|
if isDistributed
|
||||||
span.explanation
|
==t 'section.arrange_tables.modal.distributed.explanation'
|
||||||
if isByRow
|
if isByRow
|
||||||
= t 'section.arrange_tables.modal.by_row_count'
|
==t 'section.arrange_tables.modal.by_row.before_field'
|
||||||
Qsupplier.App.NumberField valueBinding="by_row_count"
|
Qsupplier.App.NumberField valueBinding="row_count"
|
||||||
=t 'models.plural.table'
|
==t 'section.arrange_tables.modal.by_row.after_field'
|
||||||
if isByColumn
|
if isByColumn
|
||||||
= t 'section.arrange_tables.modal.by_column_count'
|
==t 'section.arrange_tables.modal.by_column.before_field'
|
||||||
Qsupplier.App.NumberField valueBinding="by_column_count"
|
Qsupplier.App.NumberField valueBinding="column_count"
|
||||||
=t 'models.plural.table'
|
==t 'section.arrange_tables.modal.by_column.after_field'
|
||||||
.modal-footer
|
.modal-footer
|
||||||
hr
|
hr
|
||||||
button.confirm-cancel{action "close"}=t 'section.arrange_tables.modal.close_button'
|
button.confirm-cancel{action "close"}=t 'section.arrange_tables.modal.close_button'
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
result = result.replace("%{#{variable}}", value)
|
result = result.replace("%{#{variable}}", value)
|
||||||
|
|
||||||
isafety = 0
|
isafety = 0
|
||||||
|
try
|
||||||
while result.indexOf("${") > -1
|
while result.indexOf("${") > -1
|
||||||
m = result.match(/\${([\w\.]+(\|\w+)?)}/)
|
m = result.match(/\${([\w\.]+(\|\w+)?)}/)
|
||||||
if m[2]
|
if m[2]
|
||||||
@@ -46,6 +47,8 @@
|
|||||||
result = result.replace(m[0], replacable)
|
result = result.replace(m[0], replacable)
|
||||||
break if isafety > 10 # referencing other translations may cause infinite loops
|
break if isafety > 10 # referencing other translations may cause infinite loops
|
||||||
isafety += 1
|
isafety += 1
|
||||||
|
catch err
|
||||||
|
console.log "translation #{result} cannot be interpolated"
|
||||||
result
|
result
|
||||||
|
|
||||||
@setLocale = (locale, options={}) ->
|
@setLocale = (locale, options={}) ->
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
padding-top: 4px
|
padding-top: 4px
|
||||||
padding-bottom: 4px
|
padding-bottom: 4px
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
|
cursor: pointer
|
||||||
.dropdown-trigger-icon
|
.dropdown-trigger-icon
|
||||||
@extend .fa
|
@extend .fa
|
||||||
@extend .fa-lg
|
@extend .fa-lg
|
||||||
|
|||||||
@@ -142,11 +142,23 @@ module Suppliers
|
|||||||
# POST /sections/1/arrange_tables {number_start: 1423, number_end: 234234}
|
# POST /sections/1/arrange_tables {number_start: 1423, number_end: 234234}
|
||||||
def arrange_tables
|
def arrange_tables
|
||||||
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||||
case params[:option]
|
#TODO handle messages client side
|
||||||
when 'distributed' then render(json: (@section.arrange_tables_in_grid ? {ok: true} : json_alert('messages.could_not_arrange_tables_distributed')))
|
#json_alert('messages.could_not_arrange_tables_distributed')
|
||||||
when 'by_row' then render(json: (@section.arrange_tables_in_rows_of(params[:row_count].to_i) ? {ok: true} : json_alert('messages.could_not_arrange_tables_by_row')))
|
#json_alert('messages.could_not_arrange_tables_by_row')
|
||||||
when 'by_column' then render(json: (@section.arrange_tables_in_columns_of(params[:column_count].to_i) ? {ok: true} : json_alert('messages.could_not_arrange_tables_by_column')))
|
#json_alert('messages.could_not_arrange_tables_by_column')))
|
||||||
else render(json: json_alert('messages.could_not_arrange_tables'))
|
#json_alert('messages.could_not_arrange_tables')
|
||||||
|
success = case params[:option]
|
||||||
|
when 'distributed' then @section.arrange_tables_in_grid
|
||||||
|
when 'by_row' then @section.arrange_tables_in_rows_of(params[:row_count].to_i)
|
||||||
|
when 'by_column' then @section.arrange_tables_in_columns_of(params[:column_count].to_i)
|
||||||
|
else false
|
||||||
|
end
|
||||||
|
|
||||||
|
if success
|
||||||
|
table_json = ActiveModel::ArraySerializer.new(@section.tables, each_serializer: SupplierTableSerializer, root: false).as_json
|
||||||
|
render json: {tables: table_json}
|
||||||
|
else
|
||||||
|
render json: {}, status: 500
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -65,11 +65,17 @@ en:
|
|||||||
modal:
|
modal:
|
||||||
title: Arrange tables
|
title: Arrange tables
|
||||||
body_header: ""
|
body_header: ""
|
||||||
distributed: Distributed
|
distributed:
|
||||||
by_row: By row
|
title: Distributed
|
||||||
by_row_count: of
|
explanation: Distribute ${models.plural.table|downcase} as good as possible in the ${models.section|downcase}
|
||||||
by_column: By column
|
by_row:
|
||||||
by_column_count: of
|
title: By row
|
||||||
|
before_field: 'make rows each having '
|
||||||
|
after_field: ' ${models.plural.table}'
|
||||||
|
by_column:
|
||||||
|
title: By column
|
||||||
|
before_field: 'make columns each having '
|
||||||
|
after_field: ' ${models.plural.table}'
|
||||||
close_button: Close
|
close_button: Close
|
||||||
arrange_button: Distribute
|
arrange_button: Distribute
|
||||||
settings:
|
settings:
|
||||||
|
|||||||
@@ -65,11 +65,17 @@ nl:
|
|||||||
modal:
|
modal:
|
||||||
title: Positioneer tafels
|
title: Positioneer tafels
|
||||||
body_header: ""
|
body_header: ""
|
||||||
distributed: Verspreid
|
distributed:
|
||||||
by_row: Per rij
|
title: Verspreid
|
||||||
by_row_count: van
|
explanation: Versprijd de ${models.plural.table|downcase} zo goed mogelijk over de ${models.section|downcase}
|
||||||
by_column: Per kolom
|
by_row:
|
||||||
by_column_count: van
|
title: Per rij
|
||||||
|
before_field: 'maak rijen met elk '
|
||||||
|
after_field: ' ${models.plural.table}'
|
||||||
|
by_column:
|
||||||
|
title: Per kolom
|
||||||
|
before_field: 'maak kolommen met elk '
|
||||||
|
after_field: ' ${models.plural.table}'
|
||||||
close_button: Sluiten
|
close_button: Sluiten
|
||||||
arrange_button: Positioneer
|
arrange_button: Positioneer
|
||||||
settings:
|
settings:
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ General:
|
|||||||
needed
|
needed
|
||||||
Bugs:
|
Bugs:
|
||||||
- Dragging supplier table from one section to the other fails
|
- Dragging supplier table from one section to the other fails
|
||||||
|
- Supplier section print qr codes does not give proper images
|
||||||
|
- Supplier tables pagination styling
|
||||||
|
|
||||||
Post release
|
Post release
|
||||||
------------
|
------------
|
||||||
|
|||||||
Reference in New Issue
Block a user