client/js/list-bin.js
changeset 78 af9e716b01bc
parent 75 7adef9ce92aa
child 114 110f99eb417e
equal deleted inserted replaced
77:4f2511a70880 78:af9e716b01bc
     1 Rkns.ListBin = Rkns.Utils.inherit(Rkns._BaseBin);
     1 Rkns.ResourceList = {};
     2 
     2 
     3 Rkns.ListBin.prototype.resultTemplate = Rkns._.template(
     3 Rkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin);
     4     '<li class="Rk-Bin-Item Rk-ListBin-Item" draggable="true" data-uri="<%-url%>" '
     4 
       
     5 Rkns.ResourceList.Bin.prototype.resultTemplate = Rkns._.template(
       
     6     '<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true" data-uri="<%-url%>" '
     5     + 'data-title="<%-title%>" data-description="<%-description%>" data-image="<%-image%>">'
     7     + 'data-title="<%-title%>" data-description="<%-description%>" data-image="<%-image%>">'
     6     + '<% if (image) { %><img class="Rk-ListBin-Image" src="<%-image%>"><% } %></div><h4 class="Rk-ListBin-Title">'
     8     + '<% if (image) { %><img class="Rk-ResourceList-Image" src="<%-image%>"><% } %></div><h4 class="Rk-ResourceList-Title">'
     7     + '<% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>'
     9     + '<% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>'
     8     + '<% if (description) { %><p class="Rk-ListBin-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'
    10     + '<% if (description) { %><p class="Rk-ResourceList-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'
     9 );
    11 );
    10 
    12 
    11 Rkns.ListBin.prototype._init = function(_renkan, _opts) {
    13 Rkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {
    12 	this.renkan = _renkan;
    14 	this.renkan = _renkan;
    13     this.title_$.html(_opts.title);
    15     this.title_$.html(_opts.title);
    14     if (_opts.list) {
    16     if (_opts.list) {
    15     	this.data = _opts.list;
    17     	this.data = _opts.list;
    16     }
    18     }
    17     this.refresh();
    19     this.refresh();
    18 }
    20 }
    19 
    21 
    20 Rkns.ListBin.prototype.render = function(searchstr) {
    22 Rkns.ResourceList.Bin.prototype.render = function(searchstr) {
    21     if (searchstr) {
    23     if (searchstr) {
    22     	var _rgxp = new RegExp('('+(searchstr).replace(/(\W)/g,'\\$1')+')','gi'),
    24     	var _rgxp = new RegExp('('+(searchstr).replace(/(\W)/g,'\\$1')+')','gi'),
    23     		rxtest = new RegExp(searchstr.replace(/(\W)/g,'\\$1'),'i');
    25     		rxtest = new RegExp(searchstr.replace(/(\W)/g,'\\$1'),'i');
    24     }
    26     }
    25     function highlight(_text) {
    27     function highlight(_text) {
    83         this.$.show();
    85         this.$.show();
    84     }
    86     }
    85     this.renkan.resizeBins();
    87     this.renkan.resizeBins();
    86 }
    88 }
    87     
    89     
    88 Rkns.ListBin.prototype.refresh = function() {
    90 Rkns.ResourceList.Bin.prototype.refresh = function() {
    89     if (this.data) {
    91     if (this.data) {
    90     	this.render();
    92     	this.render();
    91     }
    93     }
    92 }
    94 }