Files
ember-cli-dunlop/tests/dummy/app/initializers/globals.coffee
T

118 lines
4.2 KiB
CoffeeScript

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