Skip to content

Commit

Permalink
Move the prog reset button into the filter_sum box & hide it when app…
Browse files Browse the repository at this point in the history
…ropriate
  • Loading branch information
eemeli committed Jul 16, 2017
1 parent 984e501 commit bcf1785
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ <h1><a href="#info" alt="CONVENTION" title="CONVENTION">
<input type="text" id="q" required data-txt="Search" data-txt-attr="placeholder">
<div id="q_ctrl">
<input type="submit" id="q_submit" data-txt="Go" data-txt-attr="value">
<input type="reset" id="q_clear" data-txt="Clear all" data-txt-attr="value">
</div>
<div id="q_hint" class="hint"></div>
<div id="filter_sum_wrap">
<input type="reset" id="q_clear" data-txt="Clear all" data-txt-attr="value">
<div id="filter_sum"></div>
</div>
</form>
<div id="filter_sum"></div>
</div>
<div id="day-narrow" class="sub-narrow"></div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions skin/prog.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
#q:valid { background: @bg-highlight; }
#q:valid + #q_ctrl input { border-color: @fg-highlight; }
#q_fix b { color: @fg-highlight; }
#q_clear { margin-left: 14px !important; }

#filter_sum {
#q_clear { float: right; }
#q_clear:disabled { visibility: hidden; }

#filter_sum_wrap {
clear: left;
max-width: (@full-width - 24px);
margin: @side-margin 0 0 @side-margin;
Expand Down
3 changes: 3 additions & 0 deletions src/prog.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,14 @@ KonOpas.Prog.prototype.init_filters = function(opt) {

KonOpas.Prog.prototype.show_filter_sum = function(ls, f) {
var fs = _el('filter_sum'); if (!fs) return;
var cb = _el('q_clear');
var _a = function(txt, unset) {
var excl = {id:1}; if (unset) excl[unset] = 1;
return '<a href="' + KonOpas.Prog.hash(f, excl) + '">' + txt + '</a>';
}
if (f.id_only) {
fs.innerHTML = i18n.txt('filter_sum_id', { 'N':ls.length, 'TITLE':_a(ls[0].title), 'ID':_a(f.id) });
if (cb) cb.disabled = false;
} else {
var d = { 'N': f.n_listed,
'ALL': !f.show_all || f.tag_str || f.area_str || f.query_str ? '' : _a(i18n.txt('all'), {}, 0),
Expand All @@ -304,6 +306,7 @@ KonOpas.Prog.prototype.show_filter_sum = function(ls, f) {
if (f.area_str) d['AREA'] = _a(f.area_str, 'area');
if (f.query_str) d['Q'] = _a(f.query_str, 'query');
fs.innerHTML = i18n.txt('filter_sum', d);
if (cb) cb.disabled = !f.area_str && !f.tag_str && !f.query_str;
}
}

Expand Down

0 comments on commit bcf1785

Please sign in to comment.