diff --git a/app/assets/javascripts/app/controllers/organization_history.js.coffee b/app/assets/javascripts/app/controllers/organization_history.js.coffee new file mode 100644 index 000000000..0504a0718 --- /dev/null +++ b/app/assets/javascripts/app/controllers/organization_history.js.coffee @@ -0,0 +1,20 @@ +class App.OrganizationHistory extends App.GenericHistory + constructor: -> + super + @fetch() + + fetch: -> + + # get data + @ajax( + id: 'organization_history', + type: 'GET', + url: @apiPath + '/organizations/history/' + @organization_id, + success: (data, status, xhr) => + + # load assets + App.Collection.loadAssets( data.assets ) + + # render page + @render(data.history) + ) diff --git a/app/assets/javascripts/app/controllers/organization_zoom.js.coffee b/app/assets/javascripts/app/controllers/organization_zoom.js.coffee new file mode 100644 index 000000000..6674e9f13 --- /dev/null +++ b/app/assets/javascripts/app/controllers/organization_zoom.js.coffee @@ -0,0 +1,100 @@ +class App.OrganizationZoom extends App.Controller + constructor: (params) -> + super + + # check authentication + return if !@authenticate() + + @navupdate '#' + + start = (organization) => + @organization = organization + @render() + + App.Organization.retrieve( @organization_id, start, true ) + + meta: => + meta = + url: @url() + id: @organization_id + + if @organization + meta.head = @organization.displayName() + meta.title = @organization.displayName() + meta.iconClass = @organization.icon() + meta + + url: => + '#organization/zoom/' + @organization_id + + activate: => + @navupdate '#' + + changed: => + formCurrent = @formParam( @el.find('.ticket-update') ) + diff = difference( @formDefault, formCurrent ) + return false if !diff || _.isEmpty( diff ) + return true + + release: => + # nothing + + render: => + # update taskbar with new meta data + App.Event.trigger 'task:render' + + @html App.view('organization_zoom')( + organization: @organization + ) + + # start action controller + new ActionRow( + el: @el.find('.action') + organization: @organization + ui: @ + ) + + new Widgets( + el: @el.find('.widgets') + organization: @organization + ui: @ + ) + +class Widgets extends App.Controller + constructor: -> + super + @render() + + render: -> + + new App.WidgetOrganization( + el: @el + organization_id: @organization.id + ) + +class ActionRow extends App.Controller + events: + 'click [data-type=history]': 'history_dialog' + + constructor: -> + super + @render() + + render: -> + @html App.view('user_zoom/actions')() + + history_dialog: (e) -> + e.preventDefault() + new App.OrganizationHistory( organization_id: @organization.id ) + +class Router extends App.ControllerPermanent + constructor: (params) -> + super + + # cleanup params + clean_params = + organization_id: params.organization_id + + App.TaskManager.add( 'Organization-' + @organization_id, 'OrganizationZoom', clean_params ) + +App.Config.set( 'organization/zoom/:organization_id', Router, 'Routes' ) diff --git a/app/assets/javascripts/app/controllers/user_zoom.js.coffee b/app/assets/javascripts/app/controllers/user_zoom.js.coffee index bc5a5befa..839d0807d 100644 --- a/app/assets/javascripts/app/controllers/user_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/user_zoom.js.coffee @@ -15,13 +15,11 @@ class App.UserZoom extends App.Controller meta = url: @url() id: @user_id - class: "" - iconClass: @user.icon() - if @user - meta.head = @user.displayName() - meta.title = @user.displayName() + meta.head = @user.displayName() + meta.title = @user.displayName() + meta.iconClass = @user.icon() meta url: => @@ -68,10 +66,8 @@ class Widgets extends App.Controller render: -> - @html App.view('user_zoom/widgets')() - new App.WidgetUser( - el: @el.find('.user_info') + el: @el user_id: @user.id ) diff --git a/app/assets/javascripts/app/models/organization.js.coffee b/app/assets/javascripts/app/models/organization.js.coffee index d4ba0b0af..dd72581d1 100644 --- a/app/assets/javascripts/app/models/organization.js.coffee +++ b/app/assets/javascripts/app/models/organization.js.coffee @@ -17,6 +17,9 @@ class App.Organization extends App.Model uiUrl: -> '#organization/zoom/' + @id + icon: (user) -> + "organisation icon" + @_fillUp: (data) -> # addd users of organization diff --git a/app/assets/javascripts/app/views/organization_zoom.jst.eco b/app/assets/javascripts/app/views/organization_zoom.jst.eco new file mode 100644 index 000000000..3bca91fd7 --- /dev/null +++ b/app/assets/javascripts/app/views/organization_zoom.jst.eco @@ -0,0 +1,11 @@ +
+