Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide the tags input field when it's empty #1478

Merged
merged 5 commits into from
Sep 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -284,6 +284,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.