long list widgets now clickable

pull/779/head
Justin Richer 2015-02-18 15:23:16 -05:00
parent 720b73939f
commit 9a19207f86
3 changed files with 26 additions and 3 deletions

View File

@ -122,9 +122,23 @@ var ListWidgetChildView = Backbone.View.extend({
render:function () {
this.$el.html(this.template(this.model.toJSON()));
$('.item-full', this.el).hide();
if (this.model.get('item').length > 30) {
this.$el.tooltip({title:this.model.get('item')});
this.$el.tooltip({title:$.t('admin.list-widget.tooltip')});
var _self = this;
$(this.el).click(function(event) {
event.preventDefault();
$('.item-short', _self.el).hide();
$('.item-full', _self.el).show();
_self.$el.tooltip('destroy');
});
}
$(this.el).i18n();
return this;
}
@ -200,6 +214,11 @@ var ListWidgetView = Backbone.View.extend({
$('input', this.$el).typeahead({source:this.options.autocomplete});
}
// render toggleable options
if (this.options.toggles) {
}
_self = this;
if (_.size(this.collection.models) == 0) {

View File

@ -6,7 +6,8 @@
},
"home": "Home",
"list-widget": {
"empty": "There are no items in this list."
"empty": "There are no items in this list.",
"tooltip": "Click to display full value."
},
"manage-blacklist": "Manage Blacklisted Clients",
"self-service-client": "Self-service Client Registration",

View File

@ -28,7 +28,10 @@
<!-- list widget -->
<script type="text/html" id="tmpl-list-widget-child">
<td><%-(item.length > 30) ? item.substr(0,27) + '...' : item %></td>
<td>
<span class="item-short"><%-(item.length > 30) ? item.substr(0,27) + '...' : item %></span>
<input type="text" readonly style="cursor: text" class="item-full input-xxlarge" value="<%- item %>" />
</td>
<td><a class="btn btn-small btn-delete-list-item" href="#"><i class="icon-minus-sign"></i></a></td>
</script>