mirror of https://github.com/keeweb/keeweb
file rename fix
parent
d973c9f989
commit
c2f6624527
|
@ -20,7 +20,10 @@ var MenuItemModel = Backbone.Model.extend({
|
|||
filterValue: null
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
initialize: function(model) {
|
||||
if (model && model.file) {
|
||||
this.listenTo(model.file, 'change:name', this.changeTitle, this);
|
||||
}
|
||||
},
|
||||
|
||||
_loadItemCollectionType: function() {
|
||||
|
@ -55,6 +58,10 @@ var MenuItemModel = Backbone.Model.extend({
|
|||
expanded = true;
|
||||
}
|
||||
this.set('expanded', expanded);
|
||||
},
|
||||
|
||||
changeTitle: function(model, newTitle) {
|
||||
this.set('title', newTitle);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ var MenuItemView = Backbone.View.extend({
|
|||
|
||||
initialize: function () {
|
||||
this.itemViews = [];
|
||||
this.listenTo(this.model, 'change:title', this.changeTitle);
|
||||
this.listenTo(this.model, 'change:active', this.changeActive);
|
||||
this.listenTo(this.model, 'change:expanded', this.changeExpanded);
|
||||
this.listenTo(this.model, 'change:cls', this.changeCls);
|
||||
|
@ -67,6 +68,10 @@ var MenuItemView = Backbone.View.extend({
|
|||
this.itemViews = [];
|
||||
},
|
||||
|
||||
changeTitle: function(model, title) {
|
||||
this.$el.find('.menu__item-title').text(title);
|
||||
},
|
||||
|
||||
changeActive: function(model, active) {
|
||||
this.$el.toggleClass('menu__item--active', active);
|
||||
},
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
}
|
||||
|
||||
&-title {
|
||||
padding-left: .4em;
|
||||
.menu__item-colors & {
|
||||
display: inline-block;
|
||||
@include th { color: text-color(); }
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
cls ? cls : '' %>">
|
||||
<div class="menu__item-body">
|
||||
<i class="menu__item-icon fa <%= icon ? 'fa-' + icon : 'menu__item-icon--no-icon' %>"></i><span
|
||||
class="menu__item-title"> <%- title %></span>
|
||||
class="menu__item-title"><%- title %></span>
|
||||
<% if (options) { %>
|
||||
<div class="menu__item-options">
|
||||
<% options.forEach(function(option) { %>
|
||||
|
@ -15,4 +15,4 @@
|
|||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue