Only show the folder icon if fields are folders

This commit is contained in:
Tom Byers
2019-05-09 11:04:43 +01:00
parent 3dc2130926
commit 1ffa8c8915
3 changed files with 31 additions and 11 deletions

View File

@@ -22,7 +22,7 @@
this.addFooterAndDoneButton(legendText);
// create summary from component pieces and match text to current selection
this.summary.addContent(legendText);
this.summary.addContent(legendText, this.fieldLabel);
this.summary.update(this.getSelection(), this.total, this.fieldLabel);
this.$fieldset.before(this.summary.$el);
@@ -56,7 +56,7 @@
}
}
},
addContent: function(legendText) {
addContent: function(legendText, fieldLabel) {
const $content = $(`<p>
<span class="selection-summary__text"></span>
<button class="button button-secondary">Change<span class="visuallyhidden"> ${legendText}</span></button>
@@ -65,6 +65,8 @@
this.$text = $content.find('.selection-summary__text');
this.$changeButton = $content.find('button');
if (fieldLabel === 'folder') { this.$text.addClass('selection-summary__text--folders'); }
this.$el.append($content);
},
update: function(selection, total, field) {