From 465e9cd329ea53ef1666d6a4e6df5fe05e7692d4 Mon Sep 17 00:00:00 2001 From: Nicolas Widart Date: Fri, 27 Nov 2015 17:34:51 +0100 Subject: [PATCH] Updating jquery.slug script --- composer.json | 2 +- public/themes/adminlte/js/vendor/jquery.slug.js | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 6ef7b8380..8fd7245fb 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "laravel5" ], "license": "MIT", - "version": "1.6.0", + "version": "1.7.0", "type": "project", "require": { "laravel/framework": "~5.1", diff --git a/public/themes/adminlte/js/vendor/jquery.slug.js b/public/themes/adminlte/js/vendor/jquery.slug.js index 968417c73..de4cd2d38 100644 --- a/public/themes/adminlte/js/vendor/jquery.slug.js +++ b/public/themes/adminlte/js/vendor/jquery.slug.js @@ -1,17 +1,19 @@ // // jQuery Slug Generation Plugin by Perry Trinier (perrytrinier@gmail.com) // Modified November 2015 by Micheal Mand for AsgardCMS (micheal@kmdwebdesigns.com) +// Modified November 2015 by Simon Funk for AsgardCMS (simon.funk@treestones.ch) // Licensed under the GPL: http://www.gnu.org/copyleft/gpl.html jQuery.fn.slug = function (options) { var settings = { slug: 'slug', // Class used for slug destination input and span. The span is created on $(document).ready() - hide: false, // Boolean - By default the slug input field is shown, set to false to hide the input field and show the span. override: false }; $this = jQuery(this); + var slugContainer = $this.closest('.box-body').find('[data-slug="target"]'); + if (options) { jQuery.extend(settings, options); } else { @@ -20,23 +22,13 @@ jQuery.fn.slug = function (options) { } } - jQuery(document).ready(function () { - if (settings.hide) { - $this.closest('input.' + settings.slug).after(""); - $this.closest('input.' + settings.slug).hide(); - } - }); - makeSlug = function (event) { var $theUnSlug = jQuery(event.target), - $slugParent = $theUnSlug.closest('.form-group').next(), slugContent = $theUnSlug.val(), slugContentHyphens = slugContent.replace(/\s+/g, '-'), slugNoAccents = normalize(slugContentHyphens), finishedSlug = slugNoAccents.replace(/[^a-zA-Z0-9\-]/g, ''); - - $slugParent.find('input.' + settings.slug).val(finishedSlug.toLowerCase()); - $slugParent.find('span.' + settings.slug).text(finishedSlug.toLowerCase()); + slugContainer.val(finishedSlug.toLowerCase()); }; normalize = function(string) {