Added new sidebars.

This commit is contained in:
Martin Edenhofer 2014-09-20 20:30:47 +02:00
parent 6f37a85f8b
commit 3131f945c4
4 changed files with 136 additions and 35 deletions

View file

@ -1,4 +1,7 @@
class App.OrganizationZoom extends App.Controller
elements:
'.tabsSidebar' : 'sidebar'
constructor: (params) ->
super
@ -67,10 +70,9 @@ class App.OrganizationZoom extends App.Controller
ui: @
)
new Widgets(
el: @el.find('.widgets')
new Sidebar(
el: @sidebar
organization: organization
ui: @
)
class Overviews extends App.Controller
@ -122,17 +124,49 @@ class Overviews extends App.Controller
@el.find( '#sortable-sidebar' ).sortable( dndOptions )
class Widgets extends App.Controller
class Sidebar extends App.Controller
constructor: ->
super
# render ui
@render()
render: ->
items = []
editOrganization = (e, el) =>
new App.ControllerGenericEdit(
id: @organization.id
genericObject: 'Organization'
pageData:
title: 'Organizations'
object: 'Organization'
objects: 'Organizations'
)
showOrganization = (el) =>
new App.WidgetOrganization(
el: @el
el: el
organization_id: @organization.id
)
items.push {
head: 'Organization'
name: 'organization'
icon: 'group'
actions: [
{
name: 'Edit Organization'
class: 'glyphicon glyphicon-edit'
callback: editOrganization
},
]
callback: showOrganization
}
new App.Sidebar(
el: @el
items: items
)
class ActionRow extends App.Controller
events:

View file

@ -1,11 +1,13 @@
class App.UserZoom extends App.Controller
elements:
'.tabsSidebar' : 'sidebar'
constructor: (params) ->
super
# check authentication
return if !@authenticate()
@navupdate '#'
App.User.full( @user_id, @render )
@ -67,10 +69,10 @@ class App.UserZoom extends App.Controller
ui: @
)
new Widgets(
el: @el.find('.widgets')
new Sidebar(
el: @sidebar
user: user
ui: @
textModule: @textModule
)
class Overviews extends App.Controller
@ -141,18 +143,81 @@ class Overviews extends App.Controller
@el.find( '#sortable' ).sortable( dndOptions )
@el.find( '#sortable-sidebar' ).sortable( dndOptions )
class Widgets extends App.Controller
class Sidebar extends App.Controller
constructor: ->
super
# render ui
@render()
render: ->
items = []
showCustomer = (el) =>
new App.WidgetUser(
el: @el
el: el
user_id: @user.id
)
editCustomer = (e, el) =>
new App.ControllerGenericEdit(
id: @user.id
genericObject: 'User'
screen: 'edit'
pageData:
title: 'Users'
object: 'User'
objects: 'Users'
)
items.push {
head: 'Customer'
name: 'customer'
icon: 'person'
actions: [
{
name: 'Edit Customer'
class: 'glyphicon glyphicon-edit'
callback: editCustomer
},
]
callback: showCustomer
}
if @user.organization_id
editOrganization = (e, el) =>
new App.ControllerGenericEdit(
id: @user.organization_id
genericObject: 'Organization'
pageData:
title: 'Organizations'
object: 'Organization'
objects: 'Organizations'
)
showOrganization = (el) =>
new App.WidgetOrganization(
el: el
organization_id: @user.organization_id
)
items.push {
head: 'Organization'
name: 'organization'
icon: 'group'
actions: [
{
name: 'Edit Organization'
class: 'glyphicon glyphicon-edit'
callback: editOrganization
},
]
callback: showOrganization
}
new App.Sidebar(
el: @el
items: items
)
class ActionRow extends App.Controller
events:
'click [data-type=history]': 'history_dialog'

View file

@ -1,13 +1,12 @@
<div class="sidebar">
<div class="widgets"></div>
<div class="action"></div>
</div>
<div class="main flex">
<div class="main flex tabsSidebarSpace">
<div class="organizationZoom">
<div class="page-header">
<h1></h1>
<h1><%- @T( @head ) %></h1>
</div>
<div class="main-overviews" id="sortable"></div>
</div>
</div>
<div class="tabsSidebar vertical"></div>

View file

@ -1,13 +1,16 @@
<div class="sidebar">
<div class="widgets"></div>
<div class="action"></div>
</div>
<div class="main flex">
<div class="main flex tabsSidebarSpace">
<div class="userZoom">
<div class="page-header">
<h1></h1>
<h1><%- @T( @head ) %></h1>
</div>
<div class="main-overviews" id="sortable"></div>
</div>
</div>
<div class="tabsSidebar vertical"></div>
<!--
<div class="action"></div>
-->