tb_media 1.2.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +2 -2
- data/Readme.markdown +3 -19
- data/app/assets/javascripts/admin/media/application.js +2 -2
- data/app/assets/javascripts/admin/media/picker.js +8 -5
- data/app/assets/javascripts/admin/media/plugin.js.erb +86 -81
- data/app/assets/stylesheets/admin/media/application.css.scss +1 -12
- data/app/controllers/admin/media_controller.rb +54 -61
- data/app/controllers/admin/media_picker_controller.rb +8 -16
- data/app/models/spud_media.rb +63 -110
- data/app/views/admin/media/index.html.erb +4 -12
- data/app/views/admin/media/new.html.erb +0 -1
- data/app/views/admin/media_picker/_media.html.erb +2 -7
- data/app/views/admin/media_picker/index.html.erb +1 -2
- data/config/locales/en.yml +0 -1
- data/config/routes.rb +5 -8
- data/db/migrate/20120101194256_create_spud_media.rb +2 -2
- data/db/migrate/20120501203325_add_protected_to_spud_media.rb +1 -2
- data/db/migrate/20120508132153_add_cropping_to_spud_media.rb +1 -1
- data/lib/spud_media/configuration.rb +3 -4
- data/lib/spud_media/content_types.rb +2 -2
- data/lib/spud_media/engine.rb +21 -13
- data/lib/spud_media/version.rb +3 -3
- data/lib/tasks/spud_media_tasks.rake +4 -6
- data/spec/controllers/admin/media_controller_spec.rb +23 -24
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/config/application.rb +2 -3
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environments/development.rb +0 -7
- data/spec/dummy/config/environments/test.rb +3 -5
- data/spec/dummy/config/routes.rb +2 -2
- data/spec/dummy/db/migrate/20130904141442_create_spud_users.tb_core.rb +12 -12
- data/spec/dummy/db/migrate/20130904141443_add_time_zone_to_spud_user.tb_core.rb +0 -1
- data/spec/dummy/db/migrate/20130904141444_add_scope_to_spud_admin_permissions.tb_core.rb +0 -1
- data/spec/dummy/db/migrate/20130904141446_create_spud_media.tb_media.rb +1 -1
- data/spec/dummy/db/migrate/20130904141447_add_protected_to_spud_media.tb_media.rb +1 -1
- data/spec/dummy/db/migrate/20130904141448_add_cropping_to_spud_media.tb_media.rb +3 -3
- data/spec/dummy/db/migrate/20151012194531_create_spud_permissions.tb_core.rb +3 -3
- data/spec/dummy/db/migrate/20151012194532_create_spud_role_permissions.tb_core.rb +2 -2
- data/spec/dummy/db/migrate/20151012194534_add_requires_password_change_to_spud_users.tb_core.rb +1 -1
- data/spec/dummy/db/schema.rb +63 -67
- data/spec/dummy/public/system/spud_media/1/cropped/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/1/small/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/2/cropped/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/2/small/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/3/cropped/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/3/small/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/4/cropped/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/4/small/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/5/cropped/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/5/small/test_img1.png +0 -0
- data/spec/dummy/script/rails +2 -2
- data/spec/javascripts/support/jasmine_helper.rb +6 -7
- data/spec/models/spud_media_spec.rb +2 -2
- data/spec/rails_helper.rb +14 -7
- data/spec/spec_helper.rb +42 -44
- metadata +103 -104
- data/app/controllers/protected_media_controller.rb +0 -24
- data/app/helpers/protected_media_helper.rb +0 -3
- data/spec/dummy/public/system/spud_media/1/cropped/test_img1.jpg +0 -0
- data/spec/dummy/public/system/spud_media/2/cropped/test_img1.jpg +0 -0
- data/spec/dummy/public/system/spud_media/3/cropped/test_img1.jpg +0 -0
- data/spec/dummy/public/system/spud_media/4/cropped/test_img1.jpg +0 -0
- data/spec/dummy/public/system/spud_media/5/cropped/test_img1.jpg +0 -0
- data/spec/support/authlogic_helper.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 04a72403b0a76aeca578363fe100b46a1e11e713adad77662be255bd3cdda1ce
|
4
|
+
data.tar.gz: c8cbb69eab1a051c89c27ebc3160644aa8439297d214d63613c3ded8521d3320
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b058846bbff6a6d01c4d0c629c627f32eae451b79457811d7178f815b0c5bdd43cab59fbed9d9c33dfdddfe982b58e2dce4ea1d9a4511161ecfb91e7ad79f325
|
7
|
+
data.tar.gz: 1baa7fb56ec845c4580f029dd24a8f5a53e77ca0a957ceeeba2e3b11cd87fcfcf8dd046b454691ba5d777711a77d8582dae28b66864611df9a3e5107e3da3d42
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
20
20
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
21
|
end
|
22
22
|
|
23
|
-
APP_RAKEFILE = File.expand_path(
|
23
|
+
APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
|
24
24
|
load 'rails/tasks/engine.rake'
|
25
25
|
|
26
26
|
Bundler::GemHelper.install_tasks
|
@@ -32,6 +32,6 @@ begin
|
|
32
32
|
load 'jasmine/tasks/jasmine.rake'
|
33
33
|
rescue LoadError
|
34
34
|
task :jasmine do
|
35
|
-
abort
|
35
|
+
abort 'Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine'
|
36
36
|
end
|
37
37
|
end
|
data/Readme.markdown
CHANGED
@@ -21,35 +21,19 @@ TB Media is an engine for managing documents and other miscellaneous media files
|
|
21
21
|
TB Media accepts the following configuration options:
|
22
22
|
|
23
23
|
Spud::Media.configure do |config|
|
24
|
-
|
24
|
+
|
25
25
|
# s3 storage requires the 'aws-sdk' gem. defaults to filesystem
|
26
26
|
config.paperclip_storage = :s3
|
27
27
|
config.s3_credentials = "#{Rails.root}/config/s3.yml"
|
28
28
|
|
29
|
-
# see below for notes on 'storage_path_protected'
|
30
29
|
config.storage_path = "public/system/spud_media/:id/:style/:basename.:extension"
|
31
|
-
config.storage_path_protected = "public/system/spud_media_protected/:id/:style/:basename.:extension"
|
32
30
|
config.storage_url = "/system/spud_media/:id/:style/:basename.:extension"
|
33
31
|
config.max_upload_size = 15.megabytes
|
34
32
|
end
|
35
33
|
|
36
|
-
## File Protection
|
37
|
-
|
38
|
-
Spud Media allows for individual files to be marked as protected. How this is actually implemented depends on whether you are using the local file system or Amazon S3 for file storage.
|
39
|
-
|
40
34
|
### Filesystem
|
41
35
|
|
42
|
-
|
43
|
-
|
44
|
-
Protected files are moved to `public/system/spud_media_protected`. Note that the public-facing download URL should __not__ reflect the `protected` storage path. Instead the user will hit the same URL as before, but this time their request will hit the `show` action of the `ProtectedMedia` controller.
|
45
|
-
|
46
|
-
__It is up to the individual developer to make sure that the protected storage path is not accessible by the public.__ You may choose to protect this folder via server configurations, or you can move the folder out of the document root using `config.storage_path_protected`.
|
47
|
-
|
48
|
-
### Amazon S3
|
49
|
-
|
50
|
-
Files marked as unprotected will be uploaded to Amazon using the `public_read` ACL. These files are accessed directly - ie, calling `@media.attachment_url` will link directly to Amazon.
|
51
|
-
|
52
|
-
Files marked as protected are uploaded using the `private` ACL. In this case, calling `@media.attachment_url` will return a local URL that hits the show action of our `ProtectedMedia` controller. Once we have verified the user is logged in we generate a secure URL and redirect the user to it. The generated URL is good for 10 minutes.
|
36
|
+
Files are stored under `/public/system/spud_media` and are accessed directly by the web server. No further configuration is required, though you may customize the storage location if desired using `config.storage_path`.
|
53
37
|
|
54
38
|
Testing
|
55
39
|
-----------------
|
@@ -57,7 +41,7 @@ Testing
|
|
57
41
|
TB uses RSpec for testing. Get the tests running with a few short commands:
|
58
42
|
|
59
43
|
1. Create and migrate the databases:
|
60
|
-
|
44
|
+
|
61
45
|
rake db:create
|
62
46
|
rake db:migrate
|
63
47
|
|
@@ -1,3 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* NOTE: This plugin is deprecated and should not be used until/unless it is upgraded to support TinyMCE v5
|
3
|
+
*/
|
4
|
+
|
1
5
|
//= require jquery
|
2
6
|
//= require jquery_ujs
|
3
7
|
//= require_self
|
@@ -107,15 +111,14 @@ spud.admin.mediapicker = new function(){
|
|
107
111
|
$('.spud_media_picker_details_name').text(element.attr('data-name'));
|
108
112
|
$('.spud_media_picker_details_size').text(element.attr('data-size'));
|
109
113
|
$('.spud_media_picker_details_lastmod').text(element.attr('data-lastmod'));
|
110
|
-
$('.spud_media_picker_details_protected').text(element.attr('data-protected'));
|
111
114
|
$('.spud_media_picker_details').show();
|
112
115
|
};
|
113
|
-
|
116
|
+
|
114
117
|
self.clickedCancel = function(e){
|
115
118
|
e.preventDefault();
|
116
119
|
parent.tinyMCE.activeEditor.windowManager.close();
|
117
120
|
};
|
118
|
-
|
121
|
+
|
119
122
|
self.clickedUseSelected = function(e){
|
120
123
|
e.preventDefault();
|
121
124
|
var $selected = $('.spud_media_picker_item_selected');
|
@@ -127,7 +130,7 @@ spud.admin.mediapicker = new function(){
|
|
127
130
|
};
|
128
131
|
self.goToTab('#spud_media_picker_tab_advanced');
|
129
132
|
};
|
130
|
-
|
133
|
+
|
131
134
|
self.submittedUpload = function(e){
|
132
135
|
if(!$('#spud_media_attachment').val()){
|
133
136
|
window.alert("Please select a file.");
|
@@ -307,4 +310,4 @@ spud.admin.mediapicker = new function(){
|
|
307
310
|
self.clickedInsert(e);
|
308
311
|
}
|
309
312
|
};
|
310
|
-
};
|
313
|
+
};
|
@@ -1,3 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* NOTE: This plugin is deprecated and should not be used until/unless it is upgraded to support TinyMCE v5
|
3
|
+
*/
|
4
|
+
|
1
5
|
/**
|
2
6
|
* editor_plugin_src.js
|
3
7
|
*
|
@@ -10,92 +14,93 @@
|
|
10
14
|
|
11
15
|
(function() {
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
$("html").on("tb:tinymce-loaded", function(){
|
18
|
+
// Tell spud about our plugin and button
|
19
|
+
spud.admin.editor.registerPlugin('spud_media_picker');
|
20
|
+
spud.admin.editor.registerButton('spud_media_picker');
|
21
|
+
tinymce.create('tinymce.plugins.SpudMediaPicker', {
|
22
|
+
/**
|
23
|
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
24
|
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
25
|
+
* of the editor instance to intercept that event.
|
26
|
+
*
|
27
|
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
28
|
+
* @param {string} url Absolute URL to where the plugin is located.
|
29
|
+
*/
|
30
|
+
init : function(ed, url) {
|
31
|
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
32
|
+
ed.addCommand('spudMediaShowPicker', function(){
|
33
|
+
ed.windowManager.open({
|
34
|
+
title: 'Media Picker',
|
35
|
+
file: '/admin/media_picker',
|
36
|
+
width: 450 + parseInt(ed.getLang('example.delta_width', 0), 10),
|
37
|
+
height: 300 + parseInt(ed.getLang('example.delta_height', 0), 10),
|
38
|
+
inline: 1,
|
39
|
+
resizable: false,
|
40
|
+
popup_css: false, // prevent tinymce from injecting some default css into our dialog box
|
41
|
+
close_previous: true, // close any previously opened dialogs
|
42
|
+
scrollbars: false
|
43
|
+
});
|
44
|
+
});
|
16
45
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
24
|
-
* @param {string} url Absolute URL to where the plugin is located.
|
25
|
-
*/
|
26
|
-
init : function(ed, url) {
|
27
|
-
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
28
|
-
ed.addCommand('spudMediaShowPicker', function(){
|
29
|
-
ed.windowManager.open({
|
30
|
-
title: 'Media Picker',
|
31
|
-
file: '/admin/media_picker',
|
32
|
-
width: 450 + parseInt(ed.getLang('example.delta_width', 0), 10),
|
33
|
-
height: 300 + parseInt(ed.getLang('example.delta_height', 0), 10),
|
34
|
-
inline: 1,
|
35
|
-
resizable: false,
|
36
|
-
popup_css: false, // prevent tinymce from injecting some default css into our dialog box
|
37
|
-
close_previous: true, // close any previously opened dialogs
|
38
|
-
scrollbars: false
|
46
|
+
// Register picker button
|
47
|
+
ed.addButton('spud_media_picker', {
|
48
|
+
title: 'Insert Media',
|
49
|
+
cmd: 'spudMediaShowPicker',
|
50
|
+
image: '<%= asset_path('admin/media_tiny.png') %>',
|
51
|
+
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])'
|
39
52
|
});
|
40
|
-
});
|
41
53
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
54
|
+
ed.addCommand('spudMediaInsertSelected', function(ui, data){
|
55
|
+
if(data.type == 'img'){
|
56
|
+
var img = ed.dom.createHTML('img', {
|
57
|
+
src: data.url,
|
58
|
+
title: data.title,
|
59
|
+
alt: data.alt,
|
60
|
+
style: data.style,
|
61
|
+
width: data.width,
|
62
|
+
height: data.height
|
63
|
+
});
|
64
|
+
ed.execCommand('mceInsertContent', false, img);
|
65
|
+
}
|
66
|
+
else{
|
67
|
+
var link = ed.dom.createHTML('a', {
|
68
|
+
href: data.url,
|
69
|
+
target: data.target
|
70
|
+
}, data.text);
|
71
|
+
ed.execCommand('mceInsertContent', false, link);
|
72
|
+
}
|
73
|
+
});
|
49
74
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
ed.execCommand('mceInsertContent', false, img);
|
61
|
-
}
|
62
|
-
else{
|
63
|
-
var link = ed.dom.createHTML('a', {
|
64
|
-
href: data.url,
|
65
|
-
target: data.target
|
66
|
-
}, data.text);
|
67
|
-
ed.execCommand('mceInsertContent', false, link);
|
68
|
-
}
|
69
|
-
});
|
75
|
+
/*
|
76
|
+
* Add a node change handler, selects the button in the UI when a image is selected
|
77
|
+
* @param {tinymce.Editor} ed Editor
|
78
|
+
* @param {tinymce.ControlManager} cm
|
79
|
+
* @param {node} n
|
80
|
+
*/
|
81
|
+
// ed.onNodeChange.add(function(ed, cm, n) {
|
82
|
+
// cm.setActive('spud_media_picker', n.nodeName == 'IMG');
|
83
|
+
// });
|
84
|
+
},
|
70
85
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
86
|
+
/**
|
87
|
+
* Returns information about the plugin as a name/value array.
|
88
|
+
* The current keys are longname, author, authorurl, infourl and version.
|
89
|
+
*
|
90
|
+
* @return {Object} Name/value array containing information about the plugin.
|
91
|
+
*/
|
92
|
+
getInfo: function(){
|
93
|
+
return {
|
94
|
+
longname : 'TB Media',
|
95
|
+
author : 'Westlake Design',
|
96
|
+
authorurl : 'http://www.westlakedesign.com',
|
97
|
+
infourl : 'https://bitbucket.org/westlakedesign/tb_media',
|
98
|
+
version : "1.0"
|
99
|
+
};
|
100
|
+
}
|
101
|
+
});
|
81
102
|
|
82
|
-
|
83
|
-
|
84
|
-
* The current keys are longname, author, authorurl, infourl and version.
|
85
|
-
*
|
86
|
-
* @return {Object} Name/value array containing information about the plugin.
|
87
|
-
*/
|
88
|
-
getInfo: function(){
|
89
|
-
return {
|
90
|
-
longname : 'TB Media',
|
91
|
-
author : 'Westlake Design',
|
92
|
-
authorurl : 'http://www.westlakedesign.com',
|
93
|
-
infourl : 'https://bitbucket.org/westlakedesign/tb_media',
|
94
|
-
version : "1.0"
|
95
|
-
};
|
96
|
-
}
|
103
|
+
// Register plugin
|
104
|
+
tinymce.PluginManager.add('spud_media_picker', tinymce.plugins.SpudMediaPicker);
|
97
105
|
});
|
98
|
-
|
99
|
-
// Register plugin
|
100
|
-
tinymce.PluginManager.add('spud_media_picker', tinymce.plugins.SpudMediaPicker);
|
101
106
|
})();
|
@@ -54,17 +54,6 @@ img.size-50-thumb {
|
|
54
54
|
border-top-right-radius: 8px;
|
55
55
|
border-top-left-radius: 8px;
|
56
56
|
background-image: linear-gradient(bottom, rgb(204,204,204) 33%, rgb(230,230,230) 66%);
|
57
|
-
background-image: -o-linear-gradient(bottom, rgb(204,204,204) 33%, rgb(230,230,230) 66%);
|
58
|
-
background-image: -moz-linear-gradient(bottom, rgb(204,204,204) 33%, rgb(230,230,230) 66%);
|
59
|
-
background-image: -webkit-linear-gradient(bottom, rgb(204,204,204) 33%, rgb(230,230,230) 66%);
|
60
|
-
background-image: -ms-linear-gradient(bottom, rgb(204,204,204) 33%, rgb(230,230,230) 66%);
|
61
|
-
background-image: -webkit-gradient(
|
62
|
-
linear,
|
63
|
-
left bottom,
|
64
|
-
left top,
|
65
|
-
color-stop(0.33, rgb(204,204,204)),
|
66
|
-
color-stop(0.66, rgb(230,230,230))
|
67
|
-
);
|
68
57
|
clear: both;
|
69
58
|
}
|
70
59
|
#spud_media_cropper_toolbar form{
|
@@ -100,4 +89,4 @@ user-select: none;
|
|
100
89
|
a[id^="spud_media_cropper_resize_"]:active{
|
101
90
|
position: relative;
|
102
91
|
top: 1px;
|
103
|
-
}
|
92
|
+
}
|
@@ -1,72 +1,65 @@
|
|
1
1
|
class Admin::MediaController < Admin::ApplicationController
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def index
|
8
|
-
@media = SpudMedia.order("created_at DESC").paginate :page => params[:page]
|
9
|
-
respond_with @media
|
10
|
-
end
|
2
|
+
layout 'admin/detail'
|
3
|
+
add_breadcrumb 'Media', :admin_media_path
|
4
|
+
belongs_to_app :media
|
5
|
+
before_action :load_media, only: [:edit, :update, :show, :destroy, :set_private]
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
respond_with @media
|
17
|
-
end
|
7
|
+
def index
|
8
|
+
@media = SpudMedia.order('created_at DESC').paginate(page: params[:page])
|
9
|
+
respond_with @media
|
10
|
+
end
|
18
11
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
flash[:notice] = "File uploaded successfully"
|
26
|
-
if @media.is_image?
|
27
|
-
location = edit_admin_medium_path(@media.id)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
respond_with @media, :location => location
|
31
|
-
end
|
12
|
+
def new
|
13
|
+
@page_name = 'New Media'
|
14
|
+
add_breadcrumb 'New', :new_admin_medium_path
|
15
|
+
@media = SpudMedia.new
|
16
|
+
respond_with @media
|
17
|
+
end
|
32
18
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
19
|
+
def create
|
20
|
+
@page_name = 'New Media'
|
21
|
+
add_breadcrumb 'New', :new_admin_medium_path
|
22
|
+
@media = SpudMedia.new(media_params)
|
23
|
+
location = admin_media_path
|
24
|
+
if @media.save
|
25
|
+
flash[:notice] = 'File uploaded successfully'
|
26
|
+
location = edit_admin_medium_path(@media.id) if @media.is_image?
|
27
|
+
end
|
28
|
+
respond_with @media, location: location
|
29
|
+
end
|
39
30
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
31
|
+
def edit
|
32
|
+
unless @media.is_image?
|
33
|
+
flash[:error] = "Unable to edit #{@media.attachment_file_name}"
|
34
|
+
redirect_to admin_media_path
|
35
|
+
end
|
36
|
+
end
|
46
37
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
38
|
+
def update
|
39
|
+
@media.attachment.reprocess! if @media.update(media_params)
|
40
|
+
respond_with @media, location: admin_media_path
|
41
|
+
end
|
51
42
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
43
|
+
def destroy
|
44
|
+
flash[:notice] = 'File successfully destroyed' if @media.destroy
|
45
|
+
respond_with @media, location: admin_media_path
|
46
|
+
end
|
57
47
|
|
58
|
-
private
|
59
|
-
def load_media
|
60
|
-
@media = SpudMedia.where(:id => params[:id]).first
|
61
|
-
if @media.blank?
|
62
|
-
flash[:error] = "Media Asset not found!"
|
63
|
-
redirect_to admin_media_path() and return
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
48
|
+
private
|
67
49
|
|
68
|
-
|
69
|
-
|
70
|
-
|
50
|
+
def load_media
|
51
|
+
@media = SpudMedia.where(id: params[:id]).first
|
52
|
+
if @media.blank?
|
53
|
+
flash[:error] = 'Media Asset not found!'
|
54
|
+
redirect_to(admin_media_path()) && return
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def media_params
|
59
|
+
params.require(:spud_media).permit(
|
60
|
+
:attachment_content_type, :attachment_file_name,
|
61
|
+
:attachment_file_size, :attachment,
|
62
|
+
:crop_x, :crop_y, :crop_w, :crop_h, :crop_s)
|
63
|
+
end
|
71
64
|
|
72
65
|
end
|