rmce_uploadr 0.0.1 → 0.0.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.
- data/README.rdoc +45 -25
- data/VERSION +1 -1
- data/examples/sinatra/views/layout.erb +1 -1
- data/rmce_uploadr.gemspec +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,44 +1,64 @@
|
|
1
1
|
= rmce_uploadr
|
2
2
|
|
3
|
-
|
3
|
+
Here's a scenario this gem is suitable for.
|
4
4
|
|
5
|
-
|
5
|
+
You have multiple rack/sinatra/rails CMS-like apps where a page editing is done with TinyMCE.
|
6
|
+
You want all of them use the same storage / database for image manipulation.
|
6
7
|
|
7
|
-
|
8
|
-
* has a hidden upload form with an "upload" button
|
8
|
+
This gem uses Sinatra, ActiveRecord and Paperclip.
|
9
9
|
|
10
|
+
== Install
|
10
11
|
|
11
|
-
|
12
|
+
For this gem to work you *have* to put your TinyMCE javascripts in public/javascripts/tiny_mce.
|
12
13
|
|
13
|
-
|
14
|
+
=== 1. Install the gem
|
14
15
|
|
16
|
+
* add <tt>config.gem "rmce_uploadr"</tt> to environment.rb and run <tt>sudo rake gems:install</tt>
|
17
|
+
* add <tt>gem "rmce_uploadr"</tt> to Gemfile if your using Bundler and run <tt>bundle install</tt>
|
15
18
|
|
16
|
-
===
|
19
|
+
=== 2. Set RMceUploadr::App as a middleware
|
17
20
|
|
18
|
-
|
21
|
+
* for a rails app add the following inside <tt>Rails::Initializer.run</tt> block:
|
22
|
+
config.middleware.use "RMceUploadr::App" do |conf|
|
23
|
+
# configuration according to ActiveRecord::Base.establish_connection
|
24
|
+
conf.dbconf = {:adapter => 'sqlite3',
|
25
|
+
:database => File.join(File.dirname(__FILE__), '..', '..', 'shared', 'db.sqlite3')}
|
26
|
+
end
|
27
|
+
* almost the same if you're a rack/sinatra app:
|
28
|
+
use ::RMceUploadr::App do |conf|
|
29
|
+
# configuration according to ActiveRecord::Base.establish_connection
|
30
|
+
conf.dbconf = {:adapter => 'sqlite3',
|
31
|
+
:database => root_path('..', 'shared', 'db.sqlite3')}
|
32
|
+
end
|
19
33
|
|
34
|
+
=== 3. Add plugin loading to TinyMCE init function, e.g.
|
20
35
|
|
21
|
-
|
36
|
+
<script type="text/javascript" charset="utf-8">
|
37
|
+
// Initialize TinyMCE with rmce_uploadr plugin and inlinepopups
|
38
|
+
tinyMCE.init({
|
39
|
+
plugins: "rmce_uploadr,inlinepopups",
|
40
|
+
mode : "textareas",
|
41
|
+
theme : "advanced",
|
42
|
+
dialog_type: 'modal',
|
43
|
+
theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,bullist,numlist,undo,redo,link,unlink,image",
|
44
|
+
theme_advanced_buttons2 : "",
|
45
|
+
theme_advanced_buttons3 : "",
|
46
|
+
theme_advanced_toolbar_location : "top",
|
47
|
+
theme_advanced_toolbar_align : "left",
|
48
|
+
theme_advanced_statusbar_location : "bottom"
|
49
|
+
});
|
50
|
+
</script>
|
22
51
|
|
23
|
-
|
52
|
+
Notice <tt>plugins: "rmce_uploadr"</tt> and <tt>theme_advanced_buttons1: "image"</tt> (which you probably have already).
|
24
53
|
|
54
|
+
=== 4. You're done
|
25
55
|
|
26
|
-
|
56
|
+
Uploaded files will live in <tt>public/uploads/g/images/:id_partition/:style_:filename</tt> so
|
57
|
+
you probably want <tt>public/uploads/g/</tt> to be shared accross all your apps.
|
27
58
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
== GET /rmce_uploadr/tags.json
|
32
|
-
|
33
|
-
Returns an array of all (unique) tags used for images tagging.
|
34
|
-
e.g. [{"tag1": 3}, {"tag2": 5}, {"tag3": 7}]
|
35
|
-
|
36
|
-
|
37
|
-
== GET /javascripts/<a file name>.js
|
38
|
-
|
39
|
-
Returns a static javascript file from the gem's lib/rmce_uploadr/public/javascripts/ directory:
|
40
|
-
* rmce_uploadr.js
|
41
|
-
* tiny_mce/plugins/rmce_uploadr/editor_plugin.js
|
59
|
+
=== 5. Check out rails and sinatra examples
|
60
|
+
<tt>examples/rails</tt> and <tt>examples/sinatra</tt> are setup to work with <tt>examples/shared/db.sqlite3</tt> and
|
61
|
+
<tt>examples/shared/uploads</tt> directory.
|
42
62
|
|
43
63
|
|
44
64
|
== Note on Patches/Pull Requests
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<title>Sinatra Example app</title>
|
6
6
|
<script type="text/javascript" src="/javascripts/tiny_mce/tiny_mce.js"></script>
|
7
7
|
<script type="text/javascript" charset="utf-8">
|
8
|
-
// Initialize TinyMCE with
|
8
|
+
// Initialize TinyMCE with rmce_uploadr plugin and inlinepopups
|
9
9
|
tinyMCE.init({
|
10
10
|
plugins: "rmce_uploadr,inlinepopups",
|
11
11
|
mode : "textareas",
|
data/rmce_uploadr.gemspec
CHANGED