Added cutoff switch to second frontend
diff --git a/public/sass/style.scss b/public/sass/style.scss
index 3c42fce..88354a7 100644
--- a/public/sass/style.scss
+++ b/public/sass/style.scss
@@ -183,6 +183,36 @@
}
}
+/*
+http://stackoverflow.com/questions/4148499/how-to-style-checkbox-using-css
+*/
+
+#q-cutoff-field {
+ display: none;
+ + label span {
+ border-radius: 4px;
+ display: inline-block;
+ background-color: white;
+ width: 12px;
+ height: 12px;
+ cursor: pointer;
+ vertical-align: middle;
+ line-height: 12px;
+ padding: 0;
+ margin-right: .3em;
+ :hover {
+ border-color: white;
+ }
+ }
+ &:checked + label span {
+ :after {
+ content:"\f00c";
+ color: $light-green;
+ font-family: FontAwesome;
+ }
+ }
+}
+
#q-field {
border: 2px solid white;
padding: 3px;
@@ -322,4 +352,4 @@
border-left-color: red;
}
}
-}
\ No newline at end of file
+}
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index 2c2030c..71c56b3 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -63,9 +63,11 @@
<div class="select">
%= select_field ql => [[Poliqarp => 'poliqarp'], ['Cosmas II' => 'cosmas2'], ['Annis' => 'annis'], ['CQL v1.2' => 'cql']], id => 'ql-field'
</div>
-%= hidden_field 'cutoff' => 0, id => 'q-cutoff-field'
<div id="button-right">
+% unless (param('q')) { param(cutoff => 1) };
+%= check_box cutoff => 1, id => 'q-cutoff-field'
+<label for="q-cutoff-field"><span></span>Quick</label>
% unless (current_route 'tutorial') {
<button type="button" title="Tutorial" onclick="openTutorial()"><i class="fa fa-graduation-cap"></i></button>
% };
diff --git a/templates/partial/javascript.html.ep b/templates/partial/javascript.html.ep
index 055ddf2..cad5ac7 100644
--- a/templates/partial/javascript.html.ep
+++ b/templates/partial/javascript.html.ep
@@ -77,11 +77,12 @@
var q = o.getAttribute("data-query");
var ql = o.getAttribute("data-query-language");
var qc = o.getAttribute("data-query-cutoff");
- if (qc === null)
- qc = 0;
+ if (qc !== 0 && qc !== "0" && qc !== "off" && qc !== null)
+ $("#q-cutoff-field").prop('checked', true);
+
$("#ql-field").val(ql);
$("#q-field").val(q);
- $("#q-cutoff-field").val(qc);
+
closeTutorial();
};