diff --git a/app/components/table-filters/dropdown-select-multiple.coffee b/app/components/table-filters/dropdown-select-multiple.coffee index e54e110..d2175a4 100644 --- a/app/components/table-filters/dropdown-select-multiple.coffee +++ b/app/components/table-filters/dropdown-select-multiple.coffee @@ -49,6 +49,7 @@ export default Ember.Component.extend init: -> @_super() + @set "filters.#{@get('key')}", [] unless Ember.isArray(@get("filters.#{@get('key')}")) # ensure selected to be an array Ember.defineProperty @, 'selected', Ember.computed.alias("filters.#{@get('key')}") actions: diff --git a/app/components/table-filters/select-multiple-modal.coffee b/app/components/table-filters/select-multiple-modal.coffee index 8ae7220..e164720 100644 --- a/app/components/table-filters/select-multiple-modal.coffee +++ b/app/components/table-filters/select-multiple-modal.coffee @@ -1,5 +1,6 @@ import Ember from 'ember' -import BaseModal from 'ember-cli-dunlop/components/modals/base' +import BaseModal from 'ember-cli-dunlop/mixins/modal-base' +#import BaseModal from 'components/modals/base' export default BaseModal.extend current_selected: Ember.computed.alias 'modal_options.base.value' options: Ember.computed.alias 'modal_options.base.options' diff --git a/app/templates/components/table-filters.hbs b/app/templates/components/table-filters.hbs index f5f2c78..130c803 100644 --- a/app/templates/components/table-filters.hbs +++ b/app/templates/components/table-filters.hbs @@ -1,12 +1,12 @@ {{yield (hash - input=(component "table-filters/input" apply_filters=(action 'apply_filters') filters=filters) - date=(component "table-filters/date" apply_filters=(action 'apply_filters') filters=filters) - date-range=(component "table-filters/date-range" apply_filters=(action 'apply_filters') filters=filters) - number-range=(component "table-filters/number-range" apply_filters=(action 'apply_filters') filters=filters) - dropdown-select=(component "table-filters/dropdown-select" apply_filters=(action 'apply_filters') filters=filters) - dropdown-select-multiple=(component "table-filters/dropdown-select-multiple" apply_filters=(action 'apply_filters') filters=filters) - option-buttons=(component "table-filters/option-buttons" apply_filters=(action 'apply_filters') filters=filters) - boolean-checkboxes=(component "table-filters/boolean-checkboxes" apply_filters=(action 'apply_filters') filters=filters) - select-multiple=(component "table-filters/select-multiple" apply_filters=(action 'apply_filters') filters=filters) - actions=(component 'table-filters/actions' apply_filters=(action 'apply_filters') clear_filters=(action 'clear_filters') filter_calls=filter_calls) + input = (component "table-filters/input" apply_filters=(action 'apply_filters') filters=filters) + date = (component "table-filters/date" apply_filters=(action 'apply_filters') filters=filters) + date-range = (component "table-filters/date-range" apply_filters=(action 'apply_filters') filters=filters) + number-range = (component "table-filters/number-range" apply_filters=(action 'apply_filters') filters=filters) + dropdown-select = (component "table-filters/dropdown-select" apply_filters=(action 'apply_filters') filters=filters) + dropdown-select-multiple = (component "table-filters/dropdown-select-multiple" apply_filters=(action 'apply_filters') filters=filters) + option-buttons = (component "table-filters/option-buttons" apply_filters=(action 'apply_filters') filters=filters) + boolean-checkboxes = (component "table-filters/boolean-checkboxes" apply_filters=(action 'apply_filters') filters=filters) + select-multiple = (component "table-filters/select-multiple" apply_filters=(action 'apply_filters') filters=filters) + actions = (component 'table-filters/actions' apply_filters=(action 'apply_filters') clear_filters=(action 'clear_filters') filter_calls=filter_calls) )}} diff --git a/app/templates/components/table-filters/select-multiple-modal3.emblem b/app/templates/components/table-filters/select-multiple-modal3.emblem new file mode 100644 index 0000000..19a3681 --- /dev/null +++ b/app/templates/components/table-filters/select-multiple-modal3.emblem @@ -0,0 +1,5 @@ +button.ui.tiny.icon.button{action 'edit_selection'} title=selectedTitle + i.list.icon +== selected_display += yield +h1 adsaf diff --git a/tests/dummy/app/controllers/table-filters/test1.coffee b/tests/dummy/app/controllers/table-filters/test1.coffee index 3d2ca07..b0d2963 100644 --- a/tests/dummy/app/controllers/table-filters/test1.coffee +++ b/tests/dummy/app/controllers/table-filters/test1.coffee @@ -6,5 +6,26 @@ export default Ember.Controller.extend {id: "B1", grumpy: "Cool name for B1!"} {id: "B2", grumpy: "Cool name for B2!"} ] + apply_filters: -> + Ember.$('.page-title').click() + query = @get('filters')?.toProperties() || {} + console.log "QUERY" + console.log query + if query.target_week + [week, year] = query.target_week.split('-') + delete query.target_week + query.week_eq = week + query.year_eq = year + @set 'model.page', 1 + @set 'model.lastPage', null + @get('model').setOtherParam('q', query) + false - a: 3 + actions: + clear_filter: (keys...) -> + keys.forEach (key) => + if Ember.isArray(@get("filters.#{key}")) + @set "filters.#{key}", [] + else + @set "filters.#{key}", null + @apply_filters() diff --git a/tests/dummy/app/initializers/globals.coffee b/tests/dummy/app/initializers/globals.coffee new file mode 100644 index 0000000..307f80f --- /dev/null +++ b/tests/dummy/app/initializers/globals.coffee @@ -0,0 +1,117 @@ +window.client_id ||= "client#{Math.round(Math.random()*10000)}" +state_names = + planned: 'Planned' + active: 'Active' + overdue: 'Overdue' + all_completed: 'Completed' +default_globals = + flash_message: '' + preload_resources_fulfilled: true + first_day_of_week: 1 + current_user: null + workflow_action_definition: + value_type_options: ['boolean', 'date', 'number', 'select', 'string', 'text', 'timestamp'] + workflow_action_offset: + offset_unit_options: ['day'] + location_planning: + filter_scopes: + with_changed_planning: 'Aangepaste planning' + is_instructed: 'Allinq aangestuurd' + is_not_instructed: 'Allinq niet aangestuurd' + with_unequal_number_of_cards: '# cards verschil' + with_more_netcap_cards_than_calculated: 'NetCap overschot' + with_less_netcap_cards_than_calculated: 'NetCap tekort' + + migration_window_planning: + filter_scopes: + epots_ready_without_work_order: 'ePOTS ready zonder work-order' + with_changed_planning: 'Aangepaste HAN planning' + #with_remarks: 'Meldingen!' + with_non_active_dslam_cards: 'Inactieve DSLAM cards' + with_work_order: 'Met work order' + without_work_order: 'Zonder work order' + with_different_target_week: 'Andere forecast week' + with_different_target_date: 'Andere forecast dag' + with_work_order_epots_ready_not_realized: 'Met work-order, ePOTS ready niet opgeleverd' + + time_formatting: 'YYYY-MM-DD HH:mm' + date_formatting: 'DD-MM-YYYY' + state_names: state_names + project_instance_states: [ + 'planned' + 'active' + 'overdue' + 'all_completed' + ].map (state) -> {id: state, label: state_names[state]} + attention_incident: + sources: [ + {id: 'allinq-daily-report', label: 'Allinq daily report'} + {id: 'work-order-epots-ready-existence-check', label: 'ePOTS ready daily check'} + {id: 'work-order-create-epots-ready-check', label: 'work-order create ePOTS ready check'} + {id: 'kanvas-f107-source-file', label: 'Kanvas F107 source file HAN HOST-1 -> Kanvas host-name'} + ] + + format_date: + compact_month: (-> + date: (jsdate, settings) -> + return '' unless jsdate + current_year = new Date().getFullYear() + mdate = moment(jsdate) + if jsdate.getFullYear() isnt current_year + mdate.format('D MMM YYYY') + else + mdate.format('D MMM') + ).property() + + # overloaded by adapters/epots/config/settings.yml + coarsing_date: + quarter_threshold: 147 # 21 weeks + month_threshold: 98 # 14 weeks + week_threshold: 49 # 7 weeks + + week_days: [ + {name: 'monday', index: 1} + {name: 'tuesday', index: 2} + {name: 'wednesday', index: 3} + {name: 'thursday', index: 4} + {name: 'friday', index: 5} + {name: 'saturday', index: 6} + {name: 'sunday', index: 0} + ] + project: + instance_scope_options: ['instance', 'batch'] + workflow_group: + batch_element_threshold_unit_options: ['businessday', 'day', 'week'] + project_instance_action: + states: ['pending', 'planned', 'overdue', 'rejected', 'completed'] + project_instance_group: + states: ['pending', 'processing', 'overdue', 'completed'] +#if window.app_globals +# for key, value of window.app_globals +# debugger +# Globals[key] = value + +default_globals.attention_incident.source = {} +for s in default_globals.attention_incident.sources + default_globals.attention_incident.source[s.id] = s.label + +export globals = Ember.Object.create default_globals, window.app_globals + +initialize = (application) -> + application.register 'service:globals', globals, instantiate: false #, singleton: true + application.inject 'controller', 'globals', 'service:globals' + application.inject 'component', 'globals', 'service:globals' + application.inject 'component', 'router', 'router:main' + #application.inject 'component', 'store', 'store:main' + #application.inject 'component', 'store', 'service:store' + application.inject 'view', 'globals', 'service:globals' + application.inject 'router', 'globals', 'service:globals' + +GlobalsInitializer = + name: 'globals' + initialize: initialize + +export {initialize, state_names} +export default GlobalsInitializer + + diff --git a/tests/dummy/app/routes/application.coffee b/tests/dummy/app/routes/application.coffee new file mode 100644 index 0000000..3e767d9 --- /dev/null +++ b/tests/dummy/app/routes/application.coffee @@ -0,0 +1,6 @@ +import Ember from 'ember' +import DunlopApplicationRoute from 'ember-cli-dunlop/mixins/application-route' + +export default Ember.Route.extend DunlopApplicationRoute, + _loadCurrentUser: -> # disable authentication magic for now + diff --git a/tests/dummy/app/templates/table-filters/test1.emblem b/tests/dummy/app/templates/table-filters/test1.emblem index db896df..305db6f 100644 --- a/tests/dummy/app/templates/table-filters/test1.emblem +++ b/tests/dummy/app/templates/table-filters/test1.emblem @@ -9,8 +9,8 @@ table.ui.celled.striped.compact.table.sortable /th date-range = sortable-table-header filters=filters key='target_date' model=model /= sortable-table-header filters=filters key='target_date' action=(invoke 'reload' model) model=model - th select-multiple - th select-multiple-modal + th dropdown-select-multiple + th select-multiple (using modal) th CUSTOM th number-range th dropdown-select @@ -27,13 +27,15 @@ table.ui.celled.striped.compact.table.sortable button.ui.mini.primary.button{action 'set_filter_target_date_this_week'}= t 'date.this_week' ' button.ui.mini.primary.button{action 'set_filter_target_date_next_fifteen_weeks'} Nu ↔ 15 weken - th - th + = filter.dropdown-select-multiple key='dropdown_select_multiple_ids_in' options=scenario_classification_objects labelPath='grumpy' + = filter.select-multiple key='select_multiple_modal_ids_in' options=scenario_classification_objects valueKey='id' textKey='grumpy' th class=filters.target_week:active-filter if filters.target_week |   span= filters.target_week i.close.icon.clear-target-week-filter{action 'clear_filter' 'target_week'} + else + i.filter.icon{action 'set_filter' 'target_week' '7-2018'} = filter.number-range key='age' inclusive=true = filter.dropdown-select key='location_planning_scenario_classification' options=scenario_classification_options = filter.dropdown-select key='location_planning_scenario_classification' options=scenario_classification_objects labelPath='grumpy'