Improved use if apiPath.

This commit is contained in:
Martin Edenhofer 2013-08-07 00:53:31 +02:00
parent e60198b927
commit 56c26cb413
49 changed files with 62 additions and 59 deletions

View file

@ -20,6 +20,9 @@ class App.Controller extends Spine.Controller
@Config = App.Config
@Session = App.Session
# create common accessors
@apiPath = @Config.get('api_path')
bind: (event, callback) =>
App.Event.bind(
event

View file

@ -23,7 +23,7 @@ class App.DashboardActivityStream extends App.Controller
App.Com.ajax(
id: 'dashoard_activity_stream'
type: 'GET'
url: @Config.get('api_path') + '/activity_stream'
url: @apiPath + '/activity_stream'
data: {
limit: 8
}

View file

@ -11,7 +11,7 @@ class App.DashboardRecentViewed extends App.Controller
App.Com.ajax(
id: 'dashboard_recent_viewed',
type: 'GET',
url: @Config.get('api_path') + '/recent_viewed',
url: @apiPath + '/recent_viewed',
data: {
limit: 5,
}

View file

@ -21,7 +21,7 @@ class App.DashboardRss extends App.Controller
App.Com.ajax(
id: 'dashboard_rss'
type: 'GET'
url: @Config.get('api_path') + '/rss_fetch'
url: @apiPath + '/rss_fetch'
data: {
limit: 8
url: 'http://www.heise.de/newsticker/heise-atom.xml'

View file

@ -30,7 +30,7 @@ class App.DashboardTicket extends App.Controller
App.Com.ajax(
id: 'dashboard_ticket_' + @key,
type: 'GET',
url: @Config.get('api_path') + '/ticket_overviews',
url: @apiPath + '/ticket_overviews',
data: {
view: @view,
view_mode: 'd',

View file

@ -37,7 +37,7 @@ class App.ProfileLanguage extends App.Controller
App.Com.ajax(
id: 'preferences'
type: 'PUT'
url: @Config.get('api_path') + '/users/preferences'
url: @apiPath + '/users/preferences'
data: JSON.stringify(params)
processData: true
success: @success

View file

@ -53,7 +53,7 @@ class App.ProfileLinkedAccounts extends App.Controller
App.Com.ajax(
id: 'account'
type: 'DELETE'
url: @Config.get('api_path') + '/users/account'
url: @apiPath + '/users/account'
data: JSON.stringify({ provider: provider, uid: uid })
processData: true
success: @success

View file

@ -38,7 +38,7 @@ class App.ProfilePassword extends App.Controller
App.Com.ajax(
id: 'password_reset'
type: 'POST'
url: @Config.get('api_path') + '/users/password_change'
url: @apiPath + '/users/password_change'
data: JSON.stringify(params)
processData: true
success: @success

View file

@ -105,7 +105,7 @@ class App.TicketCreate extends App.Controller
App.Com.ajax(
id: 'ticket_create'
type: 'GET'
url: @Config.get('api_path') + '/ticket_create'
url: @apiPath + '/ticket_create'
data:
ticket_id: params.ticket_id
article_id: params.article_id
@ -149,7 +149,7 @@ class App.TicketCreate extends App.Controller
# generate form
configure_attributes = [
{ name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 200, null: false, relation: 'User', class: 'span7', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '<a href="" class="customer_new">&raquo;</a>', callback: @localUserInfo, source: @Config.get('api_path') + '/users/search', minLengt: 2 },
{ name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 200, null: false, relation: 'User', class: 'span7', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '<a href="" class="customer_new">&raquo;</a>', callback: @localUserInfo, source: @apiPath + '/users/search', minLengt: 2 },
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: false, filter: @edit_form, nulloption: true, relation: 'Group', default: defaults['group_id'], class: 'span7', },
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, filter: @edit_form, nulloption: true, relation: 'User', default: defaults['owner_id'], class: 'span7', },
{ name: 'tags', display: 'Tags', tag: 'tag', type: 'text', null: true, default: defaults['tags'], class: 'span7', },

View file

@ -13,7 +13,7 @@ class App.TicketHistory extends App.ControllerModal
App.Com.ajax(
id: 'ticket_history',
type: 'GET',
url: @Config.get('api_path') + '/ticket_history/' + ticket_id,
url: @apiPath + '/ticket_history/' + ticket_id,
success: (data, status, xhr) =>
# remember ticket
@ticket = data.ticket

View file

@ -9,7 +9,7 @@ class App.TicketMerge extends App.ControllerModal
App.Com.ajax(
id: 'ticket_merge_list',
type: 'GET',
url: @Config.get('api_path') + '/ticket_merge_list/' + @ticket_id,
url: @apiPath + '/ticket_merge_list/' + @ticket_id,
data: {
# view: @view
}
@ -107,7 +107,7 @@ class App.TicketMerge extends App.ControllerModal
App.Com.ajax(
id: 'ticket_merge',
type: 'GET',
url: @Config.get('api_path') + '/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'],
url: @apiPath + '/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'],
data: {
# view: @view
}

View file

@ -37,7 +37,7 @@ class Index extends App.ControllerContent
App.Com.ajax(
id: 'ticket_create',
type: 'GET',
url: @Config.get('api_path') + '/ticket_create',
url: @apiPath + '/ticket_create',
data: {
ticket_id: params.ticket_id,
article_id: params.article_id,

View file

@ -21,7 +21,7 @@ class Index extends App.ControllerContent
App.Com.ajax(
id: 'getting_started',
type: 'GET',
url: @Config.get('api_path') + '/getting_started',
url: @apiPath + '/getting_started',
data: {
# view: @view,
}

View file

@ -14,7 +14,7 @@ class App.LinkInfo extends App.Controller
App.Com.ajax(
id: 'links_' + @object.id + '_' + @object_type,
type: 'GET',
url: @Config.get('api_path') + '/links',
url: @apiPath + '/links',
data: {
link_object: @object_type,
link_object_value: @object.id,
@ -83,7 +83,7 @@ class App.LinkInfo extends App.Controller
App.Com.ajax(
id: 'links_remove_' + @object.id + '_' + @object_type,
type: 'GET',
url: @Config.get('api_path') + '/links/remove',
url: @apiPath + '/links/remove',
data: {
link_type: link_type,
link_object_source: link_object_source,
@ -126,7 +126,7 @@ class App.LinkAdd extends App.ControllerModal
App.Com.ajax(
id: 'links_add_' + @object.id + '_' + @object_type,
type: 'GET',
url: @Config.get('api_path') + '/links/add',
url: @apiPath + '/links/add',
data: {
link_type: params['link_type'],
link_object_target: 'Ticket',

View file

@ -86,7 +86,7 @@ class App.Navigation extends App.Controller
App.Com.ajax(
id: 'ticket_search'
type: 'GET'
url: @Config.get('api_path') + '/search'
url: @apiPath + '/search'
data:
term: @term
processData: true,

View file

@ -16,7 +16,7 @@ class Index extends App.ControllerContent
App.Com.ajax(
id: 'packages',
type: 'GET',
url: @Config.get('api_path') + '/packages',
url: @apiPath + '/packages',
processData: true,
success: (data) =>
@render(data)
@ -50,7 +50,7 @@ class Index extends App.ControllerContent
App.Com.ajax(
id: 'packages',
type: httpType,
url: 'api/packages',
url: @apiPath + '/packages',
data: JSON.stringify( { id: id } ),
processData: false,
success: (data) =>

View file

@ -46,7 +46,7 @@ class Index extends App.ControllerContent
App.Com.ajax(
id: 'password_reset'
type: 'POST'
url: @Config.get('api_path') + '/users/password_reset'
url: @apiPath + '/users/password_reset'
data: JSON.stringify(params)
processData: true
success: @success
@ -86,7 +86,7 @@ class Verify extends App.ControllerContent
App.Com.ajax(
id: 'password_reset_verify'
type: 'POST'
url: @Config.get('api_path') + '/users/password_reset_verify'
url: @apiPath + '/users/password_reset_verify'
data: JSON.stringify(params)
processData: true
success: @render_success
@ -122,7 +122,7 @@ class Verify extends App.ControllerContent
App.Com.ajax(
id: 'password_reset_verify'
type: 'POST'
url: @Config.get('api_path') + '/users/password_reset_verify'
url: @apiPath + '/users/password_reset_verify'
data: JSON.stringify(params)
processData: true
success: @render_changed_success

View file

@ -19,7 +19,7 @@ class Session extends App.ControllerContent
App.Com.ajax(
id: 'sessions'
type: 'GET'
url: @Config.get('api_path') + '/sessions'
url: @apiPath + '/sessions'
success: (data) =>
@render(data)
)
@ -45,7 +45,7 @@ class Session extends App.ControllerContent
App.Com.ajax(
id: 'sessions/' + sessionId
type: 'DELETE'
url: @Config.get('api_path') + '/sessions/' + sessionId
url: @apiPath + '/sessions/' + sessionId
success: (data) =>
@load()
)

View file

@ -12,7 +12,7 @@ class App.TagWidget extends App.Controller
App.Com.ajax(
id: @attribute_id
type: 'GET'
url: @Config.get('api_path') + '/tags'
url: @apiPath + '/tags'
data:
object: @object_type
o_id: @object.id
@ -42,7 +42,7 @@ class App.TagWidget extends App.Controller
onAddTag: (item) =>
App.Com.ajax(
type: 'GET',
url: @Config.get('api_path') + '/tags/add',
url: @apiPath + '/tags/add',
data:
object: @object_type,
o_id: @object.id,
@ -55,7 +55,7 @@ class App.TagWidget extends App.Controller
onRemoveTag: (item) =>
App.Com.ajax(
type: 'GET'
url: @Config.get('api_path') + '/tags/remove'
url: @apiPath + '/tags/remove'
data:
object: @object_type
o_id: @object.id

View file

@ -5,7 +5,7 @@ class App.TicketCustomer extends App.ControllerModal
render: ->
configure_attributes = [
{ name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 100, null: false, relation: 'User', class: 'span5', autocapitalize: false, help: 'Select the new customer of the Ticket.', source: @Config.get('api_path') + '/users/search', minLengt: 2 },
{ name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 100, null: false, relation: 'User', class: 'span5', autocapitalize: false, help: 'Select the new customer of the Ticket.', source: @apiPath + '/users/search', minLengt: 2 },
]
@html App.view('agent_ticket_customer')()

View file

@ -42,7 +42,7 @@ class Index extends App.ControllerContent
App.Com.ajax(
id: 'ticket_overview_' + @key,
type: 'GET',
url: @Config.get('api_path') + '/ticket_overviews',
url: @apiPath + '/ticket_overviews',
data: {
view: @view,
view_mode: @view_mode,
@ -502,7 +502,7 @@ class Router extends App.Controller
else
App.Com.ajax(
type: 'GET'
url: @Config.get('api_path') + '/ticket_overviews'
url: @apiPath + '/ticket_overviews'
data:
view: @view
array: true

View file

@ -67,7 +67,7 @@ class App.TicketZoom extends App.Controller
App.Com.ajax(
id: 'ticket_zoom_' + ticket_id
type: 'GET'
url: @Config.get('api_path') + '/ticket_full/' + ticket_id + '?do_not_log=' + @doNotLog
url: @apiPath + '/ticket_full/' + ticket_id + '?do_not_log=' + @doNotLog
data:
view: @view
processData: true

View file

@ -1,6 +1,6 @@
class App.Model extends Spine.Model
@destroyBind: false
@api_path: App.Config.get('api_path')
@apiPath: App.Config.get('api_path')
constructor: ->
super

View file

@ -1,4 +1,4 @@
class App.Channel extends App.Model
@configure 'Channel', 'adapter', 'area', 'options', 'group_id', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/channels'
@url: @apiPath + '/channels'

View file

@ -1,7 +1,7 @@
class App.EmailAddress extends App.Model
@configure 'EmailAddress', 'realname', 'email', 'note', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/email_addresses'
@url: @apiPath + '/email_addresses'
@configure_attributes = [
{ name: 'realname', display: 'Realname', tag: 'input', type: 'text', limit: 250, 'null': false, 'class': 'span4' },

View file

@ -1,7 +1,7 @@
class App.Group extends App.Model
@configure 'Group', 'name', 'assignment_timeout', 'follow_up_possible', 'follow_up_assignment', 'email_address_id', 'signature_id', 'note', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/groups'
@url: @apiPath + '/groups'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },

View file

@ -1,7 +1,7 @@
class App.History extends App.Model
@configure 'History', 'name'
@extend Spine.Model.Ajax
@url: @api_path + '/histories'
@url: @apiPath + '/histories'
@_fillUp: (data) ->

View file

@ -1,4 +1,4 @@
class App.HistoryAttribute extends App.Model
@configure 'HistoryAttribute', 'name'
@extend Spine.Model.Ajax
@url: @api_path + '/history_attributes'
@url: @apiPath + '/history_attributes'

View file

@ -1,4 +1,4 @@
class App.HistoryObject extends App.Model
@configure 'HistoryObject', 'name'
@extend Spine.Model.Ajax
@url: @api_path + '/history_objects'
@url: @apiPath + '/history_objects'

View file

@ -1,4 +1,4 @@
class App.HistoryType extends App.Model
@configure 'HistoryType', 'name'
@extend Spine.Model.Ajax
@url: @api_path + '/history_types'
@url: @apiPath + '/history_types'

View file

@ -1,7 +1,7 @@
class App.Organization extends App.Model
@configure 'Organization', 'name', 'shared', 'note', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/organizations'
@url: @apiPath + '/organizations'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
{ name: 'shared', display: 'Shared organiztion', tag: 'boolean', note: 'Customers in the organiztion can view each other items.', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' },

View file

@ -1,7 +1,7 @@
class App.Overview extends Spine.Model
@configure 'Overview', 'name', 'link', 'prio', 'condition', 'order', 'group_by', 'view', 'user_id', 'organization_shared', 'role_id', 'order', 'group_by', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/overviews'
@url: @apiPath + '/overviews'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
{ name: 'link', display: 'URL', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },

View file

@ -1,7 +1,7 @@
class App.PostmasterFilter extends App.Model
@configure 'PostmasterFilter', 'name', 'channel', 'match', 'perform', 'note', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/postmaster_filters'
@url: @apiPath + '/postmaster_filters'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 250, 'null': false, 'class': 'span4' },

View file

@ -1,7 +1,7 @@
class App.Role extends App.Model
@configure 'Role', 'name', 'note', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/roles'
@url: @apiPath + '/roles'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, 'class': 'span4' },

View file

@ -1,4 +1,4 @@
class App.Setting extends App.Model
@configure 'Setting', 'name', 'state'
@extend Spine.Model.Ajax
@url: @api_path + '/settings'
@url: @apiPath + '/settings'

View file

@ -1,7 +1,7 @@
class App.Signature extends App.Model
@configure 'Signature', 'name', 'body', 'note', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/signatures'
@url: @apiPath + '/signatures'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },

View file

@ -1,7 +1,7 @@
class App.Sla extends App.Model
@configure 'Sla', 'name', 'first_response_time', 'update_time', 'close_time', 'condition', 'timezone', 'data', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/slas'
@url: @apiPath + '/slas'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'span4' },
{ name: 'first_response_time', display: 'First Response Time', tag: 'input', type: 'text', limit: 100, null: true, 'class': 'span4', note: 'In minutes, only business times are counted.' },

View file

@ -2,4 +2,4 @@ class App.Taskbar extends App.Model
@configure 'Taskbar', 'key', 'client_id', 'callback', 'state', 'params', 'prio', 'notify', 'active', 'updated_at'
# @extend Spine.Model.Local
@extend Spine.Model.Ajax
@url: @api_path + '/taskbar'
@url: @apiPath + '/taskbar'

View file

@ -1,4 +1,4 @@
class App.Template extends App.Model
@configure 'Template', 'name', 'options', 'group_ids', 'user_id', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/templates'
@url: @apiPath + '/templates'

View file

@ -1,7 +1,7 @@
class App.TextModule extends App.Model
@configure 'TextModule', 'name', 'keywords', 'content', 'active', 'group_ids', 'user_id', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/text_modules'
@url: @apiPath + '/text_modules'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
{ name: 'keywords', display: 'Keywords', tag: 'input', type: 'text', limit: 100, 'null': true, 'class': 'span4' },

View file

@ -1,7 +1,7 @@
class App.Ticket extends App.Model
@configure 'Ticket', 'number', 'title', 'group_id', 'owner_id', 'customer_id', 'ticket_state_id', 'ticket_priority_id', 'article', 'tags', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/tickets'
@url: @apiPath + '/tickets'
@configure_attributes = [
{ name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, read_only: true, style: 'width: 8%' },
{ name: 'customer_id', display: 'Customer', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '<a href="" class="customer_new">&raquo;</a>' },

View file

@ -1,7 +1,7 @@
class App.TicketArticle extends App.Model
@configure 'TicketArticle', 'from', 'to', 'cc', 'subject', 'body', 'ticket_id', 'ticket_article_type_id', 'ticket_article_sender_id', 'internal', 'in_reply_to', 'form_id', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/ticket_articles'
@url: @apiPath + '/ticket_articles'
@configure_attributes = [
{ name: 'ticket_id', display: 'TicketID', null: false, readonly: 1, },
{ name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', },

View file

@ -1,4 +1,4 @@
class App.TicketArticleSender extends App.Model
@configure 'TicketArticleSender', 'name', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/ticket_article_senders'
@url: @apiPath + '/ticket_article_senders'

View file

@ -1,4 +1,4 @@
class App.TicketArticleType extends App.Model
@configure 'TicketArticleType', 'name', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/ticket_article_types'
@url: @apiPath + '/ticket_article_types'

View file

@ -1,4 +1,4 @@
class App.TicketPriority extends App.Model
@configure 'TicketPriority', 'name', 'note', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/ticket_priorities'
@url: @apiPath + '/ticket_priorities'

View file

@ -1,4 +1,4 @@
class App.TicketState extends App.Model
@configure 'TicketState', 'name', 'note', 'active'
@extend Spine.Model.Ajax
@url: @api_path + '/ticket_states'
@url: @apiPath + '/ticket_states'

View file

@ -1,4 +1,4 @@
class App.TicketStateType extends App.Model
@configure 'TicketStateType', 'name', 'note', 'active', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/ticket_state_types'
@url: @apiPath + '/ticket_state_types'

View file

@ -1,4 +1,4 @@
class App.Translation extends App.Model
@configure 'Translation', 'source', 'target', 'locale'
@extend Spine.Model.Ajax
@url: @api_path + '/translations'
@url: @apiPath + '/translations'

View file

@ -1,7 +1,7 @@
class App.User extends App.Model
@configure 'User', 'login', 'firstname', 'lastname', 'email', 'web', 'password', 'phone', 'fax', 'mobile', 'street', 'zip', 'city', 'country', 'organization_id', 'department', 'note', 'role_ids', 'group_ids', 'active', 'invite', 'updated_at'
@extend Spine.Model.Ajax
@url: @api_path + '/users'
@url: @apiPath + '/users'
# @hasMany 'roles', 'App.Role'
@configure_attributes = [