X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-core.js;h=4a48c485335e9db9f1e1eef428d804af84906688;hb=6bf13517fbd14d3847f45acf802395dbe0742974;hp=0bfc174472329b0f097dc8040f87ae9daca12bed;hpb=96ff13c77214b76cb54dbaa6b9fae081a856738f;p=mkws-moved-to-github.git
diff --git a/src/mkws-core.js b/src/mkws-core.js
index 0bfc174..4a48c48 100644
--- a/src/mkws-core.js
+++ b/src/mkws-core.js
@@ -88,7 +88,8 @@ mkws.log = function(string) {
// you need to disable use strict at the top of the file!!!
if (mkws.log_level >= 3) {
- console.log(arguments.callee.caller);
+ // Works in Chrome; not sure about elsewhere
+ console.trace();
} else if (mkws.log_level >= 2) {
console.log(">>> called from function " + arguments.callee.caller.name + ' <<<');
}
@@ -163,6 +164,95 @@ mkws.objectInheritingFrom = function(o) {
}
+mkws.defaultTemplate = function(name) {
+ if (name === 'Record') {
+ return '\
+
\
+ \
+ {{translate "Title"}} | \
+ \
+ {{md-title}}\
+ {{#if md-title-remainder}}\
+ ({{md-title-remainder}})\
+ {{/if}}\
+ {{#if md-title-responsibility}}\
+ {{md-title-responsibility}}\
+ {{/if}}\
+ | \
+
\
+ {{#if md-date}}\
+ \
+ {{translate "Date"}} | \
+ {{md-date}} | \
+
\
+ {{/if}}\
+ {{#if md-author}}\
+ \
+ {{translate "Author"}} | \
+ {{md-author}} | \
+
\
+ {{/if}}\
+ {{#if md-electronic-url}}\
+ \
+ {{translate "Links"}} | \
+ \
+ {{#each md-electronic-url}}\
+ Link{{index1}}\
+ {{/each}}\
+ | \
+
\
+ {{/if}}\
+ {{#if-any location having="md-subject"}}\
+ \
+ {{translate "Subject"}} | \
+ \
+ {{#first location having="md-subject"}}\
+ {{#if md-subject}}\
+ {{#commaList md-subject}}\
+ {{this}}{{/commaList}}\
+ {{/if}}\
+ {{/first}}\
+ | \
+
\
+ {{/if-any}}\
+ \
+ {{translate "Locations"}} | \
+ \
+ {{#commaList location}}\
+ {{attr "@name"}}{{/commaList}}\
+ | \
+
\
+
\
+';
+ } else if (name === "Summary") {
+ return '\
+\
+ {{md-title}}\
+\
+{{#if md-title-remainder}}\
+ {{md-title-remainder}}\
+{{/if}}\
+{{#if md-title-responsibility}}\
+ {{md-title-responsibility}}\
+{{/if}}\
+';
+ } else if (name === "Image") {
+ return '\
+ \
+ {{#first md-thumburl}}\
+ \
+ {{/first}}\
+
\
+ \
+';
+ }
+
+ var s = "There is no default '" + name +"' template!";
+ alert(s);
+ return s;
+};
+
+
// The following functions are dispatchers for team methods that
// are called from the UI using a team-name rather than implicit
// context.
@@ -246,23 +336,25 @@ mkws.pagerNext = function(tname) {
var parent = $(".mkwsTermlists").parent();
if ($(window).width() <= width &&
- parent.hasClass("mkwsTermlistContainer1")) {
+ parent.hasClass("mkwsTermlist-Container-wide")) {
log("changing from wide to narrow: " + $(window).width());
- $(".mkwsTermlistContainer1").hide();
- $(".mkwsTermlistContainer2").show();
+ $(".mkwsTermlist-Container-wide").hide();
+ $(".mkwsTermlist-Container-narrow").show();
for (var tname in mkws.teams) {
- $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlistContainer2.mkwsTeam_" + tname));
+ mkws.teams[tname].queue("resize-narrow").publish();
+ $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlist-Container-narrow.mkwsTeam_" + tname));
for(var i = 0; i < list.length; i++) {
$("." + list[i] + ".mkwsTeam_" + tname).hide();
}
}
} else if ($(window).width() > width &&
- parent.hasClass("mkwsTermlistContainer2")) {
+ parent.hasClass("mkwsTermlist-Container-narrow")) {
log("changing from narrow to wide: " + $(window).width());
- $(".mkwsTermlistContainer1").show();
- $(".mkwsTermlistContainer2").hide();
+ $(".mkwsTermlist-Container-wide").show();
+ $(".mkwsTermlist-Container-narrow").hide();
for (var tname in mkws.teams) {
- $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlistContainer1.mkwsTeam_" + tname));
+ mkws.teams[tname].queue("resize-wide").publish();
+ $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlist-Container-wide.mkwsTeam_" + tname));
for(var i = 0; i < list.length; i++) {
$("." + list[i] + ".mkwsTeam_" + tname).show();
}