# HG changeset patch # User veltr # Date 1363256973 -3600 # Node ID af9e716b01bcbd1a009fce2548df5cca64a5c933 # Parent 4f2511a70880d8c5e46c6aedadf4c59647b9bf03 Renkan bin configuration now with class names instead of classes themselves diff -r 4f2511a70880 -r af9e716b01bc client/css/renkan.css --- a/client/css/renkan.css Thu Mar 14 00:29:09 2013 +0100 +++ b/client/css/renkan.css Thu Mar 14 11:29:33 2013 +0100 @@ -422,7 +422,7 @@ background: -moz-linear-gradient(top, #505050 20%, #1e1e1e 80%); background: -webkit-linear-gradient(top, #505050 20%, #1e1e1e 80%); border-bottom: 1px solid #666666; font-weight: bold; - font-size: 14px; padding: 5px 5px 5px 30px; cursor: pointer; color: #f0f0f0; + font-size: 14px; padding: 5px; cursor: pointer; color: #f0f0f0; } .Rk-Bin-Close { @@ -564,7 +564,7 @@ margin-left: 54px; } -.Rk-ListBin-Image { +.Rk-ResourceList-Image { float: left; max-width: 100px; max-height: 75px; margin-right: 2px; } diff -r 4f2511a70880 -r af9e716b01bc client/js/ldtjson-bin.js --- a/client/js/ldtjson-bin.js Thu Mar 14 00:29:09 2013 +0100 +++ b/client/js/ldtjson-bin.js Thu Mar 14 11:29:33 2013 +0100 @@ -1,5 +1,15 @@ Rkns.Ldt = {} +Rkns.Ldt.Bin = function(_renkan, _opts) { + if (_opts.ldt_type) { + var resclass = Rkns.Ldt[_opts.ldt_type+"Bin"]; + if (resclass) { + return new resclass(_renkan, _opts); + } + } + console.error("No such LDT Bin Type"); +} + Rkns.Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin); Rkns.Ldt.ProjectBin.prototype.tagTemplate = Rkns._.template( @@ -13,6 +23,7 @@ ); Rkns.Ldt.ProjectBin.prototype._init = function(_renkan, _opts) { + console.log("Initializing Project Bin"); this.renkan = _renkan; this.proj_id = _opts.project_id; this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; diff -r 4f2511a70880 -r af9e716b01bc client/js/list-bin.js --- a/client/js/list-bin.js Thu Mar 14 00:29:09 2013 +0100 +++ b/client/js/list-bin.js Thu Mar 14 11:29:33 2013 +0100 @@ -1,14 +1,16 @@ -Rkns.ListBin = Rkns.Utils.inherit(Rkns._BaseBin); +Rkns.ResourceList = {}; + +Rkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin); -Rkns.ListBin.prototype.resultTemplate = Rkns._.template( - '
<%=hdescription%>
<% } %><% if (image) { %><% } %><%=hdescription%>
<% } %><% if (image) { %><% } %>' ); -Rkns.ListBin.prototype._init = function(_renkan, _opts) { +Rkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) { this.renkan = _renkan; this.title_$.html(_opts.title); if (_opts.list) { @@ -17,7 +19,7 @@ this.refresh(); } -Rkns.ListBin.prototype.render = function(searchstr) { +Rkns.ResourceList.Bin.prototype.render = function(searchstr) { if (searchstr) { var _rgxp = new RegExp('('+(searchstr).replace(/(\W)/g,'\\$1')+')','gi'), rxtest = new RegExp(searchstr.replace(/(\W)/g,'\\$1'),'i'); @@ -85,7 +87,7 @@ this.renkan.resizeBins(); } -Rkns.ListBin.prototype.refresh = function() { +Rkns.ResourceList.Bin.prototype.refresh = function() { if (this.data) { this.render(); } diff -r 4f2511a70880 -r af9e716b01bc client/js/main.js --- a/client/js/main.js Thu Mar 14 00:29:09 2013 +0100 +++ b/client/js/main.js Thu Mar 14 11:29:33 2013 +0100 @@ -164,9 +164,12 @@ _input = this.$.find(".Rk-Web-Search-Input") _form = this.$.find(".Rk-Web-Search-Form"); Rkns._(_opts.search).each(function(_search, _key) { - var _searchObj = new _search.type(_this, _search); - _this.search_engines.push(_searchObj); + console.log(_search, Rkns[_search.type]); + if (Rkns[_search.type] && Rkns[_search.type].Search) { + _this.search_engines.push(new Rkns[_search.type].Search(_this, _search)); + } }); + console.log(_this.search_engines); _select.html( Rkns._(this.search_engines).map(function(_search, _key) { return _tmpl({ @@ -197,7 +200,9 @@ this.setSearchEngine(0); } Rkns._(_opts.bins).each(function(_bin) { - _this.tabs.push(new _bin.bin(_this, _bin)); + if (Rkns[_bin.type] && Rkns[_bin.type].Bin) { + _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin)); + } }); this.$.find(".Rk-Bins") diff -r 4f2511a70880 -r af9e716b01bc client/render-test.html --- a/client/render-test.html Thu Mar 14 00:29:09 2013 +0100 +++ b/client/render-test.html Thu Mar 14 11:29:33 2013 +0100 @@ -28,7 +28,14 @@ url: "data/simple-persist.php", bins: [ { - bin: Rkns.ListBin, + title: "Projet Lignes de Temps", + type: "Ldt", + ldt_type: "Project", + project_id: "6af4019c-8283-11e2-9678-00145ea4a2be", + ldt_platform: "http://ldt.iri.centrepompidou.fr/" + }, + { + type: "ResourceList", title: "Ressources", list: [ { @@ -36,30 +43,22 @@ title: "Google", description: "Search engine", image: "http://www.google.fr/images/srpr/logo4w.png" - }, { - url: "http://www.twitter.com/" - } + }, + "Polemic Tweet http://www.polemictweet.com", + "Twitter http://www.twitter.com/" ] } ], search: [ { - type: Rkns.Ldt.Search + type: "Ldt" }, { - type: Rkns.Wikipedia.Search, + type: "Wikipedia", lang: "fr" }, { - type: Rkns.Wikipedia.Search, - lang: "en" - }, - { - type: Rkns.Wikipedia.Search, - lang: "ja" - }, - { - type: Rkns.Twitter.Search + type: "Twitter" } ], property_files: [ "data/properties.json" ],