Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Add user-management via devise and cancan
Browse files Browse the repository at this point in the history
  • Loading branch information
joegatt committed Sep 1, 2013
1 parent 2212af0 commit 9b14a77
Show file tree
Hide file tree
Showing 43 changed files with 742 additions and 155 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ gem 'coffee-rails'
gem 'compass-rails', github: 'milgner/compass-rails', ref: '1749c06f15dc4b058427e7969810457213647fb8'
gem 'compass-h5bp'
gem 'coveralls', require: false
gem 'cancan'
gem 'dalli'
gem 'detect_language'
gem 'devise'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ GEM
debug_inspector (>= 0.0.1)
breadcrumbs_on_rails (2.3.0)
builder (3.1.4)
cancan (1.6.10)
capistrano (2.15.5)
highline
net-scp (>= 1.0.0)
Expand Down Expand Up @@ -395,6 +396,7 @@ DEPENDENCIES
better_errors
binding_of_caller
breadcrumbs_on_rails
cancan
capistrano
capybara
coffee-rails
Expand Down
37 changes: 28 additions & 9 deletions app/assets/fonts/Fontello/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "",
"css_prefix_text": "icon-",
"css_use_suffix": false,
"hinting": true,
"glyphs": [
{
"uid": "bf882b30900da12fca090d9796bc3030",
Expand Down Expand Up @@ -76,9 +77,9 @@
"src": "fontawesome"
},
{
"uid": "dfec4ffa849d8594c2e4b86f6320b8a6",
"css": "angle-double-down",
"code": 61699,
"uid": "dea706a9bd3144316ce37406ec10f469",
"css": "level-up",
"code": 59394,
"src": "fontawesome"
},
{
Expand Down Expand Up @@ -147,6 +148,24 @@
"code": 61593,
"src": "fontawesome"
},
{
"uid": "c709da589c923ba3c2ad48d9fc563e93",
"css": "cancel",
"code": 59399,
"src": "entypo"
},
{
"uid": "70370693ada58ef0a60fa0984fe8d52a",
"css": "plus",
"code": 59396,
"src": "entypo"
},
{
"uid": "1256e3054823e304d7e452a589cf8bb8",
"css": "minus",
"code": 59397,
"src": "entypo"
},
{
"uid": "48b79f27e4798f23bafa07b55dbe5b73",
"css": "book",
Expand Down Expand Up @@ -231,12 +250,6 @@
"code": 59850,
"src": "mfglabs"
},
{
"uid": "da72ab64b02d997ff0521339f2997233",
"css": "hash",
"code": 59394,
"src": "mfglabs"
},
{
"uid": "c7715df42d0413b3cae83d4bc3943a3e",
"css": "soundcloud",
Expand Down Expand Up @@ -302,6 +315,12 @@
"css": "vimeo",
"code": 62223,
"src": "brandico"
},
{
"uid": "74b2f1d1ee541715b3f389f7cdf63d1c",
"css": "logout",
"code": 59398,
"src": "websymbols"
}
]
}
Binary file modified app/assets/fonts/Fontello/regular.eot
Binary file not shown.
5 changes: 4 additions & 1 deletion app/assets/fonts/Fontello/regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/fonts/Fontello/regular.ttf
Binary file not shown.
Binary file modified app/assets/fonts/Fontello/regular.woff
Binary file not shown.
8 changes: 8 additions & 0 deletions app/assets/stylesheets/application/icon_font_mixedin.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ $iconMuted: #eee !default
+icon
content: '\2c'

=icon-cancel
+icon
content: '\e806'

=icon-digg
+icon
content: '\ea22'
Expand Down Expand Up @@ -108,6 +112,10 @@ $iconMuted: #eee !default
+icon
content: '\f30f'

=icon-signout
+icon
content: '\e807'

=icon-soundcloud
+icon
content: '\e801'
Expand Down
132 changes: 107 additions & 25 deletions app/assets/stylesheets/themes/default.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
=arrow-links
a:first-of-type, .current
text-transform: lowercase
&:before
+icon-right
+icon-small
.current
font-weight: bold

=blurb($lines: 3, $margin-right: 0)
display: block
height: $line-height * $lines
Expand Down Expand Up @@ -233,11 +242,11 @@ table
+pass_media_query('default')
#main, footer
#main, #tools, footer
width: 90%
margin: 0 5% $line-height 5%
#main > div, footer nav, footer small
#main > div, #tools ul, footer nav, footer small
+column(12)
ol, ul, .statistics
Expand All @@ -250,10 +259,8 @@ ol, ul, .statistics
font-style: normal
li
&:not(:last-child)
a:before
+icon-right
+icon-small
&:last-child
+arrow-links
&:last-child // use link_to_unless_current_or_wrapped
&:before
+icon-right
+icon-small
Expand All @@ -262,15 +269,18 @@ ol, ul, .statistics
header
position: relative
#notice
.error
background-color: $error-background-color
p
margin: 0
&:before
+icon-attention
.success
background-color: $success-background-color
&:before
+icon-ok
&.alert,
&.error
background-color: $error-background-color
&:before
+icon-attention
&.notice,
&.success
background-color: $success-background-color
&:before
+icon-ok
footer
ul
Expand Down Expand Up @@ -315,12 +325,51 @@ footer
+icon-cc-by-nc-sa
letter-spacing: 0.25em
#tools
+arrow-links
a
&[href*='users/edit']:before, &[href*='users/sign_in']:before
+icon-medium
+icon-user
&[href*='users/sign_in']
display: none
li
a[href*='users/sign_out']
display: none
&:hover
a[href*='users/sign_out']
text-indent: '-999px'
display: inline-block !important
&:before
+icon-cancel
span
&[data-href*='users/edit']:before, &[data-href*='users/sign_in']:before
+icon-medium
+icon-user
ul
margin-bottom: 0
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Elements
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ul.user li a
&.back
text-transform: lowercase
&:before
+icon-left
+icon-small
&:after
content: ''
&[data-method=delete]:before
+icon-signout
+icon-regular
blockquote
footer
+prefix-with-emdash
Expand Down Expand Up @@ -559,6 +608,11 @@ iframe
+icon-tag
color: $secondary-color
.confirmations-edit, .confirmations-new, .passwords-edit,
.passwords-new, .registrations-edit, .registrations-new, .sessions-new
h1:before
+icon-user
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Media-queries
Expand Down Expand Up @@ -606,6 +660,7 @@ iframe
padding-top: $line-height / 2
#main,
#tools,
footer
margin: 0 auto $line-height auto
overflow: hidden
Expand All @@ -615,6 +670,25 @@ iframe
& > section
+row(12)
#tools
ul
+column(12, 12)
li
// We don't use horizontal list here becaus eit cancels all margins
display: inline-block
margin-right: 5px

form
+column(6, 12)
+first-column
label
input
float: right
width: 66.66%
input[type=button],
input[type=submit]
margin-top: $line-height

header
position: relative
#notice
Expand Down Expand Up @@ -656,18 +730,18 @@ iframe
right: 0
width: auto

ul.user
+column(12, 12)
+first-column
margin-top: $line-height
li
a
text-transform: lowercase
&:before
+icon-right
+icon-small

.books-edit, .books-update, .links-edit, .links-update
form
+column(6, 12)
+first-column
input
&[type=text],
&[type=url],
&[type=number]
float: right
width: 66.66%
&[type=submit]
margin-top: $line-height
.tools
+column(6, 12)
ul
Expand Down Expand Up @@ -806,6 +880,7 @@ iframe
+fixed-column-gap

#main,
#tools,
footer
width: 1080px

Expand Down Expand Up @@ -875,6 +950,13 @@ iframe

+pass_media_query('screen-and-min-width-1200px')

#tools
left: ($text-indent / 2)
margin: 0
position: absolute
top: ($line-height / 2)
width: $column-width * 3px

// This file was generated by html5-rails
// https://github.com/sporkd/html5-rails
// Upgrade with: $ rails generate html5:install
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ def set_locale
# And: http://stackoverflow.com/questions/10865962/rails-breadcrumb-and-i18n
add_breadcrumb I18n.t('home.title'), :root_path
end

rescue_from CanCan::AccessDenied do |exception|
redirect_to new_user_session_path, :alert => exception.message
end

end
2 changes: 2 additions & 0 deletions app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class BooksController < ApplicationController

load_and_authorize_resource

add_breadcrumb I18n.t('books.index.title'), :books_path

def index
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/links_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class LinksController < ApplicationController

load_and_authorize_resource

add_breadcrumb I18n.t('links.index.title'), :links_path

def admin
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class SessionsController < Devise::SessionsController

end
Loading

0 comments on commit 9b14a77

Please sign in to comment.