diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index 5b9343978..ff891b1a5 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -25,6 +25,26 @@ class App.Controller extends Spine.Controller @delay( a, delay ) + shake: (element) -> + + # this part is from wordpress 3, thanks to open source + shakeMe = (element, position, positionEnd) -> + positionStart = position.shift() + element.css( 'left', positionStart + 'px' ) + if position.length > 0 + setTimeout( -> + shakeMe( element, position, positionEnd ) + , positionEnd) + else + try + element.css( 'position', 'static' ) + catch e + + position = [ 15, 30, 15, 0, -15, -30, -15, 0 ] + position = position.concat( position.concat( position ) ) + element.css( 'position', 'relative' ) + shakeMe( element, position, 20 ) + isRole: (name) -> roles = @Session.get( 'roles' ) return false if !roles diff --git a/app/assets/javascripts/app/controllers/login.js.coffee b/app/assets/javascripts/app/controllers/login.js.coffee index d8fe0bfce..2f97b9bdc 100644 --- a/app/assets/javascripts/app/controllers/login.js.coffee +++ b/app/assets/javascripts/app/controllers/login.js.coffee @@ -52,6 +52,7 @@ class Index extends App.Controller # scroll to top @scrollTo() + login: (e) -> e.preventDefault() @formDisable(e) @@ -103,4 +104,10 @@ class Index extends App.Controller username: @username ) + # login shake + @delay( + => @shake( @el.find('#login') ), + 1500 + ) + App.Config.set( 'login', Index, 'Routes' )