contour 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ == 0.9.3
2
+
3
+ * Enhancements
4
+ * Dependency for Rails updated to 3.2.0 and OmniAuth 1.0.2
5
+ * Updated to use Devise 2.0.0.rc
6
+ * Important! Update Devise Migrations to new format! https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0-migration-schema-style
7
+
8
+ * Refactoring
9
+ * Removed debug logging information
10
+
1
11
  == 0.9.2
2
12
 
3
13
  * Bug Fix
@@ -45,7 +55,7 @@
45
55
  * Enhancements
46
56
  * Added icons from gentleface.com (see LICENSE in /app/assets/images/gentleface/LICENSE)
47
57
  * You can reference icons using
48
- <%= image_tag('gentleface/[16|32|48]/checkmark.png')
58
+ <%= image_tag('gentleface/[16|32|48]/checkmark.png') %>
49
59
  * Note: in 0.9.0 the images/contour/gentleface icons will be removed and be moved to images/gentleface
50
60
 
51
61
  == 0.8.2
@@ -66,7 +76,7 @@
66
76
  # Replace
67
77
  provider :google_apps, OpenID::Store::Filesystem.new('/tmp')
68
78
  # With
69
- provider :open_id, OpenID::Store::Filesystem.new('/tmp'), :name => 'google_apps', :identifier => 'https://www.google.com/accounts/o8/id'
79
+ provider :open_id, OpenID::Store::Filesystem.new('/tmp'), name: 'google_apps', identifier: 'https://www.google.com/accounts/o8/id'
70
80
  * Added icons from gentleface.com (see LICENSE in /app/assets/images/contour/gentleface/LICENSE)
71
81
  * Added qTip2, http://craigsworks.com/projects/qtip2/, distributed under http://creativecommons.org/licenses/by/3.0/
72
82
 
@@ -146,7 +156,7 @@
146
156
 
147
157
  * Enhancements
148
158
  * Added warning.png image asset
149
-
159
+
150
160
  == 0.5.2
151
161
 
152
162
  * Bug Fix
@@ -177,10 +187,10 @@
177
187
 
178
188
  * Enhancements
179
189
  * Added new image assets
180
- * :target allowed as a parameter for a link in the menu, ex: :target => '_blank'
190
+ * :target allowed as a parameter for a link in the menu, ex: target: '_blank'
181
191
  * Added application_name_html configuration so that users can specify the html for the application name
182
192
  * :image and :image_options can now be passed to links to specify an image that appears to the right of the link
183
-
193
+
184
194
  == 0.3.2
185
195
 
186
196
  * Bug Fix
@@ -197,7 +207,7 @@
197
207
  * Update dependencies to Devise 1.4.4, (needed for Rails 3.1.0)
198
208
  * Menu items are now rendered using html_safe
199
209
  * 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
200
- * ex: :condition => 'current_user.admin?'
210
+ * ex: condition: 'current_user.admin?'
201
211
 
202
212
  * Testing
203
213
  * Created limited tests for authentications controller and registrations
@@ -7,7 +7,7 @@ Basic Rails framework files and assets for layout and authentication
7
7
  Contour can be installed from rubygems.org using:
8
8
 
9
9
  gem install contour
10
-
10
+
11
11
  Or update your Gemfile to include:
12
12
 
13
13
  gem 'contour'
@@ -21,11 +21,11 @@ Contour depends on a config initializer. The config initializer is used to set v
21
21
  Contour uses a template to generate your application layout. You can add the following in your application_controller.rb:
22
22
 
23
23
  layout "contour/layouts/application"
24
-
24
+
25
25
  Contour also provides a custom jquery-ui and BlueTrip CSS Framework. To include these, add the following to your application.css manifest (after "*= require_self" and before "*= require_tree ."):
26
26
 
27
27
  *= require contour
28
-
28
+
29
29
  Contour provides custom JavaScript. In order to make the application layout function properly include the following at the beginning of your application.js (before "//= require_tree ." replacing "//= require jquery" and "//= require jquery_ujs"):
30
30
 
31
31
  //= require contour
@@ -39,11 +39,11 @@ In order to get registration working, you can use the modified Contour Authentic
39
39
  Make sure you have Rails 3.2.0
40
40
 
41
41
  rails -v
42
-
42
+
43
43
  rails new blank_rails_project
44
-
44
+
45
45
  cd blank_rails_project
46
-
46
+
47
47
  Modify Gemfile and add
48
48
 
49
49
  gem 'contour', '~> 0.9.0' # Basic Layout and Assets
@@ -51,56 +51,58 @@ Modify Gemfile and add
51
51
  Run Bundle install
52
52
 
53
53
  bundle install
54
-
54
+
55
55
  Install contour files
56
56
 
57
57
  rails generate contour:install
58
58
 
59
- Add the following line to your app/controllers/application_controller.rb
60
-
61
- layout "contour/layouts/application"
62
-
63
- Edit your app/assets/javascripts/application.js manifest to use Contour JavaScript (Replace jquery and jquery_ujs)
64
-
65
- //= require contour
66
-
67
- Edit your app/assets/stylesheets/application.css manifest to use Contour CSS (after self, before tree)
68
-
69
- *= require contour
70
-
71
- Remove any scaffold.css files that exist in your application
72
-
73
59
  Add the authentication model
74
60
 
75
61
  rails generate model Authentication user_id:integer provider:string uid:string
76
62
 
77
- Add first_name and last_name to user model
63
+ Add first_name and last_name to user model
78
64
 
79
65
  rails generate migration AddFirstNameAndLastNameToUsers first_name:string last_name:string
80
66
 
81
67
  Migrate your database
82
68
 
83
69
  bundle exec rake db:create
84
-
70
+
85
71
  bundle exec rake db:migrate
86
72
 
73
+ Create a sample controller
74
+
75
+ rails generate controller welcome index
76
+
77
+ Remove any scaffold.css files that may exist in your application
78
+
79
+ rm app/assets/stylesheets/scaffold.css*
80
+
87
81
  Remove the public/index.html
88
82
 
89
83
  rm public/index.html
90
-
91
- Create a sample controller
92
84
 
93
- rails generate controller welcome index
94
-
95
- Create a root in your config/routes.rb
85
+ Add the following line to your app/controllers/application_controller.rb
96
86
 
97
- root to: 'welcome#index'
87
+ layout "contour/layouts/application"
88
+
89
+ Edit your app/assets/javascripts/application.js manifest to use Contour JavaScript (Replace jquery and jquery_ujs)
90
+
91
+ //= require contour
92
+
93
+ Edit your app/assets/stylesheets/application.css manifest to use Contour CSS (after self, before tree)
94
+
95
+ *= require contour
98
96
 
99
97
  Make sure the devise line in config/routes.rb looks as follows
100
98
 
101
99
  devise_for :users, controllers: { registrations: 'contour/registrations', sessions: 'contour/sessions', passwords: 'contour/passwords' }, path_names: { sign_up: 'register', sign_in: 'login' }
102
100
 
103
- If there is a line that just says 'devise_for :users' or a duplicate, remove it
101
+ <b>If there is a line that just says 'devise_for :users' or a duplicate, <i>REMOVE IT!</i></b>
102
+
103
+ Create a root in your config/routes.rb
104
+
105
+ root to: 'welcome#index'
104
106
 
105
107
  Add the following to your app/models/user.rb
106
108
 
@@ -123,7 +125,7 @@ Add the following to your app/models/user.rb
123
125
  self.first_name = omniauth['info']['first_name'] if first_name.blank?
124
126
  self.last_name = omniauth['info']['last_name'] if last_name.blank?
125
127
  end
126
- authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])
128
+ authentications.build( provider: omniauth['provider'], uid: omniauth['uid'] )
127
129
  end
128
130
 
129
131
  def password_required?
@@ -143,15 +145,15 @@ Edit config/initializers/devise.rb to use :get for devise sign_out_via
143
145
  # The default HTTP method used to sign out a resource. Default is :delete.
144
146
  config.sign_out_via = :get
145
147
 
146
- Start your server and navigate to localhost:3000/users/login
148
+ Start your server and navigate to http://localhost:3000/users/login
147
149
 
148
150
  rails s
149
-
150
- You can then sign in using your google account (click on the google link), or by registering for an account at localhost:3000/users/register
151
+
152
+ You can then sign in using your {Google Account}[http://localhost:3000/auth/google_apps?domain=gmail.com] or by registering for an account at http://localhost:3000/users/register
151
153
 
152
154
 
153
155
  == Contributing to contour
154
-
156
+
155
157
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
156
158
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
157
159
  * Fork the project
@@ -162,5 +164,5 @@ You can then sign in using your google account (click on the google link), or by
162
164
 
163
165
  == Copyright
164
166
 
165
- Copyright (c) 2012 Remo Mueller. See LICENSE for further details.
167
+ Copyright (c) 2012 Remo Mueller. See {LICENSE}[https://github.com/remomueller/contour/blob/master/LICENSE] for further details.
166
168
 
data/Rakefile CHANGED
@@ -38,4 +38,4 @@ Rake::TestTask.new(:test) do |t|
38
38
  end
39
39
 
40
40
 
41
- task :default => :test
41
+ task default: :test
@@ -12,15 +12,10 @@ class Contour::AuthenticationsController < ApplicationController
12
12
  end
13
13
 
14
14
  def create
15
- logger.info "request #{request.env["omniauth.auth"].inspect}"
16
15
  omniauth = request.env["omniauth.auth"]
17
- logger.info "omniauth: #{omniauth.inspect}"
18
-
19
16
  if omniauth
20
-
21
17
  omniauth['uid'] = omniauth['info']['email'] if omniauth['provider'] == 'google_apps' and omniauth['info']
22
18
  authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
23
- logger.info "OMNI AUTH INFO: #{omniauth.inspect}"
24
19
  omniauth['info']['email'] = omniauth['extra']['raw_info']['email'] if omniauth['info'] and omniauth['info']['email'].blank? and omniauth['extra'] and omniauth['extra']['raw_info']
25
20
  if authentication
26
21
  logger.info "Existing authentication found."
@@ -44,14 +39,9 @@ class Contour::AuthenticationsController < ApplicationController
44
39
  redirect_to new_user_registration_path
45
40
  end
46
41
  end
47
-
48
42
  else
49
- request.env.keys.each do |key|
50
- logger.info "request.env[#{key}]: #{request.env[key]}"
51
- end
52
43
  redirect_to authentications_path, alert: "Authentication not successful."
53
44
  end
54
-
55
45
  end
56
46
 
57
47
  def destroy
@@ -1,6 +1,6 @@
1
1
  class Contour::RegistrationsController < Devise::RegistrationsController
2
- prepend_before_filter :require_no_authentication, :only => [ :new ]
3
-
2
+ prepend_before_filter :require_no_authentication, only: [ :new ]
3
+
4
4
  def create
5
5
  if user_signed_in?
6
6
  params[:user][:password] = params[:user][:password_confirmation] = Digest::SHA1.hexdigest(Time.now.usec.to_s)[0..19]
@@ -9,18 +9,18 @@ class Contour::RegistrationsController < Devise::RegistrationsController
9
9
  [:pp_committee, :pp_committee_secretary, :steering_committee, :steering_committee_secretary, :system_admin, :status].each do |attribute|
10
10
  @user.update_attribute attribute, params[:user][attribute]
11
11
  end
12
- redirect_to(@user, :notice => 'User was successfully created.')
12
+ redirect_to @user, notice: 'User was successfully created.'
13
13
  else
14
- render :action => "/users/new"
14
+ render action: "/users/new"
15
15
  end
16
16
  else
17
17
  super
18
18
  session[:omniauth] = nil unless @user.new_record?
19
19
  end
20
20
  end
21
-
21
+
22
22
  private
23
-
23
+
24
24
  def build_resource(*args)
25
25
  super
26
26
  if session[:omniauth]
@@ -28,9 +28,9 @@ class Contour::RegistrationsController < Devise::RegistrationsController
28
28
  @user.valid?
29
29
  end
30
30
  end
31
-
31
+
32
32
  def after_inactive_sign_up_path_for(resource)
33
33
  new_session_path(resource) # root_path
34
34
  end
35
-
35
+
36
36
  end
@@ -2,12 +2,12 @@ require 'rss/2.0'
2
2
  require 'open-uri'
3
3
 
4
4
  class Contour::SessionsController < Devise::SessionsController
5
-
5
+
6
6
  def new
7
7
  @news_feed = ''
8
8
  unless Contour.news_feed.blank?
9
9
  begin
10
- open(Contour.news_feed, :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
10
+ open(Contour.news_feed, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
11
11
  response = http.read
12
12
  @news_feed = RSS::Parser.parse(response, false)
13
13
  end
@@ -15,8 +15,8 @@ class Contour::SessionsController < Devise::SessionsController
15
15
  logger.info "\n\nRSS Feed #{Contour.news_feed}\nRSS Feed Error: #{e}\n\n"
16
16
  end
17
17
  end
18
-
18
+
19
19
  super
20
20
  end
21
-
21
+
22
22
  end
@@ -1,6 +1,6 @@
1
1
  class Authentication < ActiveRecord::Base
2
2
  belongs_to :user
3
-
3
+
4
4
  def provider_name
5
5
  OmniAuth.config.camelizations[provider.to_s.downcase] || provider.to_s.titleize
6
6
  end
@@ -8,10 +8,10 @@
8
8
  <div class="authentications">
9
9
  <% for authentication in @authentications %>
10
10
  <div class="authentication">
11
- <%= image_tag "contour/#{authentication.provider}_32.png", :height => "32px" %>
11
+ <%= image_tag "contour/#{authentication.provider}_32.png", height: "32px" %>
12
12
  <div class="provider"><%= authentication.provider.titleize %></div>
13
13
  <div class="uid"><%= authentication.uid %></div>
14
- <%= link_to "X", authentication, :confirm => 'Are you sure you want to remove this authentication option?', :method => :delete, :class => "remove" %>
14
+ <%= link_to "X", authentication, confirm: 'Are you sure you want to remove this authentication option?', method: :delete, class: "remove" %>
15
15
  </div>
16
16
  <% end %>
17
17
  <div style="clear:both"></div>
@@ -23,4 +23,4 @@
23
23
  <% end %>
24
24
 
25
25
 
26
- <%= render :partial => 'contour/authentications/index' %>
26
+ <%= render partial: 'contour/authentications/index' %>
@@ -1,14 +1,14 @@
1
1
  <% unless @news_feed.blank? %>
2
2
  <fieldset>
3
3
  <legend>Latest News</legend>
4
-
5
- <h4><%= link_to @news_feed.channel.title, @news_feed.channel.link, :target => '_blank' %></h4>
4
+
5
+ <h4><%= link_to @news_feed.channel.title, @news_feed.channel.link, target: '_blank' %></h4>
6
6
  <br />
7
7
  <% @news_feed.items.each_with_index do |item, i| %>
8
8
  <% if i < Contour.news_feed_items.to_i %>
9
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>
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
12
  </div>
13
13
  <% end %>
14
14
  <% end %>
@@ -7,13 +7,13 @@
7
7
  <% Contour.menu_items.each do |menu_item| %>
8
8
  <% if display.include?(menu_item[:display]) and (menu_item[:condition].blank? or eval(menu_item[:condition])) %>
9
9
  <li class="parent li_<%= menu_item[:position] %>">
10
- <%= link_to_if (not menu_item[:path].blank?), (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].to_s), :class => 'noicon', :target => menu_item[:target] %>
10
+ <%= link_to_if (not menu_item[:path].blank?), (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].to_s), class: 'noicon', target: menu_item[:target] %>
11
11
  <% if menu_item[:links].size > 0 %>
12
12
  <ul>
13
13
  <% menu_item[:links].each do |link| %>
14
14
  <% if link[:condition].blank? or eval(link[:condition]) %>
15
15
  <% if link[:html].blank? %>
16
- <li><%= link_to_if (not link[:path].blank?), (link[:eval] ? eval(link[:name]) : link[:name].html_safe + (link[:image].blank? ? '' : image_tag(link[:image], link[:image_options]))), eval(link[:path].to_s), :class => 'noicon', :target => link[:target] %></li>
16
+ <li><%= link_to_if (not link[:path].blank?), (link[:eval] ? eval(link[:name]) : link[:name].html_safe + (link[:image].blank? ? '' : image_tag(link[:image], link[:image_options]))), eval(link[:path].to_s), class: 'noicon', target: link[:target] %></li>
17
17
  <% else %>
18
18
  <li><%= link[:eval] ? eval(link[:html]).html_safe : link[:html].html_safe %></li>
19
19
  <% end %>
@@ -24,5 +24,5 @@
24
24
  </li>
25
25
  <% end %>
26
26
  <% end %>
27
- <%= render :partial => 'contour/authentications/menu' unless user_signed_in? %>
27
+ <%= render partial: 'contour/authentications/menu' unless user_signed_in? %>
28
28
  </ul>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <title><%= [Contour.application_name, @title].compact.join(' - ').html_safe %></title>
5
5
  <%= favicon_link_tag %>
6
- <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= stylesheet_link_tag "application", media: "all" %>
7
7
  <%= javascript_include_tag "application" %>
8
8
  <%= csrf_meta_tags %>
9
9
  </head>
@@ -14,33 +14,33 @@
14
14
  <div id="version" style="position:relative;display:none">
15
15
  <span style="position:absolute;top:-15px;left:82px;font-size:0.5em;font-variant:normal" class="quiet"><%= Contour.application_version %></span>
16
16
  </div>
17
- <%= image_tag(Contour.header_title_image, :alt => '', :style => 'vertical-align:middle') unless Contour.header_title_image.blank? %>
18
- <%= link_to (Contour.application_name_html.blank? ? Contour.application_name : Contour.application_name_html.html_safe), root_path, :style => 'text-decoration:none;color:#404040;', :onmouseover => "$('#version').show();", :onmouseout => "$('#version').hide();" %>
17
+ <%= image_tag(Contour.header_title_image, alt: '', style: 'vertical-align:middle') unless Contour.header_title_image.blank? %>
18
+ <%= link_to (Contour.application_name_html.blank? ? Contour.application_name : Contour.application_name_html.html_safe), root_path, style: 'text-decoration:none;color:#404040;', onmouseover: "$('#version').show();", onmouseout: "$('#version').hide();" %>
19
19
  </div>
20
20
 
21
21
  <div class="container" style="position:relative">
22
22
  <div id="message">
23
- <%= render :partial => 'contour/layouts/message' %>
23
+ <%= render partial: 'contour/layouts/message' %>
24
24
  </div>
25
25
  </div>
26
26
 
27
27
  <div id="menu" class="container shadow">
28
- <%= render :partial => 'contour/layouts/menu' %>
28
+ <%= render partial: 'contour/layouts/menu' %>
29
29
  </div>
30
30
 
31
31
  <div id="content" class="container">
32
32
  <%= yield %>
33
33
  </div>
34
-
34
+
35
35
  <div id="popup" style="overflow-y: hidden;">
36
36
  <div id="popup_header" style="padding: 12px;">
37
- <div style="float:right;margin-right:10px; margin-top:-4px"><%= image_tag(Contour.header_title_image, :alt => '') unless Contour.header_title_image.blank? %></div>
37
+ <div style="float:right;margin-right:10px; margin-top:-4px"><%= image_tag(Contour.header_title_image, alt: '') unless Contour.header_title_image.blank? %></div>
38
38
  <a id="popup_close">x</a>
39
39
  <h1 id="popup_title"></h1>
40
40
  </div>
41
41
  <div id="popup_content"></div>
42
42
  </div>
43
-
43
+
44
44
  <div id="background_popup"></div>
45
45
  </body>
46
46
  </html>
@@ -1,6 +1,6 @@
1
1
  <h2>Change your password</h2>
2
2
 
3
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
3
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
4
  <%= devise_error_messages! %>
5
5
  <%= f.hidden_field :reset_password_token %>
6
6
 
@@ -13,4 +13,4 @@
13
13
  <p><%= f.submit "Change my password" %></p>
14
14
  <% end %>
15
15
 
16
- <%= render :partial => "devise/shared/links" %>
16
+ <%= render partial: "devise/shared/links" %>