Commit cf015f46 authored by Kjetil Thuen's avatar Kjetil Thuen

Stop rendering hidden metadata for all list entries.

Instead: fetch data using function and inject into document when needed
parent dd0670d4
......@@ -137,7 +137,9 @@ inScroll = false;
$('body').animate({scrollTop: scrollVal}, 'fast');
details = listElem.find("div.abstract").html();
details = settings.extendedInfoFunc(listElem.attr('id'));
//listElem.find("div.abstract").html();
scrollInProgress = false;
if (details !== null) {
//FIXME: Stop depending on an existing div.abstract here
......@@ -183,7 +185,8 @@ inScroll = false;
targetId: "target",
revealDivId: "expander",
timeout: 100,
backgroundColor: "white"
backgroundColor: "white",
extendedInfoFunc: function(id){ return "<strong>" + id + "</strong>";}
}, options );
//TODO: Create the target and revealDiv elements
......
<ul class="nav nav-list" id="studies_list">
{{#each studies}}
<li id="{{id}}">
<h2>{{name}}</h2>
<div class="abstract">{{abstractText}}</div>
<div>{{name}}</div>
</li>
{{/each}}
</ul>
......@@ -9,7 +9,8 @@ head.js("http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js")
var listhtml = template(jsondata);
$('#content').html(listhtml);
$('#studies_list').listPeek({
selectedClass: "selected"
selectedClass: "selected",
extendedInfoFunc: get_metadata
});
};
......@@ -26,6 +27,19 @@ head.js("http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js")
});
};
var get_metadata = function (id) {
var studyMetadata = jsondata.studies.filter(function(v) {
return v.id === id; // filter out appropriate one
});
var metadata = "No metadata found for " + id;
if (studyMetadata.length > 0) {
metadata = studyMetadata[0].abstractText;
}
return metadata;
};
head.ready(function() {
load_data();
});
......
......@@ -12,13 +12,9 @@ function program1(depth0,data) {
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "\">\n <h2>";
+ "\">\n <div>";
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "</h2>\n <div class=\"abstract\">";
if (stack1 = helpers.abstractText) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.abstractText; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "</div>\n </li>\n ";
return buffer;
......@@ -30,4 +26,4 @@ function program1(depth0,data) {
buffer += "\n</ul>\n";
return buffer;
});
})();
\ No newline at end of file
})();
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