contour 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. data/CHANGELOG.rdoc +11 -0
  2. data/app/views/contour/layouts/_menu.html.erb +9 -7
  3. data/contour.gemspec +1 -1
  4. data/lib/contour/version.rb +1 -1
  5. data/lib/generators/templates/contour.rb +3 -3
  6. data/test/fixtures/authentications.yml +11 -0
  7. data/test/functional/authentications_controller_test.rb +56 -0
  8. data/test/functional/registrations_controller_test.rb +8 -0
  9. data/test/unit/authentication_test.rb +8 -0
  10. data/test/unit/helpers/registrations_helper_test.rb +4 -0
  11. data/vendor/assets/javascripts/{errors.js.coffee → contour/errors.js.coffee} +0 -0
  12. data/vendor/assets/javascripts/{global.js.coffee → contour/global.js.coffee} +0 -0
  13. data/vendor/assets/javascripts/{menu.js.coffee → contour/menu.js.coffee} +0 -0
  14. data/vendor/assets/javascripts/{popup.js.coffee → contour/popup.js.coffee} +0 -0
  15. data/vendor/assets/stylesheets/contour.css +8 -8
  16. data/vendor/assets/stylesheets/{authentication.css → contour/authentication.css} +0 -0
  17. data/vendor/assets/stylesheets/{global.css → contour/global.css} +0 -0
  18. data/vendor/assets/stylesheets/{header.css → contour/header.css} +0 -0
  19. data/vendor/assets/stylesheets/{menu.css → contour/menu.css} +0 -0
  20. data/vendor/assets/stylesheets/{message.css → contour/message.css} +0 -0
  21. data/vendor/assets/stylesheets/{popup.css → contour/popup.css} +0 -0
  22. data/vendor/assets/stylesheets/{bluetrip-screen.css → external/bluetrip-screen.css} +0 -0
  23. data/vendor/assets/stylesheets/{jquery-ui-1.8.10.custom.css → external/jquery-ui-1.8.10.custom.css} +0 -0
  24. metadata +24 -19
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,14 @@
1
+ == 0.3.0
2
+
3
+ * Enhancements
4
+ * Update dependencies to Devise 1.4.4, (needed for Rails 3.1.0)
5
+ * Menu items are now rendered using html_safe
6
+ * Links and menu items can now have a :condition parameter passed to it which is a string that can be evaluated to true or false
7
+ * ex: :condition => 'current_user.admin?'
8
+
9
+ * Testing
10
+ * Created limited tests for authentications controller and registrations
11
+
1
12
  == 0.2.1
2
13
 
3
14
  * Bug Fix
@@ -4,18 +4,20 @@
4
4
  <% end %>
5
5
 
6
6
  <% Contour.menu_items.each do |menu_item| %>
7
- <% if display.include?(menu_item[:display]) %>
7
+ <% if display.include?(menu_item[:display]) and (menu_item[:condition].blank? or eval(menu_item[:condition])) %>
8
8
  <div style="float:<%= menu_item[:position] %>">
9
9
  <%= link_to_function (menu_item[:eval] ? eval(menu_item[:name]) : menu_item[:name]), "$('#menu_#{menu_item[:id]}').show();", :onmouseover => "$('#menu_#{menu_item[:id]}').show();" %>
10
10
  <div style="position:relative;">
11
11
  <div id="menu_<%= menu_item[:id] %>" class="menu_dropdown_<%= menu_item[:position_class] %>" style="display:none">
12
12
  <% menu_item[:links].each do |link| %>
13
- <% if link[:html].blank? %>
14
- <div style="white-space:nowrap">
15
- <%= link_to (link[:eval] ? eval(link[:name]) : link[:name]), eval(link[:path]), :class => 'noicon' %>
16
- </div>
17
- <% else %>
18
- <%= link[:eval] ? eval(link[:html]).html_safe : link[:html].html_safe %>
13
+ <% if link[:condition].blank? or eval(link[:condition]) %>
14
+ <% if link[:html].blank? %>
15
+ <div style="white-space:nowrap">
16
+ <%= link_to (link[:eval] ? eval(link[:name]) : link[:name].html_safe), eval(link[:path]), :class => 'noicon' %>
17
+ </div>
18
+ <% else %>
19
+ <%= link[:eval] ? eval(link[:html]).html_safe : link[:html].html_safe %>
20
+ <% end %>
19
21
  <% end %>
20
22
  <% end %>
21
23
  </div>
data/contour.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.authors = ["Remo Mueller"]
20
20
  s.description = "Basic Rails Framework files and assets for layout and authentication"
21
21
 
22
- s.add_dependency("devise", "~> 1.3.4")
22
+ s.add_dependency("devise", "~> 1.4.4")
23
23
  s.add_dependency("omniauth", "~> 0.2.6")
24
24
 
25
25
  s.files = `git ls-files`.split("\n")
@@ -1,3 +1,3 @@
1
1
  module Contour
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -15,15 +15,15 @@ Contour.setup do |config|
15
15
 
16
16
  # Enter the items you wish to see in the menu
17
17
  # config.menu_items = [{
18
- # :name => 'Login', :id => 'auth', :display => 'not_signed_in', :position => 'right', :position_class => 'right',
18
+ # :name => 'Login', :id => 'auth', :display => 'not_signed_in', :position => 'right', :position_class => 'right', :condition => 'true',
19
19
  # :links => [{:name => 'Login', :path => 'new_user_session_path'}, {:html => "<hr>"}, {:name => 'Sign Up', :path => 'new_user_registration_path'}]
20
20
  # },
21
21
  # {
22
- # :name => 'current_user.name', :eval => true, :id => 'auth', :display => 'signed_in', :position => 'right', :position_class => 'right',
22
+ # :name => 'current_user.name', :eval => true, :id => 'auth', :display => 'signed_in', :position => 'right', :position_class => 'right', :condition => 'true',
23
23
  # :links => [{:html => '"<div style=\"white-space:nowrap\">"+current_user.name+"</div>"', :eval => true}, {:html => '"<div class=\"small quiet\">"+current_user.email+"</div>"', :eval => true}, {:name => 'Authentications', :path => 'authentications_path'}, {:html => "<hr>"}, {:name => 'Logout', :path => 'destroy_user_session_path'}]
24
24
  # },
25
25
  # {
26
- # :name => 'Home', :id => 'home', :display => 'always', :position => 'left', :position_class => 'left',
26
+ # :name => 'Home', :id => 'home', :display => 'always', :position => 'left', :position_class => 'left', :condition => 'true',
27
27
  # :links => [{:name => 'Home', :path => 'root_path'}, {:html => "<hr>"}, {:name => 'About', :path => 'about_path'}]
28
28
  # }]
29
29
 
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ user_id: 1
5
+ provider: provider
6
+ uid: UniqueIDOne
7
+
8
+ two:
9
+ user_id: 2
10
+ provider: provider
11
+ uid: UniqueIDOne
@@ -0,0 +1,56 @@
1
+ require 'test_helper'
2
+
3
+ class AuthenticationsControllerTest < ActionController::TestCase
4
+ setup do
5
+ login(users(:valid))
6
+ @request.env["omniauth.auth"] = {'provider' => 'google_apps', 'user_info'=> {'email' => 'test@example.com'}}
7
+ @authentication = authentications(:one)
8
+ end
9
+
10
+ test "should get index" do
11
+ get :index
12
+ assert_response :success
13
+ assert_not_nil assigns(:authentications)
14
+ end
15
+
16
+ # TODO: Remove
17
+ # test "should get new" do
18
+ # get :new
19
+ # assert_response :success
20
+ # end
21
+
22
+ # TODO Redirects to Authentication Controller if user logged in, if not redirect to user sign up.
23
+ test "should create authentication" do
24
+ assert_difference('Authentication.count') do
25
+ post :create, :authentication => @authentication.attributes
26
+ end
27
+
28
+ assert_redirected_to authentications_path
29
+ end
30
+
31
+ # TODO: Remove
32
+ # test "should show authentication" do
33
+ # get :show, :id => @authentication.to_param
34
+ # assert_response :success
35
+ # end
36
+
37
+ # TODO: Remove
38
+ # test "should get edit" do
39
+ # get :edit, :id => @authentication.to_param
40
+ # assert_response :success
41
+ # end
42
+
43
+ # TODO: Remove
44
+ # test "should update authentication" do
45
+ # put :update, :id => @authentication.to_param, :authentication => @authentication.attributes
46
+ # assert_redirected_to authentication_path(assigns(:authentication))
47
+ # end
48
+
49
+ test "should destroy authentication" do
50
+ assert_difference('Authentication.count', -1) do
51
+ delete :destroy, :id => @authentication.to_param
52
+ end
53
+
54
+ assert_redirected_to authentications_path
55
+ end
56
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class RegistrationsControllerTest < ActionController::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class AuthenticationTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class RegistrationsHelperTest < ActionView::TestCase
4
+ end
@@ -3,13 +3,13 @@
3
3
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
5
  *= require_self
6
- *= require jquery-ui-1.8.10.custom
7
- *= require bluetrip-screen
8
- *= require global
9
- *= require header
10
- *= require message
11
- *= require menu
12
- *= require popup
13
- *= require authentication
6
+ *= require external/jquery-ui-1.8.10.custom
7
+ *= require external/bluetrip-screen
8
+ *= require contour/global
9
+ *= require contour/header
10
+ *= require contour/message
11
+ *= require contour/menu
12
+ *= require contour/popup
13
+ *= require contour/authentication
14
14
  *= require_tree .
15
15
  */
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.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-01 00:00:00.000000000Z
12
+ date: 2011-09-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: devise
16
- requirement: &70197105513840 !ruby/object:Gem::Requirement
16
+ requirement: &70325710820340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.3.4
21
+ version: 1.4.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70197105513840
24
+ version_requirements: *70325710820340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: omniauth
27
- requirement: &70197105513340 !ruby/object:Gem::Requirement
27
+ requirement: &70325710801360 !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: *70197105513340
35
+ version_requirements: *70325710801360
36
36
  description: Basic Rails Framework files and assets for layout and authentication
37
37
  email: remosm@gmail.com
38
38
  executables: []
@@ -70,6 +70,11 @@ files:
70
70
  - lib/generators/templates/omniauth.rb
71
71
  - lib/generators/templates/omniauth_fix.rb
72
72
  - lib/generators/templates/rack_fix.rb
73
+ - test/fixtures/authentications.yml
74
+ - test/functional/authentications_controller_test.rb
75
+ - test/functional/registrations_controller_test.rb
76
+ - test/unit/authentication_test.rb
77
+ - test/unit/helpers/registrations_helper_test.rb
73
78
  - vendor/assets/images/authbuttons/cas_32.png
74
79
  - vendor/assets/images/authbuttons/cas_64.png
75
80
  - vendor/assets/images/authbuttons/facebook_32.png
@@ -126,23 +131,23 @@ files:
126
131
  - vendor/assets/images/stock/visited.png
127
132
  - vendor/assets/images/stock/xls.png
128
133
  - vendor/assets/javascripts/contour.js
129
- - vendor/assets/javascripts/errors.js.coffee
134
+ - vendor/assets/javascripts/contour/errors.js.coffee
135
+ - vendor/assets/javascripts/contour/global.js.coffee
136
+ - vendor/assets/javascripts/contour/menu.js.coffee
137
+ - vendor/assets/javascripts/contour/popup.js.coffee
130
138
  - vendor/assets/javascripts/external/exporting-2.1.4.src.js
131
139
  - vendor/assets/javascripts/external/highcharts-2.1.4.src.js
132
140
  - vendor/assets/javascripts/external/jquery-ui-1.8.10.custom.min.js
133
141
  - vendor/assets/javascripts/external/waypoints.js
134
- - vendor/assets/javascripts/global.js.coffee
135
- - vendor/assets/javascripts/menu.js.coffee
136
- - vendor/assets/javascripts/popup.js.coffee
137
- - vendor/assets/stylesheets/authentication.css
138
- - vendor/assets/stylesheets/bluetrip-screen.css
139
142
  - vendor/assets/stylesheets/contour.css
140
- - vendor/assets/stylesheets/global.css
141
- - vendor/assets/stylesheets/header.css
142
- - vendor/assets/stylesheets/jquery-ui-1.8.10.custom.css
143
- - vendor/assets/stylesheets/menu.css
144
- - vendor/assets/stylesheets/message.css
145
- - vendor/assets/stylesheets/popup.css
143
+ - vendor/assets/stylesheets/contour/authentication.css
144
+ - vendor/assets/stylesheets/contour/global.css
145
+ - vendor/assets/stylesheets/contour/header.css
146
+ - vendor/assets/stylesheets/contour/menu.css
147
+ - vendor/assets/stylesheets/contour/message.css
148
+ - vendor/assets/stylesheets/contour/popup.css
149
+ - vendor/assets/stylesheets/external/bluetrip-screen.css
150
+ - vendor/assets/stylesheets/external/jquery-ui-1.8.10.custom.css
146
151
  homepage: https://github.com/remomueller
147
152
  licenses: []
148
153
  post_install_message: