Merge branch 'develop' into interface

Conflicts:
	app/assets/javascripts/app/views/user_zoom.jst.eco
This commit is contained in:
Martin Edenhofer 2014-07-24 16:33:33 +02:00
commit 123f6c4323
10 changed files with 167 additions and 22 deletions

View file

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

View file

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

View file

@ -15,13 +15,11 @@ class App.UserZoom extends App.Controller
meta = meta =
url: @url() url: @url()
id: @user_id id: @user_id
class: ""
iconClass: @user.icon()
if @user if @user
meta.head = @user.displayName() meta.head = @user.displayName()
meta.title = @user.displayName() meta.title = @user.displayName()
meta.iconClass = @user.icon()
meta meta
url: => url: =>
@ -68,10 +66,8 @@ class Widgets extends App.Controller
render: -> render: ->
@html App.view('user_zoom/widgets')()
new App.WidgetUser( new App.WidgetUser(
el: @el.find('.user_info') el: @el
user_id: @user.id user_id: @user.id
) )

View file

@ -17,6 +17,9 @@ class App.Organization extends App.Model
uiUrl: -> uiUrl: ->
'#organization/zoom/' + @id '#organization/zoom/' + @id
icon: (user) ->
"organisation icon"
@_fillUp: (data) -> @_fillUp: (data) ->
# addd users of organization # addd users of organization

View file

@ -0,0 +1,11 @@
<div class="sidebar">
<div class="widgets"></div>
<div class="action"></div>
</div>
<div class="main flex">
<div class="page-header">
<h1><%= @organization.displayName() %></h1>
</div>
</div>

View file

@ -4,15 +4,8 @@
</div> </div>
<div class="main flex"> <div class="main flex">
<div class="page-header user-zoom"> <div class="page-header">
<div class="page-header-title"> <h1><%= @user.displayName() %></h1>
<div class="ticket-title"></div>
</div>
</div>
<div class="ticket-answer">
<div class="article-view"></div>
<div class="edit"></div>
</div> </div>
</div> </div>

View file

@ -168,4 +168,24 @@ Test:
return if deny_if_not_role('Agent') return if deny_if_not_role('Agent')
model_destory_render(Organization, params) model_destory_render(Organization, params)
end end
# GET /api/v1/organizations/history/1
def history
# permissin check
if !is_role('Admin') && !is_role('Agent')
response_access_deny
return
end
# get organization data
organization = Organization.find( params[:id] )
# get history of organization
history = organization.history_get(true)
# return result
render :json => history
end
end end

View file

@ -1,6 +1,7 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class History < ApplicationModel class History < ApplicationModel
require 'history/assets'
include History::Assets include History::Assets
self.table_name = 'histories' self.table_name = 'histories'

View file

@ -4,13 +4,13 @@ class Ticket < ApplicationModel
include Ticket::Escalation include Ticket::Escalation
include Ticket::Subject include Ticket::Subject
include Ticket::Permission include Ticket::Permission
load 'ticket/assets.rb' require 'ticket/assets'
include Ticket::Assets include Ticket::Assets
load 'ticket/history_log.rb' require 'ticket/history_log'
include Ticket::HistoryLog include Ticket::HistoryLog
load 'ticket/activity_stream_log.rb' require 'ticket/activity_stream_log'
include Ticket::ActivityStreamLog include Ticket::ActivityStreamLog
load 'ticket/search_index.rb' require 'ticket/search_index'
include Ticket::SearchIndex include Ticket::SearchIndex
extend Ticket::Search extend Ticket::Search

View file

@ -6,5 +6,6 @@ Zammad::Application.routes.draw do
match api_path + '/organizations/:id', :to => 'organizations#show', :via => :get match api_path + '/organizations/:id', :to => 'organizations#show', :via => :get
match api_path + '/organizations', :to => 'organizations#create', :via => :post match api_path + '/organizations', :to => 'organizations#create', :via => :post
match api_path + '/organizations/:id', :to => 'organizations#update', :via => :put match api_path + '/organizations/:id', :to => 'organizations#update', :via => :put
match api_path + '/organizations/history/:id',:to => 'organizations#history',:via => :get
end end