From 06f2e779928c957ad6cf522a56f1261b4840d5b0 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 6 Feb 2015 23:11:51 +0100 Subject: [PATCH] Moved to local modals. --- .../_application_controller_generic.js.coffee | 17 +++++---- .../_application_controller_table.js.coffee | 5 +-- .../controllers/agent_ticket_create.js.coffee | 25 +++++++------ .../app/controllers/groups.js.coffee | 26 +++++++------- .../app/controllers/object_manager.js.coffee | 25 ++++++------- .../organization_history.js.coffee | 6 ++-- .../app/controllers/organizations.js.coffee | 26 +++++++------- .../app/controllers/overview.js.coffee | 26 +++++++------- .../app/controllers/scheduler.js.coffee | 26 +++++++------- .../javascripts/app/controllers/sla.js.coffee | 26 +++++++------- .../app/controllers/text_module.js.coffee | 26 +++++++------- .../app/controllers/ticket_overview.js.coffee | 2 +- .../app/controllers/ticket_zoom.js.coffee | 35 +++++++++++-------- ...user_organization_autocompletion.js.coffee | 3 +- 14 files changed, 143 insertions(+), 131 deletions(-) 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 c49f3897b..68c88ac33 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee @@ -2,15 +2,15 @@ class App.ControllerGenericNew extends App.ControllerModal constructor: (params) -> super - @head = App.i18n.translateContent( 'New' ) + ': ' + App.i18n.translateContent( @pageData.object ) + @head = App.i18n.translateContent( 'New' ) + ': ' + App.i18n.translateContent( @pageData.object ) @cancel = true @button = true controller = new App.ControllerForm( - model: App[ @genericObject ] - params: @item - screen: @screen || 'edit' - autofocus: true + model: App[ @genericObject ] + params: @item + screen: @screen || 'edit' + autofocus: true ) @content = controller.form @@ -98,8 +98,8 @@ class App.ControllerGenericEdit extends App.ControllerModal class App.ControllerGenericIndex extends App.Controller events: - 'click [data-type=edit]': 'edit' - 'click [data-type=new]': 'new' + 'click [data-type = edit]': 'edit' + 'click [data-type = new]': 'new' constructor: -> super @@ -160,6 +160,7 @@ class App.ControllerGenericIndex extends App.Controller bindRow: events: 'click': @edit + container: @container }, @pageData.tableExtend ) @@ -177,6 +178,7 @@ class App.ControllerGenericIndex extends App.Controller id: item.id pageData: @pageData genericObject: @genericObject + container: @container ) new: (e) -> @@ -184,6 +186,7 @@ class App.ControllerGenericIndex extends App.Controller new App.ControllerGenericNew( pageData: @pageData genericObject: @genericObject + container: @container ) class App.ControllerGenericDestroyConfirm extends App.ControllerModal diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee index 5f7b632d9..a218b4a7c 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee @@ -235,13 +235,14 @@ class App.ControllerTable extends App.Controller # bind on delete dialog if data.model && destroy - table.delegate('[data-type="destroy"]', 'click', (e) -> + table.delegate('[data-type="destroy"]', 'click', (e) => e.stopPropagation() e.preventDefault() itemId = $(e.target).parents('tr').data('id') item = data.model.find(itemId) new App.ControllerGenericDestroyConfirm( - item: item + item: item + container: @container ) ) 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 387657240..4f88bc5f1 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee @@ -473,8 +473,8 @@ class Sidebar extends App.Controller ) new App.WidgetUser( - el: el - user_id: user.id + el: el + user_id: user.id ) editCustomer = (e, el) => @@ -483,9 +483,10 @@ class Sidebar extends App.Controller genericObject: 'User' screen: 'edit' pageData: - title: 'Users' - object: 'User' + title: 'Users' + object: 'User' objects: 'Users' + container: @el.closest('.content') ) items.push { head: 'Customer' @@ -493,9 +494,9 @@ class Sidebar extends App.Controller icon: 'person' actions: [ { - title: 'Edit Customer' - name: 'Edit Customer' - class: 'glyphicon glyphicon-edit' + title: 'Edit Customer' + name: 'Edit Customer' + class: 'glyphicon glyphicon-edit' callback: editCustomer }, ] @@ -508,14 +509,15 @@ class Sidebar extends App.Controller id: user.organization_id genericObject: 'Organization' pageData: - title: 'Organizations' - object: 'Organization' + title: 'Organizations' + object: 'Organization' objects: 'Organizations' + container: @el.closest('.content') ) showOrganization = (el) => new App.WidgetOrganization( - el: el - organization_id: user.organization_id + el: el + organization_id: user.organization_id ) items.push { head: 'Organization' @@ -523,6 +525,7 @@ class Sidebar extends App.Controller icon: 'group' actions: [ { + title: 'Edit Organization' name: 'Edit Organization' class: 'glyphicon glyphicon-edit' callback: editOrganization diff --git a/app/assets/javascripts/app/controllers/groups.js.coffee b/app/assets/javascripts/app/controllers/groups.js.coffee index 4bf2ad3e8..c3fd370ec 100644 --- a/app/assets/javascripts/app/controllers/groups.js.coffee +++ b/app/assets/javascripts/app/controllers/groups.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Group', - pageData: { - title: 'Groups', - home: 'groups', - object: 'Group', - objects: 'Groups', - navupdate: '#groups', - notes: [ + el: @el + id: @id + genericObject: 'Group' + pageData: + title: 'Groups' + home: 'groups' + object: 'Group' + objects: 'Groups' + navupdate: '#groups' + notes: [ 'Groups are ...' - ], + ] buttons: [ { name: 'New Group', 'data-type': 'new', class: 'btn--success' }, - ], - }, + ] + container: @el.closest('.content') ) App.Config.set( 'Group', { prio: 1500, name: 'Groups', parent: '#manage', target: '#manage/groups', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/object_manager.js.coffee b/app/assets/javascripts/app/controllers/object_manager.js.coffee index 496ab320c..6d97db5c0 100644 --- a/app/assets/javascripts/app/controllers/object_manager.js.coffee +++ b/app/assets/javascripts/app/controllers/object_manager.js.coffee @@ -7,10 +7,10 @@ class Index extends App.ControllerTabs # get data @ajax( - id: 'object_manager_attributes_list', - type: 'GET', - url: @apiPath + '/object_manager_attributes_list', - processData: true, + id: 'object_manager_attributes_list' + type: 'GET' + url: @apiPath + '/object_manager_attributes_list' + processData: true success: (data, status, xhr) => @build(data.objects) ) @@ -19,9 +19,9 @@ class Index extends App.ControllerTabs @tabs = [] for object in objects item = - name: object, - target: "c-#{object}", - controller: Items, + name: object + target: "c-#{object}" + controller: Items params: object: object @tabs.push item @@ -120,18 +120,19 @@ class Items extends App.ControllerContent objects: 'ObjectManagerAttributes' navupdate: '#object_manager' genericObject: 'ObjectManagerAttribute' + container: @el.closest('.content') ) edit: (e) => e.preventDefault() id = $( e.target ).closest('tr').data('id') new Edit( - pageData: { + pageData: object: 'ObjectManagerAttribute' - }, genericObject: 'ObjectManagerAttribute' - callback: @render + callback: @render id: id + container: @el.closest('.content') ) destroy: (e) -> @@ -158,7 +159,6 @@ class Edit extends App.ControllerModal items: [] ) ) - item = App.ObjectManagerAttribute.find(@id) options = @@ -249,7 +249,6 @@ class Edit extends App.ControllerModal @content.find('[name=data_type]').trigger('change') - configureAttributesBottom = [ { name: 'active', display: 'Active', tag: 'boolean', 'default': true, 'null': false }, ] @@ -263,8 +262,6 @@ class Edit extends App.ControllerModal #@content = controller.form - - #@show(content) @show() diff --git a/app/assets/javascripts/app/controllers/organization_history.js.coffee b/app/assets/javascripts/app/controllers/organization_history.js.coffee index a88953a15..96770b540 100644 --- a/app/assets/javascripts/app/controllers/organization_history.js.coffee +++ b/app/assets/javascripts/app/controllers/organization_history.js.coffee @@ -7,9 +7,9 @@ class App.OrganizationHistory extends App.GenericHistory # get data @ajax( - id: 'organization_history', - type: 'GET', - url: @apiPath + '/organizations/history/' + @organization_id, + id: 'organization_history' + type: 'GET' + url: @apiPath + '/organizations/history/' + @organization_id success: (data, status, xhr) => # load assets diff --git a/app/assets/javascripts/app/controllers/organizations.js.coffee b/app/assets/javascripts/app/controllers/organizations.js.coffee index 11648b712..81975f653 100644 --- a/app/assets/javascripts/app/controllers/organizations.js.coffee +++ b/app/assets/javascripts/app/controllers/organizations.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Organization', - pageData: { - title: 'Organizations', - home: 'organizations', - object: 'Organization', - objects: 'Organizations', - navupdate: '#organizations', + el: @el + id: @id + genericObject: 'Organization' + pageData: + title: 'Organizations' + home: 'organizations' + object: 'Organization' + objects: 'Organizations' + navupdate: '#organizations' notes: [ 'Organizations are for any person in the system. Agents (Owners, Resposbiles, ...) and Customers.' - ], + ] buttons: [ - { name: 'New Organization', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New Organization', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'Organization', { prio: 2000, name: 'Organizations', parent: '#manage', target: '#manage/organizations', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/overview.js.coffee b/app/assets/javascripts/app/controllers/overview.js.coffee index a4af2d849..f65589a26 100644 --- a/app/assets/javascripts/app/controllers/overview.js.coffee +++ b/app/assets/javascripts/app/controllers/overview.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Overview', - pageData: { - title: 'Overviews', - home: 'overviews', - object: 'Overview', - objects: 'Overviews', - navupdate: '#overviews', + el: @el + id: @id + genericObject: 'Overview' + pageData: + title: 'Overviews' + home: 'overviews' + object: 'Overview' + objects: 'Overviews' + navupdate: '#overviews' notes: [ 'Overview are ...' - ], + ] buttons: [ - { name: 'New Overview', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New Overview', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'Overview', { prio: 2300, name: 'Overviews', parent: '#manage', target: '#manage/overviews', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/scheduler.js.coffee b/app/assets/javascripts/app/controllers/scheduler.js.coffee index 4b378f314..8ec53f30d 100644 --- a/app/assets/javascripts/app/controllers/scheduler.js.coffee +++ b/app/assets/javascripts/app/controllers/scheduler.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Job', - pageData: { - title: 'Schedulers', - home: 'schedulers', - object: 'Scheduler', - objects: 'Schedulers', - navupdate: '#schedulers', + el: @el + id: @id + genericObject: 'Job' + pageData: + title: 'Schedulers' + home: 'schedulers' + object: 'Scheduler' + objects: 'Schedulers' + navupdate: '#schedulers' notes: [ 'Scheduler are ...' - ], + ] buttons: [ - { name: 'New Scheduler', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New Scheduler', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'Scheduler', { prio: 3000, name: 'Schedulers', parent: '#manage', target: '#manage/schedulers', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/sla.js.coffee b/app/assets/javascripts/app/controllers/sla.js.coffee index 8567b6e49..ca0ea6ba5 100644 --- a/app/assets/javascripts/app/controllers/sla.js.coffee +++ b/app/assets/javascripts/app/controllers/sla.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Sla', - pageData: { - title: 'SLA', - home: 'slas', - object: 'SLA', - objects: 'SLAs', - navupdate: '#slas', + 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: 'btn--success' }, - ], - }, + { name: 'New SLA', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'Sla', { prio: 2900, name: 'SLAs', parent: '#manage', target: '#manage/slas', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/text_module.js.coffee b/app/assets/javascripts/app/controllers/text_module.js.coffee index 687d8b4ac..22e37abb1 100644 --- a/app/assets/javascripts/app/controllers/text_module.js.coffee +++ b/app/assets/javascripts/app/controllers/text_module.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'TextModule', - pageData: { - title: 'TextModules', - home: 'text_modules', - object: 'TextModule', - objects: 'TextModules', - navupdate: '#text_modules', + el: @el + id: @id + genericObject: 'TextModule' + pageData: + title: 'TextModules' + home: 'text_modules' + object: 'TextModule' + objects: 'TextModules' + navupdate: '#text_modules' notes: [ 'TextModules are ...' - ], + ] buttons: [ - { name: 'New TextModule', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New TextModule', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'TextModule', { prio: 2300, name: 'TextModules', parent: '#manage', target: '#manage/text_modules', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index 0ec91a768..32c7a256d 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -482,7 +482,7 @@ class Table extends App.ControllerContent new App.OverviewSettings( overview_id: @overview.id view_mode: @view_mode - container: @el + container: @el.closest('.content') ) class App.OverviewSettings extends App.ControllerModal diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index d6ce60104..7e65572d6 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -329,21 +329,26 @@ class App.TicketZoom extends App.Controller ) showTicketHistory = => - new App.TicketHistory( ticket_id: @ticket.id ) + new App.TicketHistory( + ticket_id: @ticket.id + container: @el.closest('.content') + ) showTicketMerge = => - new App.TicketMerge - ticket: @ticket - task_key: @task_key - container: @el + new App.TicketMerge( + ticket: @ticket + task_key: @task_key + container: @el.closest('.content') + ) changeCustomer = (e, el) => new App.TicketCustomer( - ticket: @ticket + ticket: @ticket + container: @el.closest('.content') ) items = [ { - head: 'Ticket' - name: 'ticket' - icon: 'message' + head: 'Ticket' + name: 'ticket' + icon: 'message' callback: editTicket } ] @@ -375,6 +380,7 @@ class App.TicketZoom extends App.Controller title: 'Users' object: 'User' objects: 'Users' + container: @el.closest('.content') ) showCustomer = (el) => new App.WidgetUser( @@ -382,9 +388,9 @@ class App.TicketZoom extends App.Controller user_id: @ticket.customer_id ) items.push { - head: 'Customer' - name: 'customer' - icon: 'person' + head: 'Customer' + name: 'customer' + icon: 'person' actions: [ { title: 'Change Customer' @@ -408,6 +414,7 @@ class App.TicketZoom extends App.Controller title: 'Organizations' object: 'Organization' objects: 'Organizations' + container: @el.closest('.content') ) showOrganization = (el) => new App.WidgetOrganization( @@ -429,8 +436,8 @@ class App.TicketZoom extends App.Controller } new App.Sidebar( - el: @el.find('.tabsSidebar') - items: items + el: @el.find('.tabsSidebar') + items: items ) # show article diff --git a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee index a5c9a98b7..4c13dc901 100644 --- a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee @@ -276,7 +276,8 @@ class App.UserOrganizationAutocompletion extends App.Controller if e e.preventDefault() new UserNew( - parent: @ + parent: @ + container: @el.closest('.content') ) class UserNew extends App.ControllerModal