contour 0.6.1 → 0.7.0
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/CHANGELOG.rdoc +13 -0
- data/README.rdoc +1 -7
- data/Rakefile +38 -0
- data/{vendor → app}/assets/images/contour/addfile.png +0 -0
- data/{vendor → app}/assets/images/contour/arrow.png +0 -0
- data/{vendor → app}/assets/images/contour/blank.png +0 -0
- data/{vendor → app}/assets/images/contour/cas_32.png +0 -0
- data/{vendor → app}/assets/images/contour/cas_64.png +0 -0
- data/{vendor → app}/assets/images/contour/cross.png +0 -0
- data/{vendor → app}/assets/images/contour/delete.png +0 -0
- data/{vendor → app}/assets/images/contour/doc.png +0 -0
- data/{vendor → app}/assets/images/contour/download.png +0 -0
- data/{vendor → app}/assets/images/contour/edit.png +0 -0
- data/{vendor → app}/assets/images/contour/email.png +0 -0
- data/{vendor → app}/assets/images/contour/external.png +0 -0
- data/{vendor → app}/assets/images/contour/facebook_32.png +0 -0
- data/{vendor → app}/assets/images/contour/facebook_64.png +0 -0
- data/{vendor → app}/assets/images/contour/favorite_no.png +0 -0
- data/{vendor → app}/assets/images/contour/favorite_yes.png +0 -0
- data/{vendor → app}/assets/images/contour/feed.png +0 -0
- data/{vendor → app}/assets/images/contour/google_apps_32.png +0 -0
- data/{vendor → app}/assets/images/contour/google_apps_64.png +0 -0
- data/{vendor → app}/assets/images/contour/im.png +0 -0
- data/{vendor → app}/assets/images/contour/information.png +0 -0
- data/{vendor → app}/assets/images/contour/key.png +0 -0
- data/{vendor → app}/assets/images/contour/ldap_32.png +0 -0
- data/{vendor → app}/assets/images/contour/ldap_64.png +0 -0
- data/{vendor → app}/assets/images/contour/linkedin_32.png +0 -0
- data/{vendor → app}/assets/images/contour/linkedin_64.png +0 -0
- data/{vendor → app}/assets/images/contour/mydocuments.png +0 -0
- data/{vendor → app}/assets/images/contour/open.png +0 -0
- data/{vendor → app}/assets/images/contour/openid_32.png +0 -0
- data/{vendor → app}/assets/images/contour/openid_64.png +0 -0
- data/{vendor → app}/assets/images/contour/pdf.png +0 -0
- data/{vendor → app}/assets/images/contour/save.png +0 -0
- data/{vendor → app}/assets/images/contour/search.png +0 -0
- data/{vendor → app}/assets/images/contour/tag_blue.png +0 -0
- data/{vendor → app}/assets/images/contour/tag_green.png +0 -0
- data/{vendor → app}/assets/images/contour/tag_neutral.png +0 -0
- data/{vendor → app}/assets/images/contour/tag_red.png +0 -0
- data/{vendor → app}/assets/images/contour/tick.png +0 -0
- data/{vendor → app}/assets/images/contour/twitter_32.png +0 -0
- data/{vendor → app}/assets/images/contour/twitter_64.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-icons_217bc0_256x240.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-icons_2e83ff_256x240.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-icons_469bdd_256x240.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-icons_6da8d5_256x240.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-icons_cd0a0a_256x240.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-icons_d8e7f3_256x240.png +0 -0
- data/{vendor → app}/assets/images/contour/ui-icons_f9bd01_256x240.png +0 -0
- data/{vendor → app}/assets/images/contour/visited.png +0 -0
- data/{vendor → app}/assets/images/contour/warning.png +0 -0
- data/{vendor → app}/assets/images/contour/xls.png +0 -0
- data/{vendor → app}/assets/javascripts/contour.js +0 -0
- data/{vendor → app}/assets/javascripts/contour/errors.js.coffee +0 -0
- data/app/assets/javascripts/contour/global.js.coffee +13 -0
- data/app/assets/javascripts/contour/menu.js.coffee +21 -0
- data/{vendor → app}/assets/javascripts/contour/popup.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/external/exporting-2.1.9.src.js +0 -0
- data/{vendor → app}/assets/javascripts/external/highcharts-2.1.9.src.js +0 -0
- data/{vendor → app}/assets/javascripts/external/jquery-ui-1.8.10.custom.min.js +0 -0
- data/{vendor → app}/assets/javascripts/external/waypoints.js +0 -0
- data/{vendor → app}/assets/stylesheets/bluetrip-screen.css +0 -0
- data/{vendor → app}/assets/stylesheets/contour.css +0 -0
- data/{vendor → app}/assets/stylesheets/contour/authentication.css +0 -0
- data/{vendor → app}/assets/stylesheets/contour/global.css +2 -1
- data/{vendor → app}/assets/stylesheets/contour/header.css +0 -0
- data/app/assets/stylesheets/contour/menu.css +109 -0
- data/{vendor → app}/assets/stylesheets/contour/message.css +15 -3
- data/{vendor → app}/assets/stylesheets/contour/popup.css +0 -0
- data/{vendor → app}/assets/stylesheets/jquery-ui-1.8.10.custom.css +0 -0
- data/app/models/authentication.rb +11 -0
- data/app/views/contour/authentications/_menu.html.erb +26 -0
- data/app/views/contour/layouts/_menu.html.erb +15 -21
- data/app/views/contour/layouts/application.html.erb +2 -4
- data/app/views/contour/sessions/new.html.erb +2 -2
- data/config/routes.rb +16 -0
- data/contour.gemspec +15 -11
- data/lib/contour.rb +10 -6
- data/lib/contour/engine.rb +0 -1
- data/lib/contour/version.rb +2 -2
- data/lib/generators/contour/install_generator.rb +5 -4
- data/lib/generators/templates/contour.rb +10 -6
- data/test/contour_test.rb +7 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +8 -0
- data/test/dummy/app/assets/stylesheets/application.css +8 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/user.rb +45 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +45 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +37 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +30 -0
- data/test/dummy/config/environments/production.rb +60 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/devise.rb +153 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/omniauth.rb +22 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/migrate/20111203203123_create_users.rb +26 -0
- data/test/dummy/db/migrate/20111203203307_create_authentications.rb +11 -0
- data/test/dummy/db/schema.rb +45 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/fixtures/authentications.yml +14 -9
- data/test/fixtures/users.yml +70 -0
- data/test/functional/authentications_controller_test.rb +2 -2
- data/test/functional/registrations_controller_test.rb +9 -9
- data/test/integration/navigation_test.rb +8 -0
- data/test/test_helper.rb +52 -0
- data/test/unit/authentication_test.rb +6 -3
- data/test/unit/user_test.rb +13 -0
- metadata +186 -96
- data/.gitignore +0 -7
- data/.rvmrc +0 -1
- data/lib/contour/engine/routes.rb +0 -10
- data/test/unit/helpers/registrations_helper_test.rb +0 -4
- data/vendor/assets/javascripts/contour/global.js.coffee +0 -38
- data/vendor/assets/javascripts/contour/menu.js.coffee +0 -6
- data/vendor/assets/stylesheets/contour/menu.css +0 -77
|
@@ -3,32 +3,26 @@
|
|
|
3
3
|
<% display = ['signed_in', 'always'] %>
|
|
4
4
|
<% end %>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
<%
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
<ul class="ul-menu">
|
|
7
|
+
<% Contour.menu_items.each do |menu_item| %>
|
|
8
|
+
<% if display.include?(menu_item[:display]) and (menu_item[:condition].blank? or eval(menu_item[:condition])) %>
|
|
9
|
+
<li class="parent li_<%= menu_item[:position] %>">
|
|
10
|
+
<%= link_to (menu_item[:eval] ? eval(menu_item[:name]) : menu_item[:name].html_safe + (menu_item[:image].blank? ? '' : image_tag(menu_item[:image], menu_item[:image_options]))), eval(menu_item[:path]), :class => 'noicon', :target => menu_item[:target] %>
|
|
11
|
+
<% if menu_item[:links].size > 0 %>
|
|
12
|
+
<ul>
|
|
12
13
|
<% menu_item[:links].each do |link| %>
|
|
13
14
|
<% if link[:condition].blank? or eval(link[:condition]) %>
|
|
14
15
|
<% if link[:html].blank? %>
|
|
15
|
-
<
|
|
16
|
-
<%= link_to (link[:eval] ? eval(link[:name]) : link[:name].html_safe + (link[:image].blank? ? '' : image_tag(link[:image], link[:image_options]))), eval(link[:path]), :class => 'noicon', :target => link[:target] %>
|
|
17
|
-
</div>
|
|
16
|
+
<li><%= link_to (link[:eval] ? eval(link[:name]) : link[:name].html_safe + (link[:image].blank? ? '' : image_tag(link[:image], link[:image_options]))), eval(link[:path]), :class => 'noicon', :target => link[:target] %></li>
|
|
18
17
|
<% else %>
|
|
19
|
-
|
|
18
|
+
<li><%= link[:eval] ? eval(link[:html]).html_safe : link[:html].html_safe %></li>
|
|
20
19
|
<% end %>
|
|
21
20
|
<% end %>
|
|
22
21
|
<% end %>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
</ul>
|
|
23
|
+
<% end %>
|
|
24
|
+
</li>
|
|
25
|
+
<% end %>
|
|
26
26
|
<% end %>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<% ids = Contour.menu_items.select{|mi| display.include?(mi[:display])}.collect{|mi| mi[:id]} %>
|
|
30
|
-
<%= javascript_tag "hideOnMouseOut([#{ids.collect{|id| "'#menu_#{id}'"}.join(',')}]);" %>
|
|
31
|
-
|
|
32
|
-
<%= render :partial => 'contour/authentications/menu' unless user_signed_in? %>
|
|
33
|
-
|
|
34
|
-
<div style="clear:both"></div>
|
|
27
|
+
<%= render :partial => 'contour/authentications/menu' unless user_signed_in? %>
|
|
28
|
+
</ul>
|
|
@@ -24,10 +24,8 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
<%= render :partial => 'contour/layouts/menu' %>
|
|
30
|
-
</div>
|
|
27
|
+
<div id="menu" class="container shadow">
|
|
28
|
+
<%= render :partial => 'contour/layouts/menu' %>
|
|
31
29
|
</div>
|
|
32
30
|
|
|
33
31
|
<div id="content" class="container">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<table class="blank padded">
|
|
4
4
|
<tr>
|
|
5
|
-
<td
|
|
5
|
+
<td style="vertical-align:top">
|
|
6
6
|
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
|
7
7
|
<fieldset style="width:235px">
|
|
8
8
|
<legend><%= @title %></legend>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</div>
|
|
30
30
|
<% end %>
|
|
31
31
|
</td>
|
|
32
|
-
<td>
|
|
32
|
+
<td style="vertical-align:top">
|
|
33
33
|
<%= render :partial => 'contour/layouts/latest_news' %>
|
|
34
34
|
</td>
|
|
35
35
|
</tr>
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Rails.application.routes.draw do
|
|
2
|
+
|
|
3
|
+
match '/auth/failure' => 'contour/authentications#failure'
|
|
4
|
+
match '/auth/:provider/callback' => 'contour/authentications#create'
|
|
5
|
+
match '/auth/:provider' => 'contour/authentications#passthru'
|
|
6
|
+
match '/contour' => 'contour/samples#index'
|
|
7
|
+
|
|
8
|
+
resources :authentications, controller: 'contour/authentications'
|
|
9
|
+
|
|
10
|
+
# devise_for :users, controllers: { registrations: 'contour/registrations',
|
|
11
|
+
# sessions: 'contour/sessions',
|
|
12
|
+
# passwords: 'contour/passwords' },
|
|
13
|
+
# path_names: { sign_up: 'register',
|
|
14
|
+
# sign_in: 'login' }
|
|
15
|
+
|
|
16
|
+
end
|
data/contour.gemspec
CHANGED
|
@@ -11,17 +11,21 @@ require 'contour/version'
|
|
|
11
11
|
|
|
12
12
|
Gem::Specification.new do |s|
|
|
13
13
|
s.name = 'contour'
|
|
14
|
-
s.version
|
|
15
|
-
s.
|
|
16
|
-
s.
|
|
17
|
-
s.
|
|
18
|
-
s.
|
|
19
|
-
s.authors = ['Remo Mueller']
|
|
14
|
+
s.version = Contour::VERSION::STRING
|
|
15
|
+
s.authors = ['Remo Mueller']
|
|
16
|
+
s.email = 'remosm@gmail.com'
|
|
17
|
+
s.homepage = 'https://github.com/remomueller'
|
|
18
|
+
s.summary = 'Basic Rails framework files and assets for layout and authentication'
|
|
20
19
|
s.description = 'Basic Rails Framework files and assets for layout and authentication'
|
|
21
|
-
|
|
22
|
-
s.add_dependency('devise', '~> 1.4.9')
|
|
23
|
-
s.add_dependency('omniauth', '=0.2.6')
|
|
24
|
-
s.add_dependency('jquery-rails', '~> 1.0.17')
|
|
25
20
|
|
|
26
|
-
s.
|
|
21
|
+
s.platform = Gem::Platform::RUBY
|
|
22
|
+
|
|
23
|
+
s.add_dependency 'rails', '~> 3.1.3'
|
|
24
|
+
s.add_dependency 'devise', '~> 1.4.9'
|
|
25
|
+
s.add_dependency 'omniauth', '=0.2.6'
|
|
26
|
+
s.add_dependency 'jquery-rails', '~> 1.0.17'
|
|
27
|
+
|
|
28
|
+
s.files = Dir["{app,config,db,lib}/**/*"] + ["CHANGELOG.rdoc", "contour.gemspec", "LICENSE", "Rakefile", "README.rdoc"]
|
|
29
|
+
# s.files = `git ls-files`.split("\n")
|
|
30
|
+
s.test_files = Dir["test/**/*"]
|
|
27
31
|
end
|
data/lib/contour.rb
CHANGED
|
@@ -30,16 +30,20 @@ module Contour
|
|
|
30
30
|
mattr_accessor :menu_items
|
|
31
31
|
@@menu_items = [
|
|
32
32
|
{
|
|
33
|
-
:name => 'Login', :id => 'auth', :display => 'not_signed_in', :
|
|
34
|
-
:links => [{:name => '
|
|
33
|
+
:name => 'Login', :id => 'auth', :display => 'not_signed_in', :path => 'new_user_session_path', :position => 'right',
|
|
34
|
+
:links => [{:name => 'Sign Up', :path => 'new_user_registration_path'}]
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
:name => 'current_user.name', :eval => true, :id => 'auth', :display => 'signed_in', :
|
|
38
|
-
:
|
|
37
|
+
:name => 'current_user.name', :eval => true, :id => 'auth', :display => 'signed_in', :path => 'user_path(current_user)', :position => 'right', :condition => 'true',
|
|
38
|
+
links: [{ :html => '"<div class=\"small\" style=\"color:#bbb\">"+current_user.email+"</div>"', :eval => true },
|
|
39
|
+
{ :name => 'Settings', :path => 'settings_path' },
|
|
40
|
+
{ :name => 'Authentications', :path => 'authentications_path', :condition => 'not PROVIDERS.blank?' },
|
|
41
|
+
{ :html => "<br />" },
|
|
42
|
+
{ :name => 'Logout', :path => 'destroy_user_session_path' }]
|
|
39
43
|
},
|
|
40
44
|
{
|
|
41
|
-
:name => 'Home', :id => 'home', :display => 'always', :
|
|
42
|
-
:links => [
|
|
45
|
+
:name => 'Home', :id => 'home', :display => 'always', :path => 'root_path', :position => 'left',
|
|
46
|
+
:links => []
|
|
43
47
|
}
|
|
44
48
|
]
|
|
45
49
|
|
data/lib/contour/engine.rb
CHANGED
data/lib/contour/version.rb
CHANGED
|
@@ -20,10 +20,11 @@ module Contour
|
|
|
20
20
|
|
|
21
21
|
def add_contour_route
|
|
22
22
|
contour_routes = []
|
|
23
|
-
|
|
24
|
-
contour_routes << "match '/auth
|
|
25
|
-
contour_routes << "match '/auth/:provider' => 'contour/authentications#
|
|
26
|
-
contour_routes << "
|
|
23
|
+
# These are now included in the routes file.
|
|
24
|
+
# contour_routes << "match '/auth/failure' => 'contour/authentications#failure'"
|
|
25
|
+
# contour_routes << "match '/auth/:provider/callback' => 'contour/authentications#create'"
|
|
26
|
+
# contour_routes << "match '/auth/:provider' => 'contour/authentications#passthru'"
|
|
27
|
+
# contour_routes << "resources :authentications, :controller => 'contour/authentications'"
|
|
27
28
|
# contour_routes << "devise_for :users, :controllers => {:registrations => 'contour/registrations', :sessions => 'contour/sessions', :passwords => 'contour/passwords'}, :path_names => { :sign_up => 'register', :sign_in => 'login' }"
|
|
28
29
|
contour_routes.reverse.each do |contour_route|
|
|
29
30
|
route contour_route
|
|
@@ -18,16 +18,20 @@ Contour.setup do |config|
|
|
|
18
18
|
|
|
19
19
|
# Enter the items you wish to see in the menu
|
|
20
20
|
# config.menu_items = [{
|
|
21
|
-
# :name => 'Login', :id => 'auth', :display => 'not_signed_in', :
|
|
22
|
-
# :links => [{:name => '
|
|
21
|
+
# :name => 'Login', :id => 'auth', :display => 'not_signed_in', :path => 'new_user_session_path', :position => 'right', :condition => 'true',
|
|
22
|
+
# :links => [{:name => 'Sign Up', :path => 'new_user_registration_path'}]
|
|
23
23
|
# },
|
|
24
24
|
# {
|
|
25
|
-
# :name => 'current_user.name', :eval => true, :id => 'auth', :display => 'signed_in', :
|
|
26
|
-
# :
|
|
25
|
+
# :name => 'current_user.name', :eval => true, :id => 'auth', :display => 'signed_in', :path => 'user_path(current_user)', :position => 'right', :condition => 'true',
|
|
26
|
+
# links: [{ :html => '"<div class=\"small\" style=\"color:#bbb\">"+current_user.email+"</div>"', :eval => true },
|
|
27
|
+
# { :name => 'Settings', :path => 'settings_path' },
|
|
28
|
+
# { :name => 'Authentications', :path => 'authentications_path', :condition => 'not PROVIDERS.blank?' },
|
|
29
|
+
# { :html => "<br />" },
|
|
30
|
+
# { :name => 'Logout', :path => 'destroy_user_session_path' }]
|
|
27
31
|
# },
|
|
28
32
|
# {
|
|
29
|
-
# :name => 'Home', :id => 'home', :display => 'always', :
|
|
30
|
-
# :links => [
|
|
33
|
+
# :name => 'Home', :id => 'home', :display => 'always', :path => 'root_path', :position => 'left', :condition => 'true', :image => '', :image_options => {},
|
|
34
|
+
# :links => []
|
|
31
35
|
# }]
|
|
32
36
|
|
|
33
37
|
# Enter an address of a valid RSS Feed if you would like to see news on the sign in page.
|
data/test/dummy/Rakefile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
4
|
+
|
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
|
6
|
+
|
|
7
|
+
Dummy::Application.load_tasks
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
5
|
+
// the compiled file.
|
|
6
|
+
//
|
|
7
|
+
//= require contour
|
|
8
|
+
//= require_tree .
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
|
5
|
+
*= require_self
|
|
6
|
+
*= require contour
|
|
7
|
+
*= require_tree .
|
|
8
|
+
*/
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# rails g model Authentication user_id:integer provider:string uid:string
|
|
2
|
+
# rails g migration CreateUsers first_name:string last_name:string
|
|
3
|
+
|
|
4
|
+
class User < ActiveRecord::Base
|
|
5
|
+
# Include default devise modules. Others available are:
|
|
6
|
+
# :encryptable, :confirmable, :lockable and :omniauthable
|
|
7
|
+
devise :database_authenticatable, :registerable, :timeoutable, :token_authenticatable,
|
|
8
|
+
:recoverable, :rememberable, :trackable, :validatable
|
|
9
|
+
|
|
10
|
+
# Setup accessible (or protected) attributes for your model
|
|
11
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name
|
|
12
|
+
|
|
13
|
+
# Named Scopes
|
|
14
|
+
scope :current, :conditions => { :deleted => false }
|
|
15
|
+
|
|
16
|
+
# Model Relationships
|
|
17
|
+
has_many :authentications
|
|
18
|
+
|
|
19
|
+
def name
|
|
20
|
+
first_name + ' ' + last_name
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def reverse_name
|
|
24
|
+
last_name + ', ' + first_name
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Overriding Devise built-in active? method
|
|
28
|
+
def active_for_authentication?
|
|
29
|
+
super # and self.status == 'active' and not self.deleted?
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def apply_omniauth(omniauth)
|
|
33
|
+
unless omniauth['user_info'].blank?
|
|
34
|
+
self.email = omniauth['user_info']['email'] if email.blank?
|
|
35
|
+
self.first_name = omniauth['user_info']['first_name'] if first_name.blank?
|
|
36
|
+
self.last_name = omniauth['user_info']['last_name'] if last_name.blank?
|
|
37
|
+
end
|
|
38
|
+
authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def password_required?
|
|
42
|
+
(authentications.empty? || !password.blank?) && super
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rails/all'
|
|
4
|
+
|
|
5
|
+
Bundler.require
|
|
6
|
+
require "contour"
|
|
7
|
+
|
|
8
|
+
module Dummy
|
|
9
|
+
class Application < Rails::Application
|
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
11
|
+
# Application configuration should go into files in config/initializers
|
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
13
|
+
|
|
14
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
15
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
16
|
+
|
|
17
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
18
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
19
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
20
|
+
|
|
21
|
+
# Activate observers that should always be running.
|
|
22
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
23
|
+
|
|
24
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
25
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
26
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
27
|
+
|
|
28
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
29
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
30
|
+
# config.i18n.default_locale = :de
|
|
31
|
+
|
|
32
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
|
33
|
+
config.encoding = "utf-8"
|
|
34
|
+
|
|
35
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
|
36
|
+
config.filter_parameters += [:password]
|
|
37
|
+
|
|
38
|
+
# Enable the asset pipeline
|
|
39
|
+
config.assets.enabled = true
|
|
40
|
+
|
|
41
|
+
# Version of your assets, change this if you want to expire all your assets
|
|
42
|
+
config.assets.version = '1.0'
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# SQLite version 3.x
|
|
2
|
+
# gem install sqlite3
|
|
3
|
+
#
|
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
+
# gem 'sqlite3'
|
|
6
|
+
development:
|
|
7
|
+
adapter: sqlite3
|
|
8
|
+
database: db/development.sqlite3
|
|
9
|
+
pool: 5
|
|
10
|
+
timeout: 5000
|
|
11
|
+
|
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
|
13
|
+
# re-generated from your development database when you run "rake".
|
|
14
|
+
# Do not set this db to the same as development or production.
|
|
15
|
+
test:
|
|
16
|
+
adapter: sqlite3
|
|
17
|
+
database: db/test.sqlite3
|
|
18
|
+
pool: 5
|
|
19
|
+
timeout: 5000
|
|
20
|
+
|
|
21
|
+
production:
|
|
22
|
+
adapter: sqlite3
|
|
23
|
+
database: db/production.sqlite3
|
|
24
|
+
pool: 5
|
|
25
|
+
timeout: 5000
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# # Warning: The database defined as "test" will be erased and
|
|
29
|
+
# # re-generated from your development database when you run "rake".
|
|
30
|
+
# # Do not set this db to the same as development or production.
|
|
31
|
+
# test:
|
|
32
|
+
# adapter: sqlite3
|
|
33
|
+
# database: ":memory:"
|
|
34
|
+
#
|
|
35
|
+
# production:
|
|
36
|
+
# adapter: sqlite3
|
|
37
|
+
# database: ":memory:"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Dummy::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# In the development environment your application's code is reloaded on
|
|
5
|
+
# every request. This slows down response time but is perfect for development
|
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
|
7
|
+
config.cache_classes = false
|
|
8
|
+
|
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
|
10
|
+
config.whiny_nils = true
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching
|
|
13
|
+
config.consider_all_requests_local = true
|
|
14
|
+
config.action_controller.perform_caching = false
|
|
15
|
+
|
|
16
|
+
# Don't care if the mailer can't send
|
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
|
18
|
+
|
|
19
|
+
# Print deprecation notices to the Rails logger
|
|
20
|
+
config.active_support.deprecation = :log
|
|
21
|
+
|
|
22
|
+
# Only use best-standards-support built into browsers
|
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
|
24
|
+
|
|
25
|
+
# Do not compress assets
|
|
26
|
+
config.assets.compress = false
|
|
27
|
+
|
|
28
|
+
# Expands the lines which load the assets
|
|
29
|
+
config.assets.debug = true
|
|
30
|
+
end
|