diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index 6cfa2afdc..d7eef7a74 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -418,6 +418,10 @@ class App.ControllerForm extends App.Controller ) @delay( a, 180 ) + # radio + else if attribute.tag is 'working_hour' + item = $( App.view('generic/working_hour')( attribute: attribute ) ) + # ticket attribute selection else if attribute.tag is 'ticket_attribute_selection' @@ -494,7 +498,7 @@ class App.ControllerForm extends App.Controller } ) all.unshift( { id: 1 - name: '*** nobody ***' + name: '*** not set ***' } ) all.unshift( { id: 'current_user.id' @@ -594,18 +598,18 @@ class App.ControllerForm extends App.Controller selected: false disable: true }, - { - value: 'number' - name: 'Number' - selected: true - disable: false - }, - { - value: 'title' - name: 'Title' - selected: true - disable: false - }, +# { +# value: 'number' +# name: 'Number' +# selected: true +# disable: false +# }, +# { +# value: 'title' +# name: 'Title' +# selected: true +# disable: false +# }, { value: 'group_id' name: 'Group' @@ -685,42 +689,42 @@ class App.ControllerForm extends App.Controller # selected: true # disable: false # }, - { - value: '-a' - name: '-- ' + App.i18n.translateInline('Article') + ' --' - selected: false - disable: true - }, - { - value: 'from' - name: 'From' - selected: true - disable: false - }, - { - value: 'to' - name: 'To' - selected: true - disable: false - }, - { - value: 'cc' - name: 'Cc' - selected: true - disable: false - }, - { - value: 'subject' - name: 'Subject' - selected: true - disable: false - }, - { - value: 'body' - name: 'Text' - selected: true - disable: false - }, +# { +# value: '-a' +# name: '-- ' + App.i18n.translateInline('Article') + ' --' +# selected: false +# disable: true +# }, +# { +# value: 'from' +# name: 'From' +# selected: true +# disable: false +# }, +# { +# value: 'to' +# name: 'To' +# selected: true +# disable: false +# }, +# { +# value: 'cc' +# name: 'Cc' +# selected: true +# disable: false +# }, +# { +# value: 'subject' +# name: 'Subject' +# selected: true +# disable: false +# }, +# { +# value: 'body' +# name: 'Text' +# selected: true +# disable: false +# }, # { # value: '-c' # name: '-- ' + App.i18n.translateInline('Customer') + ' --' diff --git a/app/assets/javascripts/app/controllers/sla.js.coffee b/app/assets/javascripts/app/controllers/sla.js.coffee new file mode 100644 index 000000000..8336004c5 --- /dev/null +++ b/app/assets/javascripts/app/controllers/sla.js.coffee @@ -0,0 +1,31 @@ +$ = jQuery.sub() + +class Index extends App.Controller + constructor: -> + super + + # check authentication + return if !@authenticate() + + new App.ControllerGenericIndex( + el: @el, + id: @id, + genericObject: 'Sla', + pageData: { + title: 'SLA', + home: 'slas', + object: 'SLA', + objects: 'SLAs', + navupdate: '#slas', + notes: [ +# 'SLA are ...' + ], + buttons: [ + { name: 'New SLA', 'data-type': 'new', class: 'primary' }, + ], + }, + ) + +App.Config.set( 'slas', Index, 'Routes' ) +App.Config.set( 'Sla', { prio: 2900, parent: '#admin', name: 'SLAs', target: '#slas', role: ['Admin'] }, 'NavBar' ) + diff --git a/app/assets/javascripts/app/models/sla.js.coffee b/app/assets/javascripts/app/models/sla.js.coffee new file mode 100644 index 000000000..9e0e5c4eb --- /dev/null +++ b/app/assets/javascripts/app/models/sla.js.coffee @@ -0,0 +1,33 @@ +class App.Sla extends Spine.Model + @configure 'Sla', 'name', 'condition', 'data', 'active' + @extend Spine.Model.Ajax + @url: 'api/slas' + @configure_attributes = [ + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'span4' }, + { name: 'first_response_time', display: 'First Resposne Time', tag: 'input', type: 'text', limit: 100, null: true, 'class': 'span4' }, + { name: 'update_time', display: 'Update Time', tag: 'input', type: 'text', limit: 100, null: true, 'class': 'span4' }, + { name: 'solution_time', display: 'Solution Time', tag: 'input', type: 'text', limit: 100, null: true, 'class': 'span4' }, + { name: 'condition', display: 'Conditions where SLA is used', tag: 'ticket_attribute_selection', null: true, class: 'span4' }, + { + name: 'working_hour' + display: 'Working Hours' + tag: 'working_hour' + default: '' + null: true + nulloption: true + translate: true + options: + customer: 'Customer' + ticket_state: 'State' + ticket_priority: 'Priority' + group: 'Group' + owner: 'Owner' + class: 'span4' + }, + { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' }, + ] + @configure_delete = true + @configure_overview = [ + 'name', + ] \ No newline at end of file diff --git a/app/assets/javascripts/app/views/generic/working_hour.jst.eco b/app/assets/javascripts/app/views/generic/working_hour.jst.eco new file mode 100644 index 000000000..003e36c2c --- /dev/null +++ b/app/assets/javascripts/app/views/generic/working_hour.jst.eco @@ -0,0 +1,19 @@ + + + +<% for hour in [ 0 .. 23 ]: %> + +<% end %> + + + +<% for day in ['Mon', '', 'Wed', '', 'Fri', 'Sat', 'Sun']: %> + + +<% for hour in [ 0 .. 23 ]: %> + +<% end %> + +<% end %> + +
<%- hour %>
<%- @T(day) %>
\ No newline at end of file diff --git a/app/models/sla.rb b/app/models/sla.rb new file mode 100644 index 000000000..7968da3a1 --- /dev/null +++ b/app/models/sla.rb @@ -0,0 +1,5 @@ +class Sla < ApplicationModel + store :condition + store :data + validates :name, :presence => true +end \ No newline at end of file diff --git a/config/routes/sla.rb b/config/routes/sla.rb new file mode 100644 index 000000000..43c88bf04 --- /dev/null +++ b/config/routes/sla.rb @@ -0,0 +1,13 @@ +module ExtraRoutes + def add(map) + + # slas + map.match '/api/slas', :to => 'slas#index', :via => :get + map.match '/api/slas/:id', :to => 'slas#show', :via => :get + map.match '/api/slas', :to => 'slas#create', :via => :post + map.match '/api/slas/:id', :to => 'slas#update', :via => :put + map.match '/api/slas/:id', :to => 'slas#destroy', :via => :delete + + end + module_function :add +end \ No newline at end of file diff --git a/db/migrate/20130201071513_create_sla.rb b/db/migrate/20130201071513_create_sla.rb new file mode 100644 index 000000000..5dc95e6c4 --- /dev/null +++ b/db/migrate/20130201071513_create_sla.rb @@ -0,0 +1,17 @@ +class CreateSla < ActiveRecord::Migration + def up + create_table :slas do |t| + t.column :name, :string, :limit => 150, :null => true + t.column :condition, :string, :limit => 5000, :null => true + t.column :data, :string, :limit => 5000, :null => true + t.column :active, :boolean, :null => false, :default => true + t.column :updated_by_id, :integer, :null => false + t.column :created_by_id, :integer, :null => false + t.timestamps + end + add_index :slas, [:name], :unique => true + end + + def down + end +end