tinymce-rails-imageupload 3.5.6.2 → 3.5.6.3

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.
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ ## 3.5.6.3 (August 27, 2012)
2
+
3
+ * Make the POST URL configurable (#3). Thanks to minaguib (Mina Naguib)
4
+ * Make it possible to send extra parameters to the controller (#10). Thanks to minaguib (Mina Naguib)
5
+
1
6
  ## 3.5.6.2 (August 20, 2012)
2
7
 
3
8
  * Portugese translation. Thanks to Hefesto
data/README.markdown CHANGED
@@ -1,11 +1,11 @@
1
1
  # tinymce-rails-imageupload
2
2
 
3
- Simple plugin for TinyMCE that allows uploading images and inserting.
4
- It makes no assumptions about how you store the images, but it POSTs to a URL and expects JSON back (see the Setup section).
3
+ Simple plugin for TinyMCE that allows uploading images and inserting.
4
+ It makes no assumptions about how you store the images, but it POSTs to a URL and expects JSON back (see the Setup section).
5
5
 
6
- This plugin borrows heavily from work done by [Peter Shoukry](http://77effects.com/).
6
+ This plugin borrows heavily from work done by [Peter Shoukry](http://77effects.com/).
7
7
 
8
- The icon used for the button comes from the icon set [Silk by famfamfam](http://www.famfamfam.com/lab/icons/silk/)
8
+ The icon used for the button comes from the icon set [Silk by famfamfam](http://www.famfamfam.com/lab/icons/silk/)
9
9
 
10
10
  ## Requirements
11
11
 
@@ -14,29 +14,37 @@ The icon used for the button comes from the icon set [Silk by famfamfam](http://
14
14
 
15
15
  ## Setup
16
16
 
17
- Add the gem to your Gemfile
17
+ ### Add the gem to your Gemfile
18
18
 
19
- gem 'tinymce-rails-imageupload', '~> 3.5.6.1'
19
+ gem 'tinymce-rails-imageupload', '~> 3.5.6.3'
20
20
 
21
- Set up TinyMCE as you would normally, but in the call to `.tinymce()`, add
21
+ ### Set up TinyMCE as you would normally, but in the call to `.tinymce()`, add
22
22
 
23
23
  plugins: "uploadimage"
24
24
  # theme_advanced_buttonsX must include "uploadimage" somewhere to have the button appear
25
25
 
26
- and the rest should happen automatically.
26
+ and the rest should happen automatically.
27
27
 
28
- The plugin POSTs to `/tinymce_assets` by default, which is currently not configurable ([issue #3](https://github.com/PerfectlyNormal/tinymce-rails-imageupload/issues/3)).
29
- Set it up using something similar in `routes.rb`
28
+ ### Set up upload URL and handler
29
+
30
+ The plugin defaults to POSTing to `/tinymce_assets`. You may modify it by supplying option `uploadimage_form_url` in the call to `.tinymce()`
31
+
32
+ Routing to your controller must be done manually. Set it up using something similar in `routes.rb`:
30
33
 
31
34
  post '/tinymce_assets' => 'tinymce_assets#create'
32
35
 
33
- This action gets called with a file parameter creatively called `file`, and must respond with JSON, containing the URL to the image.
34
- The JSON has to be returned with a content type of "text/html" to work, which is going to be fixed as soon as possible ([issue #7](https://github.com/PerfectlyNormal/tinymce-rails-imageupload/issues/7)).
35
- Example:
36
+ The plugin will relay option `uploadimage_hint` in the call to `.tinymce()` to the POSTed URL as param `hint`. You may use this to relay any hints you wish (for example, blog post ID #) to the controller.
37
+
38
+ This action gets called with a file parameter creatively called `file`, and must respond with JSON, containing the URL to the image.
39
+
40
+ The JSON has to be returned with a content type of "text/html" to work, which is going to be fixed as soon as possible ([issue #7](https://github.com/PerfectlyNormal/tinymce-rails-imageupload/issues/7)).
41
+
42
+ Example:
36
43
 
37
44
  class TinymceAssetsController < ApplicationController
38
45
  def create
39
46
  # Take upload from params[:file] and store it somehow...
47
+ # Optionally also accept params[:hint] and consume if needed
40
48
 
41
49
  render json: {
42
50
  image: {
@@ -46,11 +54,11 @@ Example:
46
54
  end
47
55
  end
48
56
 
49
- If the JSON response contains a `width` and/or `height` key, those will be used in the inserted HTML (`<img src="..." width="..." height="...">`), but if those are not present, the inserted HTML is just `<img src="...">`.
57
+ If the JSON response contains a `width` and/or `height` key, those will be used in the inserted HTML (`<img src="..." width="..." height="...">`), but if those are not present, the inserted HTML is just `<img src="...">`.
50
58
 
51
59
  ## Internationalization
52
60
 
53
- I18n is taken care of by `tinymce-rails`. This gem includes strings for English, Norwegian and Russian.
61
+ I18n is taken care of by `tinymce-rails`. This gem includes strings for english, norwegian, russian and portugese.
54
62
  To add your own language, create the files `<code>.js` and `<code>_dlg.js` in `vendor/assets/javascripts/tinymce/plugins/uploadimage/langs` in your application,
55
63
  or fork the gem and add your own translations there.
56
64
 
@@ -82,4 +90,4 @@ The plugin is released under the MIT license.
82
90
 
83
91
  TinyMCE is released under the LGPL Version 2.1.
84
92
 
85
- The icon used for the button comes from the icon set Silk from famfamfam, released under the [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/)
93
+ The icon used for the button comes from the icon set Silk from famfamfam, released under the [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/)
@@ -3,7 +3,15 @@ module Tinymce
3
3
  module Imageupload
4
4
  class Engine < ::Rails::Engine
5
5
  initializer 'TinymceRailsImageupload.assets_pipeline' do |app|
6
- app.config.assets.precompile << "tinymce/plugins/uploadimage/editor_plugin.js"
6
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/editor_plugin.js"
7
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/langs/en.js"
8
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/langs/en_dlg.js"
9
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/langs/nb.js"
10
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/langs/nb_dlg.js"
11
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/langs/pt.js"
12
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/langs/pt_dlg.js"
13
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/langs/ru.js"
14
+ app.config.assets.precompile << "tinymce/plugins/uploadimage/langs/ru_dlg.js"
7
15
  end
8
16
  end
9
17
  end
@@ -1,7 +1,7 @@
1
1
  module Tinymce
2
2
  module Rails
3
3
  module Imageupload
4
- VERSION = "3.5.6.2"
4
+ VERSION = "3.5.6.3"
5
5
  end
6
6
  end
7
7
  end
@@ -39,13 +39,16 @@
39
39
  }
40
40
 
41
41
  var UploadImageDialog = {
42
+
42
43
  init: function() {
43
- var f = document.forms[0];
44
+ this.f = document.forms[0];
45
+ this.f.action = tinyMCEPopup.getParam("uploadimage_form_url", "/tinymce_assets");
46
+ document.getElementById("hint").value = tinyMCEPopup.getParam("uploadimage_hint", "");
47
+ document.getElementById("authenticity_token").value = (window.opener || window.parent).$("meta[name='csrf-token']")[0].content;
44
48
  },
45
49
 
46
50
  insert: function() {
47
- document.getElementById("authenticity_token").value = (window.opener || window.parent).$("meta[name='csrf-token']")[0].content;
48
- document.forms[0].submit();
51
+ this.f.submit();
49
52
  }
50
53
  };
51
54
 
@@ -53,9 +56,11 @@
53
56
  </script>
54
57
  </head>
55
58
  <body>
56
- <form method="post" enctype='multipart/form-data' accept-charset="UTF-8" target="hidden_upload" action='/tinymce_assets' name="uploadimageForm">
59
+
60
+ <form method="post" enctype='multipart/form-data' accept-charset="UTF-8" target="hidden_upload" action='#replaceme' name="uploadimageForm">
57
61
  <input type="hidden" name="utf8" value="✓">
58
- <input type="hidden" name="authenticity_token" id="authenticity_token" value="">
62
+ <input type="hidden" name="authenticity_token" id="authenticity_token" value="#replaceme">
63
+ <input type="hidden" name="hint" id="hint" value="#replaceme">
59
64
  <iframe id="hidden_upload" name="hidden_upload" src='' onload='uploadDone("hidden_upload")' style='width:0;height:0;border:0px solid #fff'></iframe>
60
65
 
61
66
  <h1>{#uploadimage_dlg.header}</h1>
metadata CHANGED
@@ -1,87 +1,87 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: tinymce-rails-imageupload
3
- version: !ruby/object:Gem::Version
4
- version: 3.5.6.2
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 3
7
+ - 5
8
+ - 6
9
+ - 3
10
+ version: 3.5.6.3
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Per Christian B. Viken
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-08-20 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-08-27 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
15
22
  name: railties
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '3.1'
22
- type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '3.1'
30
- - !ruby/object:Gem::Dependency
31
- name: tinymce-rails
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: 3.4.9
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 3
30
+ - 1
31
+ version: "3.1"
38
32
  type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: tinymce-rails
39
36
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 3
43
+ - 4
44
+ - 9
45
45
  version: 3.4.9
46
- - !ruby/object:Gem::Dependency
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
47
49
  name: bundler
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: 1.0.0
54
- type: :development
55
50
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
59
53
  - - ~>
60
- - !ruby/object:Gem::Version
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 0
58
+ - 0
61
59
  version: 1.0.0
62
- - !ruby/object:Gem::Dependency
63
- name: rails
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '3.1'
70
60
  type: :development
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: rails
71
64
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '3.1'
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ segments:
70
+ - 3
71
+ - 1
72
+ version: "3.1"
73
+ type: :development
74
+ version_requirements: *id004
78
75
  description: TinyMCE plugin for taking image uploads in Rails >= 3.1
79
- email:
76
+ email:
80
77
  - perchr@northblue.org
81
78
  executables: []
79
+
82
80
  extensions: []
81
+
83
82
  extra_rdoc_files: []
84
- files:
83
+
84
+ files:
85
85
  - .gitignore
86
86
  - CHANGELOG.markdown
87
87
  - Gemfile
@@ -104,28 +104,35 @@ files:
104
104
  - vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/pt_dlg.js
105
105
  - vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/ru.js
106
106
  - vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/ru_dlg.js
107
+ has_rdoc: true
107
108
  homepage: http://eastblue.org/oss
108
109
  licenses: []
110
+
109
111
  post_install_message:
110
112
  rdoc_options: []
111
- require_paths:
113
+
114
+ require_paths:
112
115
  - lib
113
- required_ruby_version: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- required_rubygems_version: !ruby/object:Gem::Requirement
120
- none: false
121
- requirements:
122
- - - ! '>='
123
- - !ruby/object:Gem::Version
124
- version: '0'
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ segments:
121
+ - 0
122
+ version: "0"
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ segments:
128
+ - 0
129
+ version: "0"
125
130
  requirements: []
131
+
126
132
  rubyforge_project:
127
- rubygems_version: 1.8.24
133
+ rubygems_version: 1.3.6
128
134
  signing_key:
129
135
  specification_version: 3
130
136
  summary: TinyMCE plugin for taking image uploads in Rails >= 3.1
131
137
  test_files: []
138
+