cms_for_for becomes comfy_form_for. trying to remove copy-pasta builder from other gems
Oleg
committed Feb 13, 2012
commit aef49bdc0eba555129062b8dabd03dc0a8e9d5b5
Showing 15
changed files with
21 additions
and 18 deletions
app/assets/stylesheets/comfortable_mexican_sofa/form.css
+3
-0
| @@ | @@ -176,4 +176,7 @@ |
| text-transform: uppercase; | |
| color: #fff; | |
| margin-bottom: 3px; | |
| + | } |
| + | #cms_body .form_element.simple_field .value input { |
| + | margin-bottom: 3px; |
| } | |
| \ No newline at end of file | |
app/views/cms_admin/files/edit.html.erb
+1
-1
| @@ | @@ -1,5 +1,5 @@ |
| <h1><%= t('.title') %></h1> | |
| - | <%= cms_form_for @file, :as => :file, :url => {:action => :update} do |form| %> |
| + | <%= comfy_form_for @file, :as => :file, :url => {:action => :update} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
| \ No newline at end of file | |
app/views/cms_admin/files/new.html.erb
+1
-1
| @@ | @@ -1,5 +1,5 @@ |
| <h1><%= t('.title') %></h1> | |
| - | <%= cms_form_for @file, :as => :file, :url => {:action => :create}, :html => {:multipart => true} do |form| %> |
| + | <%= comfy_form_for @file, :as => :file, :url => {:action => :create}, :html => {:multipart => true} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
app/views/cms_admin/layouts/edit.html.erb
+1
-1
| @@ | @@ -6,6 +6,6 @@ |
| <%= render :partial => 'cms_admin/sites/mirrors', :object => @layout %> | |
| <% end %> | |
| - | <%= cms_form_for @layout, :as => :layout, :url => {:action => :update} do |form| %> |
| + | <%= comfy_form_for @layout, :as => :layout, :url => {:action => :update} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
app/views/cms_admin/layouts/new.html.erb
+1
-1
| @@ | @@ -1,5 +1,5 @@ |
| <h1><%= t('.title') %></h1> | |
| - | <%= cms_form_for @layout, :as => :layout, :url => {:action => :create} do |form| %> |
| + | <%= comfy_form_for @layout, :as => :layout, :url => {:action => :create} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
app/views/cms_admin/pages/edit.html.erb
+1
-1
| @@ | @@ -6,6 +6,6 @@ |
| <%= render :partial => 'cms_admin/sites/mirrors', :object => @page %> | |
| <% end %> | |
| - | <%= cms_form_for @page, :as => :page, :url => {:action => :update}, :html => {:multipart => true} do |form| %> |
| + | <%= comfy_form_for @page, :as => :page, :url => {:action => :update}, :html => {:multipart => true} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
app/views/cms_admin/pages/new.html.erb
+1
-1
| @@ | @@ -1,5 +1,5 @@ |
| <h1><%= t('.title') %></h1> | |
| - | <%= cms_form_for @page, :as => :page, :url => {:action => :create}, :html => {:multipart => true} do |form| %> |
| + | <%= comfy_form_for @page, :as => :page, :url => {:action => :create}, :html => {:multipart => true} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
app/views/cms_admin/revisions/show.html.erb
+1
-1
| @@ | @@ -10,7 +10,7 @@ |
| </div> | |
| <% end %> | |
| - | <%= cms_form_for @revision, :url => {:action => :revert} do |form| %> |
| + | <%= comfy_form_for @revision, :url => {:action => :revert} do |form| %> |
| <%= form.simple_field do %> | |
| <div class='current'> | |
| <div class='title'>Current</div> | |
app/views/cms_admin/sites/edit.html.erb
+1
-1
| @@ | @@ -1,5 +1,5 @@ |
| <h1><%= t('.title') %></h1> | |
| - | <%= cms_form_for @site, :as => :site, :url => {:action => :update} do |form| %> |
| + | <%= comfy_form_for @site, :as => :site, :url => {:action => :update} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
app/views/cms_admin/sites/new.html.erb
+1
-1
| @@ | @@ -1,5 +1,5 @@ |
| <h1><%= t('.title') %></h1> | |
| - | <%= cms_form_for @site, :as => :site, :url => {:action => :create} do |form| %> |
| + | <%= comfy_form_for @site, :as => :site, :url => {:action => :create} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
app/views/cms_admin/snippets/edit.html.erb
+1
-1
| @@ | @@ -5,6 +5,6 @@ |
| <%= render :partial => 'cms_admin/sites/mirrors', :object => @snippet %> | |
| <% end %> | |
| - | <%= cms_form_for @snippet, :as => :snippet, :url => {:action => :update} do |form| %> |
| + | <%= comfy_form_for @snippet, :as => :snippet, :url => {:action => :update} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
app/views/cms_admin/snippets/new.html.erb
+1
-1
| @@ | @@ -1,5 +1,5 @@ |
| <h1><%= t('.title') %></h1> | |
| - | <%= cms_form_for @snippet, :as => :snippet, :url => {:action => :create} do |form| %> |
| + | <%= comfy_form_for @snippet, :as => :snippet, :url => {:action => :create} do |form| %> |
| <%= render :partial => 'form', :object => form %> | |
| <% end %> | |
comfortable_mexican_sofa/form_builder.rb b/lib/comfortable_mexican_sofa/form_builder.rb
+1
-1
| @@ | @@ -35,7 +35,7 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder |
| def simple_field(label = nil, content = nil, options = {}, &block) | |
| content ||= @template.capture(&block) if block_given? | |
| %( | |
| - | <div class='form_element #{options.delete(:class)}'> |
| + | <div class='form_element simple_field #{options.delete(:class)}'> |
| <div class='label'>#{label}</div> | |
| <div class='value'>#{content}</div> | |
| </div> | |
comfortable_mexican_sofa/view_methods.rb b/lib/comfortable_mexican_sofa/view_methods.rb
+1
-1
| @@ | @@ -1,6 +1,6 @@ |
| module ComfortableMexicanSofa::ViewMethods | |
| # Wrapper around CmsFormBuilder | |
| - | def cms_form_for(record_or_name_or_array, *args, &proc) |
| + | def comfy_form_for(record_or_name_or_array, *args, &proc) |
| options = args.extract_options! | |
| form_for(record_or_name_or_array, *(args << options.merge(:builder => ComfortableMexicanSofa::FormBuilder)), &proc) | |
| end | |
test/unit/form_builder_test.rb
+5
-5
| @@ | @@ -4,7 +4,7 @@ class FormBuilderTest < ActionView::TestCase |
| include ComfortableMexicanSofa::ViewMethods | |
| def test_form_render_basic | |
| - | concat( cms_form_for(cms_pages(:child), :url => '#') do |f| |
| + | concat( comfy_form_for(cms_pages(:child), :url => '#') do |f| |
| f.text_area(:label) + | |
| f.text_field(:slug) + | |
| f.select(:parent_id, [['1', 'Parent']]) | |
| @@ | @@ -27,7 +27,7 @@ class FormBuilderTest < ActionView::TestCase |
| end | |
| def test_form_render_with_custom_ids | |
| - | concat( cms_form_for(cms_pages(:child), :url => '#') do |f| |
| + | concat( comfy_form_for(cms_pages(:child), :url => '#') do |f| |
| f.text_field(:label, :id => 'slugify') + | |
| f.text_field(:slug) | |
| end ) | |
| @@ | @@ -38,13 +38,13 @@ class FormBuilderTest < ActionView::TestCase |
| end | |
| def test_form_label_with_html_safe_labels | |
| - | cms_form_for(cms_pages(:child), :url => '#') do |f| |
| + | comfy_form_for(cms_pages(:child), :url => '#') do |f| |
| assert f.label_for(:is_published).html_safe? | |
| end | |
| end | |
| def test_form_label_custom_override | |
| - | concat( cms_form_for(cms_pages(:child), :url => '#') do |f| |
| + | concat( comfy_form_for(cms_pages(:child), :url => '#') do |f| |
| f.text_field(:slug, :label => 'Custom') | |
| end ) | |
| assert_select 'label[for="cms_page_slug"]', 'Custom' | |
| @@ | @@ -55,7 +55,7 @@ class FormBuilderTest < ActionView::TestCase |
| :attributes => { :slug => "Gulsty" }, | |
| :activerecord => { :attributes => { :'cms/page' => { :label => 'Titlumtimpin' } } } | |
| } do | |
| - | concat( cms_form_for(cms_pages(:child), :url => '#') do |f| |
| + | concat( comfy_form_for(cms_pages(:child), :url => '#') do |f| |
| f.text_field(:label) + | |
| f.text_field(:slug) + | |
| f.text_field(:parent_id) | |