]> source.dussan.org Git - sonarqube.git/commitdiff
remove unused issues code
authorStas Vilchik <vilchiks@gmail.com>
Wed, 3 Jun 2015 11:48:44 +0000 (13:48 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 3 Jun 2015 11:48:59 +0000 (13:48 +0200)
server/sonar-web/src/main/js/apps/issues/workspace-list-item-view.js
server/sonar-web/src/main/js/components/issue/issue-view.js
server/sonar-web/src/main/js/components/issue/models/issue.js

index 6d3df9c69018800f89e8c86e52be074e078bb3a0..002fafb07092ffa42da5efe4a4cf79f48fd4a0e2 100644 (file)
@@ -87,8 +87,7 @@ define([
       var key = this.model.get('key'),
           componentUuid = this.model.get('componentUuid'),
           index = this.model.get('index');
-      this.model.clear({ silent: true });
-      this.model.set({ key: key, componentUuid: componentUuid, index: index }, { silent: true });
+      this.model.reset({ key: key, componentUuid: componentUuid, index: index }, { silent: true });
       return this.model.fetch(options).done(function () {
         return that.trigger('reset');
       });
index 1b166bb87df5c67e8ab8f74dcbd4bdf884f65e69..d7c90ddb777d12b3cbb6a6943cf8213ed00c418a 100644 (file)
@@ -25,15 +25,6 @@ define([
       'change': 'render'
     },
 
-    ui: {
-      tagsChange: '.js-issue-edit-tags',
-      tagInput: '.issue-tag-input',
-      tagsEdit: '.issue-tag-edit',
-      tagsEditDone: '.issue-tag-edit-done',
-      tagsEditCancel: '.issue-tag-edit-cancel',
-      tagsList: '.issue-tag-list'
-    },
-
     events: function () {
       return {
         'click .js-issue-comment': 'comment',
@@ -52,7 +43,6 @@ define([
     },
 
     onRender: function () {
-      this.ui.tagsEdit.hide();
       this.$el.attr('data-key', this.model.get('key'));
     },
 
@@ -68,11 +58,7 @@ define([
       var that = this;
       var key = this.model.get('key'),
           componentUuid = this.model.get('componentUuid');
-      this.model.clear({ silent: true });
-      this.model.set({
-        key: key,
-        componentUuid: componentUuid
-      }, { silent: true });
+      this.model.reset({ key: key, componentUuid: componentUuid }, { silent: true });
       return this.model.fetch(options).done(function () {
         return that.trigger('reset');
       });
@@ -255,82 +241,6 @@ define([
       this.popup.render();
     },
 
-    changeTags: function () {
-      var that = this;
-      return jQuery.ajax({
-        url: baseUrl + '/api/issues/tags?ps=0'
-      }).done(function (r) {
-        if (that.ui.tagInput.select2) {
-          that.ui.tagInput.select2({
-            tags: _.difference(r.tags, that.model.get('tags')),
-            width: '300px'
-          });
-        }
-        if (that.ui.tagsEdit.show) {
-          that.ui.tagsEdit.show();
-        }
-        if (that.ui.tagsList.hide) {
-          that.ui.tagsList.hide();
-        }
-        that.tagsBuffer = that.ui.tagInput.select2('val');
-        var keyScope = key.getScope();
-        if (keyScope !== 'tags') {
-          that.previousKeyScope = keyScope;
-        }
-        key.setScope('tags');
-        key('escape', 'tags', function () {
-          return that.cancelEdit();
-        });
-        that.$('.select2-input').keyup(function (event) {
-          if (event.which === 27) {
-            return that.cancelEdit();
-          }
-        });
-        that.ui.tagInput.select2('focus');
-      });
-    },
-
-    cancelEdit: function () {
-      this.resetKeyScope();
-      if (this.ui.tagsList.show) {
-        this.ui.tagsList.show();
-      }
-      if (this.ui.tagInput.select2) {
-        this.ui.tagInput.select2('val', this.tagsBuffer);
-        this.ui.tagInput.select2('close');
-      }
-      if (this.ui.tagsEdit.hide) {
-        return this.ui.tagsEdit.hide();
-      }
-    },
-
-    editDone: function () {
-      var that = this;
-      this.resetKeyScope();
-      var _tags = this.model.get('tags'),
-          tags = this.ui.tagInput.val(),
-          splitTags = tags ? tags.split(',') : null;
-      this.model.set('tags', splitTags);
-      return $.post(baseUrl + '/api/issues/set_tags', {
-        key: this.model.get('key'),
-        tags: tags
-      }).done(function () {
-        that.cancelEdit();
-      }).fail(function () {
-        that.model.set('tags', _tags);
-      }).always(function () {
-        that.render();
-      });
-    },
-
-    resetKeyScope: function () {
-      key.unbind('escape', 'tags');
-      if (this.previousKeyScope) {
-        key.setScope(this.previousKeyScope);
-        this.previousKeyScope = null;
-      }
-    },
-
     serializeData: function () {
       var issueKey = encodeURIComponent(this.model.get('key'));
       return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
index af5dd980c279994fa4eae4265ca9846a0cd365b0..74ca2f3ad1934a9da98c7246971b8e1773be6054 100644 (file)
@@ -41,6 +41,15 @@ define(function () {
       var xhr = options.xhr = Backbone.ajax(opts);
       model.trigger('request', model, xhr, options);
       return xhr;
+    },
+
+    reset: function (attrs, options) {
+      for (var key in this.attributes) {
+        if (this.attributes.hasOwnProperty(key) && !(key in attrs)) {
+          attrs[key] = void 0;
+        }
+      }
+      return this.set(attrs, options);
     }
   });