the_role 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Bye_bye_CanCan_I_got_the_Role.png +0 -0
- data/README.md +82 -92
- data/app/assets/javascripts/admin_the_role.js +3 -0
- data/app/assets/javascripts/bootstrap-dropdown.js +100 -0
- data/app/assets/stylesheets/admin_the_role.css +7 -0
- data/app/assets/stylesheets/alerts.less +58 -0
- data/app/assets/stylesheets/button-groups.less +191 -0
- data/app/assets/stylesheets/buttons.less +191 -0
- data/app/assets/stylesheets/custom.scss +3 -0
- data/app/assets/stylesheets/dropdowns.less +143 -0
- data/app/assets/stylesheets/forms.less +583 -0
- data/app/assets/stylesheets/grid.less +5 -0
- data/app/assets/stylesheets/headers.scss +15 -0
- data/app/assets/stylesheets/layouts.less +17 -0
- data/app/assets/stylesheets/mix.scss +41 -0
- data/app/assets/stylesheets/mixins.less +646 -0
- data/app/assets/stylesheets/reset.css +117 -0
- data/app/assets/stylesheets/role_set.less +136 -0
- data/app/assets/stylesheets/scaffolding.less +29 -0
- data/app/assets/stylesheets/variables.less +206 -0
- data/app/assets/stylesheets/wells.less +27 -0
- data/app/controllers/admin/role_sections_controller.rb +40 -17
- data/app/controllers/admin/roles_controller.rb +8 -6
- data/app/views/admin/roles/_role.html.haml +53 -0
- data/app/views/admin/roles/_sidebar.html.haml +8 -0
- data/app/views/admin/roles/edit.html.haml +2 -42
- data/app/views/admin/roles/index.haml +2 -15
- data/app/views/admin/roles/new.html.haml +5 -4
- data/app/views/layouts/the_role.html.haml +24 -0
- data/config/routes.rb +5 -1
- data/lib/the_role/engine.rb +2 -2
- data/lib/the_role/hash.rb +50 -14
- data/lib/the_role/modules/base.rb +4 -4
- data/lib/the_role/modules/controller_requires.rb +4 -15
- data/lib/the_role/modules/role_model.rb +14 -13
- data/lib/the_role/param_helper.rb +15 -0
- data/lib/the_role/version.rb +1 -1
- data/lib/the_role.rb +13 -11
- data/pic.png +0 -0
- data/the_role.gemspec +5 -2
- metadata +58 -16
- data/app/assets/stylesheets/the_role/form.css +0 -57
- data/app/assets/stylesheets/the_role/headers.css.scss +0 -15
- data/app/assets/stylesheets/the_role/style.css.scss +0 -75
- data/lib/the_role/modules/param_helper.rb +0 -7
@@ -0,0 +1,191 @@
|
|
1
|
+
// BUTTON STYLES
|
2
|
+
// -------------
|
3
|
+
|
4
|
+
|
5
|
+
// Base styles
|
6
|
+
// --------------------------------------------------
|
7
|
+
|
8
|
+
// Core
|
9
|
+
.btn {
|
10
|
+
display: inline-block;
|
11
|
+
.ie7-inline-block();
|
12
|
+
padding: 4px 10px 4px;
|
13
|
+
margin-bottom: 0; // For input.btn
|
14
|
+
font-size: @baseFontSize;
|
15
|
+
line-height: @baseLineHeight;
|
16
|
+
*line-height: 20px;
|
17
|
+
color: @grayDark;
|
18
|
+
text-align: center;
|
19
|
+
text-shadow: 0 1px 1px rgba(255,255,255,.75);
|
20
|
+
vertical-align: middle;
|
21
|
+
cursor: pointer;
|
22
|
+
.buttonBackground(@btnBackground, @btnBackgroundHighlight);
|
23
|
+
border: 1px solid @btnBorder;
|
24
|
+
*border: 0; // Remove the border to prevent IE7's black border on input:focus
|
25
|
+
border-bottom-color: darken(@btnBorder, 10%);
|
26
|
+
.border-radius(4px);
|
27
|
+
.ie7-restore-left-whitespace(); // Give IE7 some love
|
28
|
+
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
|
29
|
+
}
|
30
|
+
|
31
|
+
// Hover state
|
32
|
+
.btn:hover {
|
33
|
+
color: @grayDark;
|
34
|
+
text-decoration: none;
|
35
|
+
background-color: darken(@white, 10%);
|
36
|
+
*background-color: darken(@white, 15%); /* Buttons in IE7 don't get borders, so darken on hover */
|
37
|
+
background-position: 0 -15px;
|
38
|
+
|
39
|
+
// transition is only when going to hover, otherwise the background
|
40
|
+
// behind the gradient (there for IE<=9 fallback) gets mismatched
|
41
|
+
.transition(background-position .1s linear);
|
42
|
+
}
|
43
|
+
|
44
|
+
// Focus state for keyboard and accessibility
|
45
|
+
.btn:focus {
|
46
|
+
.tab-focus();
|
47
|
+
}
|
48
|
+
|
49
|
+
// Active state
|
50
|
+
.btn.active,
|
51
|
+
.btn:active {
|
52
|
+
background-color: darken(@white, 10%);
|
53
|
+
background-color: darken(@white, 15%) e("\9");
|
54
|
+
background-image: none;
|
55
|
+
outline: 0;
|
56
|
+
.box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)");
|
57
|
+
}
|
58
|
+
|
59
|
+
// Disabled state
|
60
|
+
.btn.disabled,
|
61
|
+
.btn[disabled] {
|
62
|
+
cursor: default;
|
63
|
+
background-color: darken(@white, 10%);
|
64
|
+
background-image: none;
|
65
|
+
.opacity(65);
|
66
|
+
.box-shadow(none);
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
// Button Sizes
|
71
|
+
// --------------------------------------------------
|
72
|
+
|
73
|
+
// Large
|
74
|
+
.btn-large {
|
75
|
+
padding: 9px 14px;
|
76
|
+
font-size: @baseFontSize + 2px;
|
77
|
+
line-height: normal;
|
78
|
+
.border-radius(5px);
|
79
|
+
}
|
80
|
+
.btn-large [class^="icon-"] {
|
81
|
+
margin-top: 1px;
|
82
|
+
}
|
83
|
+
|
84
|
+
// Small
|
85
|
+
.btn-small {
|
86
|
+
padding: 5px 9px;
|
87
|
+
font-size: @baseFontSize - 2px;
|
88
|
+
line-height: @baseLineHeight - 2px;
|
89
|
+
}
|
90
|
+
.btn-small [class^="icon-"] {
|
91
|
+
margin-top: -1px;
|
92
|
+
}
|
93
|
+
|
94
|
+
// Mini
|
95
|
+
.btn-mini {
|
96
|
+
padding: 2px 6px;
|
97
|
+
font-size: @baseFontSize - 2px;
|
98
|
+
line-height: @baseLineHeight - 4px;
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
// Alternate buttons
|
103
|
+
// --------------------------------------------------
|
104
|
+
|
105
|
+
// Set text color
|
106
|
+
// -------------------------
|
107
|
+
.btn-primary,
|
108
|
+
.btn-primary:hover,
|
109
|
+
.btn-warning,
|
110
|
+
.btn-warning:hover,
|
111
|
+
.btn-danger,
|
112
|
+
.btn-danger:hover,
|
113
|
+
.btn-success,
|
114
|
+
.btn-success:hover,
|
115
|
+
.btn-info,
|
116
|
+
.btn-info:hover,
|
117
|
+
.btn-inverse,
|
118
|
+
.btn-inverse:hover {
|
119
|
+
color: @white;
|
120
|
+
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
|
121
|
+
}
|
122
|
+
// Provide *some* extra contrast for those who can get it
|
123
|
+
.btn-primary.active,
|
124
|
+
.btn-warning.active,
|
125
|
+
.btn-danger.active,
|
126
|
+
.btn-success.active,
|
127
|
+
.btn-info.active,
|
128
|
+
.btn-inverse.active {
|
129
|
+
color: rgba(255,255,255,.75);
|
130
|
+
}
|
131
|
+
|
132
|
+
// Set the backgrounds
|
133
|
+
// -------------------------
|
134
|
+
.btn {
|
135
|
+
// reset here as of 2.0.3 due to Recess property order
|
136
|
+
border-color: #ccc;
|
137
|
+
border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
|
138
|
+
}
|
139
|
+
.btn-primary {
|
140
|
+
.buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight);
|
141
|
+
}
|
142
|
+
// Warning appears are orange
|
143
|
+
.btn-warning {
|
144
|
+
.buttonBackground(@btnWarningBackground, @btnWarningBackgroundHighlight);
|
145
|
+
}
|
146
|
+
// Danger and error appear as red
|
147
|
+
.btn-danger {
|
148
|
+
.buttonBackground(@btnDangerBackground, @btnDangerBackgroundHighlight);
|
149
|
+
}
|
150
|
+
// Success appears as green
|
151
|
+
.btn-success {
|
152
|
+
.buttonBackground(@btnSuccessBackground, @btnSuccessBackgroundHighlight);
|
153
|
+
}
|
154
|
+
// Info appears as a neutral blue
|
155
|
+
.btn-info {
|
156
|
+
.buttonBackground(@btnInfoBackground, @btnInfoBackgroundHighlight);
|
157
|
+
}
|
158
|
+
// Inverse appears as dark gray
|
159
|
+
.btn-inverse {
|
160
|
+
.buttonBackground(@btnInverseBackground, @btnInverseBackgroundHighlight);
|
161
|
+
}
|
162
|
+
|
163
|
+
|
164
|
+
// Cross-browser Jank
|
165
|
+
// --------------------------------------------------
|
166
|
+
|
167
|
+
button.btn,
|
168
|
+
input[type="submit"].btn {
|
169
|
+
|
170
|
+
// Firefox 3.6 only I believe
|
171
|
+
&::-moz-focus-inner {
|
172
|
+
padding: 0;
|
173
|
+
border: 0;
|
174
|
+
}
|
175
|
+
|
176
|
+
// IE7 has some default padding on button controls
|
177
|
+
*padding-top: 2px;
|
178
|
+
*padding-bottom: 2px;
|
179
|
+
&.btn-large {
|
180
|
+
*padding-top: 7px;
|
181
|
+
*padding-bottom: 7px;
|
182
|
+
}
|
183
|
+
&.btn-small {
|
184
|
+
*padding-top: 3px;
|
185
|
+
*padding-bottom: 3px;
|
186
|
+
}
|
187
|
+
&.btn-mini {
|
188
|
+
*padding-top: 1px;
|
189
|
+
*padding-bottom: 1px;
|
190
|
+
}
|
191
|
+
}
|
@@ -0,0 +1,143 @@
|
|
1
|
+
// DROPDOWN MENUS
|
2
|
+
// --------------
|
3
|
+
|
4
|
+
// Use the .menu class on any <li> element within the topbar or ul.tabs and you'll get some superfancy dropdowns
|
5
|
+
.dropup,
|
6
|
+
.dropdown {
|
7
|
+
position: relative;
|
8
|
+
}
|
9
|
+
.dropdown-toggle {
|
10
|
+
// The caret makes the toggle a bit too tall in IE7
|
11
|
+
*margin-bottom: -3px;
|
12
|
+
}
|
13
|
+
.dropdown-toggle:active,
|
14
|
+
.open .dropdown-toggle {
|
15
|
+
outline: 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
// Dropdown arrow/caret
|
19
|
+
// --------------------
|
20
|
+
.caret {
|
21
|
+
display: inline-block;
|
22
|
+
width: 0;
|
23
|
+
height: 0;
|
24
|
+
vertical-align: top;
|
25
|
+
border-top: 4px solid @black;
|
26
|
+
border-right: 4px solid transparent;
|
27
|
+
border-left: 4px solid transparent;
|
28
|
+
content: "";
|
29
|
+
.opacity(30);
|
30
|
+
}
|
31
|
+
|
32
|
+
// Place the caret
|
33
|
+
.dropdown .caret {
|
34
|
+
margin-top: 8px;
|
35
|
+
margin-left: 2px;
|
36
|
+
}
|
37
|
+
.dropdown:hover .caret,
|
38
|
+
.open .caret {
|
39
|
+
.opacity(100);
|
40
|
+
}
|
41
|
+
|
42
|
+
// The dropdown menu (ul)
|
43
|
+
// ----------------------
|
44
|
+
.dropdown-menu {
|
45
|
+
position: absolute;
|
46
|
+
top: 100%;
|
47
|
+
left: 0;
|
48
|
+
z-index: @zindexDropdown;
|
49
|
+
display: none; // none by default, but block on "open" of the menu
|
50
|
+
float: left;
|
51
|
+
min-width: 160px;
|
52
|
+
padding: 4px 0;
|
53
|
+
margin: 1px 0 0; // override default ul
|
54
|
+
list-style: none;
|
55
|
+
background-color: @dropdownBackground;
|
56
|
+
border: 1px solid #ccc;
|
57
|
+
border: 1px solid rgba(0,0,0,.2);
|
58
|
+
*border-right-width: 2px;
|
59
|
+
*border-bottom-width: 2px;
|
60
|
+
.border-radius(5px);
|
61
|
+
.box-shadow(0 5px 10px rgba(0,0,0,.2));
|
62
|
+
-webkit-background-clip: padding-box;
|
63
|
+
-moz-background-clip: padding;
|
64
|
+
background-clip: padding-box;
|
65
|
+
|
66
|
+
// Aligns the dropdown menu to right
|
67
|
+
&.pull-right {
|
68
|
+
right: 0;
|
69
|
+
left: auto;
|
70
|
+
}
|
71
|
+
|
72
|
+
// Dividers (basically an hr) within the dropdown
|
73
|
+
.divider {
|
74
|
+
.nav-divider(@dropdownDividerTop, @dropdownDividerBottom);
|
75
|
+
}
|
76
|
+
|
77
|
+
// Links within the dropdown menu
|
78
|
+
a {
|
79
|
+
display: block;
|
80
|
+
padding: 3px 15px;
|
81
|
+
clear: both;
|
82
|
+
font-weight: normal;
|
83
|
+
line-height: @baseLineHeight;
|
84
|
+
color: @dropdownLinkColor;
|
85
|
+
white-space: nowrap;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
// Hover state
|
90
|
+
// -----------
|
91
|
+
.dropdown-menu li > a:hover,
|
92
|
+
.dropdown-menu .active > a,
|
93
|
+
.dropdown-menu .active > a:hover {
|
94
|
+
color: @dropdownLinkColorHover;
|
95
|
+
text-decoration: none;
|
96
|
+
background-color: @dropdownLinkBackgroundHover;
|
97
|
+
}
|
98
|
+
|
99
|
+
// Open state for the dropdown
|
100
|
+
// ---------------------------
|
101
|
+
.open {
|
102
|
+
// IE7's z-index only goes to the nearest positioned ancestor, which would
|
103
|
+
// make the menu appear below buttons that appeared later on the page
|
104
|
+
*z-index: @zindexDropdown;
|
105
|
+
|
106
|
+
& > .dropdown-menu {
|
107
|
+
display: block;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
// Right aligned dropdowns
|
112
|
+
// ---------------------------
|
113
|
+
.pull-right > .dropdown-menu {
|
114
|
+
right: 0;
|
115
|
+
left: auto;
|
116
|
+
}
|
117
|
+
|
118
|
+
// Allow for dropdowns to go bottom up (aka, dropup-menu)
|
119
|
+
// ------------------------------------------------------
|
120
|
+
// Just add .dropup after the standard .dropdown class and you're set, bro.
|
121
|
+
// TODO: abstract this so that the navbar fixed styles are not placed here?
|
122
|
+
.dropup,
|
123
|
+
.navbar-fixed-bottom .dropdown {
|
124
|
+
// Reverse the caret
|
125
|
+
.caret {
|
126
|
+
border-top: 0;
|
127
|
+
border-bottom: 4px solid @black;
|
128
|
+
content: "\2191";
|
129
|
+
}
|
130
|
+
// Different positioning for bottom up menu
|
131
|
+
.dropdown-menu {
|
132
|
+
top: auto;
|
133
|
+
bottom: 100%;
|
134
|
+
margin-bottom: 1px;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
// Typeahead
|
139
|
+
// ---------
|
140
|
+
.typeahead {
|
141
|
+
margin-top: 2px; // give it some space to breathe
|
142
|
+
.border-radius(4px);
|
143
|
+
}
|