{"id":13682690,"url":"https://github.com/SammyLin/redactor-rails","last_synced_at":"2025-04-30T09:33:45.464Z","repository":{"id":3697828,"uuid":"4768692","full_name":"SammyLin/redactor-rails","owner":"SammyLin","description":"This repo is deprecated. Please check out official gem for Redactor 2. https://github.com/Redactor2/redactor2_rails","archived":false,"fork":false,"pushed_at":"2019-03-13T16:03:29.000Z","size":1947,"stargazers_count":389,"open_issues_count":55,"forks_count":253,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-11-05T06:05:15.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SammyLin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-24T00:13:51.000Z","updated_at":"2024-07-19T22:17:43.000Z","dependencies_parsed_at":"2022-08-20T16:50:08.868Z","dependency_job_id":null,"html_url":"https://github.com/SammyLin/redactor-rails","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SammyLin%2Fredactor-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SammyLin%2Fredactor-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SammyLin%2Fredactor-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SammyLin%2Fredactor-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SammyLin","download_url":"https://codeload.github.com/SammyLin/redactor-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224206168,"owners_count":17273402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T13:01:51.257Z","updated_at":"2024-11-12T02:31:31.390Z","avatar_url":"https://github.com/SammyLin.png","language":"Ruby","readme":"\n# This repo is deprecated\n## Please check out official gem for Redactor 2. https://github.com/Redactor2/redactor2_rails\n\n# Rails 3.2 Integration for Redactor (Devise Edition)\n\nThe redactor-rails gem integrates the [Redactor](http://redactorjs.com/) editor with the Rails 3.2 asset pipeline.\n\nThis gem bundles Redactor version 10.0.4 which is the most recent version as of January 9, 2015. Check [Redactor's changelog](http://imperavi.com/redactor/log/) for further updates.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'redactor-rails'\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install redactor-rails\n\n### Now generate models for store uploading files\n\n#### ActiveRecord + carrierwave\n\n    gem \"carrierwave\"\n    gem \"mini_magick\"\n\n    $ rails generate redactor:install\n\n    or\n\n    $ rails generate redactor:install --devise\n\n    # --devise option generate user_id attribute for asset(Picture, Document) models. For more details show Devise gem.\n    # Now, Pictures and Documents uploading available only for signed in users\n    # All uploaded files will stored with current user_id\n    # User will choose only own uploaded Pictures and Documents\n\n    $ rake db:migrate\n\n#### Mongoid + carrierwave\n    gem \"carrierwave\"\n    gem \"carrierwave-mongoid\", :require =\u003e \"carrierwave/mongoid\"\n    gem \"mini_magick\"\n\n    $ rails generate redactor:install\n\n### Include the Redactor assets\n\nAdd to your `application.js`:\n\n      //= require redactor-rails\n\nAdd to your `application.css`:\n\n      *= require redactor-rails\n\n### Initialize Redactor\n\nFor each textarea that you want to use with Redactor, add the \"redactor\" class and ensure it has a unique ID:\n\n    \u003c%= text_area_tag :editor, \"\", :class =\u003e \"redactor\", :rows =\u003e 40, :cols =\u003e 120 %\u003e\n\n### Custom Your redactor\n\nIf you need change some config in redactor, you can\n\n    $ rails generate redactor:config\n\nThen generate `app\\assets\\redactor-rails\\config.js`.\n\nSee the [Redactor Documentation](http://imperavi.com/redactor/docs/settings/) for a full list of configuration options.\n\n\nIf You Want To setup a new language in Redactor you should do two things:\n\nIn you file `app\\assets\\redactor-rails\\config.js` set option\n\n    \"lang\":'zh_tw'\n\nand\n\nif redactor-rails gem version \u003c= 0.3.7\n\nAdd to your layout\n\n\n    \u003c%= redactor_lang('zh_tw') %\u003e\n\nelsif redactor-rails gem version \u003e= 0.4\n\nAdd to your `application.js`:\n\n    //= require redactor-rails/langs/zh_tw\n\n#### Setting a max image size with carrierwave\n\nIf you want to set a maximum image size used when a user uploads an image via carrierwave, open the uploader file and add add the following:\n\n    # app/uploaders/redactor_rails_picture_uploader.rb:33\n\n    process :resize_to_limit =\u003e [500, -1]\n\nThe above example will set the image to have a maximum width of 500px.\n\n### Using plugins\n\nThis gem comes bundled with several Redactor plugins:\n\n- Fullscreen\n- Clips\n- FontColor\n- FontSize\n- FontFamily\n- Text direction\n\nFull details of these can be found at [Redactor Plugins](http://imperavi.com/redactor/plugins/)\n\nTo include all the plugins just add to your `application.js`:\n\n        //= require redactor-rails/plugins\n\nand add to your `application.css`:\n\n        *= redactor-rails/plugins\n\nIf you would prefer to pick and choose which plugins to include you can\nadd for example:\n\n      //= require redactor-rails/plugins/fontsize\n      //= require redactor-rails/plugins/fontfamily\n\nAfter including the desired plugins they can be configured in the redactor config file as normal.\n\nTo add it into the editor just add 'plugins' attributes to config.js file and specify which ones do you want to use:\n\n      $('.redactor').redactor(\n        { \"plugins\": ['fontsize',\n                    'fontcolor',\n                    'fontfamily',\n                    'fullscreen',\n                    'textdirection',\n                    'clips']\n        });\n\n### Defining a Devise User Model\n\nBy default redactor-rails uses the `User` model.\n\nYou may use a different model by:\n\n1. Run a migration to update the user_id column in the\n2. Overriding the user class in an initializer.\n3. Overriding the authentication helpers in your controller.\n\n    Create a new Migration: `rails g rename_user_id_to_new_user_id`\n\n    ```\n    # db/migrate/...rename_user_id_to_new_user_id.rb\n\n    class RenameUserIdToNewUserId \u003c ActiveRecord::Migration\n      def up\n        rename_column :redactor_assets, :user_id, :admin_user_id\n      end\n\n      def down\n        rename_column :redactor_assets, :admin_user_id, :user_id\n      end\n    end\n    ```\n\n    ```\n    # config/initializers/redactor.rb\n    # Overrides the user class\n\n    module RedactorRails\n      def self.devise_user\n        %s(admin_user) # name of your user class\n      end\n\n      # You may override this to support legacy schema.\n      # def self.devise_user_key\n      #   \"#{self.devise_user.to_s}_id\".to_sym\n      # end\n    end\n    ```\n\n    ```\n    # app/controllers/application_controller.rb\n\n    class ApplicationController \u003c ActionController::Base\n      ...\n\n      def redactor_authenticate_user!\n        authenticate_admin_user! # devise before_filter\n      end\n\n      def redactor_current_user\n        current_admin_user # devise user helper\n      end\n    end\n    ```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Contributors\n\n[Sebastian Wilgosz](https://github.com/wilgoszpl)\n\n## Special Thanks\n\n[wildjcrt (Jerry Lee)](https://github.com/wildjcrt/)\n\n## Statement\n\n`redactor-rails` part of reference [galetahub/ckeditor](https://github.com/galetahub/ckeditor) project.\n\n`redactor-rails` uses MIT-LICENSE. Rock!!!!!\n\n## License\n\nthe `redactor-rails` project is MIT-LICENSE.\n\nYou may use `Redactor` for non-commercial websites for free, however, we do not guarantee any technical support.\n\nRedactor has [3 different licenses](http://imperavi.com/redactor/download/) for commercial use.\nFor details please see [License Agreement](http://imperavi.com/redactor/license/).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSammyLin%2Fredactor-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSammyLin%2Fredactor-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSammyLin%2Fredactor-rails/lists"}