alchemy_file_selector 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7faa80a1b6e64354fcc16d81e16c1ffb01e05813
4
- data.tar.gz: 231307038664d5b0f57bab002d46852d78c065bc
3
+ metadata.gz: 2de54e2215d87892bcf94b544d89590450421c23
4
+ data.tar.gz: e91204f7cb8f9a213815cf579d32789867d02d83
5
5
  SHA512:
6
- metadata.gz: d9cd79d4c18c2ef69e173897d2e6da10061fda4342367ba281de1405648b9cb10534bf62e381c8465912ef5263d980851295990c1d09bbba9063a1503a1aa38d
7
- data.tar.gz: '095abec9cf53bf479a856fa0fa7e401ab778e2af0e68e427fb59c3ff44d1030abe6447e7a0589ec26301a577da96c458f128f49d56b63c56fd27b7f5149525a4'
6
+ metadata.gz: 6e1ad52332f500ece89222ad59145ecf393928dfcfaa8304ea641604329398ee4974c4fb85c8bbc43c2a078c5b17fff46e5809c4635117f1d13be4fe570c1549
7
+ data.tar.gz: 87a935043162863ac6ec0e2369df6ddc6c2aaf05fd56285250debdc24c3d0fda19dca1ff60d2ae76d416fde669e80eebc4d31f7be34554744d2dd6d7f2ed21cd
@@ -1,52 +1,55 @@
1
1
  tinymce.PluginManager.add('alchemy_file_selector', function (editor, url) {
2
2
 
3
- var content_id = editor.targetElm.name.match(/contents\[([0-9]+)\]/)[1];
4
-
5
- var close_editor_windows = function () {
6
- tinymce.each(editor.windowManager.getWindows(), function (w) {
7
- w.hide();
8
- });
9
- }
10
-
11
- var show_editor_windows = function () {
12
- tinymce.each(editor.windowManager.getWindows(), function (w) {
13
- w.show();
14
- });
15
- }
16
-
17
- editor.settings.file_picker_callback = function (callback, value, meta) {
18
-
19
- close_editor_windows();
3
+ var exist_content_container = editor.targetElm.name.match(/contents\[([0-9]+)\]/);
4
+
5
+ if (exist_content_container) {
6
+ var content_id = exist_content_container[1];
7
+
8
+ var close_editor_windows = function () {
9
+ tinymce.each(editor.windowManager.getWindows(), function (w) {
10
+ w.hide();
11
+ });
12
+ }
13
+
14
+ var show_editor_windows = function () {
15
+ tinymce.each(editor.windowManager.getWindows(), function (w) {
16
+ w.show();
17
+ });
18
+ }
19
+
20
+ editor.settings.file_picker_callback = function (callback, value, meta) {
21
+
22
+ close_editor_windows();
23
+
24
+ //url fasullo per avere immagini
25
+ var url = Alchemy.routes.admin_picture_path('?content_id=' + content_id + '&element_id=0&options%5Bcrop%5D=true&options%5Bfixed_ratio%5D=false&swap=true');
26
+ dialog = new Alchemy.Dialog(url, {
27
+ title: "Insert image",
28
+ size: '780x580',
29
+ padding: false,
30
+ modal: true
31
+ })
20
32
 
21
- //url fasullo per avere immagini
22
- var url = Alchemy.routes.admin_picture_path('?content_id=' + content_id + '&element_id=0&options%5Bcrop%5D=true&options%5Bfixed_ratio%5D=false&swap=true');
23
- dialog = new Alchemy.Dialog(url, {
24
- title: "Insert image",
25
- size: '780x580',
26
- padding: false,
27
- modal: true
28
- })
33
+ dialog.open();
29
34
 
30
- dialog.open();
31
35
 
36
+ $(dialog.dialog_body).on('click', '.assign_image_list_detail a', function (e) {
37
+ e.preventDefault();
38
+ e.stopPropagation();
32
39
 
33
- $(dialog.dialog_body).on('click', '.assign_image_list_detail a', function (e) {
34
- e.preventDefault();
35
- e.stopPropagation();
40
+ var image_id = this.href.match(/picture_id=([0-9]+)/)[1];
36
41
 
37
- var image_id = this.href.match(/picture_id=([0-9]+)/)[1];
42
+ $.ajax({
43
+ url: Alchemy.routes.admin_picture_path(image_id) + ".json",
44
+ success: function (data) {
45
+ callback(data.url, {alt: data.alt, width: data.width, height: data.height});
46
+ show_editor_windows();
47
+ dialog.close();
48
+ }
49
+ })
38
50
 
39
- $.ajax({
40
- url: Alchemy.routes.admin_picture_path(image_id) + ".json",
41
- success: function (data) {
42
- callback(data.url, {alt: data.alt, width: data.width, height: data.height});
43
- show_editor_windows();
44
- dialog.close();
45
- }
46
- })
47
-
48
- });
51
+ });
49
52
 
53
+ }
50
54
  }
51
-
52
55
  });
@@ -1,3 +1,3 @@
1
1
  module AlchemyFileSelector
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_file_selector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marino Bonetti
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-24 00:00:00.000000000 Z
12
+ date: 2020-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.5.2
111
+ rubygems_version: 2.6.14.1
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: AlchemyFileSelector