Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Show simple_form code used to render form.

  • Loading branch information...
commit a65c15f785f1ac6bffb3c39163d0fcfd29699bd8 1 parent c2b9a20
@fabioyamate fabioyamate authored
View
7 app/assets/javascripts/application.js
@@ -9,3 +9,10 @@
//= require bootstrap-alerts-1.3.0
//= require bootstrap-dropdown-1.3.0
//= require_tree .
+//
+
+$(function() {
+ $('a[data-code]').click(function() {
+ $('pre').toggle();
+ });
+});
View
6 app/assets/stylesheets/application.css
@@ -7,3 +7,9 @@
header.master {
padding-top: 60px;
}
+
+div.well {
+ padding: 5px 10px;
+}
+
+pre { display: none; }
View
14 app/views/articles/_form.html.erb
@@ -1,4 +1,10 @@
+<div class="well">
+ <a href="#" class="btn" data-code="show">Show Code</a>
+</div>
+
<%= simple_form_for(@article, :wrapper => "inline") do |f| %>
+ <pre> simple_form_for(@article, :wrapper => "inline") do |f| </pre>
+
<% if f.error_notification %>
<div class="alert-message warning fade in" data-alert="alert">
@@ -12,15 +18,23 @@
<%= field_set_tag "Article" do %>
<%= f.input :name, :input_html => { :class => "span12" },
:hint => "add your article title here" %>
+ <pre> f.input :name, :input_html => { :class => "span12" }, :hint => "add your article title here" </pre>
<%= f.input :content_type, :collection => ['Blog', 'Editorial'],
:hint => "this is not used" %>
+ <pre> f.input :content_type, :collection => ['Blog', 'Editorial'], :hint => "this is not used" </pre>
<%= f.input :content, :input_html => { :class => "span12" } %>
+ <pre> f.input :content, :input_html => { :class => "span12" } </pre>
<%= f.input :disabled_text, :disabled => true,
:hint => "an example of disabled input" %>
+ <pre> f.input :disabled_text, :disabled => true, :hint => "an example of disabled input" </pre>
<% end %>
<div class="actions">
<%= f.button :submit, :class => 'primary' %>
<%= button_tag 'Cancel', :type => :reset, :class => "btn" %>
+
</div>
+ <pre>
+ f.button :submit, :class => 'primary'
+ button_tag 'Cancel', :type => :reset, :class => "btn" </pre>
<% end %>
View
2  app/views/articles/edit.html.erb
@@ -3,7 +3,7 @@
<li class="active">Edit article</li>
</ul>
-<h1>Editing article</h1>
+<h1>Editing article <small>Inline Form</small></h1>
<%= render 'form' %>
View
2  app/views/articles/index.html.erb
@@ -3,7 +3,7 @@
</ul>
<h1>Listing articles</h1>
-<div class="well" style="padding: 10px;">
+<div class="well">
<%= link_to 'New Article', new_article_path, :class => 'btn' %>
</div>
View
2  app/views/articles/new.html.erb
@@ -3,7 +3,7 @@
<li class="active">New article</li>
</ul>
-<h1>New article</h1>
+<h1>New article <small>Inline Form</small></h1>
<%= render 'form' %>
Please sign in to comment.
Something went wrong with that request. Please try again.