Browse Source

Improved use if apiPath.

Martin Edenhofer 11 years ago
parent
commit
56c26cb413

+ 3 - 0
app/assets/javascripts/app/controllers/_application_controller.js.coffee

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

+ 1 - 1
app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee

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

+ 1 - 1
app/assets/javascripts/app/controllers/_dashboard/recent_viewed.js.coffee

@@ -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,
       }

+ 1 - 1
app/assets/javascripts/app/controllers/_dashboard/rss.js.coffee

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

+ 1 - 1
app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee

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

+ 1 - 1
app/assets/javascripts/app/controllers/_profile/language.js.coffee

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

+ 1 - 1
app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee

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

+ 1 - 1
app/assets/javascripts/app/controllers/_profile/password.js.coffee

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

+ 2 - 2
app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee

@@ -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', },

+ 1 - 1
app/assets/javascripts/app/controllers/agent_ticket_history.js.coffee

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

Some files were not shown because too many files changed in this diff