tb_media 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/admin/media/application.js +1 -0
- data/app/assets/javascripts/admin/media/plugin.js.erb +82 -81
- data/app/controllers/admin/media_controller.rb +1 -1
- data/lib/spud_media/engine.rb +8 -2
- data/lib/spud_media/version.rb +1 -1
- data/spec/dummy/public/system/spud_media/1/small/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/small/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/small/test_img1.png +0 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c3448825f405e61320e2742b24f276e871e78cf
|
4
|
+
data.tar.gz: 7496f2fb04fd200df6801b29513b5d826975a54a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bce79a6d9912df6364d076ea641aad1eb356d181297839e65c0b5b5f663a7b7bfc760112b3da4791c7a7b55323d57b20bf0f442e9de62e9e88254fc64df3b73
|
7
|
+
data.tar.gz: 500f08f685d773c53eaa776a4991588d19e1432a2e6f2e6f79b70183b976adeead0df0313d264feacf52e359193b5344598a29bcef571fd952493fd8dfe4ae04
|
@@ -10,92 +10,93 @@
|
|
10
10
|
|
11
11
|
(function() {
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
$("html").on("tb:tinymce-loaded", function(){
|
14
|
+
// Tell spud about our plugin and button
|
15
|
+
spud.admin.editor.registerPlugin('spud_media_picker');
|
16
|
+
spud.admin.editor.registerButton('spud_media_picker');
|
17
|
+
tinymce.create('tinymce.plugins.SpudMediaPicker', {
|
18
|
+
/**
|
19
|
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
20
|
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
21
|
+
* of the editor instance to intercept that event.
|
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
|
39
|
+
});
|
40
|
+
});
|
16
41
|
|
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
|
42
|
+
// Register picker button
|
43
|
+
ed.addButton('spud_media_picker', {
|
44
|
+
title: 'Insert Media',
|
45
|
+
cmd: 'spudMediaShowPicker',
|
46
|
+
image: '<%= asset_path('admin/media_tiny.png') %>',
|
47
|
+
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])'
|
39
48
|
});
|
40
|
-
});
|
41
49
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
50
|
+
ed.addCommand('spudMediaInsertSelected', function(ui, data){
|
51
|
+
if(data.type == 'img'){
|
52
|
+
var img = ed.dom.createHTML('img', {
|
53
|
+
src: data.url,
|
54
|
+
title: data.title,
|
55
|
+
alt: data.alt,
|
56
|
+
style: data.style,
|
57
|
+
width: data.width,
|
58
|
+
height: data.height
|
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
|
+
});
|
49
70
|
|
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
|
-
});
|
71
|
+
/*
|
72
|
+
* Add a node change handler, selects the button in the UI when a image is selected
|
73
|
+
* @param {tinymce.Editor} ed Editor
|
74
|
+
* @param {tinymce.ControlManager} cm
|
75
|
+
* @param {node} n
|
76
|
+
*/
|
77
|
+
// ed.onNodeChange.add(function(ed, cm, n) {
|
78
|
+
// cm.setActive('spud_media_picker', n.nodeName == 'IMG');
|
79
|
+
// });
|
80
|
+
},
|
70
81
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
82
|
+
/**
|
83
|
+
* Returns information about the plugin as a name/value array.
|
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
|
+
}
|
97
|
+
});
|
81
98
|
|
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
|
-
}
|
99
|
+
// Register plugin
|
100
|
+
tinymce.PluginManager.add('spud_media_picker', tinymce.plugins.SpudMediaPicker);
|
97
101
|
});
|
98
|
-
|
99
|
-
// Register plugin
|
100
|
-
tinymce.PluginManager.add('spud_media_picker', tinymce.plugins.SpudMediaPicker);
|
101
102
|
})();
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Admin::MediaController < Admin::ApplicationController
|
2
2
|
layout 'admin/detail'
|
3
3
|
add_breadcrumb "Media", :admin_media_path
|
4
|
-
|
4
|
+
belongs_to_app :media
|
5
5
|
before_filter :load_media,:only => [:edit,:update,:show,:destroy,:set_private,:set_access]
|
6
6
|
|
7
7
|
def index
|
data/lib/spud_media/engine.rb
CHANGED
@@ -3,8 +3,9 @@ require 'paperclip'
|
|
3
3
|
|
4
4
|
module Spud
|
5
5
|
module Media
|
6
|
-
|
6
|
+
class Engine < Rails::Engine
|
7
7
|
engine_name :tb_media
|
8
|
+
|
8
9
|
initializer :admin do
|
9
10
|
config.assets.precompile += ['admin/media/picker.js']
|
10
11
|
Spud::Core.append_admin_javascripts('admin/media/application')
|
@@ -13,6 +14,11 @@ module Spud
|
|
13
14
|
config.admin_applications += [{:name => "Media", :thumbnail => "admin/media_thumb.png", :url => "/admin/media", :order => 3, :retina => true}]
|
14
15
|
end
|
15
16
|
end
|
16
|
-
|
17
|
+
|
18
|
+
initializer 'tb_media.assets' do
|
19
|
+
Rails.application.config.assets.precompile += ['admin/media_thumb.png']
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
17
23
|
end
|
18
24
|
end
|
data/lib/spud_media/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_media
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Westlake Design
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tb_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.3.
|
19
|
+
version: 1.3.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.3.
|
26
|
+
version: 1.3.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: paperclip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|