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.
Files changed (141) hide show
  1. data/CHANGELOG.rdoc +13 -0
  2. data/README.rdoc +1 -7
  3. data/Rakefile +38 -0
  4. data/{vendor → app}/assets/images/contour/addfile.png +0 -0
  5. data/{vendor → app}/assets/images/contour/arrow.png +0 -0
  6. data/{vendor → app}/assets/images/contour/blank.png +0 -0
  7. data/{vendor → app}/assets/images/contour/cas_32.png +0 -0
  8. data/{vendor → app}/assets/images/contour/cas_64.png +0 -0
  9. data/{vendor → app}/assets/images/contour/cross.png +0 -0
  10. data/{vendor → app}/assets/images/contour/delete.png +0 -0
  11. data/{vendor → app}/assets/images/contour/doc.png +0 -0
  12. data/{vendor → app}/assets/images/contour/download.png +0 -0
  13. data/{vendor → app}/assets/images/contour/edit.png +0 -0
  14. data/{vendor → app}/assets/images/contour/email.png +0 -0
  15. data/{vendor → app}/assets/images/contour/external.png +0 -0
  16. data/{vendor → app}/assets/images/contour/facebook_32.png +0 -0
  17. data/{vendor → app}/assets/images/contour/facebook_64.png +0 -0
  18. data/{vendor → app}/assets/images/contour/favorite_no.png +0 -0
  19. data/{vendor → app}/assets/images/contour/favorite_yes.png +0 -0
  20. data/{vendor → app}/assets/images/contour/feed.png +0 -0
  21. data/{vendor → app}/assets/images/contour/google_apps_32.png +0 -0
  22. data/{vendor → app}/assets/images/contour/google_apps_64.png +0 -0
  23. data/{vendor → app}/assets/images/contour/im.png +0 -0
  24. data/{vendor → app}/assets/images/contour/information.png +0 -0
  25. data/{vendor → app}/assets/images/contour/key.png +0 -0
  26. data/{vendor → app}/assets/images/contour/ldap_32.png +0 -0
  27. data/{vendor → app}/assets/images/contour/ldap_64.png +0 -0
  28. data/{vendor → app}/assets/images/contour/linkedin_32.png +0 -0
  29. data/{vendor → app}/assets/images/contour/linkedin_64.png +0 -0
  30. data/{vendor → app}/assets/images/contour/mydocuments.png +0 -0
  31. data/{vendor → app}/assets/images/contour/open.png +0 -0
  32. data/{vendor → app}/assets/images/contour/openid_32.png +0 -0
  33. data/{vendor → app}/assets/images/contour/openid_64.png +0 -0
  34. data/{vendor → app}/assets/images/contour/pdf.png +0 -0
  35. data/{vendor → app}/assets/images/contour/save.png +0 -0
  36. data/{vendor → app}/assets/images/contour/search.png +0 -0
  37. data/{vendor → app}/assets/images/contour/tag_blue.png +0 -0
  38. data/{vendor → app}/assets/images/contour/tag_green.png +0 -0
  39. data/{vendor → app}/assets/images/contour/tag_neutral.png +0 -0
  40. data/{vendor → app}/assets/images/contour/tag_red.png +0 -0
  41. data/{vendor → app}/assets/images/contour/tick.png +0 -0
  42. data/{vendor → app}/assets/images/contour/twitter_32.png +0 -0
  43. data/{vendor → app}/assets/images/contour/twitter_64.png +0 -0
  44. data/{vendor → app}/assets/images/contour/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  45. data/{vendor → app}/assets/images/contour/ui-bg_flat_55_fbec88_40x100.png +0 -0
  46. data/{vendor → app}/assets/images/contour/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  47. data/{vendor → app}/assets/images/contour/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  48. data/{vendor → app}/assets/images/contour/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  49. data/{vendor → app}/assets/images/contour/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  50. data/{vendor → app}/assets/images/contour/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  51. data/{vendor → app}/assets/images/contour/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  52. data/{vendor → app}/assets/images/contour/ui-icons_217bc0_256x240.png +0 -0
  53. data/{vendor → app}/assets/images/contour/ui-icons_2e83ff_256x240.png +0 -0
  54. data/{vendor → app}/assets/images/contour/ui-icons_469bdd_256x240.png +0 -0
  55. data/{vendor → app}/assets/images/contour/ui-icons_6da8d5_256x240.png +0 -0
  56. data/{vendor → app}/assets/images/contour/ui-icons_cd0a0a_256x240.png +0 -0
  57. data/{vendor → app}/assets/images/contour/ui-icons_d8e7f3_256x240.png +0 -0
  58. data/{vendor → app}/assets/images/contour/ui-icons_f9bd01_256x240.png +0 -0
  59. data/{vendor → app}/assets/images/contour/visited.png +0 -0
  60. data/{vendor → app}/assets/images/contour/warning.png +0 -0
  61. data/{vendor → app}/assets/images/contour/xls.png +0 -0
  62. data/{vendor → app}/assets/javascripts/contour.js +0 -0
  63. data/{vendor → app}/assets/javascripts/contour/errors.js.coffee +0 -0
  64. data/app/assets/javascripts/contour/global.js.coffee +13 -0
  65. data/app/assets/javascripts/contour/menu.js.coffee +21 -0
  66. data/{vendor → app}/assets/javascripts/contour/popup.js.coffee +0 -0
  67. data/{vendor → app}/assets/javascripts/external/exporting-2.1.9.src.js +0 -0
  68. data/{vendor → app}/assets/javascripts/external/highcharts-2.1.9.src.js +0 -0
  69. data/{vendor → app}/assets/javascripts/external/jquery-ui-1.8.10.custom.min.js +0 -0
  70. data/{vendor → app}/assets/javascripts/external/waypoints.js +0 -0
  71. data/{vendor → app}/assets/stylesheets/bluetrip-screen.css +0 -0
  72. data/{vendor → app}/assets/stylesheets/contour.css +0 -0
  73. data/{vendor → app}/assets/stylesheets/contour/authentication.css +0 -0
  74. data/{vendor → app}/assets/stylesheets/contour/global.css +2 -1
  75. data/{vendor → app}/assets/stylesheets/contour/header.css +0 -0
  76. data/app/assets/stylesheets/contour/menu.css +109 -0
  77. data/{vendor → app}/assets/stylesheets/contour/message.css +15 -3
  78. data/{vendor → app}/assets/stylesheets/contour/popup.css +0 -0
  79. data/{vendor → app}/assets/stylesheets/jquery-ui-1.8.10.custom.css +0 -0
  80. data/app/models/authentication.rb +11 -0
  81. data/app/views/contour/authentications/_menu.html.erb +26 -0
  82. data/app/views/contour/layouts/_menu.html.erb +15 -21
  83. data/app/views/contour/layouts/application.html.erb +2 -4
  84. data/app/views/contour/sessions/new.html.erb +2 -2
  85. data/config/routes.rb +16 -0
  86. data/contour.gemspec +15 -11
  87. data/lib/contour.rb +10 -6
  88. data/lib/contour/engine.rb +0 -1
  89. data/lib/contour/version.rb +2 -2
  90. data/lib/generators/contour/install_generator.rb +5 -4
  91. data/lib/generators/templates/contour.rb +10 -6
  92. data/test/contour_test.rb +7 -0
  93. data/test/dummy/Rakefile +7 -0
  94. data/test/dummy/app/assets/javascripts/application.js +8 -0
  95. data/test/dummy/app/assets/stylesheets/application.css +8 -0
  96. data/test/dummy/app/controllers/application_controller.rb +3 -0
  97. data/test/dummy/app/helpers/application_helper.rb +2 -0
  98. data/test/dummy/app/models/user.rb +45 -0
  99. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  100. data/test/dummy/config.ru +4 -0
  101. data/test/dummy/config/application.rb +45 -0
  102. data/test/dummy/config/boot.rb +10 -0
  103. data/test/dummy/config/database.yml +37 -0
  104. data/test/dummy/config/environment.rb +5 -0
  105. data/test/dummy/config/environments/development.rb +30 -0
  106. data/test/dummy/config/environments/production.rb +60 -0
  107. data/test/dummy/config/environments/test.rb +39 -0
  108. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  109. data/test/dummy/config/initializers/devise.rb +153 -0
  110. data/test/dummy/config/initializers/inflections.rb +10 -0
  111. data/test/dummy/config/initializers/mime_types.rb +5 -0
  112. data/test/dummy/config/initializers/omniauth.rb +22 -0
  113. data/test/dummy/config/initializers/secret_token.rb +7 -0
  114. data/test/dummy/config/initializers/session_store.rb +8 -0
  115. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  116. data/test/dummy/config/locales/en.yml +5 -0
  117. data/test/dummy/config/routes.rb +58 -0
  118. data/test/dummy/db/migrate/20111203203123_create_users.rb +26 -0
  119. data/test/dummy/db/migrate/20111203203307_create_authentications.rb +11 -0
  120. data/test/dummy/db/schema.rb +45 -0
  121. data/test/dummy/public/404.html +26 -0
  122. data/test/dummy/public/422.html +26 -0
  123. data/test/dummy/public/500.html +26 -0
  124. data/test/dummy/public/favicon.ico +0 -0
  125. data/test/dummy/script/rails +6 -0
  126. data/test/fixtures/authentications.yml +14 -9
  127. data/test/fixtures/users.yml +70 -0
  128. data/test/functional/authentications_controller_test.rb +2 -2
  129. data/test/functional/registrations_controller_test.rb +9 -9
  130. data/test/integration/navigation_test.rb +8 -0
  131. data/test/test_helper.rb +52 -0
  132. data/test/unit/authentication_test.rb +6 -3
  133. data/test/unit/user_test.rb +13 -0
  134. metadata +186 -96
  135. data/.gitignore +0 -7
  136. data/.rvmrc +0 -1
  137. data/lib/contour/engine/routes.rb +0 -10
  138. data/test/unit/helpers/registrations_helper_test.rb +0 -4
  139. data/vendor/assets/javascripts/contour/global.js.coffee +0 -38
  140. data/vendor/assets/javascripts/contour/menu.js.coffee +0 -6
  141. 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
- <% Contour.menu_items.each do |menu_item| %>
7
- <% if display.include?(menu_item[:display]) and (menu_item[:condition].blank? or eval(menu_item[:condition])) %>
8
- <div style="float:<%= menu_item[:position] %>">
9
- <%= link_to_function (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]))), "$('#menu_#{menu_item[:id]}').show();", :onmouseover => "$('#menu_#{menu_item[:id]}').show();" %>
10
- <div style="position:relative;">
11
- <div id="menu_<%= menu_item[:id] %>" class="menu_dropdown_<%= menu_item[:position_class] %>" style="display:none">
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
- <div style="white-space:nowrap">
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
- <%= link[:eval] ? eval(link[:html]).html_safe : link[:html].html_safe %>
18
+ <li><%= link[:eval] ? eval(link[:html]).html_safe : link[:html].html_safe %></li>
20
19
  <% end %>
21
20
  <% end %>
22
21
  <% end %>
23
- </div>
24
- </div>
25
- </div>
22
+ </ul>
23
+ <% end %>
24
+ </li>
25
+ <% end %>
26
26
  <% end %>
27
- <% end %>
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 style="height:29px">
28
- <div id="menu" class="container">
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 valign="middle">
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>
@@ -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
@@ -11,17 +11,21 @@ require 'contour/version'
11
11
 
12
12
  Gem::Specification.new do |s|
13
13
  s.name = 'contour'
14
- s.version = Contour::VERSION::STRING
15
- s.platform = Gem::Platform::RUBY
16
- s.summary = 'Basic Rails framework files and assets for layout and authentication'
17
- s.email = 'remosm@gmail.com'
18
- s.homepage = 'https://github.com/remomueller'
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.files = `git ls-files`.split("\n")
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
@@ -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', :position => 'right', :position_class => 'right',
34
- :links => [{:name => 'Login', :path => 'new_user_session_path'}, {:html => "<hr>"}, {:name => 'Sign Up', :path => 'new_user_registration_path'}]
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', :position => 'right', :position_class => 'right', :condition => 'true',
38
- :links => [{:html => '"<div style=\"white-space:nowrap\">"+(current_user.methods.include?(:name) ? current_user.name.to_s : "")+"</div>"', :eval => true}, {:html => '"<div class=\"small quiet\">"+current_user.email+"</div>"', :eval => true}, {:name => 'Authentications', :path => 'authentications_path', :condition => 'not PROVIDERS.blank?'}, {:html => "<hr>"}, {:name => 'Logout', :path => 'destroy_user_session_path'}]
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', :position => 'left', :position_class => 'left',
42
- :links => [{:name => 'Home', :path => 'root_path'}]
45
+ :name => 'Home', :id => 'home', :display => 'always', :path => 'root_path', :position => 'left',
46
+ :links => []
43
47
  }
44
48
  ]
45
49
 
@@ -1,6 +1,5 @@
1
1
  require "contour"
2
2
  require "rails"
3
- require 'contour/engine/routes'
4
3
 
5
4
  module Contour
6
5
  class Engine < Rails::Engine
@@ -1,8 +1,8 @@
1
1
  module Contour
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 6
5
- TINY = 1
4
+ MINOR = 7
5
+ TINY = 0
6
6
  BUILD = nil # nil, "pre", "rc", "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
@@ -20,10 +20,11 @@ module Contour
20
20
 
21
21
  def add_contour_route
22
22
  contour_routes = []
23
- contour_routes << "match '/auth/failure' => 'contour/authentications#failure'"
24
- contour_routes << "match '/auth/:provider/callback' => 'contour/authentications#create'"
25
- contour_routes << "match '/auth/:provider' => 'contour/authentications#passthru'"
26
- contour_routes << "resources :authentications, :controller => 'contour/authentications'"
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', :position => 'right', :position_class => 'right', :condition => 'true',
22
- # :links => [{:name => 'Login', :path => 'new_user_session_path'}, {:html => "<hr>"}, {:name => 'Sign Up', :path => 'new_user_registration_path'}]
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', :position => 'right', :position_class => 'right', :condition => 'true',
26
- # :links => [{:html => '"<div style=\"white-space:nowrap\">"+(current_user.methods.include?(:name) ? current_user.name.to_s : "")+"</div>"', :eval => true}, {:html => '"<div class=\"small quiet\">"+current_user.email+"</div>"', :eval => true}, {:name => 'Authentications', :path => 'authentications_path', :condition => 'not PROVIDERS.blank?'}, {:html => "<hr>"}, {:name => 'Logout', :path => 'destroy_user_session_path'}]
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', :position => 'left', :position_class => 'left', :condition => 'true', :image => '', :image_options => {},
30
- # :links => [{:name => 'Home', :path => 'root_path', :image => '', :image_options => {}}]
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.
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class ContourTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Contour
6
+ end
7
+ end
@@ -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,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -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,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -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,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -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,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -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