tb_media 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16f0a55ec656f1ee487ff39fcb9a93230854cf8e
4
- data.tar.gz: 16f7960348f0918610608ab85079eccbe95dacd2
3
+ metadata.gz: 3c3448825f405e61320e2742b24f276e871e78cf
4
+ data.tar.gz: 7496f2fb04fd200df6801b29513b5d826975a54a
5
5
  SHA512:
6
- metadata.gz: 4e59f606e31de84bad6bafbc05a216184da92d610734b14b6342dda668b1ae99908e259cfddf86e72e5e13edd840e6fea5d9dd31c0ec3135b59bdfd21265f68d
7
- data.tar.gz: 6800dd0b04f58df98b2a203356503f5720bbe05afb55042a08b4c249d3f135bb5aa75993628016f92c62485b4e3e1a26b53ec74c59d8922b3a01c8690b6d43ef
6
+ metadata.gz: 2bce79a6d9912df6364d076ea641aad1eb356d181297839e65c0b5b5f663a7b7bfc760112b3da4791c7a7b55323d57b20bf0f442e9de62e9e88254fc64df3b73
7
+ data.tar.gz: 500f08f685d773c53eaa776a4991588d19e1432a2e6f2e6f79b70183b976adeead0df0313d264feacf52e359193b5344598a29bcef571fd952493fd8dfe4ae04
@@ -163,4 +163,5 @@ spud.admin.media = new function(){
163
163
  return false;
164
164
  }
165
165
  };
166
+
166
167
  };
@@ -10,92 +10,93 @@
10
10
 
11
11
  (function() {
12
12
 
13
- // Tell spud about our plugin and button
14
- spud.admin.editor.registerPlugin('spud_media_picker');
15
- spud.admin.editor.registerButton('spud_media_picker');
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
- 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
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
- // 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])'
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
- 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
- });
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
- * 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
- },
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
- * 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
- }
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
- belongs_to_spud_app :media
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
@@ -3,8 +3,9 @@ require 'paperclip'
3
3
 
4
4
  module Spud
5
5
  module Media
6
- class Engine < Rails::Engine
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
- end
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
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Media
3
- VERSION = "1.2.1"
3
+ VERSION = "1.2.2"
4
4
  end
5
5
  end
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.1
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: 2015-10-12 00:00:00.000000000 Z
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.0
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.0
26
+ version: 1.3.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: paperclip
29
29
  requirement: !ruby/object:Gem::Requirement