diff --git a/app/assets/javascripts/supplier/app/controllers/modal_confirm_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/modal_confirm_controller.js.coffee deleted file mode 100644 index f04a7b1e..00000000 --- a/app/assets/javascripts/supplier/app/controllers/modal_confirm_controller.js.coffee +++ /dev/null @@ -1,8 +0,0 @@ -App.ModalConfirmController = Ember.ObjectController.extend - actions: - close: -> - @get('model.cancel').call(@) if @get('model.cancel') - @send 'closeModal' - confirm: -> - @get('model.ok').call(@) - @send 'closeModal' diff --git a/app/assets/javascripts/supplier/app/controllers/modal_info_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/modal_info_controller.js.coffee deleted file mode 100644 index 99cdc654..00000000 --- a/app/assets/javascripts/supplier/app/controllers/modal_info_controller.js.coffee +++ /dev/null @@ -1,5 +0,0 @@ -App.ModalInfoController = Ember.ObjectController.extend - actions: - close: -> - @get('model.cancel').call(@) if @get('model.cancel') - @send 'closeModal' diff --git a/app/assets/javascripts/supplier/app/controllers/modal_section_add_tables_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/modals/section_add_tables_controller.js.coffee similarity index 84% rename from app/assets/javascripts/supplier/app/controllers/modal_section_add_tables_controller.js.coffee rename to app/assets/javascripts/supplier/app/controllers/modals/section_add_tables_controller.js.coffee index f6e1f133..8480f72b 100644 --- a/app/assets/javascripts/supplier/app/controllers/modal_section_add_tables_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/modals/section_add_tables_controller.js.coffee @@ -1,13 +1,8 @@ -App.ModalSectionAddTablesController = Ember.ObjectController.extend +App.modals.SectionAddTablesController = App.modals.BaseController.extend number_start: 100 number_end: 110 + title_path: 'section.add_tables.modal.title' 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')) diff --git a/app/assets/javascripts/supplier/app/controllers/modal_section_arrange_tables_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/modals/section_arrange_tables_controller.js.coffee similarity index 87% rename from app/assets/javascripts/supplier/app/controllers/modal_section_arrange_tables_controller.js.coffee rename to app/assets/javascripts/supplier/app/controllers/modals/section_arrange_tables_controller.js.coffee index 4ec4d717..50bc125b 100644 --- a/app/assets/javascripts/supplier/app/controllers/modal_section_arrange_tables_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/modals/section_arrange_tables_controller.js.coffee @@ -1,4 +1,4 @@ -App.ModalSectionArrangeTablesController = Ember.ObjectController.extend +App.modals.SectionArrangeTablesController = App.modals.BaseController.extend alert_message: null arrange_type: 'distributed' # can be distributed, by_row or by_column row_count: 2 @@ -7,12 +7,6 @@ App.ModalSectionArrangeTablesController = Ember.ObjectController.extend isByRow: (->@get('arrange_type') is 'by_row').property('arrange_type') isByColumn: (->@get('arrange_type') is 'by_column').property('arrange_type') actions: - close: -> - @get('model.cancel').call(@) if @get('model.cancel') - @send 'closeModal' - confirm: -> - @get('model.ok').call(@) - @send 'closeModal' arrangeTables: -> Ember.$.post Routes.arrange_tables_suppliers_section_path(@get('model.id')), option: @get('arrange_type') diff --git a/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee index b4290364..feee3264 100644 --- a/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee @@ -7,11 +7,8 @@ App.SectionController = Ember.ObjectController.extend @set('editmode', false) @get('model').save() addSection: -> @modal 'add_section', model: @get('model') - addTables: -> - #$('#add-tables-modal').modal() - @send 'openModal', 'modal_section_add_tables', @get('model') - arrangeTables: -> - @send 'openModal', 'modal_section_arrange_tables', @get('model') + addTables: -> @modal 'section_add_tables', model: @get('model') + arrangeTables: -> @modal 'section_arrange_tables', model: @get('model') editTable: (table)-> @modal 'edit_table', model: table diff --git a/app/assets/javascripts/supplier/app/templates/modal_info.emblem b/app/assets/javascripts/supplier/app/templates/modal_info.emblem deleted file mode 100644 index 5c44e769..00000000 --- a/app/assets/javascripts/supplier/app/templates/modal_info.emblem +++ /dev/null @@ -1,5 +0,0 @@ -modal-dialog action="close" - h3.flush--top= title - p==body - hr - button{action "close"}= t 'modal.info.close' diff --git a/app/assets/javascripts/supplier/app/templates/modal_section_add_tables.emblem b/app/assets/javascripts/supplier/app/templates/modal_section_add_tables.emblem deleted file mode 100644 index f88e08ee..00000000 --- a/app/assets/javascripts/supplier/app/templates/modal_section_add_tables.emblem +++ /dev/null @@ -1,24 +0,0 @@ -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 - App.NumberField valueBinding="number_start" - .form-row - .form-label - label for='add-tables-number-end' - =t 'section.add_tables.modal.number_end' - .form-field - 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' diff --git a/app/assets/javascripts/supplier/app/templates/modal_section_arrange_tables.emblem b/app/assets/javascripts/supplier/app/templates/modal_section_arrange_tables.emblem deleted file mode 100644 index 2ecbfc0c..00000000 --- a/app/assets/javascripts/supplier/app/templates/modal_section_arrange_tables.emblem +++ /dev/null @@ -1,58 +0,0 @@ -modal-dialog action="close" - .modal-header - h3.flush--top=t 'section.arrange_tables.modal.title' - hr - .modal-body - .modal-alert== alert_message - p=t 'section.arrange_tables.modal.body_header' - .arrange-type-buttons - if isDistributed - span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed.title' - else - button.arrange-tables-type-button.distributed{action "makeDistributed"}=t 'section.arrange_tables.modal.distributed.title' - if isByRow - span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row.title' - else - button.arrange-tables-type-button.by_row{action "makeByRow"}=t 'section.arrange_tables.modal.by_row.title' - if isByColumn - span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column.title' - else - button.arrange-tables-type-button.by_column{action "makeByColumn"}=t 'section.arrange_tables.modal.by_column.title' - .arrange-content - if isDistributed - ==t 'section.arrange_tables.modal.distributed.explanation' - if isByRow - ==t 'section.arrange_tables.modal.by_row.before_field' - App.NumberField valueBinding="row_count" - ==t 'section.arrange_tables.modal.by_row.after_field' - if isByColumn - ==t 'section.arrange_tables.modal.by_column.before_field' - App.NumberField valueBinding="column_count" - ==t 'section.arrange_tables.modal.by_column.after_field' - .modal-footer - hr - button.confirm-cancel{action "close"}=t 'section.arrange_tables.modal.close_button' - button.confirm-ok.right{action "arrangeTables"}=t 'section.arrange_tables.modal.arrange_button' - - - /form.form-horizontal - .control-group - label.control-label for='arrange-tables-distributed' data-t='section.arrange_tables.modal.distributed' = t('supplier.section.arrange_tables.modal.distributed') - .controls - input#arrange-tables-distributed type="radio" name="arrange-table-option" checked=true value="distributed" - .control-group - label.control-label for='arrange-tables-by_row' data-t='section.arrange_tables.modal.by_row' = t('supplier.section.arrange_tables.modal.by_row') - .controls - input#arrange-tables-by_row type="radio" name="arrange-table-option" value="by_row" - label for="arrange-tables-by-row-count" data-t='section.arrange_tables.modal.by_row_count' = t('supplier.section.arrange_tables.modal.by_row_count') - input.input-mini#arrange-tables-by-row-count type="text" value=0 - ' - span data-t='models.plural.table' - .control-group - label.control-label for='arrange-tables-by_column' data-t='section.arrange_tables.modal.by_column' = t('supplier.section.arrange_tables.modal.by_column') - .controls - input#arrange-tables-by_column type="radio" name="arrange-table-option" value="by_column" - label for="arrange-tables-by-column-count" data-t='section.arrange_tables.modal.by_column_count' = t('supplier.section.arrange_tables.modal.by_column_count') - input.input-mini#arrange-tables-by-column-count type="text" value=0 - ' - span data-t='models.plural.table' diff --git a/app/assets/javascripts/supplier/app/templates/modals/section_add_tables.emblem b/app/assets/javascripts/supplier/app/templates/modals/section_add_tables.emblem new file mode 100644 index 00000000..e0fc7aa5 --- /dev/null +++ b/app/assets/javascripts/supplier/app/templates/modals/section_add_tables.emblem @@ -0,0 +1,18 @@ +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 + App.NumberField valueBinding="number_start" + .form-row + .form-label + label for='add-tables-number-end' + =t 'section.add_tables.modal.number_end' + .form-field + App.NumberField valueBinding="number_end" +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' diff --git a/app/assets/javascripts/supplier/app/templates/modals/section_arrange_tables.emblem b/app/assets/javascripts/supplier/app/templates/modals/section_arrange_tables.emblem new file mode 100644 index 00000000..376b7c62 --- /dev/null +++ b/app/assets/javascripts/supplier/app/templates/modals/section_arrange_tables.emblem @@ -0,0 +1,52 @@ +.modal-alert== alert_message +p=t 'section.arrange_tables.modal.body_header' +.arrange-type-buttons + if isDistributed + span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed.title' + else + button.arrange-tables-type-button.distributed{action "makeDistributed"}=t 'section.arrange_tables.modal.distributed.title' + if isByRow + span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row.title' + else + button.arrange-tables-type-button.by_row{action "makeByRow"}=t 'section.arrange_tables.modal.by_row.title' + if isByColumn + span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column.title' + else + button.arrange-tables-type-button.by_column{action "makeByColumn"}=t 'section.arrange_tables.modal.by_column.title' +.arrange-content + if isDistributed + ==t 'section.arrange_tables.modal.distributed.explanation' + if isByRow + ==t 'section.arrange_tables.modal.by_row.before_field' + App.NumberField valueBinding="row_count" + ==t 'section.arrange_tables.modal.by_row.after_field' + if isByColumn + ==t 'section.arrange_tables.modal.by_column.before_field' + App.NumberField valueBinding="column_count" + ==t 'section.arrange_tables.modal.by_column.after_field' +hr +button.confirm-cancel{action "close"}=t 'section.arrange_tables.modal.close_button' +button.confirm-ok.right{action "arrangeTables"}=t 'section.arrange_tables.modal.arrange_button' + + + /form.form-horizontal + .control-group + label.control-label for='arrange-tables-distributed' data-t='section.arrange_tables.modal.distributed' = t('supplier.section.arrange_tables.modal.distributed') + .controls + input#arrange-tables-distributed type="radio" name="arrange-table-option" checked=true value="distributed" + .control-group + label.control-label for='arrange-tables-by_row' data-t='section.arrange_tables.modal.by_row' = t('supplier.section.arrange_tables.modal.by_row') + .controls + input#arrange-tables-by_row type="radio" name="arrange-table-option" value="by_row" + label for="arrange-tables-by-row-count" data-t='section.arrange_tables.modal.by_row_count' = t('supplier.section.arrange_tables.modal.by_row_count') + input.input-mini#arrange-tables-by-row-count type="text" value=0 + ' + span data-t='models.plural.table' + .control-group + label.control-label for='arrange-tables-by_column' data-t='section.arrange_tables.modal.by_column' = t('supplier.section.arrange_tables.modal.by_column') + .controls + input#arrange-tables-by_column type="radio" name="arrange-table-option" value="by_column" + label for="arrange-tables-by-column-count" data-t='section.arrange_tables.modal.by_column_count' = t('supplier.section.arrange_tables.modal.by_column_count') + input.input-mini#arrange-tables-by-column-count type="text" value=0 + ' + span data-t='models.plural.table'