contour 2.7.0 → 3.0.0.beta1

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +1 -29
  4. data/app/assets/stylesheets/glyphicon-overrides.scss +13 -0
  5. data/app/assets/stylesheets/opensans.scss +20 -0
  6. data/app/controllers/contour/registrations_controller.rb +1 -10
  7. data/app/controllers/contour/sessions_controller.rb +8 -41
  8. data/app/views/contour/layouts/_menu.html.erb +0 -2
  9. data/app/views/contour/sessions/new.html.erb +32 -46
  10. data/config/routes.rb +0 -5
  11. data/contour.gemspec +0 -3
  12. data/lib/contour.rb +2 -14
  13. data/lib/contour/fixes.rb +0 -3
  14. data/lib/contour/version.rb +3 -3
  15. data/lib/generators/contour/install/install_generator.rb +0 -4
  16. data/lib/generators/contour/install/templates/README +0 -4
  17. data/lib/generators/contour/install/templates/contour.rb +2 -12
  18. data/test/controllers/passwords_controller_test.rb +0 -9
  19. data/test/controllers/registrations_controller_test.rb +0 -14
  20. data/test/controllers/sessions_controller_test.rb +0 -12
  21. data/test/dummy/app/models/user.rb +0 -3
  22. data/test/dummy/config/initializers/contour.rb +2 -12
  23. data/test/dummy/db/development.sqlite3 +0 -0
  24. data/test/dummy/db/migrate/20111203203123_devise_create_users.rb +1 -1
  25. data/test/dummy/db/schema.rb +4 -12
  26. data/test/dummy/db/test.sqlite3 +0 -0
  27. data/test/dummy/test/fixtures/users.yml +1 -1
  28. data/test/models/user_test.rb +0 -4
  29. metadata +5 -71
  30. data/app/assets/stylesheets/glyphicon-overrides.scss.erb +0 -13
  31. data/app/assets/stylesheets/opensans.css.erb +0 -20
  32. data/app/controllers/contour/authentications_controller.rb +0 -57
  33. data/app/models/authentication.rb +0 -4
  34. data/app/models/concerns/contour_authenticatable.rb +0 -12
  35. data/app/models/concerns/contourable.rb +0 -19
  36. data/app/views/contour/authentications/_add_remove_table.html.erb +0 -31
  37. data/app/views/contour/authentications/_authentications.html.erb +0 -3
  38. data/app/views/contour/authentications/_menu.html.erb +0 -10
  39. data/app/views/contour/authentications/destroy.js.erb +0 -1
  40. data/app/views/contour/authentications/index.html.erb +0 -6
  41. data/app/views/contour/layouts/_latest_news.html.erb +0 -17
  42. data/lib/contour/fixes/devise-with-rails-4-2.rb +0 -17
  43. data/lib/contour/fixes/omniauth.rb +0 -110
  44. data/lib/contour/fixes/sass-rails.rb +0 -8
  45. data/lib/generators/contour/install/templates/omniauth.rb +0 -33
  46. data/test/controllers/authentications_controller_test.rb +0 -57
  47. data/test/dummy/config/initializers/omniauth.rb +0 -33
  48. data/test/dummy/db/migrate/20111203203307_create_authentications.rb +0 -11
  49. data/test/dummy/test/fixtures/authentications.yml +0 -16
  50. data/test/models/authentication_test.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec4ad7b4aaf3319278a5afd7cb379369f05de69b
4
- data.tar.gz: cbc64907020460e9f6dfdd4899742eae5fbd6595
3
+ metadata.gz: c2e373a1e2322fc9859477f26f26998728a74ef0
4
+ data.tar.gz: 010c2ddc245cd936603f9a7ddcdcff18ca8600a8
5
5
  SHA512:
6
- metadata.gz: 7ff2d9392c2f05b54a843d61582109690955b350c0f2a2b919a8e392ecaad160672c81d3656fbf9d5d74c50a028437c69ae656046f04cf8d738e04e327228407
7
- data.tar.gz: f02eb6c2475a43f58bf71b37a9d1ffdc77316a4c826584d80444ce90675c07d7732aa5dcb44843d2ed2b4820aaf9c975386b91c51b23b4faf8494fd1b34eb51e
6
+ metadata.gz: 51cd53eafaea08f98cc1a15ff0b5c948a5c164509735480e17bb0a134398597caae871fd6306f3e5fe4e6217b2dce33918f1ba67f5cde4fa59c42c0a5bd42681
7
+ data.tar.gz: 8a55bf71285748a8d1c0024906a2197f7231daa69bb58b059709804b6855f3e7874bd31de0c0d9c7dc026c6c16dd34daad1c82a564562d25c7b56db4b001be58
@@ -1,3 +1,14 @@
1
+ ## 3.0.0
2
+
3
+ ### Breaking Changes
4
+ - Removed multiple authentication support as this is better handled directly with omniauth and devise
5
+ - Removed news feed stream from new registration page
6
+
7
+ ### Enhancements
8
+ - Simplified SCSS files using `asset-url`
9
+ - **Gem Changes**
10
+ - Removed omniauth, omniauth-ldap, and omniauth-openid
11
+
1
12
  ## 2.7.0 (February 13, 2015)
2
13
 
3
14
  ### Enhancements
data/README.md CHANGED
@@ -35,7 +35,7 @@ cd blank_rails_project
35
35
  Modify `Gemfile` and add
36
36
 
37
37
  ```ruby
38
- gem 'contour', '~> 2.7.0'
38
+ gem 'contour', '~> 3.0.0'
39
39
  ```
40
40
 
41
41
  Run Bundle install
@@ -50,20 +50,6 @@ Install contour files
50
50
  rails generate contour:install
51
51
  ```
52
52
 
53
- Add the authentication model
54
-
55
- ```
56
- rails generate model Authentication user_id:integer provider:string uid:string
57
- ```
58
-
59
- Migrate your database
60
-
61
- ```
62
- bundle exec rake db:create
63
-
64
- bundle exec rake db:migrate
65
- ```
66
-
67
53
  Create a sample controller
68
54
 
69
55
  ```
@@ -119,20 +105,6 @@ Add the following to the top of your `app/controllers/welcome_controller.rb`
119
105
  before_action :authenticate_user!
120
106
  ```
121
107
 
122
- Add the following to your `app/models/user.rb`
123
-
124
- ```ruby
125
- # Concerns
126
- include Contourable
127
- ```
128
-
129
- Add the following to your `app/models/authentication.rb`
130
-
131
- ```ruby
132
- # Concerns
133
- include ContourAuthenticatable
134
- ```
135
-
136
108
  Edit `config/initializers/devise.rb` to use `:get` for devise `sign_out_via`
137
109
 
138
110
  ```ruby
@@ -0,0 +1,13 @@
1
+ @font-face {
2
+ font-family: 'Glyphicons Halflings Contour';
3
+ src: asset-url('bootstrap/glyphicons-halflings-regular.eot');
4
+
5
+ src: asset-url('bootstrap/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
6
+ asset-url('bootstrap/glyphicons-halflings-regular.woff') format('woff'),
7
+ asset-url('bootstrap/glyphicons-halflings-regular.ttf') format('truetype'),
8
+ asset-url('bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
9
+ }
10
+
11
+ .glyphicon {
12
+ font-family: 'Glyphicons Halflings Contour';
13
+ }
@@ -0,0 +1,20 @@
1
+ @font-face {
2
+ font-family: 'Open Sans';
3
+ font-style: normal;
4
+ font-weight: 300;
5
+ src: asset-url('opensans/OpenSans-Light.ttf') format('truetype');
6
+ }
7
+
8
+ @font-face {
9
+ font-family: 'Open Sans';
10
+ font-style: normal;
11
+ font-weight: 400;
12
+ src: asset-url('opensans/OpenSans-Regular.ttf') format('truetype');
13
+ }
14
+
15
+ @font-face {
16
+ font-family: 'Open Sans';
17
+ font-style: normal;
18
+ font-weight: 700;
19
+ src: asset-url('opensans/OpenSans-Bold.ttf') format('truetype');
20
+ }
@@ -27,7 +27,7 @@ class Contour::RegistrationsController < Devise::RegistrationsController
27
27
  redirect_to new_session_path(resource), notice: 'Thank you for your interest! Due to limited capacity you have been put on a waiting list. We will email you when we open up additional space.'
28
28
  else
29
29
  super
30
- session[:omniauth] = nil if @user and not @user.new_record?
30
+ # session[:omniauth] = nil if @user and not @user.new_record?
31
31
  end
32
32
  end
33
33
 
@@ -38,15 +38,6 @@ class Contour::RegistrationsController < Devise::RegistrationsController
38
38
  devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(*permitted_fields) }
39
39
  end
40
40
 
41
- def build_resource(hash=nil)
42
- object = super(hash)
43
- if session[:omniauth]
44
- @user.apply_omniauth(session[:omniauth])
45
- @user.valid?
46
- end
47
- object
48
- end
49
-
50
41
  def after_inactive_sign_up_path_for(resource)
51
42
  new_session_path(resource) # root_path
52
43
  end
@@ -1,47 +1,14 @@
1
- require 'rss/2.0'
2
- require 'open-uri'
3
-
4
1
  class Contour::SessionsController < Devise::SessionsController
5
2
 
6
- def new
7
- @news_feed = ''
8
- unless Contour.news_feed.blank?
9
- begin
10
- open(Contour.news_feed, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE) 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
-
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
3
+ # Overwrite devise to provide JSON responses as well
24
4
  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
-
32
- respond_to do |format|
33
- format.html { respond_with resource, location: after_sign_in_path_for(resource) }
34
- format.json { render json: { success: true, resource_name => { id: resource.id, email: resource.email, first_name: resource.first_name, last_name: resource.last_name, authentication_token: (resource.respond_to?(:authentication_token) ? resource.authentication_token : nil) } } }
35
- end
36
- else
37
- resource = resource_name.to_s.titleize.constantize.find_by_email(params[resource_name][:email])
38
- if resource and resource.respond_to?('authentications') and providers = resource.authentications.pluck(:provider).uniq and providers.size > 0
39
- redirect_to request.script_name + '/auth/' + providers.first
40
- elsif providers = Authentication.where(uid: params[resource_name][:email]).pluck(:provider).uniq and providers.size > 0
41
- redirect_to request.script_name + '/auth/' + providers.first
42
- else
43
- resource = warden.authenticate!(auth_options)
44
- end
5
+ self.resource = warden.authenticate!(auth_options)
6
+ set_flash_message(:notice, :signed_in) if is_flashing_format?
7
+ sign_in(resource_name, resource)
8
+ yield resource if block_given?
9
+ respond_to do |format|
10
+ format.html { respond_with resource, location: after_sign_in_path_for(resource) }
11
+ format.json { render json: { success: true, resource_name => { id: resource.id, email: resource.email, first_name: resource.first_name, last_name: resource.last_name, authentication_token: (resource.respond_to?(:authentication_token) ? resource.authentication_token : nil) } } }
45
12
  end
46
13
  end
47
14
 
@@ -32,8 +32,6 @@
32
32
  <li class="divider"></li>
33
33
  <% elsif not link[:header].blank? %>
34
34
  <li class="dropdown-header"><%= link[:eval] ? eval(link[:header]) : link[:header] %></li>
35
- <% elsif link[:authentications] == true %>
36
- <%= render partial: 'contour/authentications/menu' %>
37
35
  <% else %>
38
36
  <li><%= link_to (link[:eval] ? eval(link[:html].blank? ? link[:name] : link[:html].html_safe) : (link[:html].blank? ? link[:name] : link[:html].html_safe) + (link[:image].blank? ? '' : image_tag(link[:image], link[:image_options]))).html_safe, link[:path].blank? ? '#' : eval(link[:path].to_s), target: link[:target] %></li>
39
37
  <% end %>
@@ -1,55 +1,41 @@
1
1
  <% @title = 'Sign in' %>
2
2
 
3
- <div class="row">
4
- <div class="col-md-8">
5
- <div class="page-header">
6
- <h1><%= @title %></h1>
7
- </div>
8
-
9
- <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), html: { class: 'form-horizontal' }) do |f| %>
10
- <div class="form-group">
11
- <%= f.label :email, class: 'col-md-2 control-label' %>
12
- <div class="col-md-10">
13
- <%= f.email_field :email, class: 'form-control' %>
14
- </div>
15
- </div>
3
+ <div class="page-header">
4
+ <h1><%= @title %></h1>
5
+ </div>
16
6
 
17
- <div class="form-group">
18
- <%= f.label :password, class: 'col-md-2 control-label' %>
19
- <div class="col-md-10">
20
- <%= f.password_field :password, class: 'form-control' %>
21
- </div>
22
- </div>
7
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), html: { class: 'form-horizontal' }) do |f| %>
8
+ <div class="form-group">
9
+ <%= f.label :email, class: 'col-md-2 control-label' %>
10
+ <div class="col-md-10">
11
+ <%= f.email_field :email, class: 'form-control' %>
12
+ </div>
13
+ </div>
23
14
 
24
- <% if devise_mapping.rememberable? -%>
25
- <div class="form-group">
26
- <div class="col-md-offset-2 col-md-10">
27
- <div class="checkbox">
28
- <label>
29
- <%= f.check_box :remember_me %>
30
- Remember me
31
- </label>
32
- </div>
33
- </div>
34
- </div>
35
- <% end -%>
15
+ <div class="form-group">
16
+ <%= f.label :password, class: 'col-md-2 control-label' %>
17
+ <div class="col-md-10">
18
+ <%= f.password_field :password, class: 'form-control' %>
19
+ </div>
20
+ </div>
36
21
 
37
- <div class="form-group">
38
- <div class="col-md-offset-2 col-md-10">
39
- <%= f.submit "Sign in", class: 'btn btn-primary' %>
40
- <%= render partial: 'contour/links' %>
41
- <% PROVIDERS.each do |provider| %>
42
- <a href="<%= request.script_name + "/" + OmniAuth.config.path_prefix.split('/').last.to_s + "/" + provider.to_s.downcase %>" class="btn btn-large btn-default" style="white-space:nowrap">
43
- <%= image_tag "contour/#{provider.to_s.downcase}_32.png", align: 'absmiddle' %>
44
- </a>
45
- <% end %>
22
+ <% if devise_mapping.rememberable? -%>
23
+ <div class="form-group">
24
+ <div class="col-md-offset-2 col-md-10">
25
+ <div class="checkbox">
26
+ <label>
27
+ <%= f.check_box :remember_me %>
28
+ Remember me
29
+ </label>
46
30
  </div>
47
31
  </div>
48
- <% end %>
49
-
50
- </div>
32
+ </div>
33
+ <% end -%>
51
34
 
52
- <div class="col-md-4">
53
- <%= render partial: 'contour/layouts/latest_news' %>
35
+ <div class="form-group">
36
+ <div class="col-md-offset-2 col-md-10">
37
+ <%= f.submit "Sign in", class: 'btn btn-primary' %>
38
+ <%= render partial: 'contour/links' %>
39
+ </div>
54
40
  </div>
55
- </div>
41
+ <% end %>
@@ -1,12 +1,7 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- get '/auth/failure' => 'contour/authentications#failure'
4
- post '/auth/:provider/callback' => 'contour/authentications#create'
5
- get '/auth/:provider' => 'contour/authentications#passthru'
6
3
  get '/contour' => 'contour/samples#index'
7
4
 
8
- resources :authentications, controller: 'contour/authentications'
9
-
10
5
  # devise_for :users, controllers: { registrations: 'contour/registrations',
11
6
  # sessions: 'contour/sessions',
12
7
  # passwords: 'contour/passwords',
@@ -28,9 +28,6 @@ Gem::Specification.new do |s|
28
28
  s.add_dependency 'jquery-rails', '>= 3.0.4'
29
29
  s.add_dependency 'coffee-rails', '~> 4.1.0'
30
30
  s.add_dependency 'devise', '~> 3.4.1'
31
- s.add_dependency 'omniauth', '~> 1.2.1'
32
- s.add_dependency 'omniauth-ldap', '~> 1.0.4'
33
- s.add_dependency 'omniauth-openid', '~> 1.0.1'
34
31
  s.add_dependency 'bootstrap-sass', '~> 3.3.3'
35
32
  s.add_dependency 'sass-rails', '~> 5.0.1'
36
33
  s.add_dependency 'autoprefixer-rails'
@@ -31,15 +31,11 @@ module Contour
31
31
  @@menu_items = [
32
32
  {
33
33
  name: 'Login', display: 'not_signed_in', path: 'new_user_session_path', position: 'right', condition: 'true',
34
- links: [{ name: 'Sign Up', path: 'new_user_registration_path' },
35
- { divider: true },
36
- { authentications: true }]
34
+ links: [{ name: 'Sign Up', path: 'new_user_registration_path' }]
37
35
  },
38
36
  {
39
37
  name: 'current_user.email', eval: true, display: 'signed_in', position: 'right', condition: 'true',
40
- links: [{ name: 'Authentications', path: 'authentications_path', condition: 'not PROVIDERS.blank?' },
41
- { divider: true },
42
- { name: 'Logout', path: 'destroy_user_session_path' }]
38
+ links: [{ name: 'Logout', path: 'destroy_user_session_path' }]
43
39
  },
44
40
  {
45
41
  name: 'Home', display: 'always', path: 'root_path', position: 'left', condition: 'true', image: '', image_options: {},
@@ -57,14 +53,6 @@ module Contour
57
53
  mattr_accessor :search_bar
58
54
  @@search_bar = {}
59
55
 
60
- # Default news feed
61
- mattr_accessor :news_feed
62
- @@news_feed = nil
63
-
64
- # Default max number of items displayed in the news feed
65
- mattr_accessor :news_feed_items
66
- @@news_feed_items = 5
67
-
68
56
  # A string or array of strings that represent a CSS color code for generic link color
69
57
  mattr_accessor :link_color
70
58
  @@link_color = nil
@@ -1,8 +1,5 @@
1
1
  require 'contour/fixes/devise.rb'
2
- require 'contour/fixes/devise-with-rails-4-2.rb'
3
- require 'contour/fixes/omniauth.rb'
4
2
  require 'contour/fixes/rack.rb'
5
- require 'contour/fixes/sass-rails.rb'
6
3
 
7
4
  module Contour
8
5
  module Fixes
@@ -1,9 +1,9 @@
1
1
  module Contour
2
2
  module VERSION #:nodoc:
3
- MAJOR = 2
4
- MINOR = 7
3
+ MAJOR = 3
4
+ MINOR = 0
5
5
  TINY = 0
6
- BUILD = nil # nil, "pre", "rc", "rc2"
6
+ BUILD = "beta1" # nil, "pre", "rc", "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
@@ -8,10 +8,6 @@ class Contour::InstallGenerator < Rails::Generators::Base
8
8
  template "contour.rb", "config/initializers/contour.rb"
9
9
  end
10
10
 
11
- def copy_omniauth
12
- template "omniauth.rb", "config/initializers/omniauth.rb"
13
- end
14
-
15
11
  def install_devise
16
12
  generate("devise:install")
17
13
  model_name = ask("What would you like the user model to be called? [user]")
@@ -17,8 +17,4 @@ Contour requires some additional setup:
17
17
 
18
18
  4. Remove any scaffold.css files that exist in your application
19
19
 
20
- 5. Make a migration for Authentications
21
-
22
- rails generate model Authentication user_id:integer provider:string uid:string
23
-
24
20
  ===============================================================================
@@ -21,15 +21,11 @@ Contour.setup do |config|
21
21
  # [
22
22
  # {
23
23
  # name: 'Login', display: 'not_signed_in', path: 'new_user_session_path', position: 'right', condition: 'true',
24
- # links: [{ name: 'Sign Up', path: 'new_user_registration_path' },
25
- # { divider: true },
26
- # { authentications: true }]
24
+ # links: [{ name: 'Sign Up', path: 'new_user_registration_path' }]
27
25
  # },
28
26
  # {
29
27
  # name: 'current_user.email', eval: true, display: 'signed_in', position: 'right', condition: 'true',
30
- # links: [{ name: 'Authentications', path: 'authentications_path', condition: 'not PROVIDERS.blank?' },
31
- # { divider: true },
32
- # { name: 'Logout', path: 'destroy_user_session_path' }]
28
+ # links: [{ name: 'Logout', path: 'destroy_user_session_path' }]
33
29
  # },
34
30
  # {
35
31
  # name: 'Home', display: 'always', path: 'root_path', position: 'left', condition: 'true', image: '', image_options: {},
@@ -46,12 +42,6 @@ Contour.setup do |config|
46
42
  # position: 'left'
47
43
  # }
48
44
 
49
- # Enter an address of a valid RSS Feed if you would like to see news on the sign in page.
50
- # config.news_feed = ''
51
-
52
- # Enter the max number of items you want to see in the news feed.
53
- # config.news_feed_items = 5
54
-
55
45
  # The following three parameters can be set as strings, which will rotate through the colors on a daily basis, selecting an index using (YearDay % ArraySize)
56
46
 
57
47
  # A string or array of strings that represent a CSS color code for generic link color
@@ -16,13 +16,4 @@ class Contour::PasswordsControllerTest < ActionController::TestCase
16
16
  assert_equal I18n.t('devise.passwords.send_instructions'), flash[:notice]
17
17
  assert_redirected_to new_user_session_path
18
18
  end
19
-
20
- # test "an admin should be able to create new user" do
21
- # assert_difference('User.count') do
22
- # post :create, user: { first_name: 'First Name', last_name: 'Last Name', status: 'active', email: 'new_registration@example.com',
23
- # steering_committee: true, steering_committee_secretary: false, pp_committee: false, pp_committee_secretary: false, system_admin: false }
24
- # end
25
- #
26
- # assert_redirected_to user_path(assigns(:user))
27
- # end
28
19
  end
@@ -64,18 +64,4 @@ class Contour::RegistrationsControllerTest < ActionController::TestCase
64
64
  # assert_response :success
65
65
  # end
66
66
 
67
- # test "an admin should be able to create new user" do
68
- # login(users(:admin))
69
- # assert_difference('User.count') do
70
- # post :create, user: { first_name: 'First Name', last_name: 'Last Name', status: 'active', email: 'new_registration@example.com', system_admin: false }
71
- # end
72
-
73
- # assert_not_nil assigns(:user)
74
- # assert_equal 'First Name', assigns(:user).first_name
75
- # assert_equal 'Last Name', assigns(:user).last_name
76
- # assert_equal 'active', assigns(:user).status
77
- # assert_equal 'new_registration@example.com', assigns(:user).email
78
-
79
- # assert_redirected_to user_path(assigns(:user))
80
- # end
81
67
  end