1define('jira/viewissue/watchers-voters/views/abstract-watchers-view', ['require'], function (require) { 2 var AuiMessages = require('aui/message'); 3 var Backbone = require('backbone'); 4 var _ = require('underscore'); 5 var jQuery = require('jquery'); 6 7 var Deferred = require('jira/jquery/deferred'); 8 9 var formatter = require('jira/util/formatter'); 10 11 /** 12 * Views for watchers 13 * @class AbstractWatchersView 14 * @extends Backbone.View 15 * @abstract 16 */ 17 return Backbone.View.extend({ 18 $empty: undefined, 19 20 renderNoWatchers: function renderNoWatchers() { 21 if (this.$(".recipients li").length === 0) { 22 this.$empty = AuiMessages.info({ 23 closeable: false, 24 body: formatter.I18n.getText("watcher.manage.nowatchers") 25 }); 26 this.$("fieldset").append(this.$empty); 27 } else if (this.$empty) { 28 this.$empty.remove(); 29 } 30 }, 31 32 /** 33 * Goes to server to get watchers before rendering contents 34 * 35 * @return {jQuery.Deferred} 36 */ 37 render: function render() { 38 var deferred = Deferred(); 39 this.collection.fetch().done(_.bind(function () { 40 this._render(); 41 this.renderNoWatchers(); 42 deferred.resolve(this.$el); 43 setTimeout(_.bind(function () { 44 this.focus(); 45 }, this), 0); 46 }, this)); 47 return deferred.promise(); 48 }, 49 50 watch: function watch() { 51 jQuery("#watching-toggle").text(formatter.I18n.getText("issue.operations.simple.stopwatching")); 52 }, 53 54 unwatch: function unwatch() { 55 jQuery("#watching-toggle").text(formatter.I18n.getText("issue.operations.simple.startwatching")); 56 }, 57 58 /** 59 * Focuses input field 60 * @abstract 61 * @function 62 */ 63 focus: jQuery.noop, 64 65 /** 66 * Increments watcher count by 1 67 * @private 68 */ 69 _incrementWatcherCount: function _incrementWatcherCount() { 70 var $el = jQuery("#watcher-data"); 71 var currentCount = parseInt($el.text(), 10); 72 $el.text(currentCount + 1); 73 this.renderNoWatchers(); 74 }, 75 76 /** 77 * Decrements watcher count by 1 78 * @private 79 */ 80 _decrementWatcherCount: function _decrementWatcherCount() { 81 var $el = jQuery("#watcher-data"); 82 var currentCount = parseInt($el.text(), 10); 83 $el.text(currentCount - 1); 84 this.renderNoWatchers(); 85 } 86 }); 87});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.