Moved to local modals.

This commit is contained in:
Martin Edenhofer 2015-02-06 23:11:51 +01:00
parent 76982a8976
commit 06f2e77992
14 changed files with 143 additions and 131 deletions

View file

@ -98,8 +98,8 @@ class App.ControllerGenericEdit extends App.ControllerModal
class App.ControllerGenericIndex extends App.Controller class App.ControllerGenericIndex extends App.Controller
events: events:
'click [data-type=edit]': 'edit' 'click [data-type = edit]': 'edit'
'click [data-type=new]': 'new' 'click [data-type = new]': 'new'
constructor: -> constructor: ->
super super
@ -160,6 +160,7 @@ class App.ControllerGenericIndex extends App.Controller
bindRow: bindRow:
events: events:
'click': @edit 'click': @edit
container: @container
}, },
@pageData.tableExtend @pageData.tableExtend
) )
@ -177,6 +178,7 @@ class App.ControllerGenericIndex extends App.Controller
id: item.id id: item.id
pageData: @pageData pageData: @pageData
genericObject: @genericObject genericObject: @genericObject
container: @container
) )
new: (e) -> new: (e) ->
@ -184,6 +186,7 @@ class App.ControllerGenericIndex extends App.Controller
new App.ControllerGenericNew( new App.ControllerGenericNew(
pageData: @pageData pageData: @pageData
genericObject: @genericObject genericObject: @genericObject
container: @container
) )
class App.ControllerGenericDestroyConfirm extends App.ControllerModal class App.ControllerGenericDestroyConfirm extends App.ControllerModal

View file

@ -235,13 +235,14 @@ class App.ControllerTable extends App.Controller
# bind on delete dialog # bind on delete dialog
if data.model && destroy if data.model && destroy
table.delegate('[data-type="destroy"]', 'click', (e) -> table.delegate('[data-type="destroy"]', 'click', (e) =>
e.stopPropagation() e.stopPropagation()
e.preventDefault() e.preventDefault()
itemId = $(e.target).parents('tr').data('id') itemId = $(e.target).parents('tr').data('id')
item = data.model.find(itemId) item = data.model.find(itemId)
new App.ControllerGenericDestroyConfirm( new App.ControllerGenericDestroyConfirm(
item: item item: item
container: @container
) )
) )

View file

@ -486,6 +486,7 @@ class Sidebar extends App.Controller
title: 'Users' title: 'Users'
object: 'User' object: 'User'
objects: 'Users' objects: 'Users'
container: @el.closest('.content')
) )
items.push { items.push {
head: 'Customer' head: 'Customer'
@ -511,6 +512,7 @@ class Sidebar extends App.Controller
title: 'Organizations' title: 'Organizations'
object: 'Organization' object: 'Organization'
objects: 'Organizations' objects: 'Organizations'
container: @el.closest('.content')
) )
showOrganization = (el) => showOrganization = (el) =>
new App.WidgetOrganization( new App.WidgetOrganization(
@ -523,6 +525,7 @@ class Sidebar extends App.Controller
icon: 'group' icon: 'group'
actions: [ actions: [
{ {
title: 'Edit Organization'
name: 'Edit Organization' name: 'Edit Organization'
class: 'glyphicon glyphicon-edit' class: 'glyphicon glyphicon-edit'
callback: editOrganization callback: editOrganization

View file

@ -6,22 +6,22 @@ class Index extends App.ControllerContent
return if !@authenticate() return if !@authenticate()
new App.ControllerGenericIndex( new App.ControllerGenericIndex(
el: @el, el: @el
id: @id, id: @id
genericObject: 'Group', genericObject: 'Group'
pageData: { pageData:
title: 'Groups', title: 'Groups'
home: 'groups', home: 'groups'
object: 'Group', object: 'Group'
objects: 'Groups', objects: 'Groups'
navupdate: '#groups', navupdate: '#groups'
notes: [ notes: [
'Groups are ...' 'Groups are ...'
], ]
buttons: [ buttons: [
{ name: 'New Group', 'data-type': 'new', class: 'btn--success' }, { 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' ) App.Config.set( 'Group', { prio: 1500, name: 'Groups', parent: '#manage', target: '#manage/groups', controller: Index, role: ['Admin'] }, 'NavBarAdmin' )

View file

@ -7,10 +7,10 @@ class Index extends App.ControllerTabs
# get data # get data
@ajax( @ajax(
id: 'object_manager_attributes_list', id: 'object_manager_attributes_list'
type: 'GET', type: 'GET'
url: @apiPath + '/object_manager_attributes_list', url: @apiPath + '/object_manager_attributes_list'
processData: true, processData: true
success: (data, status, xhr) => success: (data, status, xhr) =>
@build(data.objects) @build(data.objects)
) )
@ -19,9 +19,9 @@ class Index extends App.ControllerTabs
@tabs = [] @tabs = []
for object in objects for object in objects
item = item =
name: object, name: object
target: "c-#{object}", target: "c-#{object}"
controller: Items, controller: Items
params: params:
object: object object: object
@tabs.push item @tabs.push item
@ -120,18 +120,19 @@ class Items extends App.ControllerContent
objects: 'ObjectManagerAttributes' objects: 'ObjectManagerAttributes'
navupdate: '#object_manager' navupdate: '#object_manager'
genericObject: 'ObjectManagerAttribute' genericObject: 'ObjectManagerAttribute'
container: @el.closest('.content')
) )
edit: (e) => edit: (e) =>
e.preventDefault() e.preventDefault()
id = $( e.target ).closest('tr').data('id') id = $( e.target ).closest('tr').data('id')
new Edit( new Edit(
pageData: { pageData:
object: 'ObjectManagerAttribute' object: 'ObjectManagerAttribute'
},
genericObject: 'ObjectManagerAttribute' genericObject: 'ObjectManagerAttribute'
callback: @render callback: @render
id: id id: id
container: @el.closest('.content')
) )
destroy: (e) -> destroy: (e) ->
@ -158,7 +159,6 @@ class Edit extends App.ControllerModal
items: [] items: []
) ) ) )
item = App.ObjectManagerAttribute.find(@id) item = App.ObjectManagerAttribute.find(@id)
options = options =
@ -249,7 +249,6 @@ class Edit extends App.ControllerModal
@content.find('[name=data_type]').trigger('change') @content.find('[name=data_type]').trigger('change')
configureAttributesBottom = [ configureAttributesBottom = [
{ name: 'active', display: 'Active', tag: 'boolean', 'default': true, 'null': false }, { name: 'active', display: 'Active', tag: 'boolean', 'default': true, 'null': false },
] ]
@ -263,8 +262,6 @@ class Edit extends App.ControllerModal
#@content = controller.form #@content = controller.form
#@show(content) #@show(content)
@show() @show()

View file

@ -7,9 +7,9 @@ class App.OrganizationHistory extends App.GenericHistory
# get data # get data
@ajax( @ajax(
id: 'organization_history', id: 'organization_history'
type: 'GET', type: 'GET'
url: @apiPath + '/organizations/history/' + @organization_id, url: @apiPath + '/organizations/history/' + @organization_id
success: (data, status, xhr) => success: (data, status, xhr) =>
# load assets # load assets

View file

@ -6,22 +6,22 @@ class Index extends App.ControllerContent
return if !@authenticate() return if !@authenticate()
new App.ControllerGenericIndex( new App.ControllerGenericIndex(
el: @el, el: @el
id: @id, id: @id
genericObject: 'Organization', genericObject: 'Organization'
pageData: { pageData:
title: 'Organizations', title: 'Organizations'
home: 'organizations', home: 'organizations'
object: 'Organization', object: 'Organization'
objects: 'Organizations', objects: 'Organizations'
navupdate: '#organizations', navupdate: '#organizations'
notes: [ notes: [
'Organizations are for any person in the system. Agents (Owners, Resposbiles, ...) and Customers.' 'Organizations are for any person in the system. Agents (Owners, Resposbiles, ...) and Customers.'
], ]
buttons: [ 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' ) App.Config.set( 'Organization', { prio: 2000, name: 'Organizations', parent: '#manage', target: '#manage/organizations', controller: Index, role: ['Admin'] }, 'NavBarAdmin' )

View file

@ -6,22 +6,22 @@ class Index extends App.ControllerContent
return if !@authenticate() return if !@authenticate()
new App.ControllerGenericIndex( new App.ControllerGenericIndex(
el: @el, el: @el
id: @id, id: @id
genericObject: 'Overview', genericObject: 'Overview'
pageData: { pageData:
title: 'Overviews', title: 'Overviews'
home: 'overviews', home: 'overviews'
object: 'Overview', object: 'Overview'
objects: 'Overviews', objects: 'Overviews'
navupdate: '#overviews', navupdate: '#overviews'
notes: [ notes: [
'Overview are ...' 'Overview are ...'
], ]
buttons: [ 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' ) App.Config.set( 'Overview', { prio: 2300, name: 'Overviews', parent: '#manage', target: '#manage/overviews', controller: Index, role: ['Admin'] }, 'NavBarAdmin' )

View file

@ -6,22 +6,22 @@ class Index extends App.ControllerContent
return if !@authenticate() return if !@authenticate()
new App.ControllerGenericIndex( new App.ControllerGenericIndex(
el: @el, el: @el
id: @id, id: @id
genericObject: 'Job', genericObject: 'Job'
pageData: { pageData:
title: 'Schedulers', title: 'Schedulers'
home: 'schedulers', home: 'schedulers'
object: 'Scheduler', object: 'Scheduler'
objects: 'Schedulers', objects: 'Schedulers'
navupdate: '#schedulers', navupdate: '#schedulers'
notes: [ notes: [
'Scheduler are ...' 'Scheduler are ...'
], ]
buttons: [ 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' ) App.Config.set( 'Scheduler', { prio: 3000, name: 'Schedulers', parent: '#manage', target: '#manage/schedulers', controller: Index, role: ['Admin'] }, 'NavBarAdmin' )

View file

@ -6,22 +6,22 @@ class Index extends App.ControllerContent
return if !@authenticate() return if !@authenticate()
new App.ControllerGenericIndex( new App.ControllerGenericIndex(
el: @el, el: @el
id: @id, id: @id
genericObject: 'Sla', genericObject: 'Sla'
pageData: { pageData:
title: 'SLA', title: 'SLA'
home: 'slas', home: 'slas'
object: 'SLA', object: 'SLA'
objects: 'SLAs', objects: 'SLAs'
navupdate: '#slas', navupdate: '#slas'
notes: [ notes: [
# 'SLA are ...' # 'SLA are ...'
], ]
buttons: [ 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' ) App.Config.set( 'Sla', { prio: 2900, name: 'SLAs', parent: '#manage', target: '#manage/slas', controller: Index, role: ['Admin'] }, 'NavBarAdmin' )

View file

@ -6,22 +6,22 @@ class Index extends App.ControllerContent
return if !@authenticate() return if !@authenticate()
new App.ControllerGenericIndex( new App.ControllerGenericIndex(
el: @el, el: @el
id: @id, id: @id
genericObject: 'TextModule', genericObject: 'TextModule'
pageData: { pageData:
title: 'TextModules', title: 'TextModules'
home: 'text_modules', home: 'text_modules'
object: 'TextModule', object: 'TextModule'
objects: 'TextModules', objects: 'TextModules'
navupdate: '#text_modules', navupdate: '#text_modules'
notes: [ notes: [
'TextModules are ...' 'TextModules are ...'
], ]
buttons: [ 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' ) App.Config.set( 'TextModule', { prio: 2300, name: 'TextModules', parent: '#manage', target: '#manage/text_modules', controller: Index, role: ['Admin'] }, 'NavBarAdmin' )

View file

@ -482,7 +482,7 @@ class Table extends App.ControllerContent
new App.OverviewSettings( new App.OverviewSettings(
overview_id: @overview.id overview_id: @overview.id
view_mode: @view_mode view_mode: @view_mode
container: @el container: @el.closest('.content')
) )
class App.OverviewSettings extends App.ControllerModal class App.OverviewSettings extends App.ControllerModal

View file

@ -329,15 +329,20 @@ class App.TicketZoom extends App.Controller
) )
showTicketHistory = => showTicketHistory = =>
new App.TicketHistory( ticket_id: @ticket.id ) new App.TicketHistory(
ticket_id: @ticket.id
container: @el.closest('.content')
)
showTicketMerge = => showTicketMerge = =>
new App.TicketMerge new App.TicketMerge(
ticket: @ticket ticket: @ticket
task_key: @task_key task_key: @task_key
container: @el container: @el.closest('.content')
)
changeCustomer = (e, el) => changeCustomer = (e, el) =>
new App.TicketCustomer( new App.TicketCustomer(
ticket: @ticket ticket: @ticket
container: @el.closest('.content')
) )
items = [ items = [
{ {
@ -375,6 +380,7 @@ class App.TicketZoom extends App.Controller
title: 'Users' title: 'Users'
object: 'User' object: 'User'
objects: 'Users' objects: 'Users'
container: @el.closest('.content')
) )
showCustomer = (el) => showCustomer = (el) =>
new App.WidgetUser( new App.WidgetUser(
@ -408,6 +414,7 @@ class App.TicketZoom extends App.Controller
title: 'Organizations' title: 'Organizations'
object: 'Organization' object: 'Organization'
objects: 'Organizations' objects: 'Organizations'
container: @el.closest('.content')
) )
showOrganization = (el) => showOrganization = (el) =>
new App.WidgetOrganization( new App.WidgetOrganization(

View file

@ -277,6 +277,7 @@ class App.UserOrganizationAutocompletion extends App.Controller
e.preventDefault() e.preventDefault()
new UserNew( new UserNew(
parent: @ parent: @
container: @el.closest('.content')
) )
class UserNew extends App.ControllerModal class UserNew extends App.ControllerModal