/contenteditable

Primary LanguageRubyMIT LicenseMIT

Contenteditable

Contenteditable helps to integrate an easy CRM system to provide a client an opportunity editing content on a website.

  • This is a lite version, it's easy connectable to an app
  • Generates a table to keep the data
  • Uses contenteditable HTML5 tag

demo: http://www.youtube.com/watch?v=WRt5WoQQajU&feature=youtu.be

Installation

Install gem

gem "contenteditable", :github => 'micmmakarov/contenteditable'

bundle install

Run install script

rails generate contenteditable:install

Generate table

rake db:migrate

Use

Use simple tags in views

after BODY tag add:

<%= save_button %> to use build-in save button or alternatively use "contenteditable_save_button" class if you want to make a button on your own

In the view, where it's supposed to be contenteditable

<%= ceditable("title", "h1") %>

or

<%= ceditable("title", "h1", {:class => 'green'}) %>

where "title" should be a unique key, for example "front page tagline" or "about description"

Configure access

application controller:

contenteditable_filter :autintificate_admin!

this is an analog of "before_filter" if you use devise. Editable interface will be only provided to admins in this case.

Rails 3.2.x fix

Add this to your Gemfile:

gem 'i18n-active_record',
  :git => 'git://github.com/svenfuchs/i18n-active_record.git',
  :branch => 'rails-3.2',
  :require => 'i18n/active_record'

Enjoy

First version must be buggy. Fix it if you find!

Enjoy!

Under MIT license