widget that searches WIMP, based on reference UNIVERSE, MKWS-266
authorWolfram Schneider <wosch@indexdata.dk>
Tue, 9 Sep 2014 14:48:07 +0000 (14:48 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Tue, 9 Sep 2014 14:48:07 +0000 (14:48 +0000)
examples/htdocs/mkws-widget-wimp.css [new file with mode: 0644]
examples/htdocs/mkws-widget-wimp.html [new file with mode: 0644]
examples/htdocs/mkws-widget-wimp.js [new file with mode: 0644]

diff --git a/examples/htdocs/mkws-widget-wimp.css b/examples/htdocs/mkws-widget-wimp.css
new file mode 100644 (file)
index 0000000..0d5c684
--- /dev/null
@@ -0,0 +1,37 @@
+.mkwsReferenceUniverse {
+  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+  background: #FCFBFA;
+  padding: 0.5em 1em 0.25em;
+  box-shadow: 0 0 2px 0 #7F8F93;
+  border-radius: 0 0 1.5em;
+  -moz-border-radius: 0 0 1.5em;
+  -webkit-border-radius: 0 0 1.5em;
+  line-height: 1.4;
+  color: #86979B;
+  background: radial-gradient(ellipse at center,  #ffffff 0%,#f8f8f8 100%);
+}
+
+h2 {
+  font-size: 100%;
+  color: #4A5456;
+  padding-bottom: .5em;
+}
+
+ul {
+  margin: 0;
+  padding: 0;
+}
+
+li {
+  margin: .95em .25em;
+  padding-top: .75em;
+  border-top: 1px dotted #BEC8CC;
+  font-size: 90%;
+  list-style: none;
+}
+
+a {
+  text-decoration: none;
+  font-weight:bold;
+  color: #2B77AF;
+}
diff --git a/examples/htdocs/mkws-widget-wimp.html b/examples/htdocs/mkws-widget-wimp.html
new file mode 100644 (file)
index 0000000..b8fa131
--- /dev/null
@@ -0,0 +1,8 @@
+<html>
+  <div style="max-width: 18em; margin: 1.5em 1.5em">
+    <script src="//mkws.indexdata.com/mkws-complete.js"></script>
+    <script src="mkws-widget-wimp.js"></script>
+    <link rel="stylesheet" type="text/css" href="mkws-widget-wimp.css" />
+    <div class="mkwsReferenceUniverse" autosearch="!param!q"></div>
+  </div>
+</html>
diff --git a/examples/htdocs/mkws-widget-wimp.js b/examples/htdocs/mkws-widget-wimp.js
new file mode 100644 (file)
index 0000000..55b4488
--- /dev/null
@@ -0,0 +1,36 @@
+var mkws_config = {
+   service_proxy_auth: "http://mkws.indexdata.com/service-proxy/?command=auth&action=login&username=paratext&password=paratext_mkc"
+};
+
+mkws.registerWidgetType('ReferenceUniverse', function() {
+  if (!this.config.perpage) this.config.perpage = 5;
+  if (!this.config.sort) this.config.sort = "position";
+  this.team.registerTemplate('ReferenceUniverse', '\
+<h2>Results from Reference Universe</h2>\
+<ul>\
+{{#each hits}}\
+  <li>\
+    {{#mkws-first md-electronic-url}}\
+    <a href="{{this}}">\
+    {{/mkws-first}}\
+      {{md-title}}\
+    </a>\
+  {{#if md-title-remainder}}\
+    <span>{{md-title-remainder}}</span>\
+  {{/if}}\
+  {{#if md-title-responsibility}}\
+    <span><i>{{md-title-responsibility}}</i></span>\
+  {{/if}}\
+  </li>\
+{{/each}}\
+</ul>\
+');
+
+  var that = this;
+  var template = that.team.loadTemplate(that.config.template || "ReferenceUniverse");
+  this.team.queue("records").subscribe(function(data) {
+    that.node.html(template(data));
+  }); 
+  that.autosearch();
+});
+