diff --git a/app/assets/javascripts/app/controllers/trigger.js.coffee b/app/assets/javascripts/app/controllers/trigger.js.coffee index eddea8b6b..7ce2a4e33 100644 --- a/app/assets/javascripts/app/controllers/trigger.js.coffee +++ b/app/assets/javascripts/app/controllers/trigger.js.coffee @@ -9,8 +9,7 @@ class Index extends App.ControllerTabs { name: 'Time Based', target: 'c-time-based', - controller: App.SettingsArea, - params: { area: 'Email::Base' }, + controller: App.TriggerTime, }, { name: 'Event Based', @@ -34,4 +33,57 @@ class Index extends App.ControllerTabs @render() -App.Config.set( 'Trigger', { prio: 3000, name: 'Trigger', parent: '#manage', target: '#manage/triggers', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file +App.Config.set( 'Trigger', { prio: 3000, name: 'Trigger', parent: '#manage', target: '#manage/triggers', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) + +class App.TriggerTime extends App.Controller + events: + 'click .js-new': 'new' + #'click .js-edit': 'edit' + 'click .js-delete': 'delete' + + constructor: -> + super + @interval(@load, 30000) + #@load() + + load: => + @ajax( + id: 'trigger_time_index' + type: 'GET' + url: @apiPath + '/jobs' + processData: true + success: (data, status, xhr) => + + # load assets + #App.Collection.loadAssets(data.assets) + + @render(data) + ) + + render: (data = {}) => + + @html App.view('trigger/time/index')( + triggers: [] + ) + + + delete: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Channel.find(id) + new App.ControllerGenericDestroyConfirm( + item: item + container: @el.closest('.content') + callback: @load + ) + + new: (e) => + e.preventDefault() + channel_id = $(e.target).closest('.action').data('id') + new App.ControllerGenericNew( + pageData: + object: 'Jobs' + genericObject: 'Job' + container: @el.closest('.content') + callback: @load + ) diff --git a/app/assets/javascripts/app/models/job.js.coffee b/app/assets/javascripts/app/models/job.js.coffee index a2842637b..855408151 100644 --- a/app/assets/javascripts/app/models/job.js.coffee +++ b/app/assets/javascripts/app/models/job.js.coffee @@ -4,9 +4,9 @@ class App.Job extends App.Model @url: @apiPath + '/jobs' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false }, - { name: 'timeplan', display: 'The times where the job should run.', tag: 'timeplan', null: true }, - { name: 'condition', display: 'Conditions for matching objects.', tag: 'ticket_attribute_selection', null: true }, - { name: 'execute', display: 'Execute changes on objects.', tag: 'ticket_attribute_set', null: true }, +# { name: 'timeplan', display: 'The times where the job should run.', tag: 'timeplan', null: true }, + { name: 'condition', display: 'Conditions for matching objects.', tag: 'ticket_selector', null: true }, + { name: 'execute', display: 'Execute changes on objects.', tag: 'ticket_perform_action', null: true }, { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true }, { name: 'active', display: 'Active', tag: 'active', default: true }, { name: 'matching', display: 'Matching', readonly: 1 },