Skip to content

Commit

Permalink
Merge pull request #1478 from nextcloud/backport-1469-hide-tags-and-cry
Browse files Browse the repository at this point in the history
Hide the tags input field when it's empty
  • Loading branch information
blizzz authored Sep 29, 2016
2 parents 550fb8c + 923890e commit e60d5d0
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
10 changes: 10 additions & 0 deletions apps/systemtags/css/systemtagsfilelist.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@
.nav-icon-systemtagsfilter {
background-image: url('../img/tag.svg');
}

#app-sidebar .mainFileInfoView .tag-label {
cursor: pointer;
padding: 13px;
}

#app-sidebar .mainFileInfoView .icon-tag {
opacity: .5;
vertical-align: middle;
}
2 changes: 1 addition & 1 deletion apps/systemtags/img/tag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 26 additions & 2 deletions apps/systemtags/js/systemtagsinfoview.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
*/
_inputView: null,

_toggleHandle: null,

initialize: function(options) {
var self = this;
options = options || {};
Expand All @@ -58,6 +60,9 @@

this._inputView.on('select', this._onSelectTag, this);
this._inputView.on('deselect', this._onDeselectTag, this);

this._toggleHandle = $('<span>').addClass('tag-label').text(t('systemtags', 'Tags'));
this._toggleHandle.prepend($('<span>').addClass('icon icon-tag'));
},

/**
Expand Down Expand Up @@ -118,24 +123,43 @@
this.selectedTagsCollection.fetch({
success: function(collection) {
collection.fetched = true;
self._inputView.setData(collection.map(modelToSelection));
self.$el.removeClass('hidden');

var appliedTags = collection.map(modelToSelection);
self._inputView.setData(appliedTags);

if (appliedTags.length !== 0) {
self.$el.removeClass('hidden');
} else {
self.$el.addClass('hidden');
}
}
});
}

this.$el.addClass('hidden');
},

/**
* Renders this details view
*/
render: function() {
var self = this;

this.$el.append(this._inputView.$el);
this._inputView.render();

$('#app-sidebar').find('.mainFileInfoView .file-details').append(this._toggleHandle);
this._toggleHandle.off('click');
this._toggleHandle.on('click', function () {
console.log('toggle');
console.log(self.$el);
self.$el.toggleClass('hidden');
});
},

remove: function() {
this._inputView.remove();
this._toggleHandle.remove();
}
});

Expand Down
1 change: 1 addition & 0 deletions core/css/apps.css
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ em {

/* generic tab styles */
.tabHeaders {
display: inline-block;
margin: 15px;
}
.tabHeaders .tabHeader {
Expand Down
4 changes: 4 additions & 0 deletions core/css/icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ img.icon-loading-small-dark, object.icon-loading-small-dark, video.icon-loading-
background-image: url('../img/actions/starred.svg?v=1');
}

.icon-tag {
background-image: url('../img/actions/tag.svg?v=1');
}

.icon-toggle {
background-image: url('../img/actions/toggle.svg?v=1');
}
Expand Down
5 changes: 5 additions & 0 deletions core/img/actions/tag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e60d5d0

Please sign in to comment.