lib/rails/generators/humdrum/resource/templates/views/bootstrap/resource/_form.html.erb in humdrum-rails-0.0.7 vs lib/rails/generators/humdrum/resource/templates/views/bootstrap/resource/_form.html.erb in humdrum-rails-0.0.8

- old
+ new

@@ -1,44 +1,81 @@ <%%# Renders a partial which is used to create a new <%= instance_name %> %> -<%%= simple_form_for(<%= form_link_param %>, :html => {:class=>"form-vertical", :style => "margin-bottom:0px;", :method => (@<%= instance_name %>.new_record? ? :post : :put), :remote=>true}) do |f| %> +<<<<<<< Local Changes +<%%= form_for(@<%= instance_name %>, :html => {:id=>"form_<%= instance_name %>", :class=>"margin-bottom-0", :method => (@<%= instance_name %>.new_record? ? :post : :put), :remote=>true}) do |f| %> - <%%= f.error_notification %> <%%= @<%= instance_name %>.errors[:base].to_sentence %> + + <%%= hidden_field_tag :faction, @<%= instance_name %>.new_record? ? <%= instances_name %>_path : <%= instance_name %>_path(@<%= instance_name %>) %> + <%%= hidden_field_tag :fmethod, @<%= instance_name %>.new_record? ? "POST" : "PUT" %> <div class="form-inputs"> - - <%- fields.each do |name, type| -%> - <% if type == "text" %> - <%%= f.input :<%= name %>, :required => true, :input_html=>{:style=>"width:95%; margin-bottom:5px;", :rows=>"8"} %> - <% else %> - <%%= f.input :<%= name %>, :required => true, :input_html=>{:style=>"width:95%; margin-bottom:5px;"} %> - <% end %> - <%- end -%> - - <%%#= f.input :name, :placeholder => 'Enter Item Name', :required => true, :input_html=>{:style=>"width:95%; margin-bottom:5px;"} %> - - <%%#= f.input :age, :required => false, :input_html=>{:style=>"width:95%; margin-bottom:5px;"} %> - - <%%#= f.input :description, :as => :text, :placeholder => 'Add Description for the Item', :input_html => { :rows => 6, :style => "width:95%;height:200px; margin-bottom:5px;" } %> - - <%%#= f.input :cost, :hint => 'Enter Item Cost', :required => true, :input_html=>{:style=>"width:95%; margin-bottom:5px;"} %> - - <%%# list = ['2010 - Margaret Blue', 'Agenta Black', 'Margaret Blue', 'Crimson Yellow', 'Scarlet Red', 'Peacock Blue'] %> - <%%#= f.input :model, :as => :select, :collection => list, :input_html=>{:class=>"select2 prompt", :style=>"width:100%;"}, :selected => [ "Scarlet Red" ] %> - + + <%- fields.each do |name, type| %> + <!-- <%= name.titleize -%> (<%= type -%>) --> + <%%= render :partial=>"field", :locals=>{:object=>@<%= instance_name %>, + :object_name=>'<%= instance_name %>', + :field_name=>'<%= name %>', + :display_name=>'<%= name.titleize %>', + :field_type=>'<%= type %>', + :input_type=>'<%= guess_input_type(name, type) %>', + :required=>true, + :place_holder=>"e.g: Put a suitable example here."} %> + <%- end -%> + </div> + + <%% button_text = "#{@<%= instance_name %>.new_record? ? "Create" : "Update"} Item" %> + <div class="pull-right"> + <%% if @<%= instance_name %>.new_record? %> + <%%= link_to "Cancel", "#", :class => "btn", :remote=>true %> + <%% else %> + <%%= link_to 'Back', <%= resource_link('index', 'path') %>, :class=>"btn margin-left-10", :remote => true unless @<%= instance_name %>.new_record? %> + <%% end %> + <%%= f.submit button_text, "data-reset-text"=>button_text, "data-loading-text"=>"Saving ...", :class=>"btn btn-primary margin-left-10" %> + </div> <div class="cl-10"></div> + +<%% end %> + +<%%# Renders a partial which is used to create a new <%= instance_name %> %> +<%%= simple_form_for(<%= form_link_param %>, :html => {:class=>"form-vertical", :style => "margin-bottom:0px;", :method => (@<%= instance_name %>.new_record? ? :post : :put), :remote=>true}) do |f| %> +======= +<%%= form_for(@<%= instance_name %>, :html => {:id=>"form_<%= instance_name %>", :class=>"margin-bottom-0", :method => (@<%= instance_name %>.new_record? ? :post : :put), :remote=>true}) do |f| %> +>>>>>>> External Changes + + <%%= @<%= instance_name %>.errors[:base].to_sentence %> + + <%%= hidden_field_tag :faction, @<%= instance_name %>.new_record? ? <%= instances_name %>_path : <%= instance_name %>_path(@<%= instance_name %>) %> + <%%= hidden_field_tag :fmethod, @<%= instance_name %>.new_record? ? "POST" : "PUT" %> + + <div class="form-inputs"> + + <%- fields.each do |name, type| %> + <!-- <%= name.titleize -%> (<%= type -%>) --> + <%%= render :partial=>"field", :locals=>{:object=>@<%= instance_name %>, + :object_name=>'<%= instance_name %>', + :field_name=>'<%= name %>', + :display_name=>'<%= name.titleize %>', + :field_type=>'<%= type %>', + :input_type=>'<%= guess_input_type(name, type) %>', + :required=>true, + :place_holder=>"e.g: Put a suitable example here."} %> + <%- end -%> + + </div> + <%% button_text = "#{@<%= instance_name %>.new_record? ? "Create" : "Update"} Item" %> <div class="pull-right"> <%% if @<%= instance_name %>.new_record? %> <%%= link_to "Cancel", "#", :class => "btn", :remote=>true %> <%% else %> <%%= link_to 'Back', <%= resource_link('index', 'path') %>, :class=>"btn margin-left-10", :remote => true unless @<%= instance_name %>.new_record? %> <%% end %> <%%= f.submit button_text, "data-reset-text"=>button_text, "data-loading-text"=>"Saving ...", :class=>"btn btn-primary margin-left-10" %> </div> <div class="cl-10"></div> + <%% end %>