Skip to content

Commit

Permalink
hide non js required elements on render
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Jul 20, 2012
1 parent d83a376 commit f601e7e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
5 changes: 0 additions & 5 deletions ckan/public/base/javascript/modules/select-switch.js
Expand Up @@ -19,7 +19,6 @@ this.ckan.module('select-switch', {

options: {
target: 'select',
button: '[type=submit]'
},

initialize: function () {
Expand All @@ -28,9 +27,5 @@ this.ckan.module('select-switch', {
this.el.on('change', this.options.target, function () {
_this.el.submit();
});

if (this.options.button) {
this.$(this.options.button).hide();
}
}
});
4 changes: 4 additions & 0 deletions ckan/public/base/less/forms.less
@@ -1,3 +1,7 @@
html.js .js-hide {
display:none;

This comment has been minimized.

Copy link
@aron

aron Jul 20, 2012

Contributor

Two spaces please :)

This comment has been minimized.

Copy link
@aron

aron Jul 20, 2012

Contributor

Oh and remove the html (so if we move class to body it still works) and rename to hidden (there's an html attribute called hidden). So it's just .js .js-hidden

}

.btn,
label {
font-weight: bold;
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/package/search.html
Expand Up @@ -9,7 +9,7 @@
{% block primary_content %}
<section class="module">
<div class="module-content">
<form id="dataset-search" class="dataset-search clearfix" method="get" data-module="select-switch" data-module-button="#submit-order-by">
<form id="dataset-search" class="dataset-search clearfix" method="get" data-module="select-switch">
<span class="control-group search-giant">
<input type="text" class="search" name="q" value="{{ c.q }}" autocomplete="off" results="0" placeholder="{{ _('Search...') }}" />
<button type="submit" value="{{ _('Search') }}">Submit</button>
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/snippets/language_selector.html
Expand Up @@ -9,5 +9,5 @@
</option>
{% endfor %}
</select>
<button class="btn" type="submit">{{ _('Go') }}</button>
<button class="btn js-hide" type="submit">{{ _('Go') }}</button>
</form>
2 changes: 1 addition & 1 deletion ckan/templates/snippets/sort_by.html
Expand Up @@ -7,5 +7,5 @@
<option value="metadata_modified desc"{% if sort=='metadata_modified desc' %} selected="selected"{% endif %}>{{ _('Last Modified') }}</option>
<option value="views_recent desc"{% if sort=='views_recent desc' %} selected="selected"{% endif %}>{{ _('Popular') }}</option>
</select>
<button id="submit-order-by" class="btn" type="submit">Go</button>
<button class="btn js-hide" type="submit">Go</button>
</span>

0 comments on commit f601e7e

Please sign in to comment.