-
Notifications
You must be signed in to change notification settings - Fork 2
Rails plugin/generator for attachment_fu TinyMCE Image Management
License
haikuwebdev/aftimagr
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
About
Rails plugin/generator for attachment_fu TinyMCE Image Management
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published