Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1033 from nilshoerrmann/integration

Javascript fixes related to the Pagination. RE: #1023
  • Loading branch information...
commit d30d6d997e90399e4455f2848d8f06fc50d0bb8e 2 parents cc75afd + 8309ac9
@brendo brendo authored
Showing with 59 additions and 57 deletions.
  1. +59 −57 symphony/assets/admin.js
View
116 symphony/assets/admin.js
@@ -165,65 +165,67 @@
Components - Pagination
--------------------------------------------------------------------------*/
- var pageform = $('ul.page form'),
- pagegoto = pageform.find('input'),
- pageactive = pagegoto.attr('data-active'),
- pageinactive = pagegoto.attr('data-inactive'),
- pagehelper = $('<span />').appendTo(pageform),
- width;
+ var pageform = $('ul.page form');
+ if(pageform.length > 0) {
+ var pagegoto = pageform.find('input'),
+ pageactive = pagegoto.attr('data-active'),
+ pageinactive = pagegoto.attr('data-inactive'),
+ pagehelper = $('<span />').appendTo(pageform),
+ width;
+
+ // Measure placeholder text
+ width = Math.max(pagehelper.text(pageactive).width(), pagehelper.text(pageinactive).width());
+ pagehelper.remove();
+ pagegoto.width(width + 20);
+
+ // Set current page
+ pagegoto.val(pageinactive);
- // Measure placeholder text
- width = Math.max(pagehelper.text(pageactive).width(), pagehelper.text(pageinactive).width());
- pagehelper.remove();
- pagegoto.width(width + 20);
+ // Display "Go to page …" placeholder
+ pageform.on('mouseover', function(event) {
+ if(!pageform.is('.active') && pagegoto.val() == pageinactive) {
+ pagegoto.val(pageactive);
+ }
+ });
- // Set current page
- pagegoto.val(pageinactive);
-
- // Display "Go to page …" placeholder
- pageform.on('mouseover', function(event) {
- if(!pageform.is('.active') && pagegoto.val() == pageinactive) {
- pagegoto.val(pageactive);
- }
- });
-
- // Display current page placeholder
- pageform.on('mouseout', function(event) {
- if(!pageform.is('.active') && pagegoto.val() == pageactive) {
- pagegoto.val(pageinactive);
- }
- });
-
- // Edit page number
- pagegoto.on('focus', function(event) {
- if(pagegoto.val() == pageactive) {
- pagegoto.val('');
- }
- pageform.addClass('active')
- });
-
- // Stop editing page number
- pagegoto.on('blur', function(event) {
-
- // Clear errors
- if(pageform.is('.invalid') || pagegoto.val() == '') {
- pageform.removeClass('invalid');
- pagegoto.val(pageinactive);
- }
-
- // Deactivate
- if(pagegoto.val() == pageinactive) {
- pageform.removeClass('active');
- }
- });
-
- // Validate page number
- pageform.on('submit', function(event) {
- if(pagegoto.val() > pagegoto.attr('data-max')) {
- pageform.addClass('invalid');
- return false;
- }
- });
+ // Display current page placeholder
+ pageform.on('mouseout', function(event) {
+ if(!pageform.is('.active') && pagegoto.val() == pageactive) {
+ pagegoto.val(pageinactive);
+ }
+ });
+
+ // Edit page number
+ pagegoto.on('focus', function(event) {
+ if(pagegoto.val() == pageactive) {
+ pagegoto.val('');
+ }
+ pageform.addClass('active')
+ });
+
+ // Stop editing page number
+ pagegoto.on('blur', function(event) {
+
+ // Clear errors
+ if(pageform.is('.invalid') || pagegoto.val() == '') {
+ pageform.removeClass('invalid');
+ pagegoto.val(pageinactive);
+ }
+
+ // Deactivate
+ if(pagegoto.val() == pageinactive) {
+ pageform.removeClass('active');
+ }
+ });
+
+ // Validate page number
+ pageform.on('submit', function(event) {
+ if(pagegoto.val() > pagegoto.attr('data-max')) {
+ pageform.addClass('invalid');
+ return false;
+ }
+ });
+ }
/*--------------------------------------------------------------------------
Components - XSLT Editor
Please sign in to comment.
Something went wrong with that request. Please try again.