forked from haikuwebdev/aftimagr
-
Notifications
You must be signed in to change notification settings - Fork 0
Rails plugin/generator for attachment_fu TinyMCE Image Management
License
SUDO-xx/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, a Rails controller, Rails views, and resource routes. Hopefully it "just works" but it's designed along the lines of Rails' 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/). I've only tested this 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, but the generated files and directories will be pluralized. For example: script/generate aftimagr image creates an ImagesController, app/views/images directory, etc. At this time, there is no option for producing singular names, so you'll just have to edit them. (Sorry - I'd likely add this if asked.) 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, the migration for it, and associates it to the model. If used in conjunction with --skip-model, you will need to create the association in the attachment_fu model. What You Do =========== * You should have an attachment_fu-based model for dealing with images in place. At this point the generator does not create that for you, but I'll probably make that an option soon. The model should be an attachment_fu based model and must provide a class method named thumbnails. (Technically the model could be implemented after the generator is run.) The alternative to providing a thumbnails method is to change all the @thumbnails stuff in the generated code. * 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.html.erb 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, 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 the attachment_fu model is ArticleImage and 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 TJ Stankus tj@haikuwebdev.com, 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