multiauth 0.2.2 → 0.2.3

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/README.rdoc CHANGED
@@ -1,6 +1,32 @@
1
- = multiauth
1
+ = Usage (by example)
2
+
3
+ create an application
4
+
5
+ rails new multiauth-example
6
+ cd multiauth-example
7
+
8
+ edit Gemfile and add
9
+
10
+ gem 'omniauth', '~> 0.1.1'
11
+ gem 'multiauth', '~> 0.2.2'
12
+
13
+ bundle the app to install the dependencies
14
+
15
+ bundle
16
+
17
+ install required files
18
+
19
+ rails g multiauth
20
+ rails g model User email:string uid:string
21
+
22
+ start the server
23
+
24
+ rails s
25
+
26
+ and then visit
27
+
28
+ http://localhost:3000/sessions/sign_in
2
29
 
3
- Description goes here.
4
30
 
5
31
  == Note on Patches/Pull Requests
6
32
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -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 +1,7 @@
1
- <%= multiauth_box %>
1
+ <%= multiauth_assets %>
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
  ===============================================================================
@@ -115,6 +115,31 @@ a.openid_large_btn:focus {
115
115
  -moz-outline-style: none;
116
116
  }
117
117
 
118
+ #multiauth-menu {
119
+ display: inline;
120
+ position: relative;
121
+ }
122
+
123
+ #multiauth-menu div.menu-container {
124
+ display: none;
125
+ border: 2px solid gray;
126
+ }
127
+
128
+ #multiauth-menu ul {
129
+ list-style-type: none;
130
+ }
131
+
132
+ #multiauth-menu div.menu-container {
133
+ width: 56em;
134
+ position: absolute;
135
+ top: 1.6em;
136
+ left: 0em;
137
+ z-index: 1000;
138
+ }
139
+
140
+ #multiauth-menu.hovering div.menu-container {
141
+ display: block;
142
+ }
118
143
 
119
144
  #carousel {
120
145
  margin:0 auto;
@@ -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
  });
@@ -1,7 +1,11 @@
1
1
  module Multiauth
2
2
  module ViewsHelper
3
3
  def multiauth_box
4
- render(:partial => "multiauth/box")
4
+ render "multiauth/box"
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.2"
8
+ s.version = "0.2.3"
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-06}
12
+ s.date = %q{2010-10-07}
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
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
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-06 00:00:00 -05:00
17
+ date: 2010-10-07 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