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 class App.OrganizationZoom extends App.Controller
elements:
'.tabsSidebar' : 'sidebar'
constructor: (params) -> constructor: (params) ->
super super
@ -67,10 +70,9 @@ class App.OrganizationZoom extends App.Controller
ui: @ ui: @
) )
new Widgets( new Sidebar(
el: @el.find('.widgets') el: @sidebar
organization: organization organization: organization
ui: @
) )
class Overviews extends App.Controller class Overviews extends App.Controller
@ -122,17 +124,49 @@ class Overviews extends App.Controller
@el.find( '#sortable-sidebar' ).sortable( dndOptions ) @el.find( '#sortable-sidebar' ).sortable( dndOptions )
class Widgets extends App.Controller class Sidebar extends App.Controller
constructor: -> constructor: ->
super super
# render ui
@render() @render()
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( new App.WidgetOrganization(
el: @el el: el
organization_id: @organization.id 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 class ActionRow extends App.Controller
events: events:

View file

@ -1,11 +1,13 @@
class App.UserZoom extends App.Controller class App.UserZoom extends App.Controller
elements:
'.tabsSidebar' : 'sidebar'
constructor: (params) -> constructor: (params) ->
super super
# check authentication # check authentication
return if !@authenticate() return if !@authenticate()
@navupdate '#' @navupdate '#'
App.User.full( @user_id, @render ) App.User.full( @user_id, @render )
@ -67,10 +69,10 @@ class App.UserZoom extends App.Controller
ui: @ ui: @
) )
new Widgets( new Sidebar(
el: @el.find('.widgets') el: @sidebar
user: user user: user
ui: @ textModule: @textModule
) )
class Overviews extends App.Controller class Overviews extends App.Controller
@ -141,18 +143,81 @@ class Overviews extends App.Controller
@el.find( '#sortable' ).sortable( dndOptions ) @el.find( '#sortable' ).sortable( dndOptions )
@el.find( '#sortable-sidebar' ).sortable( dndOptions ) @el.find( '#sortable-sidebar' ).sortable( dndOptions )
class Widgets extends App.Controller class Sidebar extends App.Controller
constructor: -> constructor: ->
super super
# render ui
@render() @render()
render: -> render: ->
items = []
showCustomer = (el) =>
new App.WidgetUser( new App.WidgetUser(
el: @el el: el
user_id: @user.id 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 class ActionRow extends App.Controller
events: events:
'click [data-type=history]': 'history_dialog' 'click [data-type=history]': 'history_dialog'

View file

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

View file

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