From 3034ce1d7802d1e52d1e7fef0619a13d6287b6a0 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 4 Jul 2013 12:34:52 +0200 Subject: [PATCH] Add city retrieval from geonamed id on input creation --- component.json | 2 +- lib/conf.d/minifyGroupsConfig.php | 5 ----- templates/web/account/account.html.twig | 6 ++---- templates/web/admin/editusers.html.twig | 2 +- templates/web/admin/index.html.twig | 2 +- .../web/login/register-classic.html.twig | 2 +- templates/web/prod/index.html.twig | 2 +- www/scripts/apps/login/home/config.js | 2 +- www/scripts/apps/login/home/register.js | 3 ++- www/scripts/common/geonames.js | 3 --- www/skins/geonames/geonames.css | 20 +++++++++++++++++++ www/skins/login/less/skin.less | 11 +--------- 12 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 www/skins/geonames/geonames.css diff --git a/component.json b/component.json index 454964057a..346f4fdda0 100644 --- a/component.json +++ b/component.json @@ -24,6 +24,6 @@ "js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip", "bootstrap-multiselect": "https://github.com/davidstutz/bootstrap-multiselect.git", "zxcvbn" : "https://github.com/lowe/zxcvbn.git", - "geonames-server-jquery-plugin" : "~0.2.0" + "geonames-server-jquery-plugin" : "~0.2" } } diff --git a/lib/conf.d/minifyGroupsConfig.php b/lib/conf.d/minifyGroupsConfig.php index 9734b6f1cb..68af354889 100644 --- a/lib/conf.d/minifyGroupsConfig.php +++ b/lib/conf.d/minifyGroupsConfig.php @@ -23,7 +23,6 @@ $groups = array( 'client' => array( '//include/jslibs/swfobject/swfobject.js' , '//include/jslibs/jquery-ui-1.10.3/jquery-ui-i18n.js' - , '//skins/geonames/geonames.js' , '//include/jslibs/jquery.cookie.js' , '//include/jquery.common.js' , '//include/jslibs/json2.js' @@ -45,7 +44,6 @@ $groups = array( , '//skins/admin/users.js' , '//skins/admin/editusers.js' , '//include/jquery.common.js' - , '//skins/geonames/geonames.js' , '//include/jquery.tooltip.js' , '//include/jslibs/jquery.contextmenu_scroll.js' , '//assets/blueimp-load-image/js/load-image.js' @@ -81,7 +79,6 @@ $groups = array( , '//assets/blueimp-load-image/js/load-image.js' , '//assets/jquery-file-upload/js/jquery.iframe-transport.js' , '//assets/jquery-file-upload/js/jquery.fileupload.js' - , '//skins/geonames/geonames.js' , '//include/jslibs/jquery.form.2.49.js' , '//include/jslibs/jquery.vertical.buttonset.js' , '//include/js/jquery.Selection.js' @@ -121,7 +118,6 @@ $groups = array( '//include/jslibs/jquery.mousewheel.js' , '//include/jquery.tooltip.js' , '//include/jslibs/swfobject/swfobject.js' - , '//skins/geonames/geonames.js' , '//include/jslibs/jquery-ui-1.10.3/jquery-ui-i18n.js' , '//include/jslibs/jquery.cookie.js' , '//include/jslibs/jquery.contextmenu_scroll.js' @@ -133,7 +129,6 @@ $groups = array( '//include/jslibs/jquery.mousewheel.js' , '//include/jquery.tooltip.js' , '//include/jslibs/swfobject/swfobject.js' - , '//skins/geonames/geonames.js' , '//include/jslibs/jquery-ui-1.10.3/jquery-ui-i18n.js' , '//include/jslibs/jquery.cookie.js' , '//include/jslibs/jquery.contextmenu_scroll.js' diff --git a/templates/web/account/account.html.twig b/templates/web/account/account.html.twig index a933840e04..20adeb9b1f 100644 --- a/templates/web/account/account.html.twig +++ b/templates/web/account/account.html.twig @@ -5,8 +5,8 @@ {% set selected = "informations" %} {% block stylesheet %} + {{ parent() }} - {##} {% endblock %} {% block javascript %} @@ -14,12 +14,10 @@ {% endblock %} diff --git a/templates/web/admin/editusers.html.twig b/templates/web/admin/editusers.html.twig index 1248f4b0b6..00d429758a 100644 --- a/templates/web/admin/editusers.html.twig +++ b/templates/web/admin/editusers.html.twig @@ -576,7 +576,7 @@ $('div.tabs').tabs(); $('#users_rights_form button#reset_rights').bind('click', function(){ - if(confirm("{% trans'Are you sure you want to reset rights?' %}")) + if(confirm("{% trans 'Are you sure you want to reset rights?' %}")) { var users = $('#users_rights_form input[name="users"]').val(); diff --git a/templates/web/admin/index.html.twig b/templates/web/admin/index.html.twig index 80373f456b..010197c466 100644 --- a/templates/web/admin/index.html.twig +++ b/templates/web/admin/index.html.twig @@ -8,7 +8,7 @@ {% endblock %} {% block stylesheet %} - + {% endblock %} diff --git a/templates/web/login/register-classic.html.twig b/templates/web/login/register-classic.html.twig index 5ca30258e8..926c3799ce 100644 --- a/templates/web/login/register-classic.html.twig +++ b/templates/web/login/register-classic.html.twig @@ -30,7 +30,7 @@ name="registerForm" method="POST" action="{{ path("login_register_classic") }}" - data-geonames-server-adress="{{ app['geonames.server-uri'] }}" + data-geonames-server-adress="{{ app['geonames.server-uri'] }}" > {% if form.vars.errors|length > 0 %}
diff --git a/templates/web/prod/index.html.twig b/templates/web/prod/index.html.twig index 900774fee5..50476ca886 100644 --- a/templates/web/prod/index.html.twig +++ b/templates/web/prod/index.html.twig @@ -79,7 +79,7 @@ .ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: right;} - + diff --git a/www/scripts/apps/login/home/config.js b/www/scripts/apps/login/home/config.js index cc46c744cf..81f260c28d 100644 --- a/www/scripts/apps/login/home/config.js +++ b/www/scripts/apps/login/home/config.js @@ -29,7 +29,7 @@ require.config({ deps: ['jquery', 'jqueryui'], exports: '$.fn.geocompleter' }, - geonames: { + "common/geonames": { deps: ["jquery.geonames"] }, multiselect: { diff --git a/www/scripts/apps/login/home/register.js b/www/scripts/apps/login/home/register.js index 345e92716c..5f0907ef06 100644 --- a/www/scripts/apps/login/home/register.js +++ b/www/scripts/apps/login/home/register.js @@ -90,7 +90,8 @@ require([ var geocompleter = geonames.init($("#geonameid"), { "server": $form.data("geonames-server-adress"), - "limit": 40 + "limit": 40, + "init-input": false }); // Positioning menu below input diff --git a/www/scripts/common/geonames.js b/www/scripts/common/geonames.js index 78f55cc8d4..f974fb7b1b 100644 --- a/www/scripts/common/geonames.js +++ b/www/scripts/common/geonames.js @@ -9,9 +9,6 @@ init: function($field, options) { var geocompleter = $field.geocompleter(options); - var geonameId = $field.val(); - - // On focus add select-state geocompleter.geocompleter("autocompleter", "on", "autocompletefocus", function(event, ui) { $("li", $(event.originalEvent.target)).closest("li").removeClass("selected"); diff --git a/www/skins/geonames/geonames.css b/www/skins/geonames/geonames.css new file mode 100644 index 0000000000..3a222d174f --- /dev/null +++ b/www/skins/geonames/geonames.css @@ -0,0 +1,20 @@ +.geocompleter-menu { + max-height: 180px; + overflow-y: auto; + /* prevent horizontal scrollbar */ + overflow-x: hidden; +} + +.geocompleter-menu .region { + font-size: 11px; + font-style: italic; + display: block; +} + +.geocompleter-input.input-loading { + background: url('/skins/icons/loaderFFF.gif') #fff center right no-repeat; +} + +.geocompleter-input.input-error { + color: red !important; +} diff --git a/www/skins/login/less/skin.less b/www/skins/login/less/skin.less index 455e5f0289..53d23bd1b2 100644 --- a/www/skins/login/less/skin.less +++ b/www/skins/login/less/skin.less @@ -798,11 +798,8 @@ form[name=registerForm] .multiselect-group { } .geocompleter-menu { - max-height: 180px; - overflow: auto; background: @backgroundSideBar; .glow(@sideBarGlow); - list-style-type: none; } .geocompleter-menu .ui-menu-item.selected { @@ -825,11 +822,9 @@ form[name=registerForm] .multiselect-group { .geocompleter-menu .region { font-size: @fontSizeMini; - font-style: italic; - display: block; } -.geocompleter-menu .highlight { +.geocompleter-menu .ui-state-highlight { background: @green; } @@ -837,10 +832,6 @@ form[name=registerForm] .multiselect-group { background: url('/skins/icons/loader-black.gif') @black center right no-repeat; } -.geocompleter-input.input-error { - color: red !important; -} - /** IE Fixes */ .lt-ie8 authentication-sidebar-language .caret {