padrino-admin 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +3 -3
- data/.yardopts +1 -0
- data/{LICENSE → LICENSE.txt} +0 -0
- data/lib/padrino-admin/access_control.rb +34 -2
- data/lib/padrino-admin/generators/admin_app.rb +10 -11
- data/lib/padrino-admin/generators/templates/app.rb.tt +11 -11
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/amro/style.css +8 -8
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec-green/style.css +5 -5
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec/style.css +5 -5
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/blue/style.css +9 -9
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/djime-cerulean/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/kathleene/style.css +9 -9
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/olive/style.css +8 -8
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/orange/style.css +7 -7
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/reidb-greenish/style.css +27 -27
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/ruby/style.css +9 -9
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/warehouse/style.css +3 -3
- data/lib/padrino-admin/helpers/authentication_helpers.rb +1 -2
- data/lib/padrino-admin/helpers/view_helpers.rb +23 -6
- data/lib/padrino-admin/locale/admin/lv.yml +16 -0
- data/lib/padrino-admin/locale/admin/zh_cn.yml +3 -3
- data/lib/padrino-admin/locale/orm/lv.yml +26 -0
- data/test/generators/test_account_model_generator.rb +9 -9
- data/test/generators/test_admin_app_generator.rb +24 -23
- data/test/generators/test_admin_page_generator.rb +24 -24
- data/test/helper.rb +6 -19
- data/test/test_admin_application.rb +1 -1
- data/test/test_locale.rb +1 -1
- metadata +14 -11
data/.document
CHANGED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--title 'Padrino Admin Documentation' --protected
|
data/{LICENSE → LICENSE.txt}
RENAMED
File without changes
|
@@ -59,6 +59,38 @@ module Padrino
|
|
59
59
|
##
|
60
60
|
# Return true if the given account is allowed to see the given path.
|
61
61
|
#
|
62
|
+
# @example Hiding a disallowed link from a user
|
63
|
+
#
|
64
|
+
# # File: config/apps.rb
|
65
|
+
# # [...]
|
66
|
+
# Padrino.mount('Admin').to('/admin')
|
67
|
+
#
|
68
|
+
# # File: admin/app.rb
|
69
|
+
# class Admin < Padrino::Application
|
70
|
+
# # [...]
|
71
|
+
# register Padrino::Admin::AccessControl
|
72
|
+
# # [...]
|
73
|
+
#
|
74
|
+
# # Goals:
|
75
|
+
# # * Admins can manage widgets and accounts
|
76
|
+
# # * Workers can only manage widgets
|
77
|
+
#
|
78
|
+
# access_control.roles_for :admin do |role|
|
79
|
+
# role.project_module :accounts, '/accounts'
|
80
|
+
# role.project_module :widgets, '/widgets'
|
81
|
+
# end
|
82
|
+
#
|
83
|
+
# access_control.roles_for :worker do |role|
|
84
|
+
# role.project_module :widgets, '/widgets'
|
85
|
+
# end
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
# # File: admin/views/layouts/application.haml
|
89
|
+
# # NOTE The un-mounted path is used ('/accounts' instead of '/admin/accounts')
|
90
|
+
# - if access_control.allowed?(current_account, '/accounts')
|
91
|
+
# # Admins see the "Profile" link, but Workers do not
|
92
|
+
# = link_to 'Profile', url(:accounts, :edit, :id => current_account.id)
|
93
|
+
#
|
62
94
|
def allowed?(account=nil, path=nil)
|
63
95
|
path = "/" if path.blank?
|
64
96
|
role = account.role.to_sym rescue nil
|
@@ -133,8 +165,7 @@ module Padrino
|
|
133
165
|
##
|
134
166
|
# Return the path of the project module. If a prefix given will be prepended.
|
135
167
|
#
|
136
|
-
#
|
137
|
-
#
|
168
|
+
# @example
|
138
169
|
# # => /accounts/new
|
139
170
|
# project_module.path
|
140
171
|
# # => /admin/accounts
|
@@ -145,6 +176,7 @@ module Padrino
|
|
145
176
|
path = File.join(ENV['RACK_BASE_URI'].to_s, path) if ENV['RACK_BASE_URI']
|
146
177
|
path
|
147
178
|
end
|
179
|
+
|
148
180
|
end # ProjectModule
|
149
181
|
end # AccessControl
|
150
182
|
end # Admin
|
@@ -106,21 +106,20 @@ module Padrino
|
|
106
106
|
return if self.behavior == :revoke
|
107
107
|
|
108
108
|
instructions = []
|
109
|
+
instructions << "Run 'bundle install'"
|
109
110
|
instructions << "Run 'padrino rake ar:migrate'" if orm == :activerecord
|
110
111
|
instructions << "Run 'padrino rake dm:auto:upgrade'" if orm == :datamapper
|
111
112
|
instructions << "Run 'padrino rake seed'"
|
112
113
|
instructions << "Visit the admin panel in the browser at '/admin'"
|
113
|
-
instructions.map! { |i| " #{instructions.index(i)
|
114
|
-
|
115
|
-
say
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
TEXT
|
114
|
+
instructions.map! { |i| " #{instructions.index(i)+1}) #{i}" }
|
115
|
+
|
116
|
+
say
|
117
|
+
say "="*65, :green
|
118
|
+
say "The admin panel has been mounted! Next, follow these steps:", :green
|
119
|
+
say "="*65, :green
|
120
|
+
say instructions.join("\n")
|
121
|
+
say "="*65, :green
|
122
|
+
say
|
124
123
|
else
|
125
124
|
say "You are not at the root of a Padrino application! (config/boot.rb not found)"
|
126
125
|
end
|
@@ -7,17 +7,17 @@ class Admin < Padrino::Application
|
|
7
7
|
##
|
8
8
|
# Application configuration options
|
9
9
|
#
|
10
|
-
# set :raise_errors, true
|
11
|
-
# set :dump_errors, true
|
12
|
-
# set :show_exceptions, true
|
13
|
-
# set :logging, true
|
14
|
-
# set :
|
15
|
-
# set :reload, false
|
16
|
-
# set :default_builder, "foo"
|
17
|
-
# set :locale_path, "bar"
|
18
|
-
# disable :sessions
|
19
|
-
# disable :flash
|
20
|
-
# layout :my_layout
|
10
|
+
# set :raise_errors, true # Raise exceptions (will stop application) (default for test)
|
11
|
+
# set :dump_errors, true # Exception backtraces are written to STDERR (default for production/development)
|
12
|
+
# set :show_exceptions, true # Shows a stack trace in browser (default for development)
|
13
|
+
# set :logging, true # Logging in STDOUT for development and file for production (default only for development)
|
14
|
+
# set :public_folder, "foo/bar" # Location for static assets (default root/public)
|
15
|
+
# set :reload, false # Reload application files (default in development)
|
16
|
+
# set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
|
17
|
+
# set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
|
18
|
+
# disable :sessions # Disabled sessions by default (enable if needed)
|
19
|
+
# disable :flash # Disables sinatra-flash (enabled by default if Sinatra::Flash is defined)
|
20
|
+
# layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
|
21
21
|
#
|
22
22
|
|
23
23
|
set :login_page, "/admin/sessions/new"
|
@@ -48,7 +48,7 @@ body {
|
|
48
48
|
}
|
49
49
|
|
50
50
|
hr {
|
51
|
-
background: #f0f0ee;
|
51
|
+
background: #f0f0ee;
|
52
52
|
color: #f0f0ee;
|
53
53
|
}
|
54
54
|
|
@@ -113,7 +113,7 @@ p {
|
|
113
113
|
color: #fff;
|
114
114
|
}
|
115
115
|
|
116
|
-
#sidebar h3 {
|
116
|
+
#sidebar h3 {
|
117
117
|
background: #008080;
|
118
118
|
color: #FFF;
|
119
119
|
border-bottom: 6px solid #E8C53B;
|
@@ -204,13 +204,13 @@ p {
|
|
204
204
|
padding:8px 12px;
|
205
205
|
}
|
206
206
|
|
207
|
-
#footer .block {
|
207
|
+
#footer .block {
|
208
208
|
color: #FFF;
|
209
209
|
background: #E8C53B;
|
210
210
|
}
|
211
211
|
|
212
|
-
#footer .block p {
|
213
|
-
margin: 0;
|
212
|
+
#footer .block p {
|
213
|
+
margin: 0;
|
214
214
|
padding: 10px;
|
215
215
|
}
|
216
216
|
|
@@ -316,13 +316,13 @@ ul.list li .item .avatar {
|
|
316
316
|
border-color: #F0F0EE;
|
317
317
|
border-width: 1px;
|
318
318
|
border-style: solid;
|
319
|
-
padding: 2px;
|
319
|
+
padding: 2px;
|
320
320
|
}
|
321
321
|
|
322
322
|
/* box */
|
323
323
|
|
324
324
|
#box .block {
|
325
|
-
background: #FFF;
|
325
|
+
background: #FFF;
|
326
326
|
}
|
327
327
|
|
328
328
|
#box .block h2 {
|
@@ -333,7 +333,7 @@ ul.list li .item .avatar {
|
|
333
333
|
|
334
334
|
/* rounded borders */
|
335
335
|
|
336
|
-
#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
336
|
+
#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
337
337
|
#footer .block, .form input.button, #box .block, #box .block h2 {
|
338
338
|
-moz-border-radius-topleft: 4px;
|
339
339
|
-webkit-border-top-left-radius: 4px;
|
@@ -4,11 +4,11 @@ h1, h2, h3 {color:#444}
|
|
4
4
|
body {
|
5
5
|
color: #222;
|
6
6
|
background: #e5e5e5;
|
7
|
-
font-family: "Bitstream Vera Sans", verdana, sans-serif;
|
7
|
+
font-family: "Bitstream Vera Sans", verdana, sans-serif;
|
8
8
|
}
|
9
9
|
|
10
10
|
hr {
|
11
|
-
background: #f0f0ee;
|
11
|
+
background: #f0f0ee;
|
12
12
|
}
|
13
13
|
|
14
14
|
p {
|
@@ -96,7 +96,7 @@ input.check_box {
|
|
96
96
|
}
|
97
97
|
|
98
98
|
|
99
|
-
#sidebar h3 {
|
99
|
+
#sidebar h3 {
|
100
100
|
background: #c7d8d8;
|
101
101
|
border-bottom:1px solid #999;
|
102
102
|
padding: 5px 10px;
|
@@ -281,10 +281,10 @@ ul.list li .left {
|
|
281
281
|
/* box */
|
282
282
|
|
283
283
|
#box .block {
|
284
|
-
background: #FFF;
|
284
|
+
background: #FFF;
|
285
285
|
}
|
286
286
|
|
287
287
|
#box .block h2 {
|
288
|
-
background: #48625B;
|
288
|
+
background: #48625B;
|
289
289
|
color: #FFF;
|
290
290
|
}
|
@@ -4,11 +4,11 @@ h1, h2, h3 {color:#444}
|
|
4
4
|
body {
|
5
5
|
color: #333;
|
6
6
|
background: #e5e5e5;
|
7
|
-
font-family: Verdana, Arial, "Bitstream Vera Sans", sans-serif;
|
7
|
+
font-family: Verdana, Arial, "Bitstream Vera Sans", sans-serif;
|
8
8
|
}
|
9
9
|
|
10
10
|
hr {
|
11
|
-
background: #f0f0ee;
|
11
|
+
background: #f0f0ee;
|
12
12
|
}
|
13
13
|
|
14
14
|
p {
|
@@ -101,7 +101,7 @@ input.check_box {
|
|
101
101
|
}
|
102
102
|
|
103
103
|
|
104
|
-
#sidebar h3 {
|
104
|
+
#sidebar h3 {
|
105
105
|
background: #c7d8d8;
|
106
106
|
border-bottom:1px solid #999;
|
107
107
|
padding: 5px 10px;
|
@@ -292,10 +292,10 @@ ul.list li .left {
|
|
292
292
|
/* box */
|
293
293
|
|
294
294
|
#box .block {
|
295
|
-
background: #FFF;
|
295
|
+
background: #FFF;
|
296
296
|
}
|
297
297
|
|
298
298
|
#box .block h2 {
|
299
|
-
background: #006666;
|
299
|
+
background: #006666;
|
300
300
|
color: #FFF;
|
301
301
|
}
|
@@ -13,7 +13,7 @@ body {
|
|
13
13
|
}
|
14
14
|
|
15
15
|
hr {
|
16
|
-
background: #f0f0ee;
|
16
|
+
background: #f0f0ee;
|
17
17
|
color: #f0f0ee;
|
18
18
|
}
|
19
19
|
|
@@ -52,7 +52,7 @@ hr {
|
|
52
52
|
background: #FFFFCC;
|
53
53
|
}
|
54
54
|
|
55
|
-
#sidebar h3 {
|
55
|
+
#sidebar h3 {
|
56
56
|
background: #2F427A;
|
57
57
|
color: #FFF;
|
58
58
|
border-bottom: 10px solid #262626;
|
@@ -129,13 +129,13 @@ hr {
|
|
129
129
|
background-color: #262626;
|
130
130
|
}
|
131
131
|
|
132
|
-
#footer .block {
|
132
|
+
#footer .block {
|
133
133
|
color: #FFF;
|
134
134
|
background: #262626;
|
135
135
|
}
|
136
136
|
|
137
|
-
#footer .block p {
|
138
|
-
margin: 0;
|
137
|
+
#footer .block p {
|
138
|
+
margin: 0;
|
139
139
|
padding: 10px;
|
140
140
|
}
|
141
141
|
|
@@ -239,24 +239,24 @@ ul.list li .item .avatar {
|
|
239
239
|
border-color: #F0F0EE;
|
240
240
|
border-width: 1px;
|
241
241
|
border-style: solid;
|
242
|
-
padding: 2px;
|
242
|
+
padding: 2px;
|
243
243
|
}
|
244
244
|
|
245
245
|
/* box */
|
246
246
|
|
247
247
|
#box .block {
|
248
|
-
background: #FFF;
|
248
|
+
background: #FFF;
|
249
249
|
}
|
250
250
|
|
251
251
|
#box .block h2 {
|
252
|
-
background: #2F427A;
|
252
|
+
background: #2F427A;
|
253
253
|
color: #FFF;
|
254
254
|
}
|
255
255
|
|
256
256
|
|
257
257
|
/* rounded borders */
|
258
258
|
|
259
|
-
#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
259
|
+
#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
260
260
|
#footer .block, .form input.button, #box .block, #box .block h2 {
|
261
261
|
-moz-border-radius-topleft: 4px;
|
262
262
|
-webkit-border-top-left-radius: 4px;
|
data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/djime-cerulean/style.css
CHANGED
@@ -274,7 +274,7 @@ ul.list li .item .avatar {
|
|
274
274
|
|
275
275
|
/* rounded borders */
|
276
276
|
|
277
|
-
#main, #main-navigation, #main-navigation li, #main-navigation li a, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
277
|
+
#main, #main-navigation, #main-navigation li, #main-navigation li a, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
278
278
|
#footer .block, .form input.button, #box .block, #box .block h2 {
|
279
279
|
-moz-border-radius-topleft: 4px;
|
280
280
|
-webkit-border-top-left-radius: 4px;
|
@@ -12,7 +12,7 @@ body {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
hr {
|
15
|
-
background: #f0f0ee;
|
15
|
+
background: #f0f0ee;
|
16
16
|
color: #f0f0ee;
|
17
17
|
}
|
18
18
|
|
@@ -47,7 +47,7 @@ hr {
|
|
47
47
|
background: #FFF;
|
48
48
|
}
|
49
49
|
|
50
|
-
#sidebar h3 {
|
50
|
+
#sidebar h3 {
|
51
51
|
background: #AF0000;
|
52
52
|
color: #FFF;
|
53
53
|
border-bottom: 5px solid #2a0000;
|
@@ -122,13 +122,13 @@ hr {
|
|
122
122
|
background-color: #2a0000;
|
123
123
|
}
|
124
124
|
|
125
|
-
#footer .block {
|
125
|
+
#footer .block {
|
126
126
|
color: #FFF;
|
127
127
|
background: #2a0000;
|
128
128
|
}
|
129
129
|
|
130
|
-
#footer .block p {
|
131
|
-
margin: 0;
|
130
|
+
#footer .block p {
|
131
|
+
margin: 0;
|
132
132
|
padding: 10px;
|
133
133
|
}
|
134
134
|
|
@@ -227,24 +227,24 @@ ul.list li .item .avatar {
|
|
227
227
|
border-color: #F0F0EE;
|
228
228
|
border-width: 1px;
|
229
229
|
border-style: solid;
|
230
|
-
padding: 2px;
|
230
|
+
padding: 2px;
|
231
231
|
}
|
232
232
|
|
233
233
|
/* box */
|
234
234
|
|
235
235
|
#box .block {
|
236
|
-
background: #FFF;
|
236
|
+
background: #FFF;
|
237
237
|
}
|
238
238
|
|
239
239
|
#box .block h2 {
|
240
|
-
background: #AF0000;
|
240
|
+
background: #AF0000;
|
241
241
|
color: #FFF;
|
242
242
|
}
|
243
243
|
|
244
244
|
|
245
245
|
/* rounded borders */
|
246
246
|
|
247
|
-
#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
247
|
+
#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
248
248
|
#footer .block, .form input.button, #box .block, #box .block h2 {
|
249
249
|
-moz-border-radius-topleft: 4px;
|
250
250
|
-webkit-border-top-left-radius: 4px;
|
@@ -34,7 +34,7 @@ body {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
hr {
|
37
|
-
background: #f0f0ee;
|
37
|
+
background: #f0f0ee;
|
38
38
|
color: #f0f0ee;
|
39
39
|
}
|
40
40
|
|
@@ -99,7 +99,7 @@ p {
|
|
99
99
|
color: #fff;
|
100
100
|
}
|
101
101
|
|
102
|
-
#sidebar h3 {
|
102
|
+
#sidebar h3 {
|
103
103
|
background: #5E634E;
|
104
104
|
color: #FFF;
|
105
105
|
border-bottom: 6px solid #DACF77;
|
@@ -185,13 +185,13 @@ p {
|
|
185
185
|
padding:8px 12px;
|
186
186
|
}
|
187
187
|
|
188
|
-
#footer .block {
|
188
|
+
#footer .block {
|
189
189
|
color: #FFF;
|
190
190
|
background: #262626;
|
191
191
|
}
|
192
192
|
|
193
|
-
#footer .block p {
|
194
|
-
margin: 0;
|
193
|
+
#footer .block p {
|
194
|
+
margin: 0;
|
195
195
|
padding: 10px;
|
196
196
|
}
|
197
197
|
|
@@ -297,13 +297,13 @@ ul.list li .item .avatar {
|
|
297
297
|
border-color: #F0F0EE;
|
298
298
|
border-width: 1px;
|
299
299
|
border-style: solid;
|
300
|
-
padding: 2px;
|
300
|
+
padding: 2px;
|
301
301
|
}
|
302
302
|
|
303
303
|
/* box */
|
304
304
|
|
305
305
|
#box .block {
|
306
|
-
background: #FFF;
|
306
|
+
background: #FFF;
|
307
307
|
}
|
308
308
|
|
309
309
|
#box .block h2 {
|
@@ -314,7 +314,7 @@ ul.list li .item .avatar {
|
|
314
314
|
|
315
315
|
/* rounded borders */
|
316
316
|
|
317
|
-
#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
317
|
+
#main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
|
318
318
|
#footer .block, .form input.button, #box .block, #box .block h2 {
|
319
319
|
-moz-border-radius-topleft: 4px;
|
320
320
|
-webkit-border-top-left-radius: 4px;
|