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
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

View file

@ -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
container: @container
)
)

View file

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

View file

@ -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',
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' )

View file

@ -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
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()

View file

@ -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

View file

@ -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' )

View file

@ -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' )

View file

@ -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' )

View file

@ -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' )

View file

@ -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' )

View file

@ -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

View file

@ -329,15 +329,20 @@ 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
new App.TicketMerge(
ticket: @ticket
task_key: @task_key
container: @el
container: @el.closest('.content')
)
changeCustomer = (e, el) =>
new App.TicketCustomer(
ticket: @ticket
container: @el.closest('.content')
)
items = [
{
@ -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(
@ -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(

View file

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