X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-core.js;h=ff619bd2139f1d302cdd3b3fc12da912aeacee5b;hb=950eab978b2dea68dc7cf12947d3519c88373305;hp=e08958fa5b54cb04aae8201b4eb8c17a83359522;hpb=96aafc9ffce3645b210d56f9120f5e62d2866d1b;p=mkws-moved-to-github.git
diff --git a/src/mkws-core.js b/src/mkws-core.js
index e08958f..ff619bd 100644
--- a/src/mkws-core.js
+++ b/src/mkws-core.js
@@ -164,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.
@@ -243,29 +332,28 @@ mkws.pagerNext = function(tname) {
function resizePage() {
var list = ["mkwsSwitch", "mkwsLang"];
- var width = mkws.config.responsive_design_width;
- var parent = $(".mkwsTermlists").parent();
-
- if ($(window).width() <= width &&
- parent.hasClass("mkwsTermlistContainer1")) {
- log("changing from wide to narrow: " + $(window).width());
- $(".mkwsTermlistContainer1").hide();
- $(".mkwsTermlistContainer2").show();
- for (var tname in mkws.teams) {
- $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlistContainer2.mkwsTeam_" + tname));
- for(var i = 0; i < list.length; i++) {
- $("." + list[i] + ".mkwsTeam_" + tname).hide();
- }
- }
- } else if ($(window).width() > width &&
- parent.hasClass("mkwsTermlistContainer2")) {
- log("changing from narrow to wide: " + $(window).width());
- $(".mkwsTermlistContainer1").show();
- $(".mkwsTermlistContainer2").hide();
+ var threshhold = mkws.config.responsive_design_width;
+ var width = $(window).width();
+ var from, to, method;
+
+ if (mkws.width === undefined) {
+ // No state change, since we have no previous state
+ } else if (mkws.width > threshhold && width <= threshhold) {
+ from = "wide"; to = "narrow"; method = "hide";
+ } else if (mkws.width <= threshhold && width > threshhold) {
+ from = "narrow"; to = "wide"; method = "show";
+ }
+ mkws.width = width;
+
+ if (from) {
+ log("changing from " + from + " to " + to + ": " + width);
+ $(".mkwsTermlist-Container-" + from).hide();
+ $(".mkwsTermlist-Container-" + to).show();
for (var tname in mkws.teams) {
- $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlistContainer1.mkwsTeam_" + tname));
+ mkws.teams[tname].queue("resize" + to).publish();
+ $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlist-Container-" + to + ".mkwsTeam_" + tname));
for(var i = 0; i < list.length; i++) {
- $("." + list[i] + ".mkwsTeam_" + tname).show();
+ $("." + list[i] + ".mkwsTeam_" + tname)[method]();
}
}
}