remove Go button from locale form on noscript

primarily because it's confusing for advanced search and looks like
the form's submit button - at least according to lavelle ;P
This commit is contained in:
Emi Matchu 2014-04-02 22:15:15 -05:00
parent ad1aa8e42c
commit 7e73313d43
3 changed files with 12 additions and 8 deletions

View file

@ -0,0 +1,3 @@
document.getElementById('locale').addEventListener('change', function() {
document.getElementById('locale-form').submit();
});

View file

@ -314,6 +314,7 @@ View.Hash = function (wardrobe) {
previous_query = new_query;
document.location.hash = '#' + new_query;
updateLinksWithReturnTo();
updateLocaleForm();
}
function updateLinksWithReturnTo() {
@ -327,6 +328,12 @@ View.Hash = function (wardrobe) {
});
}
function updateLocaleForm() {
var fullPath = document.location.pathname + document.location.search +
document.location.hash;
$('#locale-form').find('input[name=return_to]').val(fullPath);
}
this.initialize = function () {
checkQuery();
setInterval(checkQuery, 100);
@ -1362,13 +1369,6 @@ userbar_sessions_link.hover(function () {
userbar_message_el.stop().fadeOut('fast');
});
var localeForm = $('#locale-form');
localeForm.submit(function (e) {
var fullPath = document.location.pathname + document.location.search +
document.location.hash;
localeForm.find('input[name=return_to]').val(fullPath);
});
$.ajaxSetup({
error: function (xhr) {
$.jGrowl("There was an error loading that last resource. Oops. Please try again!");

View file

@ -57,7 +57,7 @@
= form_tag choose_locale_path, :id => 'locale-form' do
= hidden_field_tag 'return_to', request.fullpath
= select_tag 'locale', options_for_select(locale_options, locale)
= submit_tag 'Go'
%noscript= submit_tag 'Go'
%ul
%li= link_to t('organization_name'), 'http://openneo.net/'
@ -74,5 +74,6 @@
%p= t '.footer.copyright', :year => Date.today.year
= javascript_include_tag 'application'
= yield(:javascripts)