alchemy_cms 3.3.3 → 3.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +42 -4
- data/README.md +7 -3
- data/alchemy_cms.gemspec +1 -0
- data/app/assets/javascripts/alchemy/{alchemy.js → admin.js} +1 -2
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js.coffee +28 -25
- data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.i18n.js.coffee +7 -1
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +26 -0
- data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +56 -1
- data/app/assets/stylesheets/alchemy/_variables.scss +1 -0
- data/app/assets/stylesheets/alchemy/admin.scss +2 -1
- data/app/assets/stylesheets/alchemy/archive.scss +7 -0
- data/app/assets/stylesheets/alchemy/base.scss +0 -42
- data/app/assets/stylesheets/alchemy/buttons.scss +2 -1
- data/app/assets/stylesheets/alchemy/form_fields.scss +9 -0
- data/app/assets/stylesheets/alchemy/forms.scss +36 -10
- data/app/assets/stylesheets/alchemy/frame.scss +12 -1
- data/app/assets/stylesheets/alchemy/icons.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery-ui.scss +0 -260
- data/app/assets/stylesheets/alchemy/jquery.datetimepicker.scss +507 -0
- data/app/assets/stylesheets/alchemy/lists.scss +62 -0
- data/app/assets/stylesheets/alchemy/selects.scss +9 -2
- data/app/assets/stylesheets/alchemy/sitemap.scss +28 -51
- data/app/assets/stylesheets/alchemy/toolbar.scss +0 -2
- data/app/controllers/alchemy/admin/attachments_controller.rb +4 -6
- data/app/controllers/alchemy/admin/base_controller.rb +2 -2
- data/app/controllers/alchemy/admin/dashboard_controller.rb +2 -2
- data/app/controllers/alchemy/admin/languages_controller.rb +5 -0
- data/app/controllers/alchemy/admin/pages_controller.rb +14 -5
- data/app/controllers/alchemy/admin/resources_controller.rb +17 -1
- data/app/controllers/alchemy/base_controller.rb +1 -0
- data/app/controllers/alchemy/messages_controller.rb +1 -1
- data/app/controllers/alchemy/pages_controller.rb +16 -26
- data/app/controllers/alchemy/pictures_controller.rb +23 -10
- data/app/controllers/concerns/alchemy/page_redirects.rb +7 -7
- data/app/helpers/alchemy/admin/base_helper.rb +22 -19
- data/app/helpers/alchemy/admin/essences_helper.rb +26 -11
- data/app/helpers/alchemy/admin/pages_helper.rb +2 -1
- data/app/helpers/alchemy/essences_helper.rb +0 -35
- data/app/helpers/alchemy/url_helper.rb +1 -1
- data/app/mailers/alchemy/base_mailer.rb +18 -0
- data/app/mailers/alchemy/{messages.rb → messages_mailer.rb} +1 -1
- data/app/models/alchemy/attachment.rb +9 -0
- data/app/models/alchemy/cell.rb +1 -1
- data/app/models/alchemy/essence_picture.rb +4 -1
- data/app/models/alchemy/essence_picture_view.rb +68 -0
- data/app/models/alchemy/language.rb +8 -10
- data/app/models/alchemy/language/code.rb +4 -1
- data/app/models/alchemy/page.rb +69 -26
- data/app/models/alchemy/page/page_natures.rb +22 -0
- data/app/models/alchemy/page/page_scopes.rb +20 -6
- data/app/models/alchemy/picture.rb +37 -4
- data/app/models/alchemy/site.rb +8 -0
- data/app/serializers/alchemy/page_tree_serializer.rb +1 -1
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +9 -6
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +11 -9
- data/app/views/alchemy/admin/attachments/_filter_bar.html.erb +32 -0
- data/app/views/alchemy/admin/attachments/_overlay_file_list.html.erb +14 -2
- data/app/views/alchemy/admin/attachments/index.html.erb +10 -9
- data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +20 -9
- data/app/views/alchemy/admin/dashboard/_recent_pages.html.erb +11 -1
- data/app/views/alchemy/admin/languages/_form.html.erb +1 -0
- data/app/views/alchemy/admin/languages/index.html.erb +7 -8
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -1
- data/app/views/alchemy/admin/layoutpages/index.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_current_page.html.erb +4 -0
- data/app/views/alchemy/admin/pages/_form.html.erb +16 -1
- data/app/views/alchemy/admin/pages/_locked_page.html.erb +2 -12
- data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page_for_links.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_page_status.html.erb +23 -11
- data/app/views/alchemy/admin/pages/edit.html.erb +2 -1
- data/app/views/alchemy/admin/pages/index.html.erb +2 -2
- data/app/views/alchemy/admin/partials/_language_tree_select.html.erb +3 -0
- data/app/views/alchemy/admin/partials/_site_select.html.erb +9 -0
- data/app/views/alchemy/admin/pictures/_picture.html.erb +6 -1
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +2 -1
- data/app/views/alchemy/admin/pictures/show.html.erb +1 -1
- data/app/views/alchemy/admin/resources/_filter_bar.html.erb +31 -0
- data/app/views/alchemy/admin/resources/_form.html.erb +6 -0
- data/app/views/alchemy/admin/resources/_tag_list.html.erb +16 -0
- data/app/views/alchemy/admin/resources/index.html.erb +13 -1
- data/app/views/alchemy/essences/_essence_file_view.html.erb +2 -5
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +5 -3
- data/app/views/alchemy/{messages → messages_mailer}/contact_form_mail.de.text.erb +0 -0
- data/app/views/alchemy/{messages → messages_mailer}/contact_form_mail.en.text.erb +0 -0
- data/app/views/alchemy/{messages → messages_mailer}/contact_form_mail.es.text.erb +0 -0
- data/app/views/alchemy/{messages → messages_mailer}/new.html.erb +0 -0
- data/app/views/layouts/alchemy/admin.html.erb +3 -8
- data/config/alchemy/config.yml +4 -3
- data/config/initializers/assets.rb +2 -2
- data/config/initializers/dragonfly.rb +3 -0
- data/config/initializers/mime_types.rb +1 -0
- data/config/locales/alchemy.de.yml +10 -2
- data/config/locales/alchemy.en.yml +6 -2
- data/config/locales/alchemy.es.yml +6 -3
- data/config/locales/alchemy.fr.yml +6 -2
- data/config/locales/alchemy.it.yml +937 -0
- data/config/locales/alchemy.nl.yml +6 -2
- data/config/locales/alchemy.ru.yml +3 -2
- data/config/locales/simple_form.it.yml +25 -0
- data/db/migrate/20160108174834_add_timebased_publishing_columns_to_pages.rb +32 -0
- data/db/migrate/20160422195310_add_image_file_format_to_alchemy_pictures.rb +21 -0
- data/db/migrate/20160617224938_change_alchemy_pages_locked_to_locked_at.rb +22 -0
- data/lib/alchemy/ability_helper.rb +23 -0
- data/lib/alchemy/configuration_methods.rb +2 -2
- data/lib/alchemy/controller_actions.rb +4 -33
- data/lib/alchemy/engine.rb +1 -0
- data/lib/alchemy/resource.rb +30 -13
- data/lib/alchemy/resources_helper.rb +17 -0
- data/lib/alchemy/test_support/factories/page_factory.rb +7 -2
- data/lib/alchemy/upgrader.rb +1 -0
- data/lib/alchemy/upgrader/tasks/install_asset_manifests.rb +15 -0
- data/lib/alchemy/upgrader/three_point_four.rb +16 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/generators/alchemy/elements/elements_generator.rb +8 -7
- data/lib/rails/generators/alchemy/essence/essence_generator.rb +2 -6
- data/lib/rails/generators/alchemy/install/files/all.css +11 -0
- data/lib/rails/generators/alchemy/install/files/all.js +11 -0
- data/lib/rails/generators/alchemy/install/files/{alchemy.elements.css.scss → article.scss} +0 -0
- data/lib/rails/generators/alchemy/install/install_generator.rb +20 -19
- data/lib/rails/generators/alchemy/module/module_generator.rb +3 -5
- data/lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb +7 -6
- data/lib/rails/generators/alchemy/site_layouts/site_layouts_generator.rb +7 -6
- data/vendor/assets/javascripts/date-formatter.js +161 -0
- data/vendor/assets/javascripts/jquery_plugins/jquery.datetimepicker.full.min.js +2 -0
- data/vendor/assets/javascripts/tinymce/langs/it.js +219 -0
- metadata +48 -13
- data/app/assets/javascripts/alchemy/alchemy.custom.js +0 -1
- data/app/assets/stylesheets/alchemy/custom.scss +0 -1
@@ -0,0 +1,62 @@
|
|
1
|
+
ul.list {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
list-style-type: none;
|
5
|
+
|
6
|
+
&#layoutpages {
|
7
|
+
margin-top: 16px;
|
8
|
+
|
9
|
+
li {
|
10
|
+
margin-left: 8px;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
&#sitemap {
|
15
|
+
padding: 0 0 104px 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
li {
|
19
|
+
list-style-type: none;
|
20
|
+
display: block;
|
21
|
+
overflow: hidden;
|
22
|
+
margin-bottom: 0;
|
23
|
+
|
24
|
+
&.legend, &.list-header {
|
25
|
+
background-color: transparent;
|
26
|
+
font-weight: bold;
|
27
|
+
padding: $default-padding;
|
28
|
+
|
29
|
+
.list-secondary {
|
30
|
+
color: $text-color;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
&.even {
|
35
|
+
background-color: #fff;
|
36
|
+
}
|
37
|
+
|
38
|
+
&.odd {
|
39
|
+
background-color: #eaf3f9;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
.list-primary,
|
44
|
+
.list-secondary {
|
45
|
+
display: inline-block;
|
46
|
+
overflow: hidden;
|
47
|
+
text-overflow: ellipsis;
|
48
|
+
vertical-align: middle;
|
49
|
+
}
|
50
|
+
|
51
|
+
.list-primary {
|
52
|
+
float: left;
|
53
|
+
max-width: 65%;
|
54
|
+
}
|
55
|
+
|
56
|
+
.list-secondary, .right {
|
57
|
+
float: right;
|
58
|
+
text-align: left;
|
59
|
+
width: 30%;
|
60
|
+
color: $dark-gray;
|
61
|
+
}
|
62
|
+
}
|
@@ -214,9 +214,16 @@ select {
|
|
214
214
|
margin: 0 3*$default-margin;
|
215
215
|
@include inline-block(top);
|
216
216
|
|
217
|
-
label {
|
217
|
+
label, form {
|
218
218
|
@include inline-block;
|
219
|
-
|
219
|
+
}
|
220
|
+
|
221
|
+
select { margin: 0; }
|
222
|
+
|
223
|
+
label {
|
224
|
+
margin-right: $default-margin;
|
225
|
+
|
226
|
+
&:after { content: ':'; }
|
220
227
|
}
|
221
228
|
}
|
222
229
|
|
@@ -33,7 +33,7 @@
|
|
33
33
|
background-color: #fff;
|
34
34
|
color: black;
|
35
35
|
display: block;
|
36
|
-
padding-left:
|
36
|
+
padding-left: $default-padding;
|
37
37
|
text-decoration: none;
|
38
38
|
@include transition(background-color, 400ms);
|
39
39
|
|
@@ -49,23 +49,23 @@
|
|
49
49
|
width: 16px;
|
50
50
|
height: 16px;
|
51
51
|
float: left;
|
52
|
-
margin-right:
|
52
|
+
margin-right: $default-margin;
|
53
53
|
background: image-url('alchemy/icons.png') -160px -168px;
|
54
|
-
margin-top:
|
54
|
+
margin-top: $default-margin;
|
55
55
|
}
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
59
59
|
.redirect_url {
|
60
60
|
position: absolute;
|
61
|
-
top:
|
61
|
+
top: $default-padding;
|
62
62
|
right: 199px;
|
63
63
|
text-align: right;
|
64
64
|
background-color: #fff0c4;
|
65
|
-
line-height:
|
66
|
-
padding-right:
|
65
|
+
line-height: $sitemap-line-height;
|
66
|
+
padding-right: $default-padding;
|
67
67
|
font-size: 10px;
|
68
|
-
padding-left:
|
68
|
+
padding-left: $default-padding;
|
69
69
|
max-width: 45%;
|
70
70
|
white-space: nowrap;
|
71
71
|
overflow: hidden;
|
@@ -85,14 +85,10 @@
|
|
85
85
|
height: 28px;
|
86
86
|
}
|
87
87
|
|
88
|
-
#layoutpages li {
|
89
|
-
padding: 0;
|
90
|
-
}
|
91
|
-
|
92
88
|
.sitemap_page {
|
93
|
-
height:
|
94
|
-
padding-bottom:
|
95
|
-
padding-top:
|
89
|
+
height: $sitemap-line-height;
|
90
|
+
padding-bottom: $default-padding;
|
91
|
+
padding-top: $default-padding;
|
96
92
|
position: relative;
|
97
93
|
|
98
94
|
&.highlight .sitemap_pagename_link {
|
@@ -117,7 +113,7 @@ div.sitemap_left_images {
|
|
117
113
|
}
|
118
114
|
|
119
115
|
.sitemap_right_tools {
|
120
|
-
height:
|
116
|
+
height: $sitemap-line-height;
|
121
117
|
background-color: $light-gray;
|
122
118
|
padding-left: 8px;
|
123
119
|
float: right;
|
@@ -188,43 +184,36 @@ ul#sitemap {
|
|
188
184
|
}
|
189
185
|
|
190
186
|
li {
|
191
|
-
padding-left:
|
187
|
+
padding-left: $sitemap-line-height;
|
192
188
|
padding-right: 0;
|
193
189
|
}
|
194
190
|
}
|
195
191
|
}
|
196
192
|
|
197
|
-
ul#sitemap li,
|
198
|
-
ul#layoutpages li {
|
199
|
-
list-style-type: none;
|
200
|
-
display: block;
|
201
|
-
margin-left: 0;
|
202
|
-
margin-bottom: 0;
|
203
|
-
line-height: 22px;
|
204
|
-
}
|
205
|
-
|
206
193
|
ul#sitemap li .sitemap_toolrow,
|
207
194
|
ul.list li .sitemap_toolrow {
|
208
195
|
margin: 0;
|
209
196
|
overflow: auto;
|
210
|
-
padding:
|
197
|
+
padding: $default-padding 0;
|
211
198
|
}
|
212
199
|
|
213
200
|
ul#sitemap .sitemap_sitename,
|
214
201
|
ul.list .sitemap_sitename {
|
215
|
-
height:
|
216
|
-
line-height:
|
202
|
+
height: $sitemap-line-height;
|
203
|
+
line-height: $sitemap-line-height;
|
217
204
|
overflow: hidden;
|
218
205
|
}
|
219
206
|
|
220
|
-
|
207
|
+
.page_infos {
|
221
208
|
@extend .right-rounded-border;
|
222
209
|
background-color: #fff;
|
223
210
|
border-left: 1px solid $light-gray;
|
224
211
|
float: right;
|
225
|
-
height:
|
226
|
-
|
227
|
-
|
212
|
+
height: $sitemap-line-height;
|
213
|
+
|
214
|
+
.page_status {
|
215
|
+
margin: $default-margin;
|
216
|
+
}
|
228
217
|
}
|
229
218
|
|
230
219
|
#sub_navigation .page_status_and_name .page_status {
|
@@ -268,14 +257,6 @@ div.page_infos {
|
|
268
257
|
}
|
269
258
|
}
|
270
259
|
|
271
|
-
#sitemap .page_status {
|
272
|
-
margin: 2px 2px 0 4px;
|
273
|
-
}
|
274
|
-
|
275
|
-
.alchemy-dialog .page_status {
|
276
|
-
margin: 2px 4px 0 0;
|
277
|
-
}
|
278
|
-
|
279
260
|
#sitemap {
|
280
261
|
|
281
262
|
&.sorting {
|
@@ -295,7 +276,7 @@ div.page_infos {
|
|
295
276
|
|
296
277
|
.sitemap_sitestatus {
|
297
278
|
float: right;
|
298
|
-
margin-top:
|
279
|
+
margin-top: $default-margin;
|
299
280
|
}
|
300
281
|
|
301
282
|
a.folder_link {
|
@@ -313,18 +294,19 @@ a.folder_link {
|
|
313
294
|
@extend %rounded-border;
|
314
295
|
}
|
315
296
|
|
316
|
-
|
297
|
+
#sitemap_heading {
|
317
298
|
padding: 0;
|
318
299
|
|
319
|
-
|
300
|
+
.page_infos {
|
320
301
|
margin-right: 144px;
|
321
302
|
width: 40px;
|
322
303
|
text-align: center;
|
323
304
|
float: right;
|
324
305
|
line-height: 28px;
|
306
|
+
background: transparent;
|
325
307
|
}
|
326
308
|
|
327
|
-
|
309
|
+
.page_name {
|
328
310
|
line-height: 28px;
|
329
311
|
margin-left: 24px;
|
330
312
|
}
|
@@ -352,7 +334,7 @@ h2#sitemap_heading {
|
|
352
334
|
|
353
335
|
.close_elements_from_page_selector {
|
354
336
|
position: absolute;
|
355
|
-
right:
|
337
|
+
right: $default-padding;
|
356
338
|
top: 12px;
|
357
339
|
font-size: 16px;
|
358
340
|
width: 16px;
|
@@ -362,11 +344,6 @@ h2#sitemap_heading {
|
|
362
344
|
}
|
363
345
|
}
|
364
346
|
|
365
|
-
.show_elements_to_link {
|
366
|
-
@extend .icon;
|
367
|
-
@extend .element_window;
|
368
|
-
}
|
369
|
-
|
370
347
|
.elements_from_page_selector {
|
371
348
|
width: 100%;
|
372
349
|
}
|
@@ -387,7 +364,7 @@ h2#sitemap_heading {
|
|
387
364
|
.spinner {
|
388
365
|
top: 17px !important;
|
389
366
|
left: 50% !important;
|
390
|
-
margin-left:
|
367
|
+
margin-left: $default-margin;
|
391
368
|
}
|
392
369
|
|
393
370
|
.alchemy_selectbox {
|
@@ -9,16 +9,14 @@ module Alchemy
|
|
9
9
|
@query = Attachment.ransack(params[:q])
|
10
10
|
@attachments = @query.result
|
11
11
|
|
12
|
-
if params[:only].present?
|
13
|
-
@attachments = @attachments.where("file_mime_type LIKE '%#{params[:only]}%'")
|
14
|
-
end
|
15
|
-
if params[:except].present?
|
16
|
-
@attachments = @attachments.where("file_mime_type NOT LIKE '%#{params[:except]}%'")
|
17
|
-
end
|
18
12
|
if params[:tagged_with].present?
|
19
13
|
@attachments = @attachments.tagged_with(params[:tagged_with])
|
20
14
|
end
|
21
15
|
|
16
|
+
if params[:file_type].present?
|
17
|
+
@attachments = @attachments.with_file_type(params[:file_type])
|
18
|
+
end
|
19
|
+
|
22
20
|
@attachments = @attachments
|
23
21
|
.page(params[:page] || 1)
|
24
22
|
.per(15)
|
@@ -165,10 +165,10 @@ module Alchemy
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def load_locked_pages
|
168
|
-
@locked_pages = Page.
|
168
|
+
@locked_pages = Page.locked_by(current_alchemy_user).order(:locked_at)
|
169
169
|
end
|
170
170
|
|
171
|
-
# Returns the current site.
|
171
|
+
# Returns the current site for admin controllers.
|
172
172
|
#
|
173
173
|
def current_alchemy_site
|
174
174
|
@current_alchemy_site ||= begin
|
@@ -7,8 +7,8 @@ module Alchemy
|
|
7
7
|
authorize_resource class: :alchemy_admin_dashboard
|
8
8
|
|
9
9
|
def index
|
10
|
-
@last_edited_pages = Page.
|
11
|
-
@all_locked_pages = Page.
|
10
|
+
@last_edited_pages = Page.all_last_edited_from(current_alchemy_user)
|
11
|
+
@all_locked_pages = Page.locked
|
12
12
|
if Alchemy.user_class.respond_to?(:logged_in)
|
13
13
|
@online_users = Alchemy.user_class.logged_in.to_a - [current_alchemy_user]
|
14
14
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module Alchemy
|
2
2
|
module Admin
|
3
3
|
class LanguagesController < ResourcesController
|
4
|
+
def index
|
5
|
+
@query = Language.on_current_site.ransack(params[:q])
|
6
|
+
@languages = @query.result.page(params[:page] || 1).per(per_page_value_for_screen_size)
|
7
|
+
end
|
8
|
+
|
4
9
|
def new
|
5
10
|
@language = Language.new
|
6
11
|
@language.page_layout = configured_page_layout || @language.page_layout
|
@@ -24,10 +24,10 @@ module Alchemy
|
|
24
24
|
def index
|
25
25
|
authorize! :index, :alchemy_admin_pages
|
26
26
|
|
27
|
-
@languages = Language.
|
27
|
+
@languages = Language.on_current_site
|
28
28
|
if !@page_root
|
29
29
|
@language = Language.current
|
30
|
-
@languages_with_page_tree = Language.with_root_page
|
30
|
+
@languages_with_page_tree = Language.on_current_site.with_root_page
|
31
31
|
@page_layouts = PageLayout.layouts_for_select(@language.id)
|
32
32
|
end
|
33
33
|
end
|
@@ -75,12 +75,15 @@ module Alchemy
|
|
75
75
|
end
|
76
76
|
|
77
77
|
# Edit the content of the page and all its elements and contents.
|
78
|
+
#
|
79
|
+
# Locks the page to current user to prevent other users from editing it meanwhile.
|
80
|
+
#
|
78
81
|
def edit
|
79
82
|
# fetching page via before filter
|
80
83
|
if page_is_locked?
|
81
84
|
flash[:notice] = Alchemy.t('This page is locked', name: @page.locker_name)
|
82
85
|
redirect_to admin_pages_path
|
83
|
-
|
86
|
+
elsif page_needs_lock?
|
84
87
|
@page.lock_to!(current_alchemy_user)
|
85
88
|
end
|
86
89
|
@layoutpage = @page.layoutpage?
|
@@ -171,9 +174,10 @@ module Alchemy
|
|
171
174
|
|
172
175
|
def visit
|
173
176
|
@page.unlock!
|
174
|
-
redirect_to
|
177
|
+
redirect_to show_page_url(
|
175
178
|
urlname: @page.urlname,
|
176
|
-
locale: prefix_locale? ? @page.language_code : nil
|
179
|
+
locale: prefix_locale? ? @page.language_code : nil,
|
180
|
+
host: @page.site.host == "*" ? request.host : @page.site.host
|
177
181
|
)
|
178
182
|
end
|
179
183
|
|
@@ -369,6 +373,11 @@ module Alchemy
|
|
369
373
|
@page.locked? && @page.locker.id != current_alchemy_user.id
|
370
374
|
end
|
371
375
|
|
376
|
+
def page_needs_lock?
|
377
|
+
return true unless @page.locker
|
378
|
+
@page.locker.try!(:id) != current_alchemy_user.try!(:id)
|
379
|
+
end
|
380
|
+
|
372
381
|
def paste_from_clipboard
|
373
382
|
if params[:paste_from_clipboard]
|
374
383
|
source = Page.find(params[:paste_from_clipboard])
|
@@ -7,7 +7,7 @@ module Alchemy
|
|
7
7
|
class ResourcesController < Alchemy::Admin::BaseController
|
8
8
|
include Alchemy::ResourcesHelper
|
9
9
|
|
10
|
-
helper Alchemy::ResourcesHelper
|
10
|
+
helper Alchemy::ResourcesHelper, TagsHelper
|
11
11
|
helper_method :resource_handler
|
12
12
|
|
13
13
|
before_filter :load_resource,
|
@@ -20,9 +20,19 @@ module Alchemy
|
|
20
20
|
def index
|
21
21
|
@query = resource_handler.model.ransack(params[:q])
|
22
22
|
items = @query.result
|
23
|
+
|
23
24
|
if contains_relations?
|
24
25
|
items = items.includes(*resource_relations_names)
|
25
26
|
end
|
27
|
+
|
28
|
+
if params[:tagged_with].present?
|
29
|
+
items = items.tagged_with(params[:tagged_with])
|
30
|
+
end
|
31
|
+
|
32
|
+
if params[:filter].present?
|
33
|
+
items = items.public_send(sanitized_filter_params)
|
34
|
+
end
|
35
|
+
|
26
36
|
respond_to do |format|
|
27
37
|
format.html {
|
28
38
|
items = items.page(params[:page] || 1).per(per_page_value_for_screen_size)
|
@@ -113,6 +123,12 @@ module Alchemy
|
|
113
123
|
def resource_params
|
114
124
|
params.require(resource_handler.namespaced_resource_name).permit!
|
115
125
|
end
|
126
|
+
|
127
|
+
def sanitized_filter_params
|
128
|
+
resource_model.alchemy_resource_filters.detect do |filter|
|
129
|
+
filter == params[:filter]
|
130
|
+
end || :all
|
131
|
+
end
|
116
132
|
end
|
117
133
|
end
|
118
134
|
end
|