<%= article.from %>
@@ -36,7 +37,8 @@
<% end %>
<% end %>
- <%- article.html %>
+ <%- article.html %>
+ 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 a2e1f6d29..92c29a654 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -362,7 +362,7 @@ class App.ControllerForm extends App.Controller params: form_id: @form_id text: - uploadButton: '' + uploadButton: '' template: '
{dragZoneText}
' +
' ' +
diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee
index 530565c56..07b7442fe 100644
--- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee
@@ -238,3 +238,66 @@ class App.ControllerTabs extends App.Controller
new tab.controller( params )
@el.find('.tab-content .tab-pane:first').addClass('active')
+
+class App.ControllerNavSidbar extends App.ControllerContent
+ constructor: (params) ->
+ super
+
+ # get groups
+ groups = App.Config.get(@configKey)
+ groupsUnsorted = []
+ for key, value of groups
+ if !value.controller
+ groupsUnsorted.push value
+
+ @groupsSorted = _.sortBy( groupsUnsorted, (item) -> return item.prio )
+
+ # get items of group
+ for group in @groupsSorted
+ items = App.Config.get(@configKey)
+ itemsUnsorted = []
+ for key, value of items
+ if value.controller
+ if value.parent is group.target
+ itemsUnsorted.push value
+
+ group.items = _.sortBy( itemsUnsorted, (item) -> return item.prio )
+
+
+ # set active item
+ selectedItem = undefined
+ for group in @groupsSorted
+ if group.items
+ for item in group.items
+ if !@target && !selectedItem
+ item.active = true
+ selectedItem = item
+ else if @target && item.target is window.location.hash
+ item.active = true
+ selectedItem = item
+ else
+ item.active = false
+
+ @render(selectedItem)
+
+ if selectedItem
+ new selectedItem.controller(
+ el: @el.find('.main')
+ )
+
+ @bind(
+ 'ui:rerender'
+ =>
+ @render(selectedItem, true)
+ )
+
+ render: (selectedItem, force) ->
+ if !$( '.' + @configKey )[0] || force
+ @html App.view('generic/navbar_l2')(
+ groups: @groupsSorted
+ className: @configKey
+ )
+ if selectedItem
+ @el.find('li').removeClass('active')
+ @el.find('a[href="' + selectedItem.target + '"]').parent().addClass('active')
+
diff --git a/app/assets/javascripts/app/controllers/_profile/language.js.coffee b/app/assets/javascripts/app/controllers/_profile/language.js.coffee
index a86a78ba2..42c5221e5 100644
--- a/app/assets/javascripts/app/controllers/_profile/language.js.coffee
+++ b/app/assets/javascripts/app/controllers/_profile/language.js.coffee
@@ -1,4 +1,4 @@
-class App.ProfileLanguage extends App.Controller
+class Index extends App.Controller
events:
'submit form': 'update'
@@ -66,3 +66,6 @@ class App.ProfileLanguage extends App.Controller
type: 'error'
msg: App.i18n.translateContent( data.message )
)
+
+App.Config.set( 'Language', { prio: 1000, name: 'Language', parent: '#profile', target: '#profile/language', controller: Index }, 'NavBarProfile' )
+
diff --git a/app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee b/app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee
index 9ac63a957..0447da5c6 100644
--- a/app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee
+++ b/app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee
@@ -1,4 +1,4 @@
-class App.ProfileLinkedAccounts extends App.Controller
+class Index extends App.Controller
events:
'click [data-type="remove"]': 'remove'
@@ -75,3 +75,6 @@ class App.ProfileLinkedAccounts extends App.Controller
type: 'error'
msg: App.i18n.translateContent( data.message )
)
+
+App.Config.set( 'LinkedAccounts', { prio: 3000, name: 'Linked Accunts', parent: '#profile', target: '#profile/linked', controller: Index }, 'NavBarProfile' )
+
diff --git a/app/assets/javascripts/app/controllers/_profile/password.js.coffee b/app/assets/javascripts/app/controllers/_profile/password.js.coffee
index 1c12a4abb..c66e916ae 100644
--- a/app/assets/javascripts/app/controllers/_profile/password.js.coffee
+++ b/app/assets/javascripts/app/controllers/_profile/password.js.coffee
@@ -1,4 +1,4 @@
-class App.ProfilePassword extends App.Controller
+class Index extends App.Controller
events:
'submit form': 'update'
@@ -59,3 +59,6 @@ class App.ProfilePassword extends App.Controller
type: 'error'
msg: App.i18n.translateContent( data.message )
)
+
+App.Config.set( 'Password', { prio: 2000, name: 'Password', parent: '#profile', target: '#profile/password', controller: Index }, 'NavBarProfile' )
+
diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee
index 26b93583f..87ae38f65 100644
--- a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee
+++ b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee
@@ -190,7 +190,7 @@ class App.TicketCreate extends App.Controller
# show template UI
new App.TemplateUI(
- el: @el.find('[data-id="ticket_template"]')
+ el: @el.find('.ticket_template')
template_id: template['id']
)
@@ -216,7 +216,7 @@ class App.TicketCreate extends App.Controller
@userInfo(
user_id: params.customer_id
- el: @el.find('[data-id="customer_info"]')
+ el: @el.find('.customer_info')
callback: callback
)
diff --git a/app/assets/javascripts/app/controllers/manage.js.coffee b/app/assets/javascripts/app/controllers/manage.js.coffee
index 1733a33f4..92ae35ab8 100644
--- a/app/assets/javascripts/app/controllers/manage.js.coffee
+++ b/app/assets/javascripts/app/controllers/manage.js.coffee
@@ -1,67 +1,5 @@
-class IndexRouter extends App.Controller
- constructor: (params) ->
- super
-
- # get groups
- groups = App.Config.get('NavBarLevel4')
- groupsUnsorted = []
- for key, value of groups
- groupsUnsorted.push value
-
- @groupsSorted = _.sortBy( groupsUnsorted, (item) -> return item.prio )
-
- # get items of group
- for group in @groupsSorted
- items = App.Config.get('NavBarLevel44')
- itemsUnsorted = []
- for key, value of items
- if value.parent is group.target
- itemsUnsorted.push value
-
- group.items = _.sortBy( itemsUnsorted, (item) -> return item.prio )
-
-
- # set active item
- selectedItem = undefined
- for group in @groupsSorted
- if group.items
- for item in group.items
- if !@target && !selectedItem
- item.active = true
- selectedItem = item
- else if @target && item.target is '#manage/' + @target
- item.active = true
- selectedItem = item
- else if @target && item.target is '#settings/' + @target
- item.active = true
- selectedItem = item
- else if @target && item.target is '#channels/' + @target
- item.active = true
- selectedItem = item
- else if @target && item.target is '#system/' + @target
- item.active = true
- selectedItem = item
- else
- item.active = false
-
- @render(selectedItem)
-
- if selectedItem
- new selectedItem.controller(
- el: @el.find('.main')
- )
-
- render: (selectedItem) ->
-
- if !$('.nav-manage')[0]
- @html App.view('generic/navbar_l2')(
- groups: @groupsSorted
- className: 'nav-manage'
- )
- if selectedItem
- @el.find('li').removeClass('active')
- @el.find('a[href="' + selectedItem.target + '"]').parent().addClass('active')
-
+class IndexRouter extends App.ControllerNavSidbar
+ configKey: 'NavBarLevel44'
App.Config.set( 'manage', IndexRouter, 'Routes' )
App.Config.set( 'manage/:target', IndexRouter, 'Routes' )
@@ -69,8 +7,10 @@ App.Config.set( 'settings/:target', IndexRouter, 'Routes' )
App.Config.set( 'channels/:target', IndexRouter, 'Routes' )
App.Config.set( 'system/:target', IndexRouter, 'Routes' )
-App.Config.set( 'Manage', { prio: 1000, name: 'Manage', target: '#manage', role: ['Admin'] }, 'NavBarLevel4' )
-App.Config.set( 'Channels', { prio: 2500, name: 'Channels', target: '#channels', role: ['Admin'] }, 'NavBarLevel4' )
-App.Config.set( 'Settings', { prio: 7000, name: 'Settings', target: '#settings', role: ['Admin'] }, 'NavBarLevel4' )
-App.Config.set( 'System', { prio: 8000, name: 'System', target: '#system', role: ['Admin'] }, 'NavBarLevel4' )
+App.Config.set( 'Manage', { prio: 1000, name: 'Manage', target: '#manage', role: ['Admin'] }, 'NavBarLevel44' )
+App.Config.set( 'Channels', { prio: 2500, name: 'Channels', target: '#channels', role: ['Admin'] }, 'NavBarLevel44' )
+App.Config.set( 'Settings', { prio: 7000, name: 'Settings', target: '#settings', role: ['Admin'] }, 'NavBarLevel44' )
+App.Config.set( 'System', { prio: 8000, name: 'System', target: '#system', role: ['Admin'] }, 'NavBarLevel44' )
+
+App.Config.set( 'SystemObject', { prio: 1700, parent: '#system', name: 'Objects', target: '#system/objects', controller: true, role: ['Admin'] }, 'NavBarLevel44' )
diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee
index 1b747d7a4..9bf03f602 100644
--- a/app/assets/javascripts/app/controllers/navigation.js.coffee
+++ b/app/assets/javascripts/app/controllers/navigation.js.coffee
@@ -35,6 +35,13 @@ class App.Navigation extends App.Controller
@recent_viewed_build(data)
@render()
+ # bell on / bell off
+ @bind 'bell', (data) =>
+ if data is 'on'
+ @el.find('.bell').addClass('show')
+ else
+ @el.find('.bell').removeClass('show')
+
render: () ->
user = App.Session.all()
nav_left = @getItems( navbar: @Config.get( 'NavBar' ) )
diff --git a/app/assets/javascripts/app/controllers/profile.js.coffee b/app/assets/javascripts/app/controllers/profile.js.coffee
index cacd6e70f..1de3787ce 100644
--- a/app/assets/javascripts/app/controllers/profile.js.coffee
+++ b/app/assets/javascripts/app/controllers/profile.js.coffee
@@ -1,32 +1,9 @@
-class Index extends App.ControllerLevel2
- toggleable: false
-# toggleable: true
+class Index extends App.ControllerNavSidbar
+ configKey: 'NavBarProfile'
- constructor: ->
- super
-
- return if !@authenticate()
-
- @menu = [
- { name: 'Password', 'target': 'password', controller: App.ProfilePassword, params: {} },
- { name: 'Language', 'target': 'language', controller: App.ProfileLanguage, params: {} },
- { name: 'Link Accounts', 'target': 'accounts', controller: App.ProfileLinkedAccounts, params: {} },
-# { name: 'Notifications', 'target': 'notify', controller: App.SettingsArea, params: { area: 'Ticket::Number' } },
- ]
- @page = {
- title: 'Profile',
- head: 'Profile',
- sub_title: 'Settings'
- nav: '#profile',
- }
-
- # render page
- @render()
-
-# render: ->
-# @html App.view('profile')()
-
-
-App.Config.set( 'profile/:target', Index, 'Routes' )
App.Config.set( 'profile', Index, 'Routes' )
+App.Config.set( 'profile/:target', Index, 'Routes' )
+
+App.Config.set( 'Profile', { prio: 1000, name: 'Profile', target: '#profile' }, 'NavBarProfile' )
+
App.Config.set( 'Profile', { prio: 1700, parent: '#current_user', name: 'Profile', target: '#profile', role: [ 'Agent', 'Customer' ] }, 'NavBarRight' )
diff --git a/app/assets/javascripts/app/controllers/settings.js.coffee b/app/assets/javascripts/app/controllers/settings.js.coffee
index 1e3841893..b743b0155 100644
--- a/app/assets/javascripts/app/controllers/settings.js.coffee
+++ b/app/assets/javascripts/app/controllers/settings.js.coffee
@@ -59,9 +59,8 @@ class Ticket extends App.ControllerTabs
@render()
-App.Config.set( 'System', { prio: 1400, parent: '#settings', name: 'System', target: '#settings/system', controller: System, role: ['Admin'] }, 'NavBarLevel44' )
-App.Config.set( 'Security', { prio: 1500, parent: '#settings', name: 'Security', target: '#settings/security', controller: Security, role: ['Admin'] }, 'NavBarLevel44' )
-App.Config.set( 'Import', { prio: 1550, parent: '#settings', name: 'Import', target: '#settings/import', controller: Import, role: ['Admin'] }, 'NavBarLevel44' )
-App.Config.set( 'Ticket', { prio: 1600, parent: '#settings', name: 'Ticket', target: '#settings/ticket', controller: Ticket, role: ['Admin'] }, 'NavBarLevel44' )
+App.Config.set( 'SettingSystem', { prio: 1400, parent: '#settings', name: 'System', target: '#settings/system', controller: System, role: ['Admin'] }, 'NavBarLevel44' )
+App.Config.set( 'SettingSecurity', { prio: 1500, parent: '#settings', name: 'Security', target: '#settings/security', controller: Security, role: ['Admin'] }, 'NavBarLevel44' )
+App.Config.set( 'SettingImport', { prio: 1550, parent: '#settings', name: 'Import', target: '#settings/import', controller: Import, role: ['Admin'] }, 'NavBarLevel44' )
+App.Config.set( 'SettingTicket', { prio: 1600, parent: '#settings', name: 'Ticket', target: '#settings/ticket', controller: Ticket, role: ['Admin'] }, 'NavBarLevel44' )
-#App.Config.set( 'Object', { prio: 1700, parent: '#settings', name: 'Objects', target: '#settings/objects', role: ['Admin'] }, 'NavBar' )
diff --git a/app/assets/javascripts/app/controllers/tag_widget.js.coffee b/app/assets/javascripts/app/controllers/tag_widget.js.coffee
index 60f66809f..4488ea8f2 100644
--- a/app/assets/javascripts/app/controllers/tag_widget.js.coffee
+++ b/app/assets/javascripts/app/controllers/tag_widget.js.coffee
@@ -29,7 +29,7 @@ class App.TagWidget extends App.Controller
tag_id: @attribute_id
)
@el.find('#' + @attribute_id ).tagsInput(
- width: '150px'
+ width: '236px'
defaultText: App.i18n.translateContent('add a Tag')
onAddTag: @onAddTag
onRemoveTag: @onRemoveTag
diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee
index 9c9a2466a..01071d9be 100644
--- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee
+++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee
@@ -345,12 +345,12 @@ class Edit extends App.Controller
@configure_attributes_article = [
{ name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', filter: @edit_form, default: '9', translate: true, class: 'medium' },
+ { name: 'internal', display: 'Visability', tag: 'select', null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: '', default: false },
{ name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', hide: true },
{ name: 'cc', display: 'Cc', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', hide: true },
# { name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', hide: true },
{ name: 'in_reply_to', display: 'In Reply to', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
{ name: 'body', display: 'Text', tag: 'textarea', rows: 6, limit: 100, null: true, class: 'span7', item_class: '', upload: true },
- { name: 'internal', display: 'Visability', tag: 'select', null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: '', default: false },
]
if @isRole('Customer')
@configure_attributes_article = [
@@ -435,7 +435,7 @@ class Edit extends App.Controller
@el.find('.ticket-update').parent().parent().find('.reset-message').show()
@el.find('.ticket-update').parent().parent().find('.reset-message').removeClass('hide')
App.TaskManager.update( @task_key, { 'state': currentData })
- @interval( update, 1500, 'autosave' )
+ @interval( update, 3000, 'autosave' )
update: (e) =>
e.preventDefault()
diff --git a/app/assets/javascripts/app/controllers/user_info_widget.js.coffee b/app/assets/javascripts/app/controllers/user_info_widget.js.coffee
index 5734a3661..20013c972 100644
--- a/app/assets/javascripts/app/controllers/user_info_widget.js.coffee
+++ b/app/assets/javascripts/app/controllers/user_info_widget.js.coffee
@@ -1,7 +1,10 @@
class App.UserInfo extends App.Controller
events:
- 'focusout [data-type=update]': 'update',
- 'click [data-type=edit]': 'edit'
+ 'focusout [data-type=update-user]': 'update_user',
+ 'focusout [data-type=update-org]': 'update_org',
+ 'click [data-type=edit-user]': 'edit_user'
+ 'click [data-type=edit-org]': 'edit_org'
+ 'click .nav li > a': 'toggle'
constructor: ->
super
@@ -20,12 +23,20 @@ class App.UserInfo extends App.Controller
release: =>
App.User.unsubscribe(@subscribeId)
+ toggle: (e) ->
+ e.preventDefault()
+ @el.find('.nav li.active').removeClass('active')
+ $(e.target).parent('li').addClass('active')
+ area = $(e.target).data('area')
+ @el.find('.user-info, .org-info').addClass('hide')
+ @el.find('.' + area ).removeClass('hide')
+
render: (user) =>
if !user
user = @u
# get display data
- data = []
+ userData = []
for item2 in App.User.configure_attributes
item = _.clone( item2 )
@@ -36,17 +47,39 @@ class App.UserInfo extends App.Controller
item.name = itemNameValueNew
# add to show if value exists
- if user[item.name]
+ if user[item.name] || item.tag is 'textarea'
# do not show firstname and lastname / already show via diplayName()
if item.name isnt 'firstname' && item.name isnt 'lastname' && item.name isnt 'organization'
if item.info
- data.push item
+ userData.push item
- # insert data
+ if user.organization_id
+ organization = App.Organization.find( user.organization_id )
+ organizationData = []
+ for item2 in App.Organization.configure_attributes
+ item = _.clone( item2 )
+
+ # check if value for _id exists
+ itemNameValue = item.name
+ itemNameValueNew = itemNameValue.substr( 0, itemNameValue.length - 3 )
+ if itemNameValueNew of user
+ item.name = itemNameValueNew
+
+ # add to show if value exists
+ if organization[item.name] || item.tag is 'textarea'
+
+ # do not show name / already show via diplayName()
+ if item.name isnt 'name'
+ if item.info
+ organizationData.push item
+
+ # insert userData
@html App.view('user_info')(
- user: user
- data: data
+ user: user
+ userData: userData
+ organization: organization
+ organizationData: organizationData
)
@userTicketPopups(
@@ -55,15 +88,14 @@ class App.UserInfo extends App.Controller
position: 'right'
)
- # update changes
- update: (e) =>
- note = $(e.target).parent().find('[data-type=update]').val()
+ update_user: (e) =>
+ note = $(e.target).parent().find('[data-type=update-user]').val()
user = App.User.find( @user_id )
if user.note isnt note
user.updateAttributes( note: note )
@log 'notice', 'update', e, note, user
- edit: (e) =>
+ edit_user: (e) =>
e.preventDefault()
new App.ControllerGenericEdit(
id: @user_id,
@@ -76,3 +108,25 @@ class App.UserInfo extends App.Controller
},
callback: @render
)
+
+ update_org: (e) =>
+ note = $(e.target).parent().find('[data-type=update-org]').val()
+ org_id = $(e.target).parents().find('[data-type=edit-org]').data('id')
+ organization = App.Organization.find( org_id )
+ if organization.note isnt note
+ organization.updateAttributes( note: note )
+ @log 'notice', 'update', e, note, organization
+
+ edit_org: (e) =>
+ e.preventDefault()
+ id = $(e.target).data('id')
+ new App.ControllerGenericEdit(
+ id: id,
+ genericObject: 'Organization',
+ pageData: {
+ title: 'Organizations',
+ object: 'Organization',
+ objects: 'Organizations',
+ },
+ callback: @render
+ )
diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee
index b1b5fc0a5..7c7e1497b 100644
--- a/app/assets/javascripts/app/index.js.coffee
+++ b/app/assets/javascripts/app/index.js.coffee
@@ -41,7 +41,9 @@ class App extends Spine.Controller
# define linkify helper
params.L = ( item ) ->
- window.linkify( item )
+ if item && typeof item is 'string'
+ return window.linkify( item )
+ item
# define config helper
params.C = ( key ) ->
@@ -55,4 +57,4 @@ class App extends Spine.Controller
JST["app/views/#{name}"](params)
template
-window.App = App
\ No newline at end of file
+window.App = App
diff --git a/app/assets/javascripts/app/models/organization.js.coffee b/app/assets/javascripts/app/models/organization.js.coffee
index 1dd39f398..73f2ae755 100644
--- a/app/assets/javascripts/app/models/organization.js.coffee
+++ b/app/assets/javascripts/app/models/organization.js.coffee
@@ -3,11 +3,11 @@ class App.Organization extends App.Model
@extend Spine.Model.Ajax
@url: 'api/organizations'
@configure_attributes = [
- { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
- { name: 'shared', display: 'Shared organiztion', tag: 'boolean', note: 'Customers in the organiztion can view each other items.', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
- { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, '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' },
+ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, info: true, 'class': 'span4' },
+ { name: 'shared', display: 'Shared organiztion', tag: 'boolean', note: 'Customers in the organiztion can view each other items.', type: 'boolean', 'default': true, 'null': false, info: false, 'class': 'span4' },
+ { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, info: true, 'class': 'span4' },
+ { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1, info: false },
+ { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, info: false, 'class': 'span4' },
]
@configure_overview = [
'name',
diff --git a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco
index 1e2b5c7d9..9132e90c4 100644
--- a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco
+++ b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco
@@ -1,9 +1,9 @@