diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee
index 883a0cbe6..99c94b222 100644
--- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee
@@ -244,7 +244,7 @@ class App.Controller extends Spine.Controller
el.unbind()
# start customer info controller
- new App.UserInfo(
+ new App.UserWidget(
el: el
user_id: data.user_id
callback: data.callback
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 caad842ff..99ed2711d 100644
--- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee
@@ -383,7 +383,8 @@ class App.ControllerForm extends App.Controller
container = document.getElementById( attribute.id + "_tagsinput" )
if reorder
$('#' + attribute.id + "_tagsinput" ).height( 20 )
- height = container.scrollHeight
+ height = container.scrollHeight || 45
+ console.log('siteUpdate', height)
$('#' + attribute.id + "_tagsinput" ).height( height - 16 )
onAddTag = =>
@@ -393,10 +394,9 @@ class App.ControllerForm extends App.Controller
siteUpdate(true)
$('#' + attribute.id + '_tagsinput').remove()
- w = $('#' + attribute.id).width()
h = $('#' + attribute.id).height()
$('#' + attribute.id).tagsInput(
- width: w + 'px'
+ width: '100%'
# height: (h + 30 )+ 'px'
onAddTag: onAddTag
onRemoveTag: onRemoveTag
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 c30fa281c..3753e951f 100644
--- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee
@@ -199,6 +199,16 @@ class DestroyConfirm extends App.ControllerModal
@modalHide()
@item.destroy()
+class App.ControllerDrox extends App.Controller
+ constructor: ->
+ super
+
+ template: (data) ->
+ drox = $( App.view('generic/drox')(data) )
+ content = App.view(data.file)(data.params)
+ drox.find('.drox-body').append(content)
+ drox
+
class App.ControllerLevel2 extends App.ControllerContent
events:
'click [data-toggle="tabnav"]': 'toggle',
diff --git a/app/assets/javascripts/app/controllers/link_info_widget.js.coffee b/app/assets/javascripts/app/controllers/link_info_widget.js.coffee
index 1a07420b6..ac8fbaa60 100644
--- a/app/assets/javascripts/app/controllers/link_info_widget.js.coffee
+++ b/app/assets/javascripts/app/controllers/link_info_widget.js.coffee
@@ -1,4 +1,4 @@
-class App.LinkInfo extends App.Controller
+class App.LinkInfo extends App.ControllerDrox
events:
'click [data-type=add]': 'add',
'click [data-type=edit]': 'edit',
@@ -8,7 +8,7 @@ class App.LinkInfo extends App.Controller
super
@fetch()
- fetch: () =>
+ fetch: =>
# fetch item on demand
# get data
@ajax(
@@ -29,7 +29,7 @@ class App.LinkInfo extends App.Controller
@render()
)
- render: () =>
+ render: =>
list = {}
for item in @links
@@ -43,8 +43,12 @@ class App.LinkInfo extends App.Controller
list[ item['link_type'] ].push ticket
# insert data
- @html App.view('link/info')(
- links: list,
+ @html @template(
+ file: 'link/info'
+ header: 'Links'
+ edit: true
+ params:
+ links: list
)
# show edit mode once enabled
@@ -61,12 +65,12 @@ class App.LinkInfo extends App.Controller
edit: (e) =>
e.preventDefault()
@edit_mode = true
- if $(e.target).parent().parent().find('[data-type=add]').hasClass('hide')
- $(e.target).parent().parent().find('[data-type=remove]').removeClass('hide')
- $(e.target).parent().parent().find('[data-type=add]').removeClass('hide')
+ if $(e.target).parents().find('[data-type=add]').hasClass('hide')
+ $(e.target).parents().find('[data-type=remove]').removeClass('hide')
+ $(e.target).parents().find('[data-type=add]').removeClass('hide')
else
- $(e.target).parent().parent().find('[data-type=remove]').addClass('hide')
- $(e.target).parent().parent().find('[data-type=add]').addClass('hide')
+ $(e.target).parents().find('[data-type=remove]').addClass('hide')
+ $(e.target).parents().find('[data-type=add]').addClass('hide')
remove: (e) =>
e.preventDefault()
diff --git a/app/assets/javascripts/app/controllers/organization_widget.js.coffee b/app/assets/javascripts/app/controllers/organization_widget.js.coffee
new file mode 100644
index 000000000..7b4240e4f
--- /dev/null
+++ b/app/assets/javascripts/app/controllers/organization_widget.js.coffee
@@ -0,0 +1,78 @@
+class App.OrganizationWidget extends App.Controller
+ events:
+ 'focusout [data-type=update-org]': 'update',
+ 'click [data-type=edit-org]': 'edit'
+
+ constructor: ->
+ super
+
+ # show organization
+ callback = (organization) =>
+ @render(organization)
+ if @callback
+ @callback(organization)
+
+ # subscribe and reload data / fetch new data if triggered
+ @subscribeId = organization.subscribe(@render)
+
+ App.Organization.retrieve( @organization_id, callback )
+
+ release: =>
+ App.Organization.unsubscribe(@subscribeId)
+
+ render: (organization) =>
+ if !organization
+ organization = @u
+
+ # get display data
+ 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 organization
+ 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('organization_widget')(
+ organization: organization
+ organizationData: organizationData
+ )
+
+ ###
+ @userTicketPopups(
+ selector: '.user-tickets'
+ user_id: user.id
+ position: 'right'
+ )
+ ###
+
+ update: (e) =>
+ note = $(e.target).parent().find('[data-type=update]').val()
+ organization = App.Organization.find( @organization_id )
+ if organization.note isnt note
+ organization.updateAttributes( note: note )
+ @log 'notice', 'update', e, note, organization
+
+ edit: (e) =>
+ e.preventDefault()
+ new App.ControllerGenericEdit(
+ id: @organization_id,
+ genericObject: 'Organization',
+ pageData: {
+ title: 'Organizations',
+ object: 'Organization',
+ objects: 'Organizations',
+ },
+ callback: @render
+ )
diff --git a/app/assets/javascripts/app/controllers/tag_widget.js.coffee b/app/assets/javascripts/app/controllers/tag_widget.js.coffee
index 01eefabfd..b609252dc 100644
--- a/app/assets/javascripts/app/controllers/tag_widget.js.coffee
+++ b/app/assets/javascripts/app/controllers/tag_widget.js.coffee
@@ -6,6 +6,8 @@ class App.TagWidget extends App.Controller
# update box size
@bind 'ui:rerender:content', =>
@siteUpdate()
+ @bind 'ui:rerender:task', =>
+ @siteUpdate()
load: =>
@attribute_id = 'tags_' + @object.id + '_' + @object_type
@@ -29,11 +31,11 @@ class App.TagWidget extends App.Controller
tag_id: @attribute_id
)
@el.find('#' + @attribute_id ).tagsInput(
- width: '236px'
+ width: '100%'
defaultText: App.i18n.translateContent('add a Tag')
onAddTag: @onAddTag
onRemoveTag: @onRemoveTag
-# height: '65px'
+ height: '45px'
)
@delay @siteUpdate, 250
diff --git a/app/assets/javascripts/app/controllers/template_widget.js.coffee b/app/assets/javascripts/app/controllers/template_widget.js.coffee
index 26971643f..c283597e3 100644
--- a/app/assets/javascripts/app/controllers/template_widget.js.coffee
+++ b/app/assets/javascripts/app/controllers/template_widget.js.coffee
@@ -1,4 +1,4 @@
-class App.TemplateUI extends App.Controller
+class App.TemplateUI extends App.ControllerDrox
events:
'click [data-type=template_save]': 'create',
'click [data-type=template_select]': 'select',
@@ -21,8 +21,11 @@ class App.TemplateUI extends App.Controller
template = App.Template.find( @template_id )
# insert data
- @html App.view('template_widget')(
- template: template,
+ @html @template(
+ file: 'template_widget'
+ header: 'Templates'
+ params:
+ template: template
)
new App.ControllerForm(
el: @el.find('#form-template')
diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee
index d6f1d5a72..a4bc36e24 100644
--- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee
+++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee
@@ -140,7 +140,6 @@ class App.TicketZoom extends App.Controller
@frontendTimeUpdate()
@TicketTitle()
- @TicketInfo()
@TicketAction()
@ArticleView()
@@ -177,13 +176,6 @@ class App.TicketZoom extends App.Controller
el: @el.find('.ticket-title')
)
- TicketInfo: =>
- # show ticket info
- new TicketInfo(
- ticket: @ticket
- el: @el.find('.ticket-info')
- )
-
ArticleView: =>
# show article
new ArticleView(
@@ -248,16 +240,27 @@ class TicketTitle extends App.Controller
App.Event.trigger 'task:render'
-class TicketInfo extends App.Controller
+class TicketInfo extends App.ControllerDrox
constructor: ->
super
@render()
render: ->
- @html App.view('ticket_zoom/ticket_info')(
- ticket: @ticket
+ @html @template(
+ file: 'ticket_zoom/ticket_info'
+ header: '#' + @ticket.number
+ params:
+ ticket: @ticket
)
+ # start tag controller
+ if !@isRole('Customer')
+ new App.TagWidget(
+ el: @el.find('.tag_info')
+ object_type: 'Ticket'
+ object: @ticket
+ )
+
class TicketAction extends App.Controller
constructor: ->
super
@@ -267,30 +270,29 @@ class TicketAction extends App.Controller
@html App.view('ticket_zoom/ticket_action')()
+ # show ticket info
+ new TicketInfo(
+ ticket: @ticket
+ el: @el.find('.ticket_info')
+ )
+
# start customer info controller
if !@isRole('Customer')
- new App.UserInfo(
+ new App.UserWidget(
el: @el.find('.customer_info')
user_id: @ticket.customer_id
ticket: @ticket
)
# start action controller
+ ###
if !@isRole('Customer')
new TicketActionRow(
el: @el.find('.action_info')
ticket: @ticket
zoom: @ui
)
-
- # start tag controller
- if !@isRole('Customer')
- new App.TagWidget(
- el: @el.find('.tag_info')
- object_type: 'Ticket'
- object: @ticket
- )
-
+ ###
# start link info controller
if !@isRole('Customer')
new App.LinkInfo(
@@ -423,9 +425,9 @@ class Edit extends App.Controller
if !@autosaveLast || ( diff && !_.isEmpty( diff ) )
@autosaveLast = currentData
@log 'notice', 'form hash changed', diff, currentData
- @el.find('.ticket-update').parent().addClass('form-changed')
- @el.find('.ticket-update').parent().parent().find('.reset-message').show()
- @el.find('.ticket-update').parent().parent().find('.reset-message').removeClass('hide')
+ @el.find('.edit-ticket').addClass('form-changed')
+ @el.find('.edit-ticket').find('.reset-message').show()
+ @el.find('.edit-ticket').find('.reset-message').removeClass('hide')
App.TaskManager.update( @task_key, { 'state': currentData })
@interval( update, 3000, 'autosave' )
diff --git a/app/assets/javascripts/app/controllers/user_info_widget.js.coffee b/app/assets/javascripts/app/controllers/user_info_widget.js.coffee
deleted file mode 100644
index 20013c972..000000000
--- a/app/assets/javascripts/app/controllers/user_info_widget.js.coffee
+++ /dev/null
@@ -1,132 +0,0 @@
-class App.UserInfo extends App.Controller
- events:
- '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
-
- # show user
- callback = (user) =>
- @render(user)
- if @callback
- @callback(user)
-
- # subscribe and reload data / fetch new data if triggered
- @subscribeId = user.subscribe(@render)
-
- App.User.retrieve( @user_id, callback )
-
- 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
- userData = []
- for item2 in App.User.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 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
- userData.push item
-
- 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
- userData: userData
- organization: organization
- organizationData: organizationData
- )
-
- @userTicketPopups(
- selector: '.user-tickets'
- user_id: user.id
- position: 'right'
- )
-
- 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_user: (e) =>
- e.preventDefault()
- new App.ControllerGenericEdit(
- id: @user_id,
- genericObject: 'User',
- required: 'quick',
- pageData: {
- title: 'Users',
- object: 'User',
- objects: 'Users',
- },
- 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/controllers/user_widget.js.coffee b/app/assets/javascripts/app/controllers/user_widget.js.coffee
new file mode 100644
index 000000000..297cb3765
--- /dev/null
+++ b/app/assets/javascripts/app/controllers/user_widget.js.coffee
@@ -0,0 +1,89 @@
+class App.UserWidget extends App.ControllerDrox
+ events:
+ 'focusout [data-type=update]': 'update',
+ 'click [data-type=edit]': 'edit'
+
+ constructor: ->
+ super
+
+ # show user
+ callback = (user) =>
+ @render(user)
+ if @callback
+ @callback(user)
+
+ # subscribe and reload data / fetch new data if triggered
+ @subscribeId = user.subscribe(@render)
+
+ App.User.retrieve( @user_id, callback )
+
+ release: =>
+ App.User.unsubscribe(@subscribeId)
+
+ render: (user) =>
+ if !user
+ user = @u
+
+ # get display data
+ userData = []
+ for item2 in App.User.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 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'
+ if item.info
+ userData.push item
+
+ # insert userData
+ @html @template(
+ file: 'user_widget'
+ header: 'Customer'
+ edit: true
+ params:
+ user: user
+ userData: userData
+ )
+
+ @userTicketPopups(
+ selector: '.user-tickets'
+ user_id: user.id
+ position: 'right'
+ )
+
+
+ if user.organization_id
+ @el.append('
')
+ new App.OrganizationWidget(
+ organization_id: user.organization_id
+ el: @el.find('.org-info')
+ )
+
+ update: (e) =>
+ note = $(e.target).parent().find('[data-type=update]').val()
+ user = App.User.find( @user_id )
+ if user.note isnt note
+ user.updateAttributes( note: note )
+ @log 'notice', 'update', e, note, user
+
+ edit: (e) =>
+ e.preventDefault()
+ new App.ControllerGenericEdit(
+ id: @user_id,
+ genericObject: 'User',
+ required: 'quick',
+ pageData: {
+ title: 'Users',
+ object: 'User',
+ objects: 'Users',
+ },
+ callback: @render
+ )
diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee
index a9c44f04d..9aa54e6a5 100644
--- a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee
+++ b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee
@@ -208,6 +208,7 @@ class _taskManagerSingleton extends App.Controller
worker = @worker( key )
if worker && worker.activate
worker.activate()
+ App.Event.trigger('ui:rerender:task')
# return if controller is already started
return if @workersStarted[key]
diff --git a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco
index d2036a9f0..9d50c5862 100644
--- a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco
+++ b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco
@@ -10,7 +10,6 @@
<%- @T( 'Cancel' ) %>
-
<%- @T( 'Create' ) %>
diff --git a/app/assets/javascripts/app/views/generic/drox.jst.eco b/app/assets/javascripts/app/views/generic/drox.jst.eco
new file mode 100644
index 000000000..cba06c21f
--- /dev/null
+++ b/app/assets/javascripts/app/views/generic/drox.jst.eco
@@ -0,0 +1,12 @@
+
diff --git a/app/assets/javascripts/app/views/link/info.jst.eco b/app/assets/javascripts/app/views/link/info.jst.eco
index 15a5b87aa..227424335 100644
--- a/app/assets/javascripts/app/views/link/info.jst.eco
+++ b/app/assets/javascripts/app/views/link/info.jst.eco
@@ -1,14 +1,11 @@
-
-
<%- @T( 'Links' ) %>
- <% for type of @links: %>
-
<%- @T( type ) %>
-
- <% end %>
-
-
+<% for type of @links: %>
+ <%- @T( type ) %>
+
+<% end %>
+
\ No newline at end of file
diff --git a/app/assets/javascripts/app/views/organization_widget.jst.eco b/app/assets/javascripts/app/views/organization_widget.jst.eco
new file mode 100644
index 000000000..e77973dbf
--- /dev/null
+++ b/app/assets/javascripts/app/views/organization_widget.jst.eco
@@ -0,0 +1,26 @@
+
+
+
+
+ <%= @organization.displayName() %>
+
+ <% for row in @organizationData: %>
+ <% if @organization[row.name] || row.name is 'note': %>
+ <% if row.tag isnt 'textarea': %>
+
<%- @L( @P( @organization[row.name] ) ) %>
+ <% else: %>
+
+
+
+ <% end %>
+ <% end %>
+ <% end %>
+
+
+
+
diff --git a/app/assets/javascripts/app/views/tag_widget.jst.eco b/app/assets/javascripts/app/views/tag_widget.jst.eco
index 0419ef274..f34854c08 100644
--- a/app/assets/javascripts/app/views/tag_widget.jst.eco
+++ b/app/assets/javascripts/app/views/tag_widget.jst.eco
@@ -1,4 +1,4 @@
-
<%- @T( 'Tags' ) %>
+ <%- @T( 'Tags' ) %>
diff --git a/app/assets/javascripts/app/views/template_widget.jst.eco b/app/assets/javascripts/app/views/template_widget.jst.eco
index 8584e7ee1..48af7cf79 100644
--- a/app/assets/javascripts/app/views/template_widget.jst.eco
+++ b/app/assets/javascripts/app/views/template_widget.jst.eco
@@ -1,10 +1,9 @@
-
<%- @T( 'Templates' ) %>
diff --git a/app/assets/javascripts/app/views/ticket_zoom.jst.eco b/app/assets/javascripts/app/views/ticket_zoom.jst.eco
index 6a02e248a..7df0a5d88 100644
--- a/app/assets/javascripts/app/views/ticket_zoom.jst.eco
+++ b/app/assets/javascripts/app/views/ticket_zoom.jst.eco
@@ -1,13 +1,12 @@
-->
-
-
<%- @T('Message') %> ×
-