contour 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.9.2
data/CHANGELOG.rdoc CHANGED
@@ -1,8 +1,18 @@
1
+ == 0.5.4
2
+
3
+ * Enhancements
4
+ * Added arrow.png image asset
5
+ * Added config.news_feed options that allows users to specify an RSS feed url that is displayed on the login page
6
+ * Added config.news_feed_items to be able to specify the maximum number of items displayed in the News Feed
7
+
8
+ * Refactoring
9
+ * Code cleanup and additional logger information for Devise Registrations (Omniauth) controller
10
+
1
11
  == 0.5.3
2
12
 
3
13
  * Enhancements
4
14
  * Added warning.png image asset
5
-
15
+
6
16
  == 0.5.2
7
17
 
8
18
  * Bug Fix
@@ -23,13 +23,16 @@ class Contour::AuthenticationsController < ApplicationController
23
23
  logger.info "OMNI AUTH INFO: #{omniauth.inspect}"
24
24
  omniauth['user_info']['email'] = omniauth['extra']['user_hash']['email'] if omniauth['user_info'] and omniauth['user_info']['email'].blank? and omniauth['extra'] and omniauth['extra']['user_hash']
25
25
  if authentication
26
+ logger.info "Existing authentication found."
26
27
  session["user_return_to"] = request.env["action_dispatch.request.unsigned_session_cookie"]["user_return_to"] if request.env and request.env["action_dispatch.request.unsigned_session_cookie"] and request.env["action_dispatch.request.unsigned_session_cookie"]["user_return_to"] and session["user_return_to"].blank?
27
28
  flash[:notice] = "Signed in successfully." if authentication.user.active_for_authentication?
28
29
  sign_in_and_redirect(:user, authentication.user)
29
30
  elsif current_user
31
+ logger.info "Logged in user found, creating associated authentication."
30
32
  current_user.authentications.create!(:provider => omniauth['provider'], :uid => omniauth['uid'])
31
33
  redirect_to authentications_path, :notice => "Authentication successful."
32
34
  else
35
+ logger.info "Creating new user with new authentication."
33
36
  user = User.new(params[:user])
34
37
  user.apply_omniauth(omniauth)
35
38
  if user.save
@@ -1,3 +1,22 @@
1
+ require 'rss/2.0'
2
+ require 'open-uri'
3
+
1
4
  class Contour::SessionsController < Devise::SessionsController
2
5
 
6
+ def new
7
+ @news_feed = ''
8
+ unless Contour.news_feed.blank?
9
+ begin
10
+ open(Contour.news_feed) do |http|
11
+ response = http.read
12
+ @news_feed = RSS::Parser.parse(response, false)
13
+ end
14
+ rescue => e
15
+ logger.info "\n\nRSS Feed #{Contour.news_feed}\nRSS Feed Error: #{e}\n\n"
16
+ end
17
+ end
18
+
19
+ super
20
+ end
21
+
3
22
  end
@@ -1,5 +1,4 @@
1
1
  <% PROVIDERS.each do |provider| %>
2
-
3
2
  <% url_params = (provider == :google_apps) ? '?domain=gmail.com' : '' %>
4
3
  <% if provider == :open_id %>
5
4
  <% provider_name = 'OpenID' %>
@@ -14,12 +13,8 @@
14
13
  <% provider_name = provider.to_s.titleize %>
15
14
  <% image_name = provider.to_s.downcase %>
16
15
  <% end %>
17
- <% if false %>
18
- <div style="float:right;margin-right:15px;width:32px;position:relative">&nbsp;
19
- <div style="position:absolute;top:-4px;">
20
- <% end %>
21
16
  <div style="float:right;top:-4px;position:relative;height:20px;margin-right:15px">
22
- <a href="<%#= Contour.application_site_url.to_s + "/" %><%= request.script_name %><%= "/" + OmniAuth.config.path_prefix.split('/').last.to_s %><%= "/" + provider.to_s.downcase %><%= url_params %>" class="noicon">
17
+ <a href="<%= request.script_name %><%= "/" + OmniAuth.config.path_prefix.split('/').last.to_s %><%= "/" + provider.to_s.downcase %><%= url_params %>" class="noicon">
23
18
  <%= image_tag "contour/#{image_name}_32.png", :align => 'absmiddle', :height => "28px", :title => provider_name %>
24
19
  </a>
25
20
  </div>
@@ -1,4 +1,3 @@
1
- <!-- authentications/index.html.erb -->
2
1
  <% @title = "Authentications" %>
3
2
 
4
3
  <h1><%= @title %></h1>
@@ -0,0 +1,16 @@
1
+ <% unless @news_feed.blank? %>
2
+ <fieldset>
3
+ <legend>Latest News</legend>
4
+
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 %>
14
+ <% end %>
15
+ </fieldset>
16
+ <% end %>
@@ -1,27 +1,36 @@
1
1
  <% @title = 'Login' %>
2
2
 
3
- <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4
- <fieldset style="width:235px">
5
- <legend><%= @title %></legend>
3
+ <table class="blank padded">
4
+ <tr>
5
+ <td valign="middle">
6
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
7
+ <fieldset style="width:235px">
8
+ <legend><%= @title %></legend>
6
9
 
7
- <div class="field">
8
- <%= f.label :email %><br />
9
- <%= f.text_field :email %>
10
- </div>
11
- <div class="field">
12
- <%= f.label :password %><br />
13
- <%= f.password_field :password %>
14
- </div>
15
- </fieldset>
16
- <div class="actions">
17
- <% form_name = "#{resource.class.name.underscore}_new" %>
18
- <%= link_to_function image_tag('contour/tick.png', :alt => '') + "Login", "$('##{form_name}').submit();", :class => "button positive" %>
19
- <% if devise_mapping.rememberable? -%>
20
- <div style="padding-top:5px;padding-bottom:4px;"><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
21
- <% end -%>
22
- <% if devise_mapping.recoverable? && controller_name != 'passwords' %>
23
- <div style="clear:both"></div><br />
24
- <%= link_to "Forgot your password?", new_password_path(resource_name) %> or <%= link_to "Register here!", new_registration_path(resource_name) %>
25
- <% end %>
26
- </div>
27
- <% end %>
10
+ <div class="field">
11
+ <%= f.label :email %><br />
12
+ <%= f.text_field :email %>
13
+ </div>
14
+ <div class="field">
15
+ <%= f.label :password %><br />
16
+ <%= f.password_field :password %>
17
+ </div>
18
+ </fieldset>
19
+ <div class="actions">
20
+ <% form_name = "#{resource.class.name.underscore}_new" %>
21
+ <%= link_to_function image_tag('contour/tick.png', :alt => '') + "Login", "$('##{form_name}').submit();", :class => "button positive" %>
22
+ <% if devise_mapping.rememberable? -%>
23
+ <div style="padding-top:5px;padding-bottom:4px;"><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
24
+ <% end -%>
25
+ <% if devise_mapping.recoverable? && controller_name != 'passwords' %>
26
+ <div style="clear:both"></div><br />
27
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %> or <%= link_to "Register here!", new_registration_path(resource_name) %>
28
+ <% end %>
29
+ </div>
30
+ <% end %>
31
+ </td>
32
+ <td>
33
+ <%= render :partial => 'contour/layouts/latest_news' %>
34
+ </td>
35
+ </tr>
36
+ </table>
data/lib/contour.rb CHANGED
@@ -42,7 +42,15 @@ module Contour
42
42
  :links => [{:name => 'Home', :path => 'root_path'}]
43
43
  }
44
44
  ]
45
-
45
+
46
+ # Default news feed
47
+ mattr_accessor :news_feed
48
+ @@news_feed = nil
49
+
50
+ # Default max number of items displayed in the news feed
51
+ mattr_accessor :news_feed_items
52
+ @@news_feed_items = 5
53
+
46
54
  def self.setup
47
55
  yield self
48
56
  end
@@ -1,3 +1,3 @@
1
1
  module Contour
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -30,4 +30,10 @@ Contour.setup do |config|
30
30
  # :links => [{:name => 'Home', :path => 'root_path', :image => '', :image_options => {}}]
31
31
  # }]
32
32
 
33
+ # Enter an address of a valid RSS Feed if you would like to see news on the sign in page.
34
+ # config.news_feed = ''
35
+
36
+ # Enter the max number of items you want to see in the news feed.
37
+ # config.news_feed_items = 5
38
+
33
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-30 00:00:00.000000000Z
12
+ date: 2011-10-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: devise
16
- requirement: &70126968581260 !ruby/object:Gem::Requirement
16
+ requirement: &70176180355640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.4.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70126968581260
24
+ version_requirements: *70176180355640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: omniauth
27
- requirement: &70126968578180 !ruby/object:Gem::Requirement
27
+ requirement: &70176180354940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 0.2.6
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70126968578180
35
+ version_requirements: *70176180354940
36
36
  description: Basic Rails Framework files and assets for layout and authentication
37
37
  email: remosm@gmail.com
38
38
  executables: []
@@ -40,6 +40,7 @@ extensions: []
40
40
  extra_rdoc_files: []
41
41
  files:
42
42
  - .gitignore
43
+ - .rvmrc
43
44
  - CHANGELOG.rdoc
44
45
  - LICENSE
45
46
  - README.rdoc
@@ -51,6 +52,7 @@ files:
51
52
  - app/views/contour/authentications/_index.html.erb
52
53
  - app/views/contour/authentications/_menu.html.erb
53
54
  - app/views/contour/authentications/index.html.erb
55
+ - app/views/contour/layouts/_latest_news.html.erb
54
56
  - app/views/contour/layouts/_menu.html.erb
55
57
  - app/views/contour/layouts/_message.html.erb
56
58
  - app/views/contour/layouts/application.html.erb
@@ -80,6 +82,7 @@ files:
80
82
  - test/unit/authentication_test.rb
81
83
  - test/unit/helpers/registrations_helper_test.rb
82
84
  - vendor/assets/images/contour/addfile.png
85
+ - vendor/assets/images/contour/arrow.png
83
86
  - vendor/assets/images/contour/blank.png
84
87
  - vendor/assets/images/contour/cas_32.png
85
88
  - vendor/assets/images/contour/cas_64.png