From 2cc94ba296be1000185672bd964c261cd8009b73 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Mon, 6 Mar 2017 16:31:00 -0600 Subject: [PATCH] a little js cleanup --- app/assets/javascripts/application.js | 7 ++--- app/assets/javascripts/forms/animations.js | 30 ------------------- app/assets/javascripts/forms/button-group.js | 8 ----- .../javascripts/{ => main}/ajax-links.js | 0 .../{forms => main}/textarea-limit.js | 0 5 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 app/assets/javascripts/forms/animations.js delete mode 100644 app/assets/javascripts/forms/button-group.js rename app/assets/javascripts/{ => main}/ajax-links.js (100%) rename app/assets/javascripts/{forms => main}/textarea-limit.js (100%) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 199376b..8dbf4d2 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -15,8 +15,5 @@ //= require turbolinks //= require modernizr-lite/modernizr -//= require ajax-links - -//= require forms/button-group -//= require forms/animations -//= require forms/textarea-limit +//= require main/ajax-links +//= require main/textarea-limit diff --git a/app/assets/javascripts/forms/animations.js b/app/assets/javascripts/forms/animations.js deleted file mode 100644 index a920c94..0000000 --- a/app/assets/javascripts/forms/animations.js +++ /dev/null @@ -1,30 +0,0 @@ -var $textInput = $('[type="color"], [type="date"], [type="datetime"], [type="datetime-local"], [type="email"], [type="month"], [type="number"], [type="password"], [type="search"], [type="tel"], [type="text"], [type="time"], [type="url"], [type="week"], input:not([type]), textarea'); - -// Text Input Label Animation -$textInput.prev('label').addClass('loaded'); -$textInput.each(function() { - if( $(this).val() ) { - $(this).prev('label').addClass('animate'); - } -}); - -$textInput.on('focus', function() { - $(this).prev('label').addClass('animate'); -}).on('focusout', function() { - if( !$(this).val() ) { - $(this).prev('label').removeClass('animate'); - } -}); - -// form error resolutions -$('form').has('.error').each(function(){ - var $form = $(this); - - $form.on('keyup', $textInput, function(){ - $form.find(".error").addClass('resolve-error'); - }); - - $form.on('change', $("[type=radio], [type=checkbox]"), function(){ - $form.find(".error").addClass('resolve-error'); - }); -}); diff --git a/app/assets/javascripts/forms/button-group.js b/app/assets/javascripts/forms/button-group.js deleted file mode 100644 index bea798c..0000000 --- a/app/assets/javascripts/forms/button-group.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Button Group Functionality - */ - -$('.btn-group button').click(function() { - $(this).siblings().removeClass('selected'); - $(this).addClass('selected'); -}); diff --git a/app/assets/javascripts/ajax-links.js b/app/assets/javascripts/main/ajax-links.js similarity index 100% rename from app/assets/javascripts/ajax-links.js rename to app/assets/javascripts/main/ajax-links.js diff --git a/app/assets/javascripts/forms/textarea-limit.js b/app/assets/javascripts/main/textarea-limit.js similarity index 100% rename from app/assets/javascripts/forms/textarea-limit.js rename to app/assets/javascripts/main/textarea-limit.js