contour 1.2.0.pre8 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +417 -0
- data/README.md +255 -0
- data/contour.gemspec +1 -1
- data/lib/contour/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +238 -0
- metadata +7 -7
- data/CHANGELOG.rdoc +0 -415
- data/README.rdoc +0 -195
data/CHANGELOG.md
ADDED
@@ -0,0 +1,417 @@
|
|
1
|
+
## 1.2.0
|
2
|
+
|
3
|
+
### Breaking Changes
|
4
|
+
- Removed support for the subnav partial
|
5
|
+
|
6
|
+
### Enhancements
|
7
|
+
- Updated Twitter Bootstrap to 2.3.0
|
8
|
+
- Updated Gem Dependencies
|
9
|
+
- devise 2.2.3, jquery-rails 2.2.1, rails 3.2.12
|
10
|
+
- Updated jQuery UI to 1.10.0, the following modules are included:
|
11
|
+
- UI Core: Core, Widget, Mouse
|
12
|
+
- Interactions: Draggable, Droppable, Sortable
|
13
|
+
- Effects: Effects Core, Fade, Highlight
|
14
|
+
- Updated qTip2 to account for deprecations in jQuery 1.9.1
|
15
|
+
- Added bootstrap-datepicker and bootstrap-timepicker
|
16
|
+
- Contour can now be configured to have a search bar in the navigation menu
|
17
|
+
- For example:
|
18
|
+
```ruby
|
19
|
+
config.search_bar = {
|
20
|
+
display: 'always',
|
21
|
+
id: 'global-search',
|
22
|
+
path: 'search_path',
|
23
|
+
placeholder: 'Search',
|
24
|
+
position: 'left'
|
25
|
+
}
|
26
|
+
```
|
27
|
+
- Flash messages have been moved up into the navbar
|
28
|
+
|
29
|
+
## 1.1.3 (February 11, 2013)
|
30
|
+
|
31
|
+
### Enhancements
|
32
|
+
- Tooltip base line-height is now fixed at 20px
|
33
|
+
- Update Gem Dependencies
|
34
|
+
- rails 3.2.11
|
35
|
+
- Removed tooltips from alternate login providers to save iPhones and iPads from clicking the authentication button twice
|
36
|
+
- Added a `.center` CSS class to use instead of the deprecated `<center>` tag
|
37
|
+
|
38
|
+
### Bug Fix
|
39
|
+
- apply_omniauth(omniauth) updated to account for PostgreSQL error, see [README](https://github.com/remomueller/contour/blob/master/README.md)
|
40
|
+
|
41
|
+
## 1.1.2 (January 3, 2013)
|
42
|
+
|
43
|
+
### Enhancements
|
44
|
+
- Recommended Ruby bumped to 1.9.3-p327
|
45
|
+
- Updated Twitter Bootstrap to 2.2.2
|
46
|
+
- Updated HighCharts to 2.3.3
|
47
|
+
- Kaminari Pagination styling now provided, available themes:
|
48
|
+
- `<%= paginate @items, theme: "contour[-large|-small|-mini]" %>`
|
49
|
+
- Update Gem Dependencies
|
50
|
+
- rails 3.2.10, jquery-rails 2.1.4, omniauth-cas 1.0.1, omniauth-twitter 0.0.14
|
51
|
+
- Updated Bootstrap-Scroll-Modal to version 1.2
|
52
|
+
- nonStandardClick(event) helper JavaScript added to capture clicks
|
53
|
+
|
54
|
+
## 1.1.1 (October 30, 2012)
|
55
|
+
|
56
|
+
### Bug Fix
|
57
|
+
- Renamed `LICENSE` to `LICENSE.txt` to keep assets from failing to compile in Rails 3.2.9.rc1
|
58
|
+
|
59
|
+
## 1.1.0 (September 18, 2012)
|
60
|
+
|
61
|
+
### Enhancements
|
62
|
+
- Updated jQuery UI to 1.8.22, the following modules are included:
|
63
|
+
- UI Core: Core, Widget, Mouse
|
64
|
+
- Interactions: Draggable, Droppable, Resizable, Selectable, Sortable
|
65
|
+
- Widgets: Datepicker
|
66
|
+
- Effects: Effects Core, Blind, Bounce, Clip, Drop, Explode, Fade, Fold, Highlight, Pulsate, Scale, Shake, Slide, Transfer
|
67
|
+
- Updated Twitter Bootstrap from 2.0.4 to 2.1.1
|
68
|
+
|
69
|
+
### Breaking Changes
|
70
|
+
- Unobtrusive JS now required, JavaScript is now included at bottom of HTML to improve perceived page load
|
71
|
+
|
72
|
+
## 1.0.6 (September 10, 2012)
|
73
|
+
|
74
|
+
### Enhancements
|
75
|
+
- Login and Registration API now return authentication token, first_name, last_name, id, and email for JSON requests on successful login
|
76
|
+
|
77
|
+
## 1.0.5 (August 21, 2012)
|
78
|
+
|
79
|
+
### Bug Fix
|
80
|
+
- IE8 no longer shows security warning due to http reference to shim.js when using https by default
|
81
|
+
|
82
|
+
## 1.0.4 (August 14, 2012)
|
83
|
+
|
84
|
+
### Enhancements
|
85
|
+
- Rails updated to minimum 3.2.8
|
86
|
+
- Removed deprecated use of update_attribute for Rails 4.0 compatibility
|
87
|
+
- Cancel button no longer uses btn-danger class for consistency with Bootstrap cancel button defaults
|
88
|
+
- `devise.failure.unauthenticated` message is no longer displayed when navigating to the root_url
|
89
|
+
- `rails g contour:scaffold` updated to include better ordering and object counts on index pages
|
90
|
+
- Sign in with PROVIDER buttons added to sign in page
|
91
|
+
|
92
|
+
### Testing
|
93
|
+
- Use ActionDispatch for Integration tests instead of ActionController
|
94
|
+
|
95
|
+
## 1.0.3 (July 11, 2012)
|
96
|
+
|
97
|
+
### Enhancements
|
98
|
+
- JavaScript includes reordered to allow Twitter Bootstrap buttons to be the default $().button() instead of jQuery UI
|
99
|
+
- Added styling CSS for an About page
|
100
|
+
- All headers (h1, h2, ...) have had their font-weight changed from bold to 300
|
101
|
+
- Flash messages can be added using JavaScript:
|
102
|
+
- flashMessage('My Message', alert_type, overwrite)
|
103
|
+
- alert_type can be 'success' (default), 'error', 'info', or '', which are green, red, blue, and yellow respectively
|
104
|
+
- overwrite can be `true` (default), or `false` in which case it will append to the already existing alerts
|
105
|
+
|
106
|
+
## 1.0.2 (June 19, 2012)
|
107
|
+
|
108
|
+
### Enhancements
|
109
|
+
- Rails updated to minimum 3.2.6
|
110
|
+
- :confirm links updated to use data: { :confirm } to account for deprecations in Rails 4.0
|
111
|
+
- Devise updated to minimum 2.1.2
|
112
|
+
- Twitter Bootstrap updated to 2.0.4
|
113
|
+
- Now includes all Bootstrap JavaScript Plugins, http://twitter.github.com/bootstrap/javascript.html
|
114
|
+
- Added styling for .subnav and .subnav-fixed
|
115
|
+
- Subnav Partial added, can be called as follows: **Subnav was REMOVED in 1.2.0**
|
116
|
+
- `render partial: 'contour/layouts/subnav', locals: { links: [{name: 'Link A', sublinks: [{name: 'Sublink 1'}, {name: 'Sublink 2'}]}, {name: 'Link B'}]}`
|
117
|
+
|
118
|
+
## 1.0.1 (June 1, 2012)
|
119
|
+
|
120
|
+
### Enhancements
|
121
|
+
- Rails updated to minimum 3.2.5
|
122
|
+
- Recommended use of Ruby 1.9.3-p194
|
123
|
+
|
124
|
+
## 1.0.0 (May 31, 2012)
|
125
|
+
|
126
|
+
### Enhancements
|
127
|
+
- Twitter-Bootstrap CSS layout is now default!
|
128
|
+
- Authentications can now be placed as a submenu using { authentications: true } anywhere in the contour links configuration
|
129
|
+
- Rails updated to minimum 3.2.4
|
130
|
+
- Redirects to the user's alternate login page if a user fails to login on the default devise sign in page
|
131
|
+
- Registration page can now have fields added by modifying `config.sign_up_fields`
|
132
|
+
- Ex: `config.sign_up_fields = [ { attribute: 'first_name', type: 'text_field' }, { attribute: 'last_name', type: 'text_field' } ]`
|
133
|
+
- An empty `links` array is no longer required when specifying a menu item without a submenu
|
134
|
+
- Submenus are properly hidden if none of the submenu link conditions evaluate to true
|
135
|
+
- Added Rails scaffold generator
|
136
|
+
- `rails generate contour:scaffold ModelName`
|
137
|
+
- NOTE: This generator currently assumes you have a scope named current in your model. The conditions can be modified to limit only those records who are not deleted for example.
|
138
|
+
- `scope :current, conditions: { }`
|
139
|
+
|
140
|
+
### Breaking Changes
|
141
|
+
- CSS updated to use Twitter-Bootstrap
|
142
|
+
- New CSS classes here: http://twitter.github.com/bootstrap/base-css.html
|
143
|
+
- New JS operations here: http://twitter.github.com/bootstrap/javascript.html
|
144
|
+
- New Components here: http://twitter.github.com/bootstrap/components.html
|
145
|
+
- All icons other than Gentleface 16x16 have been removed
|
146
|
+
- User model no longer requires a name attribute or method
|
147
|
+
- Authentication model is no longer required to be the user model
|
148
|
+
- Authentication model creation no longer assigns application specific variables, i.e. first_name, last_name
|
149
|
+
|
150
|
+
## 0.10.2 (March 2, 2012)
|
151
|
+
|
152
|
+
### Bug Fix
|
153
|
+
- CSS fixed for positive and negative classes for buttons
|
154
|
+
|
155
|
+
## 0.10.1 (February 14, 2012)
|
156
|
+
|
157
|
+
### Enhancements
|
158
|
+
- Added options for setting body_background_{image|color} and link_color
|
159
|
+
- Setting these as arrays will rotate through on a daily basis
|
160
|
+
- Use the month_day configuration to set specific colors/images for select days
|
161
|
+
|
162
|
+
## 0.10.0 (February 13, 2012)
|
163
|
+
|
164
|
+
### Enhancements
|
165
|
+
- Changes made to accomodate contour template gems like contour-minimalist
|
166
|
+
|
167
|
+
## 0.9.4 (February 13, 2012)
|
168
|
+
|
169
|
+
### Enhancements
|
170
|
+
- Dependency for Rails updated to 3.2.1 and Devise 2.0.1
|
171
|
+
- Devise no longer complains about missing Engine Route, set to :main_app
|
172
|
+
- Removed Devise fix that is no longer needed as of Devise 2.0.1
|
173
|
+
|
174
|
+
### Testing
|
175
|
+
- Passwords controller test added for "Forget Password"
|
176
|
+
|
177
|
+
## 0.9.3 (January 20, 2012)
|
178
|
+
|
179
|
+
### Enhancements
|
180
|
+
- Dependency for Rails updated to 3.2.0 and OmniAuth 1.0.2
|
181
|
+
- Updated to use Devise 2.0.0.rc
|
182
|
+
- Important! Update Devise Migrations to new format! https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0-migration-schema-style
|
183
|
+
|
184
|
+
### Refactoring
|
185
|
+
- Removed debug logging information
|
186
|
+
|
187
|
+
## 0.9.2 (January 18, 2012)
|
188
|
+
|
189
|
+
### Bug Fix
|
190
|
+
- HTTP Basic Auth failure fix for Devise added, (Do not use ActiveSupport::Base64, https://github.com/plataformatec/devise/commit/9549a32500301c0a60a41bc31311b6198a8f0670)
|
191
|
+
|
192
|
+
## 0.9.1 (January 16, 2012)
|
193
|
+
|
194
|
+
### Bug Fix
|
195
|
+
- rails generate contour:install now installs the correct omniauth.rb configuration file
|
196
|
+
|
197
|
+
## 0.9.0 (January 13, 2012)
|
198
|
+
|
199
|
+
### Enhancements
|
200
|
+
- Updated Contour to work with OmniAuth 1.0
|
201
|
+
- Contour will now provide support for the following providers:
|
202
|
+
- OmniAuth OpenID
|
203
|
+
- OmniAuth LDAP
|
204
|
+
- OmniAuth Twitter
|
205
|
+
- OmniAuth Facebook
|
206
|
+
- OmniAuth LinkedIn
|
207
|
+
- OmniAuth CAS
|
208
|
+
- Authentication provider names now rely on the OmniAuth camelizations
|
209
|
+
|
210
|
+
### Testing
|
211
|
+
- SimpleCov testing updated to show gem test coverage
|
212
|
+
|
213
|
+
## 0.8.4 (January 12, 2012)
|
214
|
+
|
215
|
+
### Bug Fix
|
216
|
+
- OmniAuth Builder updated to work with Rack 1.4.0
|
217
|
+
- Menu Items no longer require a path (url link) to be specified and the option can now be omitted as it is optional
|
218
|
+
- Silent 404 no longer occurs when the `Contour.header_title_image` is left blank
|
219
|
+
|
220
|
+
### Testing
|
221
|
+
- Dummy Application tests added:
|
222
|
+
- Functional Tests for Authentication Controller
|
223
|
+
- Functional Tests for Registration Controller
|
224
|
+
- Integration Tests for Navigation
|
225
|
+
- Unit Tests for Authentication Model
|
226
|
+
- Unit Tests for User Model
|
227
|
+
- Continuous Integration using TravisCI (travis-ci.org)
|
228
|
+
|
229
|
+
## 0.8.3 (January 9, 2012)
|
230
|
+
|
231
|
+
### Enhancements
|
232
|
+
- Added icons from gentleface.com (see LICENSE in /app/assets/images/gentleface/LICENSE)
|
233
|
+
- You can reference icons using
|
234
|
+
- `<%= image_tag('gentleface/[16|32|48]/checkmark.png') %>`
|
235
|
+
- Note: in 1.0.0+ the `images/contour/gentleface` icons will be removed and be moved to `images/gentleface`
|
236
|
+
|
237
|
+
## 0.8.2 (January 9, 2012)
|
238
|
+
|
239
|
+
### Bug Fix
|
240
|
+
- Submit buttons on new registration, new session, and new password have been fixed
|
241
|
+
|
242
|
+
## 0.8.1 (January 6, 2012)
|
243
|
+
|
244
|
+
### Bug Fix
|
245
|
+
- rake assets:precompile now works due to Sprockets 2.1.2 incorrectly assuming that .src was a x-wais-source file instead of a javascript file
|
246
|
+
|
247
|
+
## 0.8.0 (January 3, 2012)
|
248
|
+
|
249
|
+
### Enhancements
|
250
|
+
- Updated to require Rails 3.2.x for ~> 0.8.0
|
251
|
+
- Google Omniauth authentication now uses OpenID protocol
|
252
|
+
# Replace
|
253
|
+
provider :google_apps, OpenID::Store::Filesystem.new('/tmp')
|
254
|
+
# With
|
255
|
+
provider :open_id, OpenID::Store::Filesystem.new('/tmp'), name: 'google_apps', identifier: 'https://www.google.com/accounts/o8/id'
|
256
|
+
- Added icons from gentleface.com (see LICENSE in /app/assets/images/contour/gentleface/LICENSE)
|
257
|
+
- Added qTip2, http://craigsworks.com/projects/qtip2/, distributed under http://creativecommons.org/licenses/by/3.0/
|
258
|
+
|
259
|
+
### Bug Fix
|
260
|
+
- Fixed Rails 3.2.x deprecation warning due to passing the format in the template name for render :template
|
261
|
+
|
262
|
+
## 0.7.2 (January 3, 2012)
|
263
|
+
|
264
|
+
### Bug Fix
|
265
|
+
- Print layouts can now be specified using @media print{} block in CSS
|
266
|
+
|
267
|
+
## 0.7.1 (December 14, 2011)
|
268
|
+
|
269
|
+
### Bug Fix
|
270
|
+
- Settings default menu item removed
|
271
|
+
|
272
|
+
### Documentation
|
273
|
+
- Contour Menu Items no longer require a unique id
|
274
|
+
- README updated to reflects that Contour requires Rails 3.1.3 for ~> 0.7.0
|
275
|
+
|
276
|
+
## 0.7.0 (December 13, 2011)
|
277
|
+
|
278
|
+
### Enhancements
|
279
|
+
- Restructuring gem to be more in line with a gem created by 'rails plugin new'
|
280
|
+
- Menu system updated to use embedded ul and li tags, and jQuery to capture mouseenter and mouseleave
|
281
|
+
- GUI updates for alert and notice popups
|
282
|
+
|
283
|
+
### Testing
|
284
|
+
- Adding dummy app and tests
|
285
|
+
|
286
|
+
### Bug Fix
|
287
|
+
- New Menu system is now IE7+ compatible
|
288
|
+
|
289
|
+
## 0.6.1 (November 14, 2011)
|
290
|
+
|
291
|
+
### Bug Fix
|
292
|
+
- Samples Index page now correctly displays the Contour version number
|
293
|
+
|
294
|
+
## 0.6.0 (November 14, 2011)
|
295
|
+
|
296
|
+
### Enhancements
|
297
|
+
- Underlying HighCharts Library updated to 2.1.9 to work with jQuery 1.7.0
|
298
|
+
- Added jquery-rails ~> 1.0.17 as a dependency
|
299
|
+
|
300
|
+
### Bug Fix
|
301
|
+
- CSS classes negative and positive now properly apply color to their corresponding links
|
302
|
+
|
303
|
+
## 0.5.7 (November 14, 2011)
|
304
|
+
|
305
|
+
### Enhancements
|
306
|
+
- Authentications link is now hidden by default if no additional providers have been specified for Omniauth
|
307
|
+
|
308
|
+
### Bug Fix
|
309
|
+
- Dependency added for jquery-rails 1.0.0 to 1.0.16 since jquery-rails 1.0.17 switches to jQuery 1.7.0 which is incompatible with HighCharts 2.1.4 which requires jQuery 1.6.4
|
310
|
+
|
311
|
+
## 0.5.6 (October 11, 2011)
|
312
|
+
|
313
|
+
### Bug Fix
|
314
|
+
- SSL Verify Mode set to VERIFY_NONE so that RSS feeds using https can be read and parsed
|
315
|
+
|
316
|
+
## 0.5.5 (October 10, 2011)
|
317
|
+
|
318
|
+
### Bug Fix
|
319
|
+
- after_inactive_sign_up_path_for is now set to redirect to new_session_path(resource) to properly show message and to avoid redirect when the root_path is not publicly available
|
320
|
+
|
321
|
+
## 0.5.4 (October 10, 2011)
|
322
|
+
|
323
|
+
### Enhancements
|
324
|
+
- Added arrow.png image asset
|
325
|
+
- Added config.news_feed options that allows users to specify an RSS feed url that is displayed on the login page
|
326
|
+
- Added config.news_feed_items to be able to specify the maximum number of items displayed in the News Feed
|
327
|
+
|
328
|
+
### Refactoring
|
329
|
+
- Code cleanup and additional logger information for Devise Registrations (Omniauth) controller
|
330
|
+
|
331
|
+
## 0.5.3 (September 30, 2011)
|
332
|
+
|
333
|
+
### Enhancements
|
334
|
+
- Added warning.png image asset
|
335
|
+
|
336
|
+
## 0.5.2 (September 19, 2011)
|
337
|
+
|
338
|
+
### Bug Fix
|
339
|
+
- Password reset functionality fixed
|
340
|
+
|
341
|
+
## 0.5.1 (September 12, 2011)
|
342
|
+
|
343
|
+
### Refactoring
|
344
|
+
- Removed debug output
|
345
|
+
|
346
|
+
### Documentation
|
347
|
+
- Contour Walkthrough from an empty Rails 3.1 application now works correctly (# Devise.config.sign_out_via = :delete)
|
348
|
+
|
349
|
+
## 0.5.0 (September 8, 2011)
|
350
|
+
|
351
|
+
### Enhancements
|
352
|
+
- rails generate contour:install now appends routes
|
353
|
+
- Authentication icons can be overridden in the application if the application has a contour folder in the assets directory
|
354
|
+
- ex: if the web app contains a special logo for LDAP authentication, the app/assets/images/contour folder would contain specialized ldap_64.png and ldap_32.png where 64 and 32 represent the height
|
355
|
+
- Removing reliance on Contour.application_site_url and using request.script_name instead
|
356
|
+
- Contour now handles fixes to other libraries in the background, no longer needs to add omniauth_fix.rb and rack_fix.rb to the config/initializers folder
|
357
|
+
|
358
|
+
### Bug Fix
|
359
|
+
- Removed registration page requirement for first_name and last_name
|
360
|
+
- Incorrect redirect on LDAP authentication failure for Rails apps on subdomains fixed
|
361
|
+
|
362
|
+
## 0.4.0 (September 7, 2011)
|
363
|
+
|
364
|
+
### Enhancements
|
365
|
+
- Added new image assets
|
366
|
+
- :target allowed as a parameter for a link in the menu, ex: target: '_blank'
|
367
|
+
- Added application_name_html configuration so that users can specify the html for the application name
|
368
|
+
- :image and :image_options can now be passed to links to specify an image that appears to the right of the link
|
369
|
+
|
370
|
+
## 0.3.2 (September 6, 2011)
|
371
|
+
|
372
|
+
### Bug Fix
|
373
|
+
- Fixing asset paths in production and development by restructuring asset (image and stylesheet) relative placement
|
374
|
+
|
375
|
+
## 0.3.1 (September 5, 2011)
|
376
|
+
|
377
|
+
### Bug Fix
|
378
|
+
- Fixed assets location for images specified in the stylesheets
|
379
|
+
|
380
|
+
## 0.3.0 (September 5, 2011)
|
381
|
+
|
382
|
+
### Enhancements
|
383
|
+
- Update dependencies to Devise 1.4.4, (needed for Rails 3.1.0)
|
384
|
+
- Menu items are now rendered using html_safe
|
385
|
+
- 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
|
386
|
+
- ex: condition: 'current_user.admin?'
|
387
|
+
|
388
|
+
### Testing
|
389
|
+
- Created limited tests for authentications controller and registrations
|
390
|
+
|
391
|
+
## 0.2.1 (September 1, 2011)
|
392
|
+
|
393
|
+
### Bug Fix
|
394
|
+
- Apparently add_dependency doesn't work with (= ) signs either
|
395
|
+
|
396
|
+
## 0.2.0 (September 1, 2011)
|
397
|
+
|
398
|
+
### Enhancements
|
399
|
+
- Stock assets added
|
400
|
+
- Sign in, password reset, and registration pages redesigned
|
401
|
+
|
402
|
+
## 0.1.1 (September 1, 2011)
|
403
|
+
|
404
|
+
### Bug Fix
|
405
|
+
- Apparently add_dependency doesn't currently work without ~> Set Omniauth dependency to increment on bug fix revision
|
406
|
+
|
407
|
+
## 0.1.0 (September 1, 2011)
|
408
|
+
|
409
|
+
### Enhancements
|
410
|
+
- Contour can now be used as a default template for the application layout
|
411
|
+
- Contour provides assets, (images, css, and javascript), to provide an easy authentication system built on top of Devise and Omniauth
|
412
|
+
- Contour provides CSS based on Bluetrip to provide cross-browser compatiblity
|
413
|
+
- Contour rails generator provides fixes to Rack and Omniauth to allow correct reverse proxy (chaining) authentication to machines behind firewalls
|
414
|
+
|
415
|
+
## 0.0.0 (August 29, 2011)
|
416
|
+
|
417
|
+
- Skeleton files to compile gem and make it available on rubygems.org
|
data/README.md
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
# Contour
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/remomueller/contour.png?branch=master)](https://travis-ci.org/remomueller/contour)
|
4
|
+
[![Dependency Status](https://gemnasium.com/remomueller/contour.png)](https://gemnasium.com/remomueller/contour)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/remomueller/contour.png)](https://codeclimate.com/github/remomueller/contour)
|
6
|
+
|
7
|
+
Basic Rails framework files and assets for layout and authentication
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Contour can be installed from rubygems.org using
|
12
|
+
|
13
|
+
```console
|
14
|
+
gem install contour
|
15
|
+
```
|
16
|
+
|
17
|
+
Or update your `Gemfile` to include
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'contour'
|
21
|
+
```
|
22
|
+
|
23
|
+
## Getting started
|
24
|
+
|
25
|
+
Make sure you have Rails 3.2.12
|
26
|
+
|
27
|
+
```console
|
28
|
+
rails -v
|
29
|
+
|
30
|
+
rails new blank_rails_project
|
31
|
+
|
32
|
+
cd blank_rails_project
|
33
|
+
```
|
34
|
+
|
35
|
+
Modify `Gemfile` and add
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
gem 'contour', '~> 1.2.0'
|
39
|
+
```
|
40
|
+
|
41
|
+
Run Bundle install
|
42
|
+
|
43
|
+
```console
|
44
|
+
bundle install
|
45
|
+
```
|
46
|
+
|
47
|
+
Install contour files
|
48
|
+
|
49
|
+
```console
|
50
|
+
rails generate contour:install
|
51
|
+
```
|
52
|
+
|
53
|
+
Add the authentication model
|
54
|
+
|
55
|
+
```console
|
56
|
+
rails generate model Authentication user_id:integer provider:string uid:string
|
57
|
+
```
|
58
|
+
|
59
|
+
Migrate your database
|
60
|
+
|
61
|
+
```console
|
62
|
+
bundle exec rake db:create
|
63
|
+
|
64
|
+
bundle exec rake db:migrate
|
65
|
+
```
|
66
|
+
|
67
|
+
Create a sample controller
|
68
|
+
|
69
|
+
```console
|
70
|
+
rails generate controller welcome index --skip-stylesheets
|
71
|
+
```
|
72
|
+
|
73
|
+
Remove the `public/index.html`
|
74
|
+
|
75
|
+
```console
|
76
|
+
rm public/index.html
|
77
|
+
```
|
78
|
+
|
79
|
+
Add the following line to your `app/controllers/application_controller.rb`
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
layout "contour/layouts/application"
|
83
|
+
```
|
84
|
+
|
85
|
+
Edit your `app/assets/javascripts/application.js` manifest to use Contour JavaScript (Replace `jquery` and `jquery_ujs`)
|
86
|
+
|
87
|
+
```
|
88
|
+
//= require contour
|
89
|
+
```
|
90
|
+
|
91
|
+
Edit your `app/assets/stylesheets/application.css` manifest to use Contour CSS (after `self`, before `tree`)
|
92
|
+
|
93
|
+
```
|
94
|
+
*= require contour
|
95
|
+
```
|
96
|
+
|
97
|
+
Make sure the devise line in `config/routes.rb` looks as follows
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
devise_for :users, controllers: { registrations: 'contour/registrations', sessions: 'contour/sessions', passwords: 'contour/passwords', confirmations: 'contour/confirmations', unlocks: 'contour/unlocks' }, path_names: { sign_up: 'register', sign_in: 'login' }
|
101
|
+
```
|
102
|
+
|
103
|
+
**If there is a line that just says `devise_for :users` or a duplicate, REMOVE IT!**
|
104
|
+
|
105
|
+
Create a root in your `config/routes.rb`
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
root to: 'welcome#index'
|
109
|
+
```
|
110
|
+
|
111
|
+
Add the following to the top of your `app/controllers/welcome_controller.rb`
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
before_filter :authenticate_user!
|
115
|
+
```
|
116
|
+
|
117
|
+
Add the following to your `app/models/user.rb`
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
# Model Relationships
|
121
|
+
has_many :authentications
|
122
|
+
|
123
|
+
def apply_omniauth(omniauth)
|
124
|
+
unless omniauth['info'].blank?
|
125
|
+
self.email = omniauth['info']['email'] if email.blank?
|
126
|
+
end
|
127
|
+
self.password = Devise.friendly_token[0,20] if self.password.blank?
|
128
|
+
authentications.build( provider: omniauth['provider'], uid: omniauth['uid'] )
|
129
|
+
end
|
130
|
+
|
131
|
+
def password_required?
|
132
|
+
(authentications.empty? || !password.blank?) && super
|
133
|
+
end
|
134
|
+
```
|
135
|
+
|
136
|
+
Add the following to your `app/models/authentication.rb`
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
belongs_to :user
|
140
|
+
|
141
|
+
def provider_name
|
142
|
+
OmniAuth.config.camelizations[provider.to_s.downcase] || provider.to_s.titleize
|
143
|
+
end
|
144
|
+
```
|
145
|
+
|
146
|
+
Edit `config/initializers/devise.rb` to use `:get` for devise `sign_out_via`
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
150
|
+
config.sign_out_via = :get
|
151
|
+
```
|
152
|
+
|
153
|
+
Start your server and navigate to [http://localhost:3000/users/login](http://localhost:3000/users/login)
|
154
|
+
|
155
|
+
```console
|
156
|
+
rails s
|
157
|
+
```
|
158
|
+
|
159
|
+
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](http://localhost:3000/users/register)
|
160
|
+
|
161
|
+
## Overwrite Default Rails Scaffolding (optional)
|
162
|
+
|
163
|
+
Add [Kaminari](https://github.com/amatsuda/kaminari) gem to your `Gemfile`
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
gem 'kaminari', '~> 0.14.1'
|
167
|
+
```
|
168
|
+
|
169
|
+
Update your gems
|
170
|
+
|
171
|
+
```console
|
172
|
+
bundle update
|
173
|
+
```
|
174
|
+
|
175
|
+
Create a new model using the Rails scaffold
|
176
|
+
|
177
|
+
```console
|
178
|
+
rails g scaffold Item name:string description:text user_id:integer bought_date:date --no-stylesheets
|
179
|
+
```
|
180
|
+
|
181
|
+
Add a current `scope` and `belongs_to` relationship to `app/models/item.rb`
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
scope :current, conditions: { }
|
185
|
+
|
186
|
+
belongs_to :user
|
187
|
+
```
|
188
|
+
|
189
|
+
Add a current `scope` and `has_many` relationship to `app/models/user.rb` along with name placeholder
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
scope :current, conditions: { }
|
193
|
+
|
194
|
+
has_many :items
|
195
|
+
|
196
|
+
def name
|
197
|
+
"User ##{self.id}"
|
198
|
+
end
|
199
|
+
```
|
200
|
+
|
201
|
+
Add a user resource to your `config/routes.rb` file
|
202
|
+
|
203
|
+
```ruby
|
204
|
+
resources :users
|
205
|
+
```
|
206
|
+
|
207
|
+
NOTE: Adding the User controller is not shown, but could be created using `rails g controller Users index show edit update destroy --no-stylesheets`. Remember that the `new` and `create` actions are already defined and should be left commented out.
|
208
|
+
|
209
|
+
Migrate your database
|
210
|
+
|
211
|
+
```console
|
212
|
+
bundle exec rake db:migrate
|
213
|
+
```
|
214
|
+
|
215
|
+
Update with the Contour scaffold
|
216
|
+
|
217
|
+
```console
|
218
|
+
rails g contour:scaffold Item
|
219
|
+
```
|
220
|
+
|
221
|
+
When prompted to overwrite the existing files, type `a` for ALL.
|
222
|
+
|
223
|
+
NOTE: This will overwrite all the files generated by the rails scaffold command!
|
224
|
+
|
225
|
+
Go to [http://localhost:3000/items](http://localhost:3000/items) to see the changes! Note, that the `user_id` selection now defaults to a drop down box!
|
226
|
+
|
227
|
+
## Inspiration and Attribution
|
228
|
+
|
229
|
+
Contour is designed to rapidly prototype Rails applications with nice default styling and a solid authentication system. The Contour code base has been influenced by existing Rails Engines architectures that are listed below. Please check them out if you are interested in seeing how Contour is put together!
|
230
|
+
|
231
|
+
### Devise
|
232
|
+
|
233
|
+
[Devise](https://github.com/plataformatec/devise) is the highly configurable authentication gem that Contour utilizes.
|
234
|
+
|
235
|
+
Contour has adopted Devise's installation and configuration approach `rails generate devise:install` and `config/intializers/devise.rb`.
|
236
|
+
|
237
|
+
### Twitter Bootstrap Rails
|
238
|
+
|
239
|
+
While Contour doesn't have an external dependency on the [Twitter Bootstrap Rails](https://github.com/seyhunak/twitter-bootstrap-rails) gem, Contour does adopt the templating approach, `rails generate contour:scaffold ModelName`, used to overwrite the default scaffolding provided by Rails.
|
240
|
+
|
241
|
+
For those interested in having better control on modifying the Twitter Bootstrap Less file and CSS, I highly recommend taking a look at Twitter Bootstrap Rails!
|
242
|
+
|
243
|
+
## Contributing to Contour
|
244
|
+
|
245
|
+
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
246
|
+
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
247
|
+
- Fork the project
|
248
|
+
- Start a feature/bugfix branch
|
249
|
+
- Commit and push until you are happy with your contribution
|
250
|
+
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
251
|
+
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
252
|
+
|
253
|
+
## Copyright [![Creative Commons 3.0](http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png)](http://creativecommons.org/licenses/by-nc-sa/3.0)
|
254
|
+
|
255
|
+
Copyright (c) 2013 Remo Mueller. See [LICENSE](https://github.com/remomueller/contour/blob/master/LICENSE) for further details.
|