Commit f4b06b2e by cahrens

Beginnings of is-set work.

parent fd52980a
<ul class="list-input settings-list">
<% _.each(metadata_entries, function(entry) { %>
<li class="field comp-setting-entry">
<div class='metadata_entry' />
<li class="field comp-setting-entry metadata_entry">
</li>
<% }) %>
</ul>
\ No newline at end of file
......@@ -5,4 +5,4 @@
<i class="ss-icon ss-symbolicons-block undo">&#x21A9;</i>
</button>
</div>
<span class="tip setting-help"><%= model.get('help') %></span>
\ No newline at end of file
<span class="tip setting-help"><%= model.get('help') %></span>
......@@ -24,6 +24,8 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({
model: new CMS.Models.Metadata(item)
};
if (item.options.length > 0) {
// Right now, all our option types only hold strings. Should really support
// any type though.
self.views[key] = new CMS.Views.Metadata.Option(data);
}
else {
......
if (!CMS.Views['Metadata']) CMS.Views.Metadata = {};
CMS.Views.Metadata.Number = CMS.Views.Metadata.String.extend({
getValue: function() {
var stringVal = this.$el.find('#' + this.uniqueId).val();
if (this.isInteger) {
return parseInt(stringVal)
}
else {
return parseFloat(stringVal)
}
}
});
\ No newline at end of file
......@@ -18,6 +18,11 @@ CMS.Views.Metadata.Option = Backbone.View.extend({
$('#' + self.uniqueId + " option").filter(function() {
return $(this).text() === self.model.get('value');
}).prop('selected', true);
if (self.model.get('explicitly_set')) {
self.$el.addClass('is-set');
self.$el.find('#'+self.uniqueId + " .setting-clear").addClass('active');
}
}
);
},
......
......@@ -15,6 +15,10 @@ CMS.Views.Metadata.String = Backbone.View.extend({
function (raw_template) {
self.template = _.template(raw_template);
self.$el.append(self.template({model: self.model, uniqueId: self.uniqueId}));
if (self.model.get('explicitly_set')) {
self.$el.addClass('is-set');
self.$el.find('#'+self.uniqueId + " .setting-clear").addClass('active');
}
}
);
},
......
......@@ -53,6 +53,7 @@
<!--TODO: not the right place-->
<script type="text/javascript" src="${static.url('js/models/metadata_model.js')}"></script>
<script type="text/javascript" src="${static.url('js/views/metadata_string_view.js')}"></script>
<script type="text/javascript" src="${static.url('js/views/metadata_number_view.js')}"></script>
<script type="text/javascript" src="${static.url('js/views/metadata_option_view.js')}"></script>
<script type="text/javascript" src="${static.url('js/models/metadata_editor.js')}"></script>
<script type="text/javascript" src="${static.url('js/views/metadata_editor_view.js')}"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment