-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
106 lines (76 loc) · 3.54 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Aftimagr
========
This plugin is a generator for getting server-side image management to work
with the TinyMCE editor. It generates a TinyMCE plugin and Rails scaffolding.
It's designed along the lines of Rails's built-in scaffold generator; it gives
you bare-bones generated files with the expectation that you'll make changes to
fit your needs. The generator makes as few assumptions as possible about
application logic.
Dependencies
============
* Rails 2.1.
* Prototype Javascript library (comes with Rails)
* TinyMCE (http://tinymce.moxiecode.com/). Only tested with 3.x versions of
TinyMCE.
* attachment_fu plugin (http://github.com/technoweenie/attachment_fu/).
* responds_to_parent plugin
(http://github.com/haikuwebdev/responds_to_parent/tree/master)
This is a fork of the official responds_to_parent repository with some
changes.
Example
=======
script/generate aftimagr attachment_fu_model_name
The attachment_fu_model_name should be singular. For example:
script/generate aftimagr photo
creates a Photo model, PhotosController, app/views/photos directory, etc.
Optional Parameters
===================
--with-editable-image
This parameter will generate code for integrating with the editable-image gem.
The editable-image gem must be installed and configured in your app. See
http://github.com/haikuwebdev/editable-image/ for info.
Once you've run aftimagr with this option, you will need to edit the
picnik_params method created in the generated controller. If you have more than
one controller with a picnik_params method, you'll probably want to refactor
that.
--skip-model
Will not generate a model.
--skip-migration
Will not generate a migration.
--with-categories
Generates a separate ActiveRecord model for categories named
#{model_name}Category, a migration, and associates it to the
attachment_fu-based model. If used in conjunction with --skip-model, you will
need to create the association in the attachment_fu model.
Installing TinyMCE
==================
TinyMCE v3 must be installed at the default location in your Rails app:
RAILS_ROOT/public/javascripts/tinymce
I like to have a public/javascripts/tiny_mce_init.js and include it via
javascript_include_tag in my application layout file, but this is not
mandatory. As long as your tinyMCE.init has what it needs, it's all good.
Example javascript includes:
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'tinymce/jscripts/tiny_mce/tiny_mce', 'tiny_mce_init' %>
The generator doesn't touch your tinyMCE.init function, so you've gotta do
that. Your tinyMCE.init must pull in your plugin and its button to launch the
dialog window. It must also set the convert_urls and relative_urls options to
false. Refer to the TinyMCE docs for more info, but here's an example assuming
we've run `script/generate aftimagr article_image`
tinyMCE.init({
mode: "textareas",
theme: "advanced",
plugins: "article_image",
theme_advanced_buttons1: "bold,italic,link,unlink,bullist,numlist,code,separator,article_image",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
convert_urls: false,
relative_urls: false
});
You may want to edit the TinyMCE button image for generated TinyMCE plugins,
especially if you run the generator more than once, thereby making more than
one TinyMCE plugin. To change this button, replace the gif file in
your_tiny_mce_plugin_dir/img/your_tiny_mce_plugin.gif
Copyright (c) 2008-2009 TJ Stankus http://tj.stank.us, released under the MIT license.