Skip to content
Snippets Groups Projects
Commit 00dbfc71 authored by anonymous's avatar anonymous
Browse files

layout changes for rangesearch

parent 180e46b6
Branches
Tags
No related merge requests found
$(document).ready(function() { $(document).ready(function() {
$('.mylabel').click(function() { $('.mylabel').click(function() {
console.log($(this).siblings());
window.location = $(this).siblings('a').attr('href'); window.location = $(this).siblings('a').attr('href');
}); });
}); });
......
ckan.module('odsh_rangesearch', function ($)
{
return {
initialize: function ()
{
var start = $("#ext_startdate")
var end = $("#ext_enddate")
var checkbox = $('#check-rangefilter')
var label = $('#rangesearch-label')
label.click(function ()
{
if (label.hasClass('checked'))
{
start.val('')
end.val('')
}
if (!label.hasClass('disabled'))
$('#date-search-form').submit();
});
var updateCheckbox = function ()
{
var enable = (start.val() || end.val())
label.toggleClass('disabled', !enable);
if (!enable)
$('#date-search-form').submit();
};
start.change(updateCheckbox)
end.change(updateCheckbox)
}
};
});
\ No newline at end of file
...@@ -260,7 +260,8 @@ input[type=radio], input[type=checkbox] { ...@@ -260,7 +260,8 @@ input[type=radio], input[type=checkbox] {
display:none; display:none;
} }
/* input[type=checkbox] + label.checkbox, */
label.rangesearch,
input[type=checkbox] + label.mylabel { input[type=checkbox] + label.mylabel {
background: #fff; background: #fff;
border: 1px solid black; border: 1px solid black;
...@@ -271,12 +272,8 @@ input[type=checkbox] + label.mylabel { ...@@ -271,12 +272,8 @@ input[type=checkbox] + label.mylabel {
margin-bottom: 0px; margin-bottom: 0px;
min-height: 8px; min-height: 8px;
} }
/* input[type=checkbox] + label.checkbox{
border: 1px solid black;
} */
/* input[type=checkbox]:checked + label.checkbox, */ label.rangesearch.checked,
input[type=checkbox]:checked + label.mylabel { input[type=checkbox]:checked + label.mylabel {
background: url(/base/images/checked.png); background: url(/base/images/checked.png);
background-color: #fff; background-color: #fff;
...@@ -290,14 +287,12 @@ input[type=checkbox]:checked + label.mylabel { ...@@ -290,14 +287,12 @@ input[type=checkbox]:checked + label.mylabel {
margin-bottom: 0px; margin-bottom: 0px;
} }
/* .checklabel .controls > .checkbox:first-child {
padding-top: 0px;
} */
.checklabel input[type="checkbox"] .checklabel input[type="checkbox"]
{ {
float: inherit; float: inherit;
} }
label.rangesearch,
label.mylabel { label.mylabel {
margin-right: 3px; margin-right: 3px;
margin-bottom: 0px; margin-bottom: 0px;
...@@ -307,10 +302,37 @@ label.mylabel { ...@@ -307,10 +302,37 @@ label.mylabel {
user-select: none; /* Standard */ user-select: none; /* Standard */
} }
label.rangesearch::after,
label.mylabel::after { label.mylabel::after {
content: ""; content: "";
} }
label.rangesearch.disabled {
cursor: default;
border-color: #999999;
}
.rangesearch-controls{
margin-top:10px;
}
.rangesearch{
display: inline-block;
}
.controls input.rangesearch{
width:155px;
padding: 2px;
font-size: 12px;
line-height: 1.16666667em;
}
.controls.rangesearch label{
font-size: 12px;
line-height: 1.16666667em;
color:black
}
/* following makes the secondary span (left side, facets etc.) the same height as the primary span */ /* following makes the secondary span (left side, facets etc.) the same height as the primary span */
/* see: https://scotch.io/bar-talk/different-tricks-on-how-to-make-bootstrap-columns-all-the-same-height */ /* see: https://scotch.io/bar-talk/different-tricks-on-how-to-make-bootstrap-columns-all-the-same-height */
.is-table-row { .is-table-row {
......
...@@ -32,15 +32,35 @@ default_extent="{ \"type\": \"Polygon\", \"coordinates\": [[[7.6574,53.1632],[11 ...@@ -32,15 +32,35 @@ default_extent="{ \"type\": \"Polygon\", \"coordinates\": [[[7.6574,53.1632],[11
</div> </div>
{% block datereange_search %} {% block datereange_search %}
<form id="date-search-form" method="get" action="{% url_for controller='package', action='search' %}"> {% resource 'odsh/odsh_rangesearch.js' %}
{{ form.input_raw('ext_startdate', id='ext_startdate', value=request.params['ext_startdate'], {% set has_range_filter = request.params.get('ext_startdate') or request.params.get('ext_enddate') %}
classes=['control-full'],type='date',placeholder=_('from')) <section class="module module-narrow module-shallow">
}} <nav>
{{ form.input_raw('ext_enddate', id='ext_enddate', value=request.params['ext_enddate'], <div class="nav-title">{{_('timerange')}}</div>
classes=['control-full'],type='date',placeholder=_('to')) <div class="rangesearch-controls">
}} <form id="date-search-form" method="get" action="{% url_for controller='package', action='search' %}" data-module="odsh_rangesearch">
<a href="javascript:{}" onclick="$('#date-search-form').submit();" class="action">{{_('submit date search') }}</a> <div class='span1'>
<label id="rangesearch-label" class="rangesearch {% if has_range_filter %} checked {%else%} disabled {% endif %}"></label>
</div>
<div class='span1'>
<div class='controls rangesearch'>
{%- set start = request.params['ext_startdate'] -%}
{%- set end = request.params['ext_enddate'] -%}
{%- set typeStart = 'text' if not start else 'date' -%}
{%- set typeEnd = 'text' if not end else 'date' -%}
{%- set onFocus = 'onfocus=(this.type=\'date\')' -%}
<label for="ext_startdate">{{_('from')|title}}</label>
<input id="ext_startdate" name="ext_startdate" type="{{ typeStart }}" value="{{start}}" placeholder="{{ _('Date') }}"
{{ onFocus }} class='rangesearch' />
<label for="ext_enddate">{{_('to')|title}}</label>
<input id="ext_enddate" name="ext_enddate" type="{{ typeEnd }}" value="{{end}}" placeholder="{{ _('Date') }}"
{{ onFocus }} class='rangesearch' />
</div>
</div>
</form> </form>
</div>
</nav>
</section>
{% endblock %} {% endblock %}
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment