initialize: function(options) {
this.view = options.view;
- this.listenTo(this.model, 'change', this.render);
+ this.listenTo(this.model, 'change:checked', this.toggleChecked);
this.listenTo(this.model, 'remove', this.remove);
this.listenTo(this.model, 'hidden', this.toggleHidden);
},
this.$el.toggleClass('hidden', this.model.isHidden() && !this.view.showHidden());
},
+ toggleChecked: function(obj, value) {
+ this.$el.toggleClass('active', value);
+ this.$el.find('input[type="checkbox"]').prop('checked', value);
+ },
+
click: function(e) {
if (e.target.className == 'link') {
if (this.model.isDir()) {
<script type="text/template" id="dir-template">
<td class="text-center">
<label for="dir-<%= cid %>" class="sr-only">Zaznacz katalog <%= name %></label>
- <input id="dir-<%= cid %>" type="checkbox" autocomplete="off" <%= checked ? 'checked="checked"' : '' %>>
+ <input id="dir-<%= cid %>" type="checkbox" autocomplete="off">
</td>
<td class="text-center"><span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span></td>
<td><a class="link" href="#"><%= name %></a></td>
<script type="text/template" id="file-template">
<td class="text-center">
<label for="file-<%= cid %>" class="sr-only">Zaznacz plik <%= name %></label>
- <input id="file-<%= cid %>" type="checkbox" autocomplete="off" <%= checked ? 'checked="checked"' : '' %>>
+ <input id="file-<%= cid %>" type="checkbox" autocomplete="off">
</td>
<td class="text-center"><span class="glyphicon glyphicon-file" aria-hidden="true"></span></td>
<td>