iam 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -31,7 +31,7 @@ Also you may log in using user_id (e.g. 42):
31
31
  Add gem to your gemfile:
32
32
 
33
33
  ```ruby
34
- gem 'iam', '~> 0.1.11'
34
+ gem 'iam', '~> 0.1.12'
35
35
  ```
36
36
  ##Configuration
37
37
 
@@ -1,3 +1,3 @@
1
- <tr href='<%= log_in_as_path(account) %>'>
1
+ <tr id='<%='iam-current-account' if account == current_user%>' href='<%= log_in_as_path(account) %>'>
2
2
  <%= render partial: 'iam/account_attribute', collection: Iam::Configuration.account_attributes.map { |key| [key, account.public_send(key)] } %>
3
3
  </tr>
@@ -1,3 +1,3 @@
1
1
  module Iam
2
- VERSION = '0.1.11'
2
+ VERSION = '0.1.12'
3
3
  end
@@ -1,5 +1,4 @@
1
1
  $ ->
2
- $menu = $('#iam-menu')
3
2
  templateLink = '/iam/log_in_as/:id'
4
3
  menuLink = '/iam/menu'
5
4
  inputMode = false # account id is anticipated to be typed
@@ -30,7 +29,6 @@ $ ->
30
29
 
31
30
  logInByLink = (link) ->
32
31
  $.post link, (data) ->
33
- $menu.hide()
34
32
  window.location.reload()
35
33
  iamNotice data.notice
36
34
 
@@ -56,7 +54,6 @@ $ ->
56
54
  logInByInput = ->
57
55
  if inputMode
58
56
  processInput input
59
- $('#iam-menu').remove()
60
57
  else
61
58
  $.get menuLink, (menu) ->
62
59
  $('body').append menu
@@ -69,6 +66,6 @@ $ ->
69
66
  logInByInput()
70
67
 
71
68
  inputMode = !inputMode
72
- $menu.toggle()
69
+ $('#iam-menu').remove()
73
70
  else
74
71
  input += String.fromCharCode e.keyCode if 48 <= e.keyCode <= 57
@@ -0,0 +1 @@
1
+ (function(){$(function(){var e,t,n,r,i,s,o,u,a,f,l,c,h;return h="/iam/log_in_as/:id",l="/iam/menu",s=!1,i="",e=["alt","ctrl","shift"],r=function(){return $(".iam-settings-header").on("click",function(){return $(".iam-settings").toggle()}),$("#iam-menu").on("click","td",function(){var e,t;e=$(this).parents("tr"),t=e.attr("href");if(t)return f(t)}),$.each(e,function(){var e,t;return e=$(".iam-"+this+"-settings input"),t="iam-"+this+"-checked",e[0].checked=$.cookie(t)==="true",e.on("click",function(){return $.cookie(t,this.checked)})})},n=function(e){var t;return t=$("<div class='iam-notice'>"+e+"</div>"),$("body").append(t),t.fadeIn(200).delay(1e3).fadeOut(600)},f=function(e){return $.post(e,function(e){return window.location.reload(),n(e.notice)})},u=function(e){return String.fromCharCode(e)==="À"},t=function(t){var n,r,i,s;for(i=0,s=e.length;i<s;i++){n=e[i],r=$.cookie("iam-"+n+"-checked")==="true";if(r!==t[""+n+"Key"])return!1}return!0},o=function(){return $(document.getSelection().focusNode).find("input, textarea").length>0},c=function(e){var t;if(e.match(/^\d+$/))return t=h.replace(/:id/,e),f(t);if(e)return n(""+e+" is invalid id.")},a=function(){return s?c(i):$.get(l,function(e){return $("body").append(e),r()}),i=""},$(document).on("keydown",function(e){var n;if(!o()&&u(e.keyCode)&&t(e))return a(),s=!s,$("#iam-menu").remove();if(48<=(n=e.keyCode)&&n<=57)return i+=String.fromCharCode(e.keyCode)})})}).call(this);
@@ -7,4 +7,4 @@
7
7
  * http://www.opensource.org/licenses/mit-license.php
8
8
  * http://www.opensource.org/licenses/GPL-2.0
9
9
  */
10
- (function(e,t,n){function i(e){return e}function s(e){return decodeURIComponent(e.replace(r," "))}var r=/\+/g,o=e.cookie=function(r,u,a){if(u!==n){a=e.extend({},o.defaults,a),u===null&&(a.expires=-1);if(typeof a.expires=="number"){var f=a.expires,l=a.expires=new Date;l.setDate(l.getDate()+f)}return u=o.json?JSON.stringify(u):String(u),t.cookie=[encodeURIComponent(r),"=",o.raw?u:encodeURIComponent(u),a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}var c=o.raw?i:s,h=t.cookie.split("; ");for(var p=0,d=h.length;p<d;p++){var v=h[p].split("=");if(c(v.shift())===r){var m=c(v.join("="));return o.json?JSON.parse(m):m}}return null};o.defaults={},e.removeCookie=function(t,n){return e.cookie(t)!==null?(e.cookie(t,null,n),!0):!1}})(jQuery,document);
10
+ (function(e,t,n){function r(e){return e}function i(e){return decodeURIComponent(e.replace(s," "))}var s=/\+/g,o=e.cookie=function(s,u,a){if(u!==n){a=e.extend({},o.defaults,a),u===null&&(a.expires=-1);if(typeof a.expires=="number"){var f=a.expires,l=a.expires=new Date;l.setDate(l.getDate()+f)}return u=o.json?JSON.stringify(u):String(u),t.cookie=[encodeURIComponent(s),"=",o.raw?u:encodeURIComponent(u),a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}var c=o.raw?r:i,h=t.cookie.split("; ");for(var p=0,d=h.length;p<d;p++){var v=h[p].split("=");if(c(v.shift())===s){var m=c(v.join("="));return o.json?JSON.parse(m):m}}return null};o.defaults={},e.removeCookie=function(t,n){return e.cookie(t)!==null?(e.cookie(t,null,n),!0):!1}})(jQuery,document);
@@ -22,6 +22,8 @@
22
22
  padding-left: 10px; }
23
23
  #iam-menu .iam-settings {
24
24
  display: none; }
25
+ #iam-menu #iam-current-account td {
26
+ border: 2px solid red !important; }
25
27
 
26
28
  .iam-notice {
27
29
  position: fixed;
@@ -27,6 +27,9 @@
27
27
  .iam-settings
28
28
  display: none
29
29
 
30
+ #iam-current-account td
31
+ border: 2px solid red !important
32
+
30
33
  .iam-notice
31
34
  position: fixed
32
35
  left: 200px
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-11 00:00:00.000000000 Z
12
+ date: 2012-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -265,8 +265,8 @@ files:
265
265
  - spec/rails_app/script/rails
266
266
  - spec/spec_helper.rb
267
267
  - spec/support/database_cleaner.rb
268
- - vendor/assets/javascripts/iam.coffee
269
- - vendor/assets/javascripts/iam.js
268
+ - vendor/assets/javascripts/iam.js.coffee
269
+ - vendor/assets/javascripts/iam.js.js
270
270
  - vendor/assets/javascripts/jquery.cookie.js
271
271
  - vendor/assets/stylesheets/.sass-cache/99c7326b15538dc9b4651af91a5f076fe779d5ec/iam.css.sassc
272
272
  - vendor/assets/stylesheets/iam.css
@@ -1,2 +0,0 @@
1
- // Generated by CoffeeScript 1.3.3
2
- (function(){$(function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p;return e=$("#iam-menu"),p="/iam/log_in_as/:id",c="/iam/menu",o=!1,s="",t=["alt","ctrl","shift"],i=function(){return $(".iam-settings-header").on("click",function(){return $(".iam-settings").toggle()}),$("#iam-menu").on("click","td",function(){var e,t;e=$(this).parents("tr"),t=e.attr("href");if(t)return l(t)}),$.each(t,function(){var e,t;return e=$(".iam-"+this+"-settings input"),t="iam-"+this+"-checked",e[0].checked=$.cookie(t)==="true",e.on("click",function(){return $.cookie(t,this.checked)})})},r=function(e){var t;return t=$("<div class='iam-notice'>"+e+"</div>"),$("body").append(t),t.fadeIn(200).delay(1e3).fadeOut(600)},l=function(t){return $.post(t,function(t){return e.hide(),window.location.reload(),r(t.notice)})},a=function(e){return String.fromCharCode(e)==="À"},n=function(e){var n,r,i,s;for(i=0,s=t.length;i<s;i++){n=t[i],r=$.cookie("iam-"+n+"-checked")==="true";if(r!==e[""+n+"Key"])return!1}return!0},u=function(){return $(document.getSelection().focusNode).find("input, textarea").length>0},h=function(e){var t;if(e.match(/^\d+$/))return t=p.replace(/:id/,e),l(t);if(e)return r(""+e+" is invalid id.")},f=function(){return o?(h(s),$("#iam-menu").remove()):$.get(c,function(e){return $("body").append(e),i()}),s=""},$(document).on("keydown",function(t){var r;if(!u()&&a(t.keyCode)&&n(t))return f(),o=!o,e.toggle();if(48<=(r=t.keyCode)&&r<=57)return s+=String.fromCharCode(t.keyCode)})})}).call(this);