contour 1.0.0.beta3 → 1.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@
4
4
  * Twitter-Bootstrap CSS layout is now default!
5
5
  * Authentications can now be placed as a submenu using { authentications: true } anywhere in the contour links configuration
6
6
  * Rails updated to minimum 3.2.3
7
+ * Redirects to the user's alternate login page if a user fails to login on the default devise sign in page
7
8
 
8
9
  * Breaking Changes
9
10
  * CSS updated to use Twitter-Bootstrap
@@ -5,6 +5,3 @@
5
5
  element.html('<br /><center><img width=\"13\" height=\"13\" src=\"' + root_url + 'assets/ajax-loader.gif\" align=\"absmiddle\" alt=\"...\" />' + text + '</center><br />')
6
6
  else if element
7
7
  element.html('<img width=\"13\" height=\"13\" src=\"' + root_url + 'assets/ajax-loader.gif\" align=\"absmiddle\" alt=\"...\" />' + text)
8
-
9
- jQuery ->
10
- $(".collapse").collapse()
@@ -3,3 +3,4 @@ jQuery ->
3
3
  $(".tooltip").tooltip()
4
4
  $("a[rel=tooltip]").tooltip()
5
5
  $('.dropdown-toggle').dropdown()
6
+ # $(".collapse").collapse()
@@ -19,4 +19,26 @@ class Contour::SessionsController < Devise::SessionsController
19
19
  super
20
20
  end
21
21
 
22
- end
22
+ # Overwrite Devise authentication to check if the user is typing another credential into the default box
23
+ # if so, find alternative login methods for that user and forward the user to those login screens
24
+ def create
25
+ # resource = warden.authenticate!(auth_options)
26
+ resource = warden.authenticate(auth_options)
27
+
28
+ if resource
29
+ set_flash_message(:notice, :signed_in) if is_navigational_format?
30
+ sign_in(resource_name, resource)
31
+ respond_with resource, location: after_sign_in_path_for(resource)
32
+ else
33
+ resource = resource_name.to_s.titleize.constantize.find_by_email(params[resource_name][:email])
34
+ if resource and resource.respond_to?('authentications') and providers = resource.authentications.pluck(:provider).uniq and providers.size > 0
35
+ redirect_to request.script_name + '/auth/' + providers.first
36
+ elsif providers = Authentication.where(uid: params[resource_name][:email]).pluck(:provider).uniq and providers.size > 0
37
+ redirect_to request.script_name + '/auth/' + providers.first
38
+ else
39
+ resource = warden.authenticate!(auth_options)
40
+ end
41
+ end
42
+ end
43
+
44
+ end
@@ -0,0 +1,25 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to "Sign in", new_session_path(resource_name), class: 'btn btn-mini' %>
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to "Sign up", new_registration_path(resource_name), class: 'btn btn-mini' %>
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10
+ <%= link_to "Forgot your password?", new_password_path(resource_name), class: 'btn btn-mini' %>
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name), class: 'btn btn-mini' %>
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name), class: 'btn btn-mini' %>
19
+ <% end -%>
20
+
21
+ <%- if devise_mapping.omniauthable? %>
22
+ <%- resource_class.omniauth_providers.each do |provider| %>
23
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), class: 'btn btn-mini' %>
24
+ <% end -%>
25
+ <% end -%>
@@ -1,12 +1,20 @@
1
- <h2>Resend confirmation instructions</h2>
1
+ <% @title = 'Resend confirmation instructions' %>
2
+ <div class="page-header">
3
+ <h1><%= @title %></h1>
4
+ </div>
2
5
 
3
- <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
6
+ <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, class: 'form-horizontal' }) do |f| %>
4
7
  <%= devise_error_messages! %>
5
8
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email %></div>
9
+ <div class="control-group">
10
+ <%= f.label :email, class: 'control-label' %>
11
+ <div class="controls">
12
+ <%= f.email_field :email %>
13
+ </div>
14
+ </div>
8
15
 
9
- <div><%= f.submit "Resend confirmation instructions" %></div>
16
+ <div class="form-actions">
17
+ <%= f.submit "Resend confirmation instructions", class: 'btn btn-primary' %>
18
+ <%= render partial: 'contour/links' %>
19
+ </div>
10
20
  <% end %>
11
-
12
- <%= render "links" %>
@@ -1,16 +1,17 @@
1
1
  <% unless @news_feed.blank? %>
2
- <fieldset>
3
- <legend>Latest News</legend>
2
+ <div class="page-header">
3
+ <h1>
4
+ Latest News
5
+ <%#= link_to @news_feed.channel.title, @news_feed.channel.link, target: '_blank', class: 'btn btn-mini' %>
6
+ </h1>
7
+ </div>
4
8
 
5
- <h4><%= link_to @news_feed.channel.title, @news_feed.channel.link, target: '_blank' %></h4>
6
- <br />
7
- <% @news_feed.items.each_with_index do |item, i| %>
8
- <% if i < Contour.news_feed_items.to_i %>
9
- <div class="field">
10
- <label><%= link_to item.title, item.link, target: '_blank' %></label><br />
11
- <ul style="list-style: none"><li><%= item.description.gsub("[...]", link_to('[read more]', item.link, target: '_blank')).html_safe %></li></ul>
12
- </div>
13
- <% end %>
9
+ <% @news_feed.items.each_with_index do |item, i| %>
10
+ <% if i < Contour.news_feed_items.to_i %>
11
+ <div class="well">
12
+ <label><%= link_to item.title, item.link, target: '_blank' %></label><br />
13
+ <ul style="list-style: none"><li><%= item.description.gsub("[...]", link_to('[read more]', item.link, target: '_blank')).html_safe %></li></ul>
14
+ </div>
14
15
  <% end %>
15
- </fieldset>
16
- <% end %>
16
+ <% end %>
17
+ <% end %>
@@ -1,16 +1,28 @@
1
- <h2>Change your password</h2>
1
+ <% @title = 'Change your password' %>
2
+ <div class="page-header">
3
+ <h1><%= @title %></h1>
4
+ </div>
2
5
 
3
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
6
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, class: 'form-horizontal' }) do |f| %>
4
7
  <%= devise_error_messages! %>
5
8
  <%= f.hidden_field :reset_password_token %>
6
9
 
7
- <div><%= f.label :password, "New password" %><br />
8
- <%= f.password_field :password %></div>
10
+ <div class="control-group">
11
+ <%= f.label :password, "New password", class: 'control-label' %>
12
+ <div class="controls">
13
+ <%= f.password_field :password %>
14
+ </div>
15
+ </div>
9
16
 
10
- <div><%= f.label :password_confirmation, "Confirm new password" %><br />
11
- <%= f.password_field :password_confirmation %></div>
17
+ <div class="control-group">
18
+ <%= f.label :password_confirmation, "Confirm new password", class: 'control-label' %>
19
+ <div class="controls">
20
+ <%= f.password_field :password_confirmation %>
21
+ </div>
22
+ </div>
12
23
 
13
- <div><%= f.submit "Change my password" %></div>
24
+ <div class="form-actions">
25
+ <%= f.submit "Change my password", class: 'btn btn-primary' %>
26
+ <%= render partial: 'contour/links' %>
27
+ </div>
14
28
  <% end %>
15
-
16
- <%= render "links" %>
@@ -1,12 +1,20 @@
1
- <h2>Forgot your password?</h2>
1
+ <% @title = 'Forgot your password?' %>
2
+ <div class="page-header">
3
+ <h1><%= @title %></h1>
4
+ </div>
2
5
 
3
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
6
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, class: 'form-horizontal' }) do |f| %>
4
7
  <%= devise_error_messages! %>
5
8
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email %></div>
9
+ <div class="control-group">
10
+ <%= f.label :email, class: 'control-label' %>
11
+ <div class="controls">
12
+ <%= f.email_field :email %>
13
+ </div>
14
+ </div>
8
15
 
9
- <div><%= f.submit "Send me reset password instructions" %></div>
16
+ <div class="form-actions">
17
+ <%= f.submit "Send me reset password instructions", class: 'btn btn-primary' %>
18
+ <%= render partial: 'contour/links' %>
19
+ </div>
10
20
  <% end %>
11
-
12
- <%= render "links" %>
@@ -1,25 +1,50 @@
1
- <h2>Edit <%= resource_name.to_s.humanize %></h2>
1
+ <% @title = "Edit #{resource_name.to_s.humanize}" %>
2
+ <div class="page-header">
3
+ <h1><%= @title %></h1>
4
+ </div>
2
5
 
3
- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
6
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: { method: :put, class: 'form-horizontal' }) do |f| %>
4
7
  <%= devise_error_messages! %>
5
8
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email %></div>
8
-
9
- <div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
10
- <%= f.password_field :password, :autocomplete => "off" %></div>
11
-
12
- <div><%= f.label :password_confirmation %><br />
13
- <%= f.password_field :password_confirmation %></div>
14
-
15
- <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
16
- <%= f.password_field :current_password %></div>
17
-
18
- <div><%= f.submit "Update" %></div>
9
+ <div class="control-group">
10
+ <%= f.label :email, class: 'control-label' %>
11
+ <div class="controls">
12
+ <%= f.email_field :email %>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="control-group">
17
+ <%= f.label :password, class: 'control-label' %>
18
+ <div class="controls">
19
+ <%= f.password_field :password, :autocomplete => "off" %>
20
+ <i class="help-block">(leave blank if you don't want to change it)</i>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="control-group">
25
+ <%= f.label :password_confirmation, class: 'control-label' %>
26
+ <div class="controls">
27
+ <%= f.password_field :password_confirmation %>
28
+ </div>
29
+ </div>
30
+
31
+ <div class="control-group">
32
+ <%= f.label :current_password, class: 'control-label' %>
33
+ <div class="controls">
34
+ <%= f.password_field :current_password %>
35
+ <i class="help-block">(we need your current password to confirm your changes)</i>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="form-actions">
40
+ <%= f.submit "Update", class: 'btn btn-primary' %>
41
+ </div>
19
42
  <% end %>
20
43
 
21
- <h3>Cancel my account</h3>
44
+ <div class="page-header">
45
+ <h3>Cancel my account</h3>
46
+ </div>
22
47
 
23
- <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
48
+ <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, class: 'btn btn-danger' %>.</p>
24
49
 
25
50
  <%= link_to "Back", :back %>
@@ -1,18 +1,34 @@
1
- <h2>Sign up</h2>
1
+ <% @title = 'Sign up' %>
2
+ <div class="page-header">
3
+ <h1><%= @title %></h1>
4
+ </div>
2
5
 
3
- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
6
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: { class: 'form-horizontal' }) do |f| %>
4
7
  <%= devise_error_messages! %>
5
8
 
6
- <div><%= f.label :email %>
7
- <%= f.email_field :email %></div>
9
+ <div class="control-group">
10
+ <%= f.label :email, class: 'control-label' %>
11
+ <div class="controls">
12
+ <%= f.email_field :email %>
13
+ </div>
14
+ </div>
8
15
 
9
- <div><%= f.label :password %>
10
- <%= f.password_field :password %></div>
16
+ <div class="control-group">
17
+ <%= f.label :password, class: 'control-label' %>
18
+ <div class="controls">
19
+ <%= f.password_field :password %>
20
+ </div>
21
+ </div>
11
22
 
12
- <div><%= f.label :password_confirmation %>
13
- <%= f.password_field :password_confirmation %></div>
23
+ <div class="control-group">
24
+ <%= f.label :password_confirmation, class: 'control-label' %>
25
+ <div class="controls">
26
+ <%= f.password_field :password_confirmation %>
27
+ </div>
28
+ </div>
14
29
 
15
- <div><%= f.submit "Sign up", class: 'btn btn-primary' %></div>
30
+ <div class="form-actions">
31
+ <%= f.submit "Sign up", class: 'btn btn-primary' %>
32
+ <%= render partial: 'contour/links' %>
33
+ </div>
16
34
  <% end %>
17
-
18
- <%= render "links" %>
@@ -1,9 +1,13 @@
1
- <h1>Contour Details</h1>
1
+ <% @title = 'Contour Details' %>
2
+ <div class="page-header">
3
+ <h1><%= @title %></h1>
4
+ </div>
5
+
6
+ <dl class="dl-horizontal">
7
+ <dt>Contour Version</dt>
8
+ <dd><%= Contour::VERSION::STRING %></dd>
9
+ </dl>
2
10
 
3
- <p>
4
- <b>Contour Version:</b>
5
- <%= Contour::VERSION::STRING %>
6
- </p>
7
11
 
8
12
  <h2>Application Details</h2>
9
13
 
@@ -15,18 +19,18 @@ If the file does not exist run:<br />
15
19
  <br />
16
20
  <code style="margin-left:10px">rails generate contour:install</code><br />
17
21
  <br />
18
- <% unless request.script_name.blank? %>
19
- <p><b>Subdomain:</b>
20
- <%= request.script_name %>
21
- </p>
22
- <% end %>
23
- <% (Contour.class_variables.collect{|v| v.to_s.gsub('@@','')} - ['menu_items']).each do |attribute| %>
24
- <p>
25
- <b><%= attribute.titleize %>:</b>
22
+
23
+ <dl class="dl-horizontal">
24
+ <% unless request.script_name.blank? %>
25
+ <dt>Subdomain</dt>
26
+ <dd><%= request.script_name %></dd>
27
+ <% end %>
28
+ <% (Contour.class_variables.collect{|v| v.to_s.gsub('@@','')} - ['menu_items']).each do |attribute| %>
29
+ <dt><%= attribute.titleize %></dt>
26
30
  <% if Contour.send(attribute).blank? %>
27
- <span class="quiet">NULL</span>
31
+ <dd class="muted">NULL</dd>
28
32
  <% else %>
29
- <%= Contour.send(attribute) %>
33
+ <dd><%= Contour.send(attribute) %></dd>
30
34
  <% end %>
31
- </p>
32
- <% end %>
35
+ <% end %>
36
+ </dl>
@@ -1,17 +1,42 @@
1
- <h2>Sign in</h2>
1
+ <% @title = 'Sign in' %>
2
2
 
3
- <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4
- <div><%= f.label :email %>
5
- <%= f.email_field :email %></div>
3
+ <div class="row">
4
+ <div class="span8">
5
+ <div class="page-header">
6
+ <h1><%= @title %></h1>
7
+ </div>
6
8
 
7
- <div><%= f.label :password %>
8
- <%= f.password_field :password %></div>
9
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), html: { class: 'form-horizontal' }) do |f| %>
10
+ <div class="control-group">
11
+ <%= f.label :email, class: 'control-label' %>
12
+ <div class="controls">
13
+ <%= f.email_field :email %>
14
+ </div>
15
+ </div>
9
16
 
10
- <% if devise_mapping.rememberable? -%>
11
- <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
12
- <% end -%>
17
+ <div class="control-group">
18
+ <%= f.label :password, class: 'control-label' %>
19
+ <div class="controls">
20
+ <%= f.password_field :password %>
21
+ </div>
22
+ </div>
13
23
 
14
- <div><%= f.submit "Sign in", class: 'btn btn-primary' %></div>
15
- <% end %>
24
+ <% if devise_mapping.rememberable? -%>
25
+ <div class="control-group">
26
+ <div class="controls checkbox">
27
+ <%= f.check_box :remember_me %> <%= f.label :remember_me %>
28
+ </div>
29
+ </div>
30
+ <% end -%>
16
31
 
17
- <%= render "links" %>
32
+ <div class="form-actions">
33
+ <%= f.submit "Sign in", class: 'btn btn-primary' %>
34
+ <%= render partial: 'contour/links' %>
35
+ </div>
36
+ <% end %>
37
+ </div>
38
+
39
+ <div class="span4">
40
+ <%= render partial: 'contour/layouts/latest_news' %>
41
+ </div>
42
+ </div>
@@ -1,12 +1,20 @@
1
- <h2>Resend unlock instructions</h2>
1
+ <% @title = 'Resend unlock instructions' %>
2
+ <div class="page-header">
3
+ <h1><%= @title %></h1>
4
+ </div>
2
5
 
3
- <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
6
+ <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post, class: 'form-horizontal' }) do |f| %>
4
7
  <%= devise_error_messages! %>
5
8
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email %></div>
9
+ <div class="control-group">
10
+ <%= f.label :email, class: 'control-label' %>
11
+ <div class="controls">
12
+ <%= f.email_field :email %>
13
+ </div>
14
+ </div>
8
15
 
9
- <div><%= f.submit "Resend unlock instructions" %></div>
16
+ <div class="form-actions">
17
+ <%= f.submit "Resend unlock instructions", class: 'btn btn-primary' %>
18
+ <%= render partial: 'contour/links' %>
19
+ </div>
10
20
  <% end %>
11
-
12
- <%= render "links" %>