diff options
author | Bharat Mediratta <bharat@menalto.com> | 2013-02-23 01:09:30 -0500 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2013-02-23 01:09:30 -0500 |
commit | 9d6ed037bb5b346fba900c17ba57b34dae3b6fc8 (patch) | |
tree | 2caddad82bfa6a6ad5f45ea0199c2d0539278026 /modules | |
parent | 42878556cf38bccfea2b9b38ab2c8dd90d1ebc88 (diff) | |
parent | f95159c0b886a2ff724d6fa9a9315460186b02ef (diff) |
Merge branch 'jquery_190'
Diffstat (limited to 'modules')
-rw-r--r-- | modules/g2_import/controllers/admin_g2_import.php | 6 | ||||
-rw-r--r-- | modules/g2_import/views/admin_g2_import.html.php | 9 | ||||
-rw-r--r-- | modules/gallery/css/gallery.css | 15 | ||||
-rw-r--r-- | modules/server_add/controllers/admin_server_add.php | 6 | ||||
-rw-r--r-- | modules/server_add/views/admin_server_add.html.php | 5 | ||||
-rw-r--r-- | modules/tag/controllers/tags.php | 9 | ||||
-rw-r--r-- | modules/tag/helpers/tag_event.php | 5 | ||||
-rw-r--r-- | modules/tag/views/tag_block.html.php | 16 | ||||
-rw-r--r-- | modules/user/js/password_strength.js | 71 |
9 files changed, 73 insertions, 69 deletions
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index c4f03907..08007b85 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -101,10 +101,10 @@ class Admin_g2_import_Controller extends Admin_Controller { public function autocomplete() { $directories = array(); - $path_prefix = Input::instance()->get("q"); + $path_prefix = Input::instance()->get("term"); foreach (glob("{$path_prefix}*") as $file) { if (is_dir($file) && !is_link($file)) { - $file = html::clean($file); + $file = (string)html::clean($file); $directories[] = $file; // If we find an embed.php, include it as well @@ -114,7 +114,7 @@ class Admin_g2_import_Controller extends Admin_Controller { } } - ajax::response(implode("\n", $directories)); + ajax::response(json_encode($directories)); } private function _get_import_form() { diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 22e19f5b..fd9487e4 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -5,10 +5,7 @@ $("document").ready(function() { $("form input[name=embed_path]").gallery_autocomplete( "<?= url::site("__ARGS__") ?>".replace("__ARGS__", "admin/g2_import/autocomplete"), - { - max: 256, - loadingClass: "g-loading-small", - }); + {}); }); </script> @@ -25,9 +22,9 @@ $("document").ready(function() { .tabs("disable", 1) .tabs("disable", 2) <? elseif ($g3_resource_count > .9 * $g2_resource_count): ?> - .tabs("select", 2) + .tabs({active: 2}) <? else: ?> - .tabs("select", 1) + .tabs({active: 1}) <? endif ?> ; diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index 7e711156..73b8ab4e 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -149,6 +149,21 @@ text-align: center; } +/* Dialogs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/** + * Newer Themeroller-based themes do this on their own, but older + * themes need help ensuring that dialogs and overlays are on top + */ +.ui-front { + z-index: 1000 +} + +/* Autocomplete ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.ui-autocomplete { + text-align: left; +} + /** ******************************************************************* * 2) Admin **********************************************************************/ diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index ba2b9b3f..4e522702 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -73,14 +73,14 @@ class Admin_Server_Add_Controller extends Admin_Controller { public function autocomplete() { $directories = array(); - $path_prefix = Input::instance()->get("q"); + $path_prefix = Input::instance()->get("term"); foreach (glob("{$path_prefix}*") as $file) { if (is_dir($file) && !is_link($file)) { - $directories[] = html::clean($file); + $directories[] = (string)html::clean($file); } } - ajax::response(implode("\n", $directories)); + ajax::response(json_encode($directories)); } private function _get_admin_form() { diff --git a/modules/server_add/views/admin_server_add.html.php b/modules/server_add/views/admin_server_add.html.php index f59e327f..b2421c7c 100644 --- a/modules/server_add/views/admin_server_add.html.php +++ b/modules/server_add/views/admin_server_add.html.php @@ -6,10 +6,7 @@ $("document").ready(function() { $("#g-path").gallery_autocomplete( "<?= url::site("__ARGS__") ?>".replace("__ARGS__", "admin/server_add/autocomplete"), - { - max: 256, - loadingClass: "g-loading-small", - }); + {multiple: true}); }); </script> diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 77d45a95..32e857c6 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -48,18 +48,17 @@ class Tags_Controller extends Controller { public function autocomplete() { $tags = array(); - $tag_parts = explode(",", Input::instance()->get("q")); - $limit = Input::instance()->get("limit"); + $tag_parts = explode(",", Input::instance()->get("term")); $tag_part = ltrim(end($tag_parts)); $tag_list = ORM::factory("tag") ->where("name", "LIKE", Database::escape_for_like($tag_part) . "%") ->order_by("name", "ASC") - ->limit($limit) + ->limit(100) ->find_all(); foreach ($tag_list as $tag) { - $tags[] = html::clean($tag->name); + $tags[] = (string)html::clean($tag->name); } - ajax::response(implode("\n", $tags)); + ajax::response(json_encode($tags)); } } diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index d62ae36e..08d5d53a 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -72,8 +72,7 @@ class tag_event_Core { $url = url::site("tags/autocomplete"); $form->script("") ->text("$('form input[name=tags]').ready(function() { - $('form input[name=tags]').gallery_autocomplete( - '$url', {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1}); + $('form input[name=tags]').gallery_autocomplete('$url', {multiple: true}); });"); $tag_names = array(); @@ -125,7 +124,7 @@ class tag_event_Core { ->text("$('input[name=tags]') .gallery_autocomplete( '$autocomplete_url', - {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1} + {multiple: true} ); $('input[name=tags]') .change(function (event) { diff --git a/modules/tag/views/tag_block.html.php b/modules/tag/views/tag_block.html.php index d25b8dcb..afa61b15 100644 --- a/modules/tag/views/tag_block.html.php +++ b/modules/tag/views/tag_block.html.php @@ -2,15 +2,13 @@ <script type="text/javascript"> $("#g-add-tag-form").ready(function() { var url = $("#g-tag-cloud-autocomplete-url").attr("href"); - $("#g-add-tag-form input:text").gallery_autocomplete( - url, { - max: 30, - multiple: true, - multipleSeparator: ',', - cacheLength: 1, - selectFirst: false - } - ); + function split(val) { + return val.split(/,\s*/); + } + function extract_last(term) { + return split(term).pop(); + } + $("#g-add-tag-form input:text").gallery_autocomplete(url, {multiple: true}); $("#g-add-tag-form").ajaxForm({ dataType: "json", success: function(data) { diff --git a/modules/user/js/password_strength.js b/modules/user/js/password_strength.js index 2442b8de..5764e332 100644 --- a/modules/user/js/password_strength.js +++ b/modules/user/js/password_strength.js @@ -1,39 +1,38 @@ (function($) { - // Based on the Password Strength Indictor By Benjamin Sterling - // http://benjaminsterling.com/password-strength-indicator-and-generator/ - $.widget("ui.user_password_strength", { - _init: function() { - var self = this; - $(this.element).keyup(function() { - var strength = self.calculateStrength (this.value); - var index = Math.min(Math.floor( strength / 10 ), 10); - $("#g-password-gauge") - .removeAttr('class') - .addClass( "g-password-strength0" ) - .addClass( self.options.classes[ index ] ); - }).after("<div id='g-password-gauge' class='g-password-strength0'></div>"); - }, + // Based on the Password Strength Indictor By Benjamin Sterling + // http://benjaminsterling.com/password-strength-indicator-and-generator/ + $.widget("ui.user_password_strength", { + options: { + classes: ['g-password-strength10', 'g-password-strength20', 'g-password-strength30', + 'g-password-strength40', 'g-password-strength50', 'g-password-strength60', + 'g-password-strength70', 'g-password-strength80', 'g-password-strength90', + 'g-password-strength100'] + }, - calculateStrength: function(value) { - // Factor in the length of the password - var strength = Math.min(5, value.length) * 10 - 20; - // Factor in the number of numbers - strength += Math.min(3, value.length - value.replace(/[0-9]/g,"").length) * 10; - // Factor in the number of non word characters - strength += Math.min(3, value.length - value.replace(/\W/g,"").length) * 15; - // Factor in the number of Upper case letters - strength += Math.min(3, value.length - value.replace(/[A-Z]/g,"").length) * 10; + _init: function() { + var self = this; + $(this.element).keyup(function() { + var strength = self.calculateStrength(this.value); + var index = Math.min(Math.floor(strength / 10), 10); + $("#g-password-gauge") + .removeAttr("class") + .addClass("g-password-strength0") + .addClass(self.options.classes[index]); + }).after("<div id='g-password-gauge' class='g-password-strength0'></div>"); + }, - // Normalizxe between 0 and 100 - return Math.max(0, Math.min(100, strength)); - } - }); - $.extend($.ui.user_password_strength, { - defaults: { - classes : ['g-password-strength10', 'g-password-strength20', 'g-password-strength30', - 'g-password-strength40', 'g-password-strength50', 'g-password-strength60', - 'g-password-strength70',' g-password-strength80',' g-password-strength90', - 'g-password-strength100'] - } - }); - })(jQuery); + calculateStrength: function(value) { + // Factor in the length of the password + var strength = Math.min(5, value.length) * 10 - 20; + // Factor in the number of numbers + strength += Math.min(3, value.length - value.replace(/[0-9]/g,"").length) * 10; + // Factor in the number of non word characters + strength += Math.min(3, value.length - value.replace(/\W/g,"").length) * 15; + // Factor in the number of Upper case letters + strength += Math.min(3, value.length - value.replace(/[A-Z]/g,"").length) * 10; + + // Normalize between 0 and 100 + return Math.max(0, Math.min(100, strength)); + } + }); +})(jQuery); |