Reduced dom operations at loading time.
This commit is contained in:
parent
1439588581
commit
b102e75aaa
3 changed files with 44 additions and 39 deletions
|
@ -4,24 +4,24 @@ class App.OrganizationProfile extends App.Controller
|
||||||
|
|
||||||
# check authentication
|
# check authentication
|
||||||
if !@authenticate()
|
if !@authenticate()
|
||||||
App.TaskManager.remove( @task_key )
|
App.TaskManager.remove(@task_key)
|
||||||
return
|
return
|
||||||
|
|
||||||
# fetch new data if needed
|
# fetch new data if needed
|
||||||
App.Organization.full( @organization_id, @render )
|
App.Organization.full(@organization_id, @render)
|
||||||
|
|
||||||
# rerender view, e. g. on langauge change
|
# rerender view, e. g. on langauge change
|
||||||
@bind 'ui:rerender', =>
|
@bind 'ui:rerender', =>
|
||||||
return if !@authenticate(true)
|
return if !@authenticate(true)
|
||||||
@render( App.Organization.fullLocal( @organization_id ) )
|
@render(App.Organization.fullLocal(@organization_id))
|
||||||
|
|
||||||
meta: =>
|
meta: =>
|
||||||
meta =
|
meta =
|
||||||
url: @url()
|
url: @url()
|
||||||
id: @organization_id
|
id: @organization_id
|
||||||
|
|
||||||
if App.Organization.exists( @organization_id )
|
if App.Organization.exists(@organization_id)
|
||||||
organization = App.Organization.find( @organization_id )
|
organization = App.Organization.find(@organization_id)
|
||||||
|
|
||||||
meta.head = organization.displayName()
|
meta.head = organization.displayName()
|
||||||
meta.title = organization.displayName()
|
meta.title = organization.displayName()
|
||||||
|
@ -33,7 +33,7 @@ class App.OrganizationProfile extends App.Controller
|
||||||
'#organization/profile/' + @organization_id
|
'#organization/profile/' + @organization_id
|
||||||
|
|
||||||
show: =>
|
show: =>
|
||||||
App.OnlineNotification.seen( 'Organization', @organization_id )
|
App.OnlineNotification.seen('Organization', @organization_id)
|
||||||
@navupdate '#'
|
@navupdate '#'
|
||||||
|
|
||||||
changed: ->
|
changed: ->
|
||||||
|
@ -43,22 +43,24 @@ class App.OrganizationProfile extends App.Controller
|
||||||
|
|
||||||
if !@doNotLog
|
if !@doNotLog
|
||||||
@doNotLog = 1
|
@doNotLog = 1
|
||||||
@recentView( 'Organization', @organization_id )
|
@recentView('Organization', @organization_id)
|
||||||
|
|
||||||
@html App.view('organization_profile/index')(
|
elLocal = $(App.view('organization_profile/index')(
|
||||||
organization: organization
|
organization: organization
|
||||||
)
|
))
|
||||||
|
|
||||||
new Object(
|
new Object(
|
||||||
el: @$('.js-object-container')
|
el: elLocal.find('.js-object-container')
|
||||||
organization: organization
|
organization: organization
|
||||||
)
|
)
|
||||||
|
|
||||||
new App.TicketStats(
|
new App.TicketStats(
|
||||||
el: @$('.js-ticket-stats')
|
el: elLocal.find('.js-ticket-stats')
|
||||||
organization: organization
|
organization: organization
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@html elLocal
|
||||||
|
|
||||||
new App.UpdateTastbar(
|
new App.UpdateTastbar(
|
||||||
genericObject: organization
|
genericObject: organization
|
||||||
)
|
)
|
||||||
|
@ -71,7 +73,7 @@ class Object extends App.Controller
|
||||||
super
|
super
|
||||||
|
|
||||||
# subscribe and reload data / fetch new data if triggered
|
# subscribe and reload data / fetch new data if triggered
|
||||||
@subscribeId = App.Organization.full( @organization.id, @render, false, true )
|
@subscribeId = App.Organization.full(@organization.id, @render, false, true)
|
||||||
|
|
||||||
release: =>
|
release: =>
|
||||||
App.Organization.unsubscribe(@subscribeId)
|
App.Organization.unsubscribe(@subscribeId)
|
||||||
|
@ -87,12 +89,12 @@ class Object extends App.Controller
|
||||||
|
|
||||||
# check if value for _id exists
|
# check if value for _id exists
|
||||||
name = attributeName
|
name = attributeName
|
||||||
nameNew = name.substr( 0, name.length - 3 )
|
nameNew = name.substr(0, name.length - 3)
|
||||||
if nameNew of organization
|
if nameNew of organization
|
||||||
name = nameNew
|
name = nameNew
|
||||||
|
|
||||||
# add to show if value exists
|
# add to show if value exists
|
||||||
if ( organization[name] || attributeConfig.tag is 'richtext' ) && attributeConfig.shown
|
if (organization[name] || attributeConfig.tag is 'richtext') && attributeConfig.shown
|
||||||
|
|
||||||
# do not show firstname and lastname / already show via diplayName()
|
# do not show firstname and lastname / already show via diplayName()
|
||||||
if name isnt 'name'
|
if name isnt 'name'
|
||||||
|
@ -148,11 +150,11 @@ class Object extends App.Controller
|
||||||
update: (e) =>
|
update: (e) =>
|
||||||
name = $(e.target).attr('data-name')
|
name = $(e.target).attr('data-name')
|
||||||
value = $(e.target).html()
|
value = $(e.target).html()
|
||||||
org = App.Organization.find( @organization.id )
|
org = App.Organization.find(@organization.id)
|
||||||
if org[name] isnt value
|
if org[name] isnt value
|
||||||
data = {}
|
data = {}
|
||||||
data[name] = value
|
data[name] = value
|
||||||
org.updateAttributes( data )
|
org.updateAttributes(data)
|
||||||
@log 'notice', 'update', name, value, org
|
@log 'notice', 'update', name, value, org
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,4 +173,4 @@ class Router extends App.ControllerPermanent
|
||||||
show: true
|
show: true
|
||||||
)
|
)
|
||||||
|
|
||||||
App.Config.set( 'organization/profile/:organization_id', Router, 'Routes' )
|
App.Config.set('organization/profile/:organization_id', Router, 'Routes')
|
||||||
|
|
|
@ -6,21 +6,23 @@ class App.TicketOverview extends App.Controller
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
@html App.view('ticket_overview')()
|
elLocal = $(App.view('ticket_overview')())
|
||||||
|
|
||||||
@navBarControllerVertical = new Navbar
|
@navBarControllerVertical = new Navbar
|
||||||
el: @$('.overview-header')
|
el: elLocal.find('.overview-header')
|
||||||
view: @view
|
view: @view
|
||||||
vertical: true
|
vertical: true
|
||||||
|
|
||||||
@navBarController = new Navbar
|
@navBarController = new Navbar
|
||||||
el: @$('.sidebar')
|
el: elLocal.first()
|
||||||
view: @view
|
view: @view
|
||||||
|
|
||||||
@contentController = new Table
|
@contentController = new Table
|
||||||
el: @$('.overview-table')
|
el: elLocal.find('.overview-table')
|
||||||
view: @view
|
view: @view
|
||||||
|
|
||||||
|
@html elLocal
|
||||||
|
|
||||||
active: (state) =>
|
active: (state) =>
|
||||||
@activeState = state
|
@activeState = state
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,16 @@ class App.UserProfile extends App.Controller
|
||||||
|
|
||||||
# check authentication
|
# check authentication
|
||||||
if !@authenticate()
|
if !@authenticate()
|
||||||
App.TaskManager.remove( @task_key )
|
App.TaskManager.remove(@task_key)
|
||||||
return
|
return
|
||||||
|
|
||||||
# fetch new data if needed
|
# fetch new data if needed
|
||||||
@subscribeId = App.User.full( @user_id, @render )
|
@subscribeId = App.User.full(@user_id, @render)
|
||||||
|
|
||||||
# rerender view, e. g. on langauge change
|
# rerender view, e. g. on langauge change
|
||||||
@bind 'ui:rerender', =>
|
@bind 'ui:rerender', =>
|
||||||
return if !@authenticate(true)
|
return if !@authenticate(true)
|
||||||
@render( App.User.fullLocal( @user_id ) )
|
@render(App.User.fullLocal(@user_id))
|
||||||
|
|
||||||
release: =>
|
release: =>
|
||||||
App.User.unsubscribe(@subscribeId)
|
App.User.unsubscribe(@subscribeId)
|
||||||
|
@ -23,8 +23,8 @@ class App.UserProfile extends App.Controller
|
||||||
url: @url()
|
url: @url()
|
||||||
id: @user_id
|
id: @user_id
|
||||||
|
|
||||||
if App.User.exists( @user_id )
|
if App.User.exists(@user_id)
|
||||||
user = App.User.find( @user_id )
|
user = App.User.find(@user_id)
|
||||||
|
|
||||||
meta.head = user.displayName()
|
meta.head = user.displayName()
|
||||||
meta.title = user.displayName()
|
meta.title = user.displayName()
|
||||||
|
@ -35,7 +35,7 @@ class App.UserProfile extends App.Controller
|
||||||
'#user/profile/' + @user_id
|
'#user/profile/' + @user_id
|
||||||
|
|
||||||
show: =>
|
show: =>
|
||||||
App.OnlineNotification.seen( 'User', @user_id )
|
App.OnlineNotification.seen('User', @user_id)
|
||||||
@navupdate '#'
|
@navupdate '#'
|
||||||
|
|
||||||
changed: ->
|
changed: ->
|
||||||
|
@ -45,22 +45,24 @@ class App.UserProfile extends App.Controller
|
||||||
|
|
||||||
if !@doNotLog
|
if !@doNotLog
|
||||||
@doNotLog = 1
|
@doNotLog = 1
|
||||||
@recentView( 'User', @user_id )
|
@recentView('User', @user_id)
|
||||||
|
|
||||||
@html App.view('user_profile/index')(
|
elLocal = $(App.view('user_profile/index')(
|
||||||
user: user
|
user: user
|
||||||
)
|
))
|
||||||
|
|
||||||
new Object(
|
new Object(
|
||||||
el: @$('.js-object-container')
|
el: elLocal.find('.js-object-container')
|
||||||
user: user
|
user: user
|
||||||
)
|
)
|
||||||
|
|
||||||
new App.TicketStats(
|
new App.TicketStats(
|
||||||
el: @$('.js-ticket-stats')
|
el: elLocal.find('.js-ticket-stats')
|
||||||
user: user
|
user: user
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@html elLocal
|
||||||
|
|
||||||
new App.UpdateTastbar(
|
new App.UpdateTastbar(
|
||||||
genericObject: user
|
genericObject: user
|
||||||
)
|
)
|
||||||
|
@ -74,7 +76,7 @@ class Object extends App.Controller
|
||||||
super
|
super
|
||||||
|
|
||||||
# subscribe and reload data / fetch new data if triggered
|
# subscribe and reload data / fetch new data if triggered
|
||||||
@subscribeId = App.User.full( @user.id, @render, false, true )
|
@subscribeId = App.User.full(@user.id, @render, false, true)
|
||||||
|
|
||||||
release: =>
|
release: =>
|
||||||
App.User.unsubscribe(@subscribeId)
|
App.User.unsubscribe(@subscribeId)
|
||||||
|
@ -90,12 +92,12 @@ class Object extends App.Controller
|
||||||
|
|
||||||
# check if value for _id exists
|
# check if value for _id exists
|
||||||
name = attributeName
|
name = attributeName
|
||||||
nameNew = name.substr( 0, name.length - 3 )
|
nameNew = name.substr(0, name.length - 3)
|
||||||
if nameNew of user
|
if nameNew of user
|
||||||
name = nameNew
|
name = nameNew
|
||||||
|
|
||||||
# add to show if value exists
|
# add to show if value exists
|
||||||
if ( user[name] || attributeConfig.tag is 'richtext' ) && attributeConfig.shown
|
if (user[name] || attributeConfig.tag is 'richtext') && attributeConfig.shown
|
||||||
|
|
||||||
# do not show firstname and lastname / already show via diplayName()
|
# do not show firstname and lastname / already show via diplayName()
|
||||||
if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization'
|
if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization'
|
||||||
|
@ -152,11 +154,11 @@ class Object extends App.Controller
|
||||||
update: (e) =>
|
update: (e) =>
|
||||||
name = $(e.target).attr('data-name')
|
name = $(e.target).attr('data-name')
|
||||||
value = $(e.target).html()
|
value = $(e.target).html()
|
||||||
user = App.User.find( @user.id )
|
user = App.User.find(@user.id)
|
||||||
if user[name] isnt value
|
if user[name] isnt value
|
||||||
data = {}
|
data = {}
|
||||||
data[name] = value
|
data[name] = value
|
||||||
user.updateAttributes( data )
|
user.updateAttributes(data)
|
||||||
@log 'notice', 'update', name, value, user
|
@log 'notice', 'update', name, value, user
|
||||||
|
|
||||||
class Router extends App.ControllerPermanent
|
class Router extends App.ControllerPermanent
|
||||||
|
@ -174,5 +176,4 @@ class Router extends App.ControllerPermanent
|
||||||
show: true
|
show: true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
App.Config.set('user/profile/:user_id', Router, 'Routes')
|
||||||
App.Config.set( 'user/profile/:user_id', Router, 'Routes' )
|
|
||||||
|
|
Loading…
Reference in a new issue