trusty-cms 6.0.5 → 6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +18 -12
- data/app/assets/javascripts/admin/assets.js +254 -237
- data/app/assets/stylesheets/admin/partials/_forms.scss +1 -1
- data/app/controllers/admin/assets_controller.rb +4 -4
- data/app/controllers/admin/pages_controller.rb +9 -0
- data/app/models/asset.rb +4 -0
- data/app/views/admin/assets/_search.html.haml +7 -6
- data/app/views/admin/assets/index.html.haml +2 -2
- data/app/views/admin/pages/_asset_popups.html.haml +1 -1
- data/config/initializers/ransack.rb +5 -0
- data/lib/trusty_cms/engine.rb +1 -0
- data/lib/trusty_cms.rb +1 -1
- data/trusty_cms.gemspec +2 -1
- data/vendor/extensions/clipped-extension/clipped_extension.rb +10 -10
- data/vendor/extensions/clipped-extension/lib/asset_tags.rb +42 -41
- metadata +54 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 317a11bc953c6892d860b8c0e13b7d71ca9feffd3e9c6251c52606928fc1ada3
|
4
|
+
data.tar.gz: aef8f45d869c2b2ec31df22d23002ba14c4b1399e1bf82b06a4a6bc5ca8d707e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c6011cc75d010d0a669e5105820b8ab4d498c081220a5584e654dd8e9c8002fa748175b06cce6145c8011b3f1ab0823052c231bd2107946b725afcfcc94b5ea
|
7
|
+
data.tar.gz: 9b9460d709ae5504c298d03a3a5b170db440fc9db7b7998531ac856f7635dfee5f99dfe3d66d25bf4ce54494c4a687523355b84ff73d8f887f81bfef38fc5f25
|
data/Gemfile
CHANGED
@@ -15,7 +15,7 @@ group :development, :test do
|
|
15
15
|
gem 'activestorage-validator'
|
16
16
|
gem 'acts_as_list'
|
17
17
|
gem 'database_cleaner'
|
18
|
-
gem 'factory_bot_rails', '6.2
|
18
|
+
gem 'factory_bot_rails', '6.4.2'
|
19
19
|
gem 'file_validators'
|
20
20
|
gem 'launchy', '~> 2.5.0'
|
21
21
|
gem 'mysql2'
|
@@ -23,6 +23,7 @@ group :development, :test do
|
|
23
23
|
gem 'pry-byebug'
|
24
24
|
gem 'psych', '5.1.1.1'
|
25
25
|
gem 'rails-observers'
|
26
|
+
gem 'ransack'
|
26
27
|
gem 'rspec-rails'
|
27
28
|
gem 'simplecov'
|
28
29
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
trusty-cms (6.
|
5
|
-
RedCloth (= 4.3.
|
4
|
+
trusty-cms (6.1.2)
|
5
|
+
RedCloth (= 4.3.3)
|
6
6
|
activestorage-validator
|
7
7
|
acts_as_list (>= 0.9.5, < 1.2.0)
|
8
8
|
acts_as_tree (~> 2.9.1)
|
@@ -22,6 +22,7 @@ PATH
|
|
22
22
|
radius (~> 0.7)
|
23
23
|
rails
|
24
24
|
rake (< 14.0)
|
25
|
+
ransack
|
25
26
|
rdoc (>= 5.1, < 7.0)
|
26
27
|
roadie-rails
|
27
28
|
sass-rails
|
@@ -33,7 +34,7 @@ PATH
|
|
33
34
|
GEM
|
34
35
|
remote: https://rubygems.org/
|
35
36
|
specs:
|
36
|
-
RedCloth (4.3.
|
37
|
+
RedCloth (4.3.3)
|
37
38
|
actioncable (6.1.7.6)
|
38
39
|
actionpack (= 6.1.7.6)
|
39
40
|
activesupport (= 6.1.7.6)
|
@@ -141,10 +142,10 @@ GEM
|
|
141
142
|
docile (1.4.0)
|
142
143
|
erubi (1.12.0)
|
143
144
|
execjs (2.9.1)
|
144
|
-
factory_bot (6.2
|
145
|
+
factory_bot (6.4.2)
|
145
146
|
activesupport (>= 5.0.0)
|
146
|
-
factory_bot_rails (6.2
|
147
|
-
factory_bot (~> 6.
|
147
|
+
factory_bot_rails (6.4.2)
|
148
|
+
factory_bot (~> 6.4)
|
148
149
|
railties (>= 5.0.0)
|
149
150
|
ffi (1.15.5)
|
150
151
|
file_validators (3.0.0)
|
@@ -179,7 +180,7 @@ GEM
|
|
179
180
|
addressable (~> 2.8)
|
180
181
|
libv8-node (16.10.0.0-x86_64-darwin)
|
181
182
|
libv8-node (16.10.0.0-x86_64-linux)
|
182
|
-
loofah (2.
|
183
|
+
loofah (2.22.0)
|
183
184
|
crass (~> 1.0.2)
|
184
185
|
nokogiri (>= 1.12.0)
|
185
186
|
mail (2.8.1)
|
@@ -228,7 +229,7 @@ GEM
|
|
228
229
|
psych (5.1.1.1)
|
229
230
|
stringio
|
230
231
|
public_suffix (4.0.7)
|
231
|
-
racc (1.7.
|
232
|
+
racc (1.7.3)
|
232
233
|
rack (2.2.8)
|
233
234
|
rack-cache (1.14.0)
|
234
235
|
rack (>= 0.4)
|
@@ -265,6 +266,10 @@ GEM
|
|
265
266
|
rake (>= 12.2)
|
266
267
|
thor (~> 1.0)
|
267
268
|
rake (13.1.0)
|
269
|
+
ransack (4.1.1)
|
270
|
+
activerecord (>= 6.1.5)
|
271
|
+
activesupport (>= 6.1.5)
|
272
|
+
i18n
|
268
273
|
rdoc (6.5.0)
|
269
274
|
psych (>= 4.0.0)
|
270
275
|
regexp_parser (2.1.1)
|
@@ -282,10 +287,10 @@ GEM
|
|
282
287
|
rspec-expectations (3.12.3)
|
283
288
|
diff-lcs (>= 1.2.0, < 2.0)
|
284
289
|
rspec-support (~> 3.12.0)
|
285
|
-
rspec-mocks (3.12.
|
290
|
+
rspec-mocks (3.12.6)
|
286
291
|
diff-lcs (>= 1.2.0, < 2.0)
|
287
292
|
rspec-support (~> 3.12.0)
|
288
|
-
rspec-rails (6.0
|
293
|
+
rspec-rails (6.1.0)
|
289
294
|
actionpack (>= 6.1)
|
290
295
|
activesupport (>= 6.1)
|
291
296
|
railties (>= 6.1)
|
@@ -293,7 +298,7 @@ GEM
|
|
293
298
|
rspec-expectations (~> 3.12)
|
294
299
|
rspec-mocks (~> 3.12)
|
295
300
|
rspec-support (~> 3.12)
|
296
|
-
rspec-support (3.12.
|
301
|
+
rspec-support (3.12.1)
|
297
302
|
ruby-vips (2.1.4)
|
298
303
|
ffi (~> 1.12)
|
299
304
|
sass-rails (6.0.0)
|
@@ -354,7 +359,7 @@ DEPENDENCIES
|
|
354
359
|
activestorage-validator
|
355
360
|
acts_as_list
|
356
361
|
database_cleaner
|
357
|
-
factory_bot_rails (= 6.2
|
362
|
+
factory_bot_rails (= 6.4.2)
|
358
363
|
file_validators
|
359
364
|
launchy (~> 2.5.0)
|
360
365
|
mysql2
|
@@ -362,6 +367,7 @@ DEPENDENCIES
|
|
362
367
|
pry-byebug
|
363
368
|
psych (= 5.1.1.1)
|
364
369
|
rails-observers
|
370
|
+
ransack
|
365
371
|
rspec-rails
|
366
372
|
simplecov
|
367
373
|
trusty-cms!
|
@@ -1,268 +1,285 @@
|
|
1
1
|
Assets = {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
2
|
+
attachEvents: function () {
|
3
|
+
$('a.attach_asset').off('click').click(function (e) {
|
4
|
+
e.preventDefault();
|
5
|
+
var link = $(this);
|
6
|
+
var container = link.parents('li.asset');
|
7
|
+
var title = link.parents('div.title').html();
|
8
|
+
var image = link.parents('img');
|
9
|
+
container.addClass('waiting');
|
10
|
+
$.ajax({
|
11
|
+
url: link.attr('href'),
|
12
|
+
success: function (data, textStatus, jqXHR) {
|
13
|
+
container.removeClass('waiting');
|
14
|
+
Assets.addToList(data);
|
15
|
+
}
|
16
|
+
});
|
17
|
+
});
|
18
|
+
|
19
|
+
$('a.detach_asset').off('click').click(function (e) {
|
20
|
+
e.preventDefault();
|
21
|
+
var link = $(this);
|
22
|
+
Assets.removeFromList(link.parents('li.asset'));
|
23
|
+
});
|
24
|
+
|
25
|
+
$('a.insert_asset').off('click').click(function (e) {
|
26
|
+
e.preventDefault();
|
27
|
+
var part_name = $("a.tab.here").children('span').html();
|
28
|
+
if (part_name.indexOf(' ')) part_name = part_name.replace(' ', '-').toLowerCase();
|
29
|
+
part_name = part_name.replace('_', '-');
|
30
|
+
var part_id = 'part_' + part_name + '_content';
|
31
|
+
var tag_parts = $(this).attr('rel').split('_');
|
32
|
+
var tag_name = tag_parts[0];
|
33
|
+
var asset_size = tag_parts[1];
|
34
|
+
var asset_id = tag_parts[2];
|
35
|
+
var radius_tag = '<r:asset:' + tag_name;
|
36
|
+
if (asset_size != '') radius_tag = radius_tag + ' size="' + asset_size + '"';
|
37
|
+
radius_tag = radius_tag + ' id="' + asset_id + '" />';
|
38
|
+
Assets.insertAtCursor(part_id, radius_tag);
|
39
|
+
|
40
|
+
});
|
41
|
+
|
42
|
+
$(".pagination a").off('click').click(function (e) {
|
43
|
+
e.preventDefault();
|
44
|
+
$.ajax({
|
45
|
+
method: 'get',
|
46
|
+
url: $(this).attr('href') + Assets.assetFilterParameters(),
|
47
|
+
complete: function (data, textStatus, jqXHR) {
|
48
|
+
Assets.updateTable(data.responseText);
|
49
|
+
Assets.attachEvents();
|
50
|
+
}
|
51
|
+
});
|
52
|
+
});
|
24
53
|
|
25
|
-
|
26
|
-
e.preventDefault();
|
27
|
-
var part_name = $("a.tab.here").children('span').html();
|
28
|
-
if (part_name.indexOf(' ')) part_name = part_name.replace(' ', '-').toLowerCase();
|
29
|
-
part_name = part_name.replace('_', '-');
|
30
|
-
var part_id = 'part_' + part_name + '_content';
|
31
|
-
var tag_parts = $(this).attr('rel').split('_');
|
32
|
-
var tag_name = tag_parts[0];
|
33
|
-
var asset_size = tag_parts[1];
|
34
|
-
var asset_id = tag_parts[2];
|
35
|
-
var radius_tag = '<r:asset:' + tag_name;
|
36
|
-
if (asset_size != '') radius_tag = radius_tag + ' size="' + asset_size + '"';
|
37
|
-
radius_tag = radius_tag +' id="' + asset_id + '" />';
|
38
|
-
Assets.insertAtCursor(part_id, radius_tag);
|
54
|
+
},
|
39
55
|
|
40
|
-
|
56
|
+
assetFilterParameters: function () {
|
57
|
+
var parameters = [];
|
58
|
+
if ($('#filesearchforminput').val() !== '') {
|
59
|
+
parameters.push([ 'search[title_cont]', $('#filesearchforminput').val() ]);
|
60
|
+
}
|
41
61
|
|
42
|
-
|
43
|
-
|
44
|
-
$.ajax({
|
45
|
-
method: 'get',
|
46
|
-
url: $(this).attr('href') + Assets.assetFilterParameters(),
|
47
|
-
complete: function(data, textStatus, jqXHR) {
|
48
|
-
Assets.updateTable(data.responseText);
|
49
|
-
Assets.attachEvents();
|
62
|
+
if ($('#page_id').val() !== undefined) {
|
63
|
+
parameters.push([ 'page_id', $('#page_id').val() ]);
|
50
64
|
}
|
51
|
-
});
|
52
|
-
});
|
53
65
|
|
54
|
-
|
66
|
+
var filters = [];
|
67
|
+
var url_params = "";
|
68
|
+
$('a.selective.pressed').each(function () {
|
69
|
+
filters.push($(this).attr('rel'));
|
70
|
+
});
|
55
71
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
parameters.push(['search', $('#filesearchforminput').val()]);
|
60
|
-
}
|
72
|
+
if (filters.length > 0) {
|
73
|
+
parameters.push([ 'filter', filters.toString() ])
|
74
|
+
}
|
61
75
|
|
62
|
-
|
63
|
-
|
64
|
-
|
76
|
+
for (var i = 0; i < parameters.length; i++) {
|
77
|
+
if (i > 0) {
|
78
|
+
url_params = url_params + '&'
|
79
|
+
}
|
80
|
+
url_params = url_params + parameters[i][0] + '=' + parameters[i][1];
|
81
|
+
}
|
82
|
+
return url_params + '&pp=50';
|
83
|
+
},
|
65
84
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
85
|
+
activateUpload: function () {
|
86
|
+
$('#upload-controls').hide();
|
87
|
+
$('#update-controls').show();
|
88
|
+
$('#asset_title').prop("disabled", false);
|
89
|
+
$('#new_asset input[name="commit"]').prop("disabled", false);
|
90
|
+
},
|
91
|
+
activateUpdate: function () {
|
92
|
+
$('#upload-controls').show();
|
93
|
+
$('#update-controls').hide();
|
94
|
+
$('#asset_title').prop("disabled", true);
|
95
|
+
$('#new_asset input[name="commit"]').prop("disabled", true);
|
96
|
+
},
|
71
97
|
|
72
|
-
|
98
|
+
insertAtCursor: function (part_id, insertion) {
|
99
|
+
if (CKEDITOR.instances[part_id].mode == 'wysiwyg') {
|
100
|
+
CKEDITOR.instances[part_id].insertText(insertion);
|
101
|
+
} else {
|
102
|
+
var textbox = $("textarea.cke_source[title~=" + part_id + "]");
|
103
|
+
var caretPos = textbox[0].selectionStart;
|
104
|
+
var textAreaTxt = textbox.val();
|
105
|
+
textbox.val(textAreaTxt.substring(0, caretPos) + insertion + textAreaTxt.substring(caretPos));
|
106
|
+
}
|
107
|
+
},
|
108
|
+
filterAssets: function () {
|
109
|
+
var url = $("#filesearchform").attr('action');
|
110
|
+
var parameters = Assets.assetFilterParameters();
|
111
|
+
|
112
|
+
url = url + "?" + parameters;
|
113
|
+
$.ajax({
|
114
|
+
url: url,
|
115
|
+
complete: function (data, textStatus, jqXHR) {
|
116
|
+
Assets.updateTable(data.responseText);
|
117
|
+
}
|
118
|
+
});
|
119
|
+
},
|
120
|
+
updateTable: function (html) {
|
121
|
+
$("#assets_table").html(html);
|
122
|
+
Assets.attachEvents();
|
123
|
+
},
|
124
|
+
addToList: function (html) {
|
125
|
+
var list = $('#attachment_fields');
|
126
|
+
list.append(html);
|
127
|
+
Assets.showListIfHidden();
|
128
|
+
Assets.notify('Save page to commit changes');
|
129
|
+
Assets.attachEvents();
|
130
|
+
// I'm not sure what Sortable does and can't find any example of
|
131
|
+
// its use in current Trusty, so I'm going to comment it out for now.
|
73
132
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
},
|
93
|
-
|
94
|
-
insertAtCursor: function(part_id, insertion) {
|
95
|
-
if (CKEDITOR.instances[part_id].mode == 'wysiwyg') {
|
96
|
-
CKEDITOR.instances[part_id].insertText( insertion );
|
97
|
-
} else {
|
98
|
-
var textbox = $("textarea.cke_source[title~=" + part_id +"]");
|
99
|
-
var caretPos = textbox[0].selectionStart;
|
100
|
-
var textAreaTxt = textbox.val();
|
101
|
-
textbox.val(textAreaTxt.substring(0, caretPos) + insertion + textAreaTxt.substring(caretPos) );
|
102
|
-
}
|
103
|
-
},
|
104
|
-
filterAssets: function() {
|
105
|
-
var url = $("#filesearchform").attr('action');
|
106
|
-
var parameters = Assets.assetFilterParameters();
|
107
|
-
|
108
|
-
url = url + "?" + parameters;
|
109
|
-
$.ajax({
|
110
|
-
url: url,
|
111
|
-
complete: function(data, textStatus, jqXHR) {
|
112
|
-
Assets.updateTable(data.responseText);
|
113
|
-
}
|
114
|
-
});
|
115
|
-
},
|
116
|
-
updateTable: function(html) {
|
117
|
-
$("#assets_table").html(html);
|
118
|
-
Assets.attachEvents();
|
119
|
-
},
|
120
|
-
addToList: function(html){
|
121
|
-
var list = $('#attachment_fields');
|
122
|
-
list.append(html);
|
123
|
-
Assets.showListIfHidden();
|
124
|
-
Assets.notify('Save page to commit changes');
|
125
|
-
Assets.attachEvents();
|
126
|
-
// I'm not sure what Sortable does and can't find any example of
|
127
|
-
// its use in current Trusty, so I'm going to comment it out for now.
|
128
|
-
|
129
|
-
//Assets.makeSortable(list);
|
130
|
-
|
131
|
-
},
|
132
|
-
removeFromList: function(container) {
|
133
|
-
container.children('input.attacher').remove();
|
134
|
-
container.children('input.pos').remove();
|
135
|
-
container.children('input.destroyer').val(1);
|
136
|
-
container.fadeOut();
|
137
|
-
container.addClass('detached');
|
138
|
-
},
|
139
|
-
showListIfHidden: function() {
|
140
|
-
var list = $('#attachment_fields');
|
141
|
-
if (list.hasClass('empty')) {
|
142
|
-
list.removeClass('empty');
|
133
|
+
//Assets.makeSortable(list);
|
134
|
+
|
135
|
+
},
|
136
|
+
removeFromList: function (container) {
|
137
|
+
container.children('input.attacher').remove();
|
138
|
+
container.children('input.pos').remove();
|
139
|
+
container.children('input.destroyer').val(1);
|
140
|
+
container.fadeOut();
|
141
|
+
container.addClass('detached');
|
142
|
+
},
|
143
|
+
showListIfHidden: function () {
|
144
|
+
var list = $('#attachment_fields');
|
145
|
+
if (list.hasClass('empty')) {
|
146
|
+
list.removeClass('empty');
|
147
|
+
}
|
148
|
+
},
|
149
|
+
notify: function (message) {
|
150
|
+
$('#attachment_list span.message').html(message).addClass('important');
|
143
151
|
}
|
144
|
-
},
|
145
|
-
notify: function(message){
|
146
|
-
$('#attachment_list span.message').html(message).addClass('important');
|
147
|
-
}
|
148
152
|
|
149
153
|
};
|
150
154
|
|
151
155
|
|
152
|
-
$(function() {
|
156
|
+
$(function () {
|
153
157
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
158
|
+
$('a.selective').click(function (e) {
|
159
|
+
e.preventDefault();
|
160
|
+
var element = $(this);
|
161
|
+
var type_id = element.attr('rel');
|
162
|
+
var type_check = $('#' + type_id + '-check');
|
163
|
+
|
164
|
+
if (element.hasClass('pressed')) {
|
165
|
+
element.removeClass('pressed');
|
166
|
+
$(type_check).prop('checked', false);
|
167
|
+
if ($('a.selective.pressed').length == 0) $('#select_all').addClass('pressed');
|
168
|
+
} else {
|
169
|
+
element.addClass('pressed');
|
170
|
+
$('a.deselective').each(function () {
|
171
|
+
$(this).removeClass('pressed');
|
172
|
+
});
|
173
|
+
$(type_check).prop('checked', true);
|
174
|
+
}
|
175
|
+
Assets.filterAssets();
|
176
|
+
Assets.attachEvents();
|
159
177
|
|
160
|
-
|
161
|
-
element.removeClass('pressed');
|
162
|
-
$(type_check).prop('checked', false);
|
163
|
-
if ($('a.selective.pressed').length == 0) $('#select_all').addClass('pressed');
|
164
|
-
}
|
165
|
-
else {
|
166
|
-
element.addClass('pressed');
|
167
|
-
$('a.deselective').each(function() { $(this).removeClass('pressed'); });
|
168
|
-
$(type_check).prop('checked', true);
|
169
|
-
}
|
170
|
-
Assets.filterAssets();
|
171
|
-
Assets.attachEvents();
|
178
|
+
});
|
172
179
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
180
|
+
$('a.deselective').click(function (e) {
|
181
|
+
e.preventDefault();
|
182
|
+
var element = $(this);
|
183
|
+
if (!element.hasClass('pressed')) {
|
184
|
+
$('a.selective').each(function () {
|
185
|
+
$(this).removeClass('pressed');
|
186
|
+
});
|
187
|
+
$('input.selective').each(function () {
|
188
|
+
$(this).prop('checked', false);
|
189
|
+
});
|
190
|
+
element.addClass('pressed');
|
191
|
+
Assets.filterAssets();
|
192
|
+
Assets.attachEvents();
|
193
|
+
}
|
194
|
+
});
|
186
195
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
Popup.show('attach_asset');
|
195
|
-
$('.close_popup').click(function(e){
|
196
|
-
e.preventDefault();
|
197
|
-
Popup.close();
|
198
|
-
$('#attach_asset').hide();
|
196
|
+
$('#filesearchforminput').keyup(function () {
|
197
|
+
clearTimeout($(this).data('timeout'));
|
198
|
+
var timeout = setTimeout(function () {
|
199
|
+
Assets.filterAssets();
|
200
|
+
Assets.attachEvents();
|
201
|
+
}, 500);
|
202
|
+
$(this).data('timeout', timeout);
|
199
203
|
});
|
200
|
-
|
201
|
-
|
202
|
-
$('#filesearchforminput').keyup(function(){
|
203
|
-
Assets.filterAssets();
|
204
|
-
});
|
205
|
-
|
206
|
-
$("#upload_asset_link").click(function(e) {
|
207
|
-
e.preventDefault();
|
208
|
-
Popup.close();
|
209
|
-
$('#attach_asset').hide();
|
210
|
-
Assets.activateUpdate();
|
211
|
-
Popup.show('upload_asset');
|
212
|
-
|
213
|
-
$("#attach-popup").click(function(e) {
|
214
|
-
e.preventDefault();
|
215
|
-
Popup.close();
|
216
|
-
$('#upload_asset').hide();
|
217
|
-
Popup.show('attach_asset');
|
218
|
-
$('.close_popup').click(function(e){
|
204
|
+
|
205
|
+
$("#attach_assets").click(function (e) {
|
219
206
|
e.preventDefault();
|
220
|
-
Popup.
|
221
|
-
$('
|
222
|
-
|
207
|
+
Popup.show('attach_asset');
|
208
|
+
$('.close_popup').click(function (e) {
|
209
|
+
e.preventDefault();
|
210
|
+
Popup.close();
|
211
|
+
$('#attach_asset').hide();
|
212
|
+
});
|
223
213
|
});
|
224
214
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
215
|
+
$('#filesearchforminput').keyup(function () {
|
216
|
+
clearTimeout($(this).data('timeout'));
|
217
|
+
var timeout = setTimeout(function () {
|
218
|
+
Assets.filterAssets();
|
219
|
+
}, 500);
|
220
|
+
$(this).data('timeout', timeout);
|
229
221
|
});
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
e.preventDefault();
|
234
|
-
$("#update-asset").attr("disabled", true);
|
235
|
-
$('#update-status').show();
|
236
|
-
$.ajax({
|
237
|
-
method: 'put',
|
238
|
-
url: $(this).attr('action') + $("#asset_id").val(),
|
239
|
-
data: $(this).serialize(),
|
240
|
-
complete: function(data, textStatus, jqXHR) {
|
222
|
+
|
223
|
+
$("#upload_asset_link").click(function (e) {
|
224
|
+
e.preventDefault();
|
241
225
|
Popup.close();
|
242
|
-
$('#
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
226
|
+
$('#attach_asset').hide();
|
227
|
+
Assets.activateUpdate();
|
228
|
+
Popup.show('upload_asset');
|
229
|
+
|
230
|
+
$("#attach-popup").click(function (e) {
|
231
|
+
e.preventDefault();
|
232
|
+
Popup.close();
|
233
|
+
$('#upload_asset').hide();
|
234
|
+
Popup.show('attach_asset');
|
235
|
+
$('.close_popup').click(function (e) {
|
236
|
+
e.preventDefault();
|
237
|
+
Popup.close();
|
238
|
+
$('#attach_asset').hide();
|
239
|
+
});
|
240
|
+
});
|
241
|
+
|
242
|
+
$('.close_popup').click(function (e) {
|
243
|
+
e.preventDefault();
|
244
|
+
Popup.close();
|
245
|
+
$('#upload_asset').hide();
|
246
|
+
});
|
247
247
|
});
|
248
|
-
});
|
249
248
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
249
|
+
$('#update_asset').submit(function (e) {
|
250
|
+
e.preventDefault();
|
251
|
+
$("#update-asset").attr("disabled", true);
|
252
|
+
$('#update-status').show();
|
253
|
+
$.ajax({
|
254
|
+
method: 'put',
|
255
|
+
url: $(this).attr('action') + $("#asset_id").val(),
|
256
|
+
data: $(this).serialize(),
|
257
|
+
complete: function (data, textStatus, jqXHR) {
|
258
|
+
Popup.close();
|
259
|
+
$('#upload_asset').hide();
|
260
|
+
$('#update-status').hide();
|
261
|
+
$("#update-asset").attr("disabled", false);
|
262
|
+
$('#update_asset').trigger("reset");
|
263
|
+
}
|
264
|
+
});
|
265
|
+
});
|
266
|
+
|
267
|
+
$('#asset_asset').fileupload({
|
268
|
+
add: function (e, data) {
|
269
|
+
$("#asset_asset").attr("disabled", true);
|
270
|
+
$('#upload-status').show();
|
271
|
+
data.submit();
|
272
|
+
},
|
273
|
+
done: function (e, data) {
|
274
|
+
$("#asset_id").val($(data.result).find(".attacher").val());
|
275
|
+
Assets.addToList($(data.result));
|
276
|
+
Assets.activateUpload();
|
277
|
+
$("#asset_asset").attr("disabled", false);
|
278
|
+
$('#upload-status').hide();
|
279
|
+
$("#popup_window").hide();
|
280
|
+
}
|
281
|
+
});
|
265
282
|
|
266
|
-
|
283
|
+
Assets.attachEvents();
|
267
284
|
|
268
285
|
});
|
@@ -40,8 +40,8 @@ input[type="submit"], input[type="button"] {
|
|
40
40
|
input[type="text"], input[type="search"], input[type="password"], input[type="email"] {
|
41
41
|
border: 0.5px solid $gray;
|
42
42
|
margin: 0.5em;
|
43
|
+
max-width: 75%;
|
43
44
|
padding: 0.25em;
|
44
|
-
width: 75%;
|
45
45
|
}
|
46
46
|
|
47
47
|
select {
|
@@ -8,9 +8,8 @@ class Admin::AssetsController < Admin::ResourceController
|
|
8
8
|
def index
|
9
9
|
assets = Asset.order('created_at DESC')
|
10
10
|
@page = Page.find(params[:page_id]) if params[:page_id]
|
11
|
-
|
12
|
-
|
13
|
-
assets = assets.matching(@term) if @term && !@term.blank?
|
11
|
+
@term = assets.ransack(params[:search] || '')
|
12
|
+
assets = @term.result(distinct: true)
|
14
13
|
|
15
14
|
@types = params[:filter] ? params[:filter].split(',') : []
|
16
15
|
if @types.include?('all')
|
@@ -20,6 +19,7 @@ class Admin::AssetsController < Admin::ResourceController
|
|
20
19
|
end
|
21
20
|
|
22
21
|
@assets = paginated? ? assets.paginate(pagination_parameters) : assets.all
|
22
|
+
|
23
23
|
respond_to do |format|
|
24
24
|
format.js do
|
25
25
|
@page = Page.find_by_id(params[:page_id])
|
@@ -54,7 +54,7 @@ class Admin::AssetsController < Admin::ResourceController
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
if asset_params[:for_attachment]
|
59
59
|
render partial: 'admin/page_attachments/attachment', collection: @page_attachments
|
60
60
|
else
|
@@ -27,11 +27,20 @@ class Admin::PagesController < Admin::ResourceController
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def new
|
30
|
+
assets = Asset.order('created_at DESC')
|
31
|
+
@term = assets.ransack(params[:search] || '')
|
30
32
|
@page = self.model = model_class.new_with_defaults(trusty_config)
|
31
33
|
assign_page_attributes
|
32
34
|
response_for :new
|
33
35
|
end
|
34
36
|
|
37
|
+
def edit
|
38
|
+
assets = Asset.order('created_at DESC')
|
39
|
+
@term = assets.ransack(params[:search] || '')
|
40
|
+
@term.result(distinct: true)
|
41
|
+
response_for :edit
|
42
|
+
end
|
43
|
+
|
35
44
|
def preview
|
36
45
|
render_preview
|
37
46
|
rescue PreviewStop => e
|
data/app/models/asset.rb
CHANGED
@@ -56,6 +56,10 @@ class Asset < ActiveRecord::Base
|
|
56
56
|
asset_type.icon(style_name.to_s)
|
57
57
|
end
|
58
58
|
|
59
|
+
def self.ransackable_attributes(auth_object = nil)
|
60
|
+
%w[asset_content_type asset_file_name asset_file_size caption created_at created_by_id id original_extension original_height original_width title updated_at updated_by_id uuid]
|
61
|
+
end
|
62
|
+
|
59
63
|
def render_original(style_name)
|
60
64
|
style_name.to_s == 'original' && asset.key.include?('culturaldistrict')
|
61
65
|
end
|
@@ -1,18 +1,19 @@
|
|
1
|
-
=
|
2
|
-
- if
|
3
|
-
= hidden_field_tag "page_id",
|
1
|
+
= search_form_for term, url: admin_assets_path, class: 'search', id: 'filesearchform' do |f|
|
2
|
+
- if page
|
3
|
+
= hidden_field_tag "page_id", page.id
|
4
4
|
= hidden_field_tag "p", params['p'] || 1
|
5
|
-
= hidden_field_tag "pp", params['pp'] ||
|
5
|
+
= hidden_field_tag "pp", params['pp'] || 50
|
6
6
|
|
7
7
|
.asset_filters
|
8
8
|
= link_to t("asset_types.all"), admin_assets_url, :id => "select_all", :class => params[:filter].blank? ? "deselective pressed" : "deselective"
|
9
9
|
- AssetType.all.each do |type|
|
10
10
|
- unless type.name == :other
|
11
11
|
= link_to t("asset_types.#{type.plural}"), admin_assets_url(:filter => type.name), :rel => type.name.to_s, :class => params[:filter] == type.name.to_s ? "selective pressed" : "selective"
|
12
|
+
|
12
13
|
.asset_search
|
13
14
|
%i.fas.fa-search
|
14
|
-
|
15
|
-
|
15
|
+
= f.search_field :title_cont, placeholder: 'Search Asset Title', class: 'search', id: 'filesearchforminput', size: '30'
|
16
|
+
Sort By #{sort_link(term, :title)} or #{sort_link(term, :created_at)}
|
16
17
|
#type_boxes{:style => "display: none"}
|
17
18
|
- AssetType.all.each do |type|
|
18
19
|
= check_box_tag 'filter[]', type.name.to_s, false, :id => "#{type.name}-check", :class => 'selective'
|
@@ -3,11 +3,11 @@
|
|
3
3
|
- body_classes << 'reversed'
|
4
4
|
|
5
5
|
- content_for :toolbar do
|
6
|
-
= render 'search'
|
6
|
+
= render partial: 'search', locals: { term: @term, page: @page }
|
7
7
|
|
8
8
|
.outset
|
9
9
|
#assets_table.assets
|
10
|
-
= render :
|
10
|
+
= render partial: 'asset_table', locals: { assets: @assets, with_pagination: true }
|
11
11
|
%p{style: 'clear: both; height: 2em'}
|
12
12
|
|
13
13
|
- render_region :bottom do |bottom|
|
@@ -24,7 +24,7 @@
|
|
24
24
|
.popup_title= t('clipped_extension.find_assets')
|
25
25
|
|
26
26
|
.toolbar
|
27
|
-
= render :partial => 'admin/assets/search'
|
27
|
+
= render :partial => 'admin/assets/search', locals: { term: @term, page: @page }
|
28
28
|
|
29
29
|
#assets_table.assets.viewport
|
30
30
|
- assets = Asset.all.paginate(:per_page => 20, page: params[:p])
|
data/lib/trusty_cms/engine.rb
CHANGED
data/lib/trusty_cms.rb
CHANGED
data/trusty_cms.gemspec
CHANGED
@@ -43,8 +43,9 @@ a general purpose content management system--not merely a blogging engine.'
|
|
43
43
|
s.add_dependency 'radius', '~> 0.7'
|
44
44
|
s.add_dependency 'rails'
|
45
45
|
s.add_dependency 'rake', '< 14.0'
|
46
|
+
s.add_dependency 'ransack'
|
46
47
|
s.add_dependency 'rdoc', '>= 5.1', '< 7.0'
|
47
|
-
s.add_dependency 'RedCloth', '4.3.
|
48
|
+
s.add_dependency 'RedCloth', '4.3.3'
|
48
49
|
s.add_dependency 'roadie-rails'
|
49
50
|
s.add_dependency 'sass-rails'
|
50
51
|
s.add_dependency 'stringex', '>= 2.7.1', '< 2.9.0'
|
@@ -5,10 +5,10 @@ class ClippedExtension < TrustyCms::Extension
|
|
5
5
|
def activate
|
6
6
|
if database_exists?
|
7
7
|
if Asset.table_exists?
|
8
|
-
Page.send :include, PageAssetAssociations
|
9
|
-
TrustyCms::AdminUI.send :include, ClippedAdminUI unless defined? admin.asset
|
10
|
-
Admin::PagesController.send :helper, Admin::AssetsHelper
|
11
|
-
Page.send :include, AssetTags
|
8
|
+
Page.send :include, PageAssetAssociations # defines page-asset associations. likely to be generalised soon.
|
9
|
+
TrustyCms::AdminUI.send :include, ClippedAdminUI unless defined? admin.asset # defines shards for extension of the asset-admin interface
|
10
|
+
Admin::PagesController.send :helper, Admin::AssetsHelper # currently only provides a description of asset sizes
|
11
|
+
Page.send :include, AssetTags # radius tags for selecting sets of assets and presenting each one
|
12
12
|
AssetType.new :image, :icon => 'image', :default_radius_tag => 'image', :processors => [:thumbnail], :styles => :standard, :extensions => %w[jpg jpeg png gif], :mime_types => %w[image/png image/x-png image/jpeg image/pjpeg image/jpg image/gif]
|
13
13
|
AssetType.new :video, :icon => 'video', :processors => [:frame_grab], :styles => :standard, :mime_types => %w[application/x-mp4 video/mpeg video/quicktime video/x-la-asf video/x-ms-asf video/x-msvideo video/x-sgi-movie video/x-flv flv-application/octet-stream video/3gpp video/3gpp2 video/3gpp-tt video/BMPEG video/BT656 video/CelB video/DV video/H261 video/H263 video/H263-1998 video/H263-2000 video/H264 video/JPEG video/MJ2 video/MP1S video/MP2P video/MP2T video/mp4 video/MP4V-ES video/MPV video/mpeg4 video/mpeg4-generic video/nv video/parityfec video/pointer video/raw video/rtx video/ogg video/webm]
|
14
14
|
AssetType.new :audio, :icon => 'audio', :mime_types => %w[audio/mpeg audio/mpg audio/ogg application/ogg audio/x-ms-wma audio/vnd.rn-realaudio audio/x-wav]
|
@@ -16,19 +16,19 @@ class ClippedExtension < TrustyCms::Extension
|
|
16
16
|
AssetType.new :document, :icon => 'document', :mime_types => %w[application/msword application/rtf application/vnd.ms-excel application/vnd.ms-powerpoint application/vnd.ms-project application/vnd.ms-works text/plain text/html]
|
17
17
|
AssetType.new :other, :icon => 'unknown'
|
18
18
|
|
19
|
-
admin.asset ||= TrustyCms::AdminUI.load_default_asset_regions
|
20
|
-
admin.page.edit.add :form, 'assets', :after => :edit_page_parts
|
21
|
-
admin.page.edit.add :main, 'asset_popups', :after => :edit_popups
|
19
|
+
admin.asset ||= TrustyCms::AdminUI.load_default_asset_regions # loads the shards defined in AssetsAdminUI
|
20
|
+
admin.page.edit.add :form, 'assets', :after => :edit_page_parts # adds the asset-attachment picker to the page edit view
|
21
|
+
admin.page.edit.add :main, 'asset_popups', :after => :edit_popups # adds the asset-attachment picker to the page edit view
|
22
22
|
admin.page.edit.asset_popups.concat %w{upload_asset attach_asset}
|
23
23
|
admin.configuration.show.add :trusty_config, 'admin/configuration/clipped_show', :after => 'defaults'
|
24
|
-
admin.configuration.edit.add :form,
|
24
|
+
admin.configuration.edit.add :form, 'admin/configuration/clipped_edit', :after => 'edit_defaults'
|
25
25
|
|
26
|
-
if TrustyCms::Config.table_exists? && TrustyCms::config["paperclip.command_path"]
|
26
|
+
if TrustyCms::Config.table_exists? && TrustyCms::config["paperclip.command_path"] # This is needed for testing if you are using mod_rails
|
27
27
|
Paperclip.options[:command_path] = TrustyCms::config["paperclip.command_path"]
|
28
28
|
end
|
29
29
|
|
30
30
|
tab "Assets", :after => "Content" do
|
31
|
-
add_item "All", "/admin/assets
|
31
|
+
add_item "All", "/admin/assets"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -2,34 +2,34 @@ module AssetTags
|
|
2
2
|
include TrustyCms::Taggable
|
3
3
|
include ActionView::Helpers::TagHelper
|
4
4
|
include ActionView::Helpers::AssetTagHelper
|
5
|
-
|
5
|
+
|
6
6
|
class TagError < StandardError; end
|
7
|
-
|
7
|
+
|
8
8
|
%w{top_padding width height caption asset_file_name asset_content_type asset_file_size id filename image flash thumbnail url link extension if_content_type page:title page:url}.each do |name|
|
9
9
|
deprecated_tag "assets:#{name}", :substitute => "asset:#{name}", :deadline => '2.0'
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
desc %{
|
13
13
|
The namespace for referencing images and assets.
|
14
14
|
|
15
15
|
*Usage:*
|
16
16
|
<pre><code><r:asset [name="asset name"]>...</r:asset></code></pre>
|
17
|
-
}
|
17
|
+
}
|
18
18
|
tag 'asset' do |tag|
|
19
19
|
tag.locals.asset = find_asset(tag, tag.attr) unless tag.attr.empty?
|
20
|
-
|
20
|
+
tag.expand
|
21
21
|
end
|
22
22
|
|
23
23
|
desc %{
|
24
24
|
Cycles through all assets attached to the current page.
|
25
|
-
This tag does not require the name
|
25
|
+
This tag does not require the name attribute, nor do any of its children.
|
26
26
|
Use the @limit@ and @offset@ attribute to render a specific number of assets.
|
27
27
|
Use @by@ and @order@ attributes to control the order of assets.
|
28
28
|
Use @extensions@ attribute to specify which assets to be rendered.
|
29
29
|
|
30
30
|
*Usage:*
|
31
31
|
<pre><code><r:assets:each [limit=0] [offset=0] [order="asc|desc"] [by="position|title|..."] [extensions="png|pdf|doc"]>...</r:assets:each></code></pre>
|
32
|
-
}
|
32
|
+
}
|
33
33
|
tag 'assets' do |tag|
|
34
34
|
tag.expand
|
35
35
|
end
|
@@ -58,7 +58,7 @@ module AssetTags
|
|
58
58
|
end
|
59
59
|
result
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
desc %{
|
63
63
|
References the first asset attached to the current page.
|
64
64
|
|
@@ -84,7 +84,7 @@ module AssetTags
|
|
84
84
|
assets = tag.locals.page.assets.count(:conditions => assets_find_options(tag)[:conditions])
|
85
85
|
tag.expand if assets >= count
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
desc %{
|
89
89
|
The opposite of @<r:if_assets/>@.
|
90
90
|
}
|
@@ -93,7 +93,7 @@ module AssetTags
|
|
93
93
|
assets = tag.locals.page.assets.count(:conditions => assets_find_options(tag)[:conditions])
|
94
94
|
tag.expand unless assets >= count
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
# Resets the page Url and title within the asset tag
|
98
98
|
[:title, :url].each do |method|
|
99
99
|
tag "asset:page:#{method.to_s}" do |tag|
|
@@ -127,10 +127,10 @@ module AssetTags
|
|
127
127
|
size = options['size'] ? options.delete('size') : 'icon'
|
128
128
|
raise TagError, "asset #{tag.locals.asset.title} has no '#{size}' thumbnail" unless tag.locals.asset.style?(size)
|
129
129
|
container = options.delete('container')
|
130
|
-
((container.to_i - asset.height(size).to_i)/2).to_s
|
130
|
+
((container.to_i - asset.height(size).to_i) / 2).to_s
|
131
131
|
end
|
132
|
-
|
133
|
-
['height','width'].each do |dimension|
|
132
|
+
|
133
|
+
['height', 'width'].each do |dimension|
|
134
134
|
desc %{
|
135
135
|
Renders the #{dimension} of the asset.
|
136
136
|
}
|
@@ -180,11 +180,11 @@ module AssetTags
|
|
180
180
|
tag 'asset:if_content_type' do |tag|
|
181
181
|
options = tag.attr.dup
|
182
182
|
# XXX build_regexp_for comes from StandardTags
|
183
|
-
regexp = build_regexp_for(tag,options)
|
183
|
+
regexp = build_regexp_for(tag, options)
|
184
184
|
asset_content_type = tag.locals.asset.asset_content_type
|
185
185
|
tag.expand unless asset_content_type.match(regexp).nil?
|
186
186
|
end
|
187
|
-
|
187
|
+
|
188
188
|
[:title, :caption, :asset_file_name, :extension, :asset_content_type, :asset_file_size, :id].each do |method|
|
189
189
|
desc %{
|
190
190
|
Renders the @#{method.to_s}@ attribute of the asset
|
@@ -194,16 +194,16 @@ module AssetTags
|
|
194
194
|
asset.send(method) rescue nil
|
195
195
|
end
|
196
196
|
end
|
197
|
-
|
197
|
+
|
198
198
|
tag 'asset:name' do |tag|
|
199
199
|
tag.render('asset:title', tag.attr.dup)
|
200
|
-
end
|
201
|
-
|
200
|
+
end
|
201
|
+
|
202
202
|
tag 'asset:filename' do |tag|
|
203
203
|
asset, options = asset_and_options(tag)
|
204
204
|
asset.asset_file_name rescue nil
|
205
205
|
end
|
206
|
-
|
206
|
+
|
207
207
|
desc %{
|
208
208
|
Renders an image tag for the asset.
|
209
209
|
|
@@ -213,7 +213,7 @@ module AssetTags
|
|
213
213
|
|
214
214
|
*Usage:*
|
215
215
|
<pre><code><r:asset:image [name="asset name" or id="asset id"] [size="icon|thumbnail|whatever"]></code></pre>
|
216
|
-
}
|
216
|
+
}
|
217
217
|
tag 'asset:image' do |tag|
|
218
218
|
tag.locals.asset, options = image_asset_and_options(tag)
|
219
219
|
return "Error: This image cannot be found" if tag.locals.asset == nil
|
@@ -223,20 +223,20 @@ module AssetTags
|
|
223
223
|
url = tag.locals.asset.thumbnail(size)
|
224
224
|
ActionController::Base.helpers.image_tag(url, options)
|
225
225
|
end
|
226
|
-
|
226
|
+
|
227
227
|
desc %{
|
228
228
|
Renders the url for the asset. If the asset is an image, the <code>size</code> attribute can be used to
|
229
229
|
generate the url for that size.
|
230
230
|
|
231
231
|
*Usage:*
|
232
232
|
<pre><code><r:url [name="asset name" or id="asset id"] [size="icon|thumbnail"]></code></pre>
|
233
|
-
}
|
233
|
+
}
|
234
234
|
tag 'asset:url' do |tag|
|
235
235
|
asset, options = asset_and_options(tag)
|
236
236
|
size = options['size'] ? options.delete('size') : 'original'
|
237
237
|
asset.thumbnail(size) rescue nil
|
238
238
|
end
|
239
|
-
|
239
|
+
|
240
240
|
desc %{
|
241
241
|
Renders a link to the asset. If the asset is an image, the <code>size</code> attribute can be used to
|
242
242
|
generate a link to that size.
|
@@ -255,8 +255,9 @@ module AssetTags
|
|
255
255
|
url = asset.thumbnail(size)
|
256
256
|
%{<a href="#{url }#{anchor}"#{attributes}>#{text}</a>} rescue nil
|
257
257
|
end
|
258
|
-
|
259
|
-
private
|
258
|
+
|
259
|
+
private
|
260
|
+
|
260
261
|
def asset_and_options(tag)
|
261
262
|
options = tag.attr.dup
|
262
263
|
[find_asset(tag, options), options]
|
@@ -269,19 +270,19 @@ private
|
|
269
270
|
|
270
271
|
def find_asset(tag, options)
|
271
272
|
tag.locals.asset ||= if title = (options.delete('name') || options.delete('title'))
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
273
|
+
Asset.find_by_title(title)
|
274
|
+
elsif id = options.delete('id')
|
275
|
+
Asset.find_by_id(id)
|
276
|
+
end
|
276
277
|
tag.locals.asset || raise(TagError, "Asset not found.")
|
277
278
|
end
|
278
279
|
|
279
280
|
def find_image_asset(tag, options)
|
280
281
|
tag.locals.asset ||= if title = (options.delete('name') || options.delete('title'))
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
282
|
+
Asset.find_by_title(title)
|
283
|
+
elsif id = options.delete('id')
|
284
|
+
Asset.find_by_id(id)
|
285
|
+
end
|
285
286
|
tag.locals.asset || nil
|
286
287
|
end
|
287
288
|
|
@@ -289,16 +290,16 @@ private
|
|
289
290
|
attr = tag.attr.symbolize_keys
|
290
291
|
extensions = attr[:extensions] && attr[:extensions].split('|') || []
|
291
292
|
conditions = unless extensions.blank?
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
293
|
+
# this is soon to be removed in favour of asset types
|
294
|
+
[extensions.map { |ext| "assets.asset_file_name LIKE ?" }.join(' OR '),
|
295
|
+
*extensions.map { |ext| "%.#{ext}" }]
|
296
|
+
else
|
297
|
+
nil
|
298
|
+
end
|
299
|
+
|
299
300
|
by = attr[:by] || 'page_attachments.position'
|
300
301
|
order = attr[:order] || 'asc'
|
301
|
-
|
302
|
+
|
302
303
|
options = {
|
303
304
|
:order => "#{by} #{order}",
|
304
305
|
:limit => attr[:limit] || nil,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusty-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TrustyCms CMS dev team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage-validator
|
@@ -312,6 +312,20 @@ dependencies:
|
|
312
312
|
- - "<"
|
313
313
|
- !ruby/object:Gem::Version
|
314
314
|
version: '14.0'
|
315
|
+
- !ruby/object:Gem::Dependency
|
316
|
+
name: ransack
|
317
|
+
requirement: !ruby/object:Gem::Requirement
|
318
|
+
requirements:
|
319
|
+
- - ">="
|
320
|
+
- !ruby/object:Gem::Version
|
321
|
+
version: '0'
|
322
|
+
type: :runtime
|
323
|
+
prerelease: false
|
324
|
+
version_requirements: !ruby/object:Gem::Requirement
|
325
|
+
requirements:
|
326
|
+
- - ">="
|
327
|
+
- !ruby/object:Gem::Version
|
328
|
+
version: '0'
|
315
329
|
- !ruby/object:Gem::Dependency
|
316
330
|
name: rdoc
|
317
331
|
requirement: !ruby/object:Gem::Requirement
|
@@ -338,14 +352,14 @@ dependencies:
|
|
338
352
|
requirements:
|
339
353
|
- - '='
|
340
354
|
- !ruby/object:Gem::Version
|
341
|
-
version: 4.3.
|
355
|
+
version: 4.3.3
|
342
356
|
type: :runtime
|
343
357
|
prerelease: false
|
344
358
|
version_requirements: !ruby/object:Gem::Requirement
|
345
359
|
requirements:
|
346
360
|
- - '='
|
347
361
|
- !ruby/object:Gem::Version
|
348
|
-
version: 4.3.
|
362
|
+
version: 4.3.3
|
349
363
|
- !ruby/object:Gem::Dependency
|
350
364
|
name: roadie-rails
|
351
365
|
requirement: !ruby/object:Gem::Requirement
|
@@ -781,6 +795,7 @@ files:
|
|
781
795
|
- config/initializers/assets.rb
|
782
796
|
- config/initializers/devise.rb
|
783
797
|
- config/initializers/kraken.rb
|
798
|
+
- config/initializers/ransack.rb
|
784
799
|
- config/initializers/response_cache_timeout.rb
|
785
800
|
- config/initializers/secret_token.rb
|
786
801
|
- config/initializers/tmp.rb
|
@@ -1132,52 +1147,52 @@ signing_key:
|
|
1132
1147
|
specification_version: 4
|
1133
1148
|
summary: A no-fluff content management system designed for small teams.
|
1134
1149
|
test_files:
|
1135
|
-
- spec/
|
1136
|
-
- spec/
|
1137
|
-
- spec/
|
1150
|
+
- spec/fixtures/users.yml
|
1151
|
+
- spec/features/layouts_spec.rb
|
1152
|
+
- spec/features/config_spec.rb
|
1153
|
+
- spec/features/pages_spec.rb
|
1138
1154
|
- spec/controllers/users_controller_spec.rb
|
1139
1155
|
- spec/controllers/application_controller_spec.rb
|
1140
|
-
- spec/
|
1141
|
-
- spec/
|
1142
|
-
- spec/
|
1143
|
-
- spec/dummy/
|
1144
|
-
- spec/dummy/
|
1145
|
-
- spec/dummy/config.
|
1146
|
-
- spec/dummy/config/
|
1147
|
-
- spec/dummy/config/
|
1148
|
-
- spec/dummy/config/
|
1156
|
+
- spec/spec_helper.rb
|
1157
|
+
- spec/ci/database.mysql.yml
|
1158
|
+
- spec/models/layout_spec.rb
|
1159
|
+
- spec/dummy/config/environment.rb
|
1160
|
+
- spec/dummy/config/application.rb
|
1161
|
+
- spec/dummy/config/secrets.yml
|
1162
|
+
- spec/dummy/config/locales/en.yml
|
1163
|
+
- spec/dummy/config/routes.rb
|
1164
|
+
- spec/dummy/config/environments/development.rb
|
1165
|
+
- spec/dummy/config/environments/test.rb
|
1166
|
+
- spec/dummy/config/environments/production.rb
|
1149
1167
|
- spec/dummy/config/initializers/mime_types.rb
|
1150
|
-
- spec/dummy/config/initializers/
|
1168
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
1151
1169
|
- spec/dummy/config/initializers/session_store.rb
|
1170
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
1171
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
1152
1172
|
- spec/dummy/config/initializers/trusty_cms_config.rb
|
1153
|
-
- spec/dummy/config/initializers/
|
1173
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
1174
|
+
- spec/dummy/config/initializers/assets.rb
|
1154
1175
|
- spec/dummy/config/initializers/inflections.rb
|
1155
|
-
- spec/dummy/config/application.rb
|
1156
|
-
- spec/dummy/config/environments/production.rb
|
1157
|
-
- spec/dummy/config/environments/development.rb
|
1158
|
-
- spec/dummy/config/environments/test.rb
|
1159
|
-
- spec/dummy/config/locales/en.yml
|
1160
1176
|
- spec/dummy/config/database.yml
|
1161
1177
|
- spec/dummy/config/boot.rb
|
1162
|
-
- spec/dummy/config/
|
1163
|
-
- spec/dummy/
|
1164
|
-
- spec/dummy/config/secrets.yml
|
1178
|
+
- spec/dummy/app/assets/config/manifest.js
|
1179
|
+
- spec/dummy/package.json
|
1165
1180
|
- spec/dummy/README.rdoc
|
1166
|
-
- spec/dummy/
|
1167
|
-
- spec/dummy/
|
1168
|
-
- spec/dummy/
|
1169
|
-
- spec/dummy/bin/rake
|
1181
|
+
- spec/dummy/db/schema.rb
|
1182
|
+
- spec/dummy/Rakefile
|
1183
|
+
- spec/dummy/public/422.html
|
1170
1184
|
- spec/dummy/public/favicon.ico
|
1171
1185
|
- spec/dummy/public/404.html
|
1172
|
-
- spec/dummy/public/422.html
|
1173
1186
|
- spec/dummy/public/500.html
|
1174
|
-
- spec/dummy/
|
1175
|
-
- spec/
|
1176
|
-
- spec/
|
1187
|
+
- spec/dummy/yarn.lock
|
1188
|
+
- spec/dummy/bin/rails
|
1189
|
+
- spec/dummy/bin/bundle
|
1190
|
+
- spec/dummy/bin/rake
|
1191
|
+
- spec/dummy/bin/setup
|
1192
|
+
- spec/dummy/config.ru
|
1193
|
+
- spec/support/custom_actions.rb
|
1194
|
+
- spec/rails_helper.rb
|
1177
1195
|
- spec/factories/page_part.rb
|
1178
|
-
- spec/factories/layout.rb
|
1179
1196
|
- spec/factories/user.rb
|
1180
|
-
- spec/
|
1181
|
-
- spec/
|
1182
|
-
- spec/features/layouts_spec.rb
|
1183
|
-
- spec/ci/database.mysql.yml
|
1197
|
+
- spec/factories/page.rb
|
1198
|
+
- spec/factories/layout.rb
|