diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-06-09 04:34:56 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-06-09 10:04:24 +0300 |
commit | ccf4b9ec69c3a9d33cc02b5cf01f2ff0a866efdd (patch) | |
tree | 4752b300530184087c37a293053cfd24452d8167 /apps/systemtags/js | |
parent | 9e767b46ec24cf9ff559339950fdfd2f7f6bd1bf (diff) |
Add visibility related methods
SystemTagsInfoView now provides public methods related to its visibility
in preparation to be used by external objects.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/systemtags/js')
-rw-r--r-- | apps/systemtags/js/systemtagsinfoview.js | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/apps/systemtags/js/systemtagsinfoview.js b/apps/systemtags/js/systemtagsinfoview.js index ce5de2048ab..d42bf18761b 100644 --- a/apps/systemtags/js/systemtagsinfoview.js +++ b/apps/systemtags/js/systemtagsinfoview.js @@ -65,9 +65,11 @@ this._toggleHandle.prepend($('<span>').addClass('icon icon-tag')); this._toggleHandle.on('click', function () { - self.$el.toggleClass('hidden'); - if (!self.$el.hasClass('hidden')) { - self.$el.find('.systemTagsInputField').select2('open'); + if (self.isVisible()) { + self.hide(); + } else { + self.show(); + self.openDropdown(); } }); }, @@ -144,15 +146,15 @@ self._inputView.setData(appliedTags); if (appliedTags.length !== 0) { - self.$el.removeClass('hidden'); + self.show(); } else { - self.$el.addClass('hidden'); + self.hide(); } } }); } - this.$el.addClass('hidden'); + this.hide(); }, /** @@ -165,6 +167,22 @@ this._inputView.render(); }, + isVisible: function() { + return !this.$el.hasClass('hidden'); + }, + + show: function() { + this.$el.removeClass('hidden'); + }, + + hide: function() { + this.$el.addClass('hidden'); + }, + + openDropdown: function() { + this.$el.find('.systemTagsInputField').select2('open'); + }, + remove: function() { this._inputView.remove(); this._toggleHandle.remove(); |