Sha256: ce7090a3179e79bffe47bd942b3ac4e771d052369809afd0879455d8a26251fa

Contents?: true

Size: 1.69 KB

Versions: 4

Compression:

Stored size: 1.69 KB

Contents

*********************
Textile Editor Helper
*********************

The assets have been copied.


*********************
Example App
*********************

rails new something -d mysql
rake db:create RAILS_ENV
rails g scaffold Post body:text
rake db:migrate

*********************
Example layout
*********************

<!DOCTYPE html>
<html>
<head>
  <title>Peace</title>
  <%= stylesheet_link_tag 'application', media: 'all' %>

  <%= csrf_meta_tags %>
  <%= yield :head %>
</head>
<body>

<%= yield %>
<%= javascript_include_tag 'application' %>
<%= yield :javascript %>
</body>
</html>


***************************
Example application.js
***************************

//= require jquery
//= require jquery_ujs
//= require textile-editor
//= require textile-editor-config

****************************
Example form
****************************

<%= form_for(@post) do |f| %>
  <% if @post.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>

      <ul>
      <% @post.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :body %><br />
    <%= f.textile_editor :body %>
  </div>
  <div class="actions">
    <%= f.submit %>
    <% content_for :javascript do %>
    <%= textile_editor_initialize %>
    <% end %>
  </div>
<% end %>



********************************
Example: If you use simple_form
********************************

<%= simple_form_for @post do |f| %>
  <%= f.input :body, as: :textile_editor %>
  <%= f.button :submit %>

  <% content_for :javascript do %>
    <%= textile_editor_initialize %>
  <% end %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
textile_editor_helper-0.1.4 vendor/README
textile_editor_helper-0.1.3 vendor/README
textile_editor_helper-0.1.2 vendor/README
textile_editor_helper-0.1.1 vendor/README