diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/provisioning/project.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/provisioning/project.js | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/server/sonar-web/src/main/js/apps/provisioning/project.js b/server/sonar-web/src/main/js/apps/provisioning/project.js index fa34df605f2..b709f02695b 100644 --- a/server/sonar-web/src/main/js/apps/provisioning/project.js +++ b/server/sonar-web/src/main/js/apps/provisioning/project.js @@ -1,38 +1,39 @@ -define(function () { +import _ from 'underscore'; +import Backbone from 'backbone'; - return Backbone.Model.extend({ - idAttribute: 'uuid', +export default Backbone.Model.extend({ + idAttribute: 'uuid', - defaults: { - selected: false - }, + defaults: { + selected: false + }, - urlRoot: function () { - return baseUrl + '/api/projects'; - }, + urlRoot: function () { + return baseUrl + '/api/projects'; + }, - sync: function (method, model, options) { - var opts = options || {}; - if (method === 'create') { - _.defaults(opts, { - url: this.urlRoot() + '/create', - type: 'POST', - data: _.pick(model.toJSON(), 'key', 'name', 'branch') - }); - } - if (method === 'delete') { - _.defaults(opts, { - url: this.urlRoot() + '/bulk_delete', - type: 'POST', - data: { ids: this.id } - }); - } - return Backbone.ajax(opts); - }, - - toggle: function () { - this.set({ selected: !this.get('selected') }); + sync: function (method, model, options) { + var opts = options || {}; + if (method === 'create') { + _.defaults(opts, { + url: this.urlRoot() + '/create', + type: 'POST', + data: _.pick(model.toJSON(), 'key', 'name', 'branch') + }); + } + if (method === 'delete') { + _.defaults(opts, { + url: this.urlRoot() + '/bulk_delete', + type: 'POST', + data: { ids: this.id } + }); } - }); + return Backbone.ajax(opts); + }, + toggle: function () { + this.set({ selected: !this.get('selected') }); + } }); + + |