Sha256: 2e5ebe73821eff7c88a04a4bd6e0f63e229c64e728203a63cf647679d27637f4
Contents?: true
Size: 1.38 KB
Versions: 6
Compression:
Stored size: 1.38 KB
Contents
var Adapter = Backbone.Model.extend({ defaults: { domain: null, backend_url: null, api_token: null }, initialize: function(){ var session = new Session(); this.set('api_token', session.getApiKey()) }, set_adapter: function(adapter_url){ var adapter_url = adapter_url; $.ajax({ type: 'POST', url: '/api/source/save_adapter', data: {api_token : this.get('api_token'), adapter_url : adapter_url}, success: function(model, resp){ $(".setadapter-status")[0].firstChild.className = "label label-success"; $(".setadapter-status")[0].firstChild.innerHTML = "success"; $('#input_adapter').val(adapter_url); }, error: function(resp){ if(resp.status == 422){ new App.Views.Index() } $(".setadapter-status")[0].firstChild.className = "label label-important"; $(".setadapter-status")[0].firstChild.innerHTML = "error"; } }) }, get_adapter: function(){ $.ajax({ type: 'POST', url: '/api/source/get_adapter', data: {api_token : this.get('api_token')}, success: function(resp){ var r = JSON.parse(resp); if(r.adapter_url) $('#input_adapter').val(r.adapter_url); }, error: function(resp){ if(resp.status == 422){ new App.Views.Index() } $(".setadapter-status")[0].firstChild.className = "label label-important"; $(".setadapter-status")[0].firstChild.innerHTML = "error"; } }) } });
Version data entries
6 entries across 6 versions & 1 rubygems