multiauth 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -12,7 +12,7 @@ module Multiauth
12
12
  end
13
13
 
14
14
  if logged_in?
15
- redirect_to root_path
15
+ redirect_to session[:return_to] ? session[:return_to] : root_path
16
16
  else
17
17
  render 'new'
18
18
  end
@@ -4,7 +4,7 @@
4
4
  <a href="#" id="prev">prev</a>
5
5
  <a href="#" id="next">next</a>
6
6
  </div>
7
- Choose your account provider
7
+ <%= title || "Choose your account provider" %>
8
8
  <div class="clear"></div>
9
9
  <div id="slides">
10
10
  <ul class="list">
@@ -14,7 +14,7 @@
14
14
  <% providers.each_slice(3) do |column| %>
15
15
  <div class="column">
16
16
  <% column.each do |provider, config| %>
17
- <a id="btn_<%= count+=1 %>" class="<%= provider %> openid_btn <%= config[:class] %>" title="<%= provider %>" href="/auth/<%= config["openid"] ? "open_id?openid_url=#{config["openid"]}" : "#{provider.downcase}" %>"></a>
17
+ <a id="btn_<%= count+=1 %>" class="<%= provider %> openid_btn <%= config["class"] %>" title="<%= provider %>" href="/auth/<%= config["openid"] ? "open_id?openid_url=#{config["openid"]}" : "#{provider.downcase}" %>"></a>
18
18
  <% end %>
19
19
  </div>
20
20
  <% end %>
@@ -0,0 +1,17 @@
1
+ <div id="multiauth-menu">
2
+ <h2>
3
+ <a href="#"><%= title %></a>
4
+ </h2>
5
+ <div class="menu-container">
6
+ <% count = 0 %>
7
+ <% multiauth_providers.each_slice(5) do |providers| %>
8
+ <div class="rows">
9
+ <% providers.each do |provider, config| %>
10
+ <div class="item" style="float: left; width: 19.5%;">
11
+ <a id="btn_<%= count+=1 %>" class="<%= provider %> openid_btn <%= config["class"] %>" title="<%= provider %>" href="/auth/<%= config["openid"] ? "open_id?openid_url=#{config["openid"]}" : "#{provider.downcase}" %>"></a>
12
+ </div>
13
+ <% end %>
14
+ </div>
15
+ <% end %>
16
+ </div>
17
+ </div>
@@ -1,2 +1,7 @@
1
1
  <%= multiauth_assets %>
2
- <%= multiauth_box %>
2
+ <% if logged_in? %>
3
+ <%= multiauth_menu("Connect Your Account") %>
4
+ <% else %>
5
+ <%= multiauth_box %>
6
+ <% end %>
7
+
@@ -55,5 +55,14 @@ you can override them using the following routes:
55
55
  match "/login" => "multiauth/sessions#new", :as => :new_session
56
56
  match "/logout" => "multiauth/sessions#destroy", :method => :get, :as => :destroy_session
57
57
 
58
+ you can override the default view creating the file:
59
+ app/views/multiauth/sessions/new.html.haml
60
+
61
+ to render the auth providers as a dropdown menu use:
62
+ <%= multiauth_menu("connect your account") %>
63
+
64
+ you can render single links as follows:
65
+ <%= multiauth_link("Google") %>
66
+
58
67
 
59
68
  ===============================================================================
@@ -58,7 +58,7 @@ jQuery(function ($) {
58
58
  return false;
59
59
  });
60
60
 
61
- $form.find(".openid_btn").click(function(e){
61
+ $(".openid_btn").click(function(e){
62
62
  var a = $(this);
63
63
 
64
64
  if(a.attr("href").match("{user_name}")) {
@@ -81,4 +81,16 @@ jQuery(function ($) {
81
81
  });
82
82
 
83
83
  openidCarouselEffect();
84
+
85
+ var intervalId = null;
86
+ $("#multiauth-menu").hover(function(){
87
+ if(intervalId)
88
+ clearTimeout(intervalId);
89
+ $(this).addClass("hovering");
90
+ }, function() {
91
+ var e = $(this);
92
+ intervalId = setTimeout(function() {
93
+ e.removeClass("hovering");
94
+ }, 1000)
95
+ })
84
96
  });
@@ -31,7 +31,7 @@ module Multiauth
31
31
  next if config["token"].blank?
32
32
 
33
33
  puts ">> Setting up #{provider} provider"
34
- provider provider.downcase.to_sym, config["id"], config["token"]
34
+ provider provider.underscore.to_sym, config["id"], config["token"]
35
35
  end
36
36
  end
37
37
  else
@@ -1,7 +1,11 @@
1
1
  module Multiauth
2
2
  module ViewsHelper
3
- def multiauth_box
4
- render(:partial => "multiauth/box")
3
+ def multiauth_box(title = nil)
4
+ render "multiauth/box", :title => title
5
+ end
6
+
7
+ def multiauth_menu(title = "Sign In")
8
+ render "multiauth/menu", :title => title
5
9
  end
6
10
 
7
11
  def multiauth_assets
@@ -10,7 +14,14 @@ module Multiauth
10
14
  end
11
15
 
12
16
  def multiauth_providers
13
- Multiauth.providers || []
17
+ Multiauth.providers || {}
18
+ end
19
+
20
+ def multiauth_link(provider, text = "", cssclass = nil)
21
+ config = multiauth_providers[provider]
22
+ css_class ||= "#{provider} openid_btn #{config["class"]}"
23
+
24
+ %@<a class="#{css_class}" title="#{provider}" href="/auth/#{config["openid"] ? "open_id?openid_url=#{config["openid"]}" : "#{provider.downcase}"}">#{text}</a>@
14
25
  end
15
26
  end
16
27
  end
data/multiauth.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{multiauth}
8
- s.version = "0.2.5"
8
+ s.version = "0.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David A. Cuadrado"]
12
- s.date = %q{2010-10-14}
12
+ s.date = %q{2010-10-16}
13
13
  s.description = %q{multi authentication gem using devise & co}
14
14
  s.email = %q{krawek@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "VERSION",
28
28
  "app/controllers/multiauth/sessions_controller.rb",
29
29
  "app/views/multiauth/_box.html.erb",
30
+ "app/views/multiauth/_menu.html.erb",
30
31
  "app/views/multiauth/sessions/new.html.erb",
31
32
  "lib/generators/multiauth/multiauth_generator.rb",
32
33
  "lib/generators/templates/README",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 5
9
- version: 0.2.5
8
+ - 6
9
+ version: 0.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - David A. Cuadrado
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-14 00:00:00 -05:00
17
+ date: 2010-10-16 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -82,6 +82,7 @@ files:
82
82
  - VERSION
83
83
  - app/controllers/multiauth/sessions_controller.rb
84
84
  - app/views/multiauth/_box.html.erb
85
+ - app/views/multiauth/_menu.html.erb
85
86
  - app/views/multiauth/sessions/new.html.erb
86
87
  - lib/generators/multiauth/multiauth_generator.rb
87
88
  - lib/generators/templates/README