Last active
December 14, 2015 17:09
-
-
Save leofrozenyogurt/5120657 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| validates :title , :presence => true | |
| validates :price , :presence => true | |
| validates :description , :presence => true | |
| validates :category , :presence => {:message=> "must be selected"} | |
| validates :dimg1, :presence => {:message => "Your deal must have at least one image"} | |
| <% @deal=Deal.new %> | |
| <%= form_for(@deal,:html => {:"data-spinner" => "#user_form_spinner", :id=>"dialog-form"}, :remote=>true) do |f| %> | |
| <div class="controls controls-row"> | |
| <label class="control-label text-error" for="input01">Post Title*</label> | |
| <%= f.text_field :title, :class=>"span3" %> | |
| <label class="control-label text-error" for="input01">Price*</label> | |
| <%= f.text_field :price, :class=>"span1"%> | |
| </div> | |
| <div class="controls"> | |
| <label class="control-label text-error" for="input01">Description*</label> | |
| <%= f.text_area :description, :class=>"span4", :rows=>3%> | |
| </div> | |
| <%= f.text_field :category%> | |
| <div class="controls controls-row"> | |
| <label class="control-label" for="input01">Address</label> | |
| <%= f.text_field :address, :class=>"span2"%> | |
| <label for="input01" style="text-align:center">(Exact address will not be visible)</label> | |
| </div> | |
| <div class="controls"> | |
| <label class="control-label" for="input01">City</label> | |
| <%= f.text_field :city %> | |
| </div> | |
| <div class="controls controls-row"> | |
| <label class="control-label" for="input01">State</label> | |
| <%= f.text_field :state, :class=>"span2" %> | |
| </div> | |
| <div class="controls controls-row"> | |
| <label class="control-label text-error" for="input01"><i class="icon-picture icon-small" style=""> Image 1*</i></label> | |
| <%= f.file_field :dimg1 %> | |
| <br> | |
| <label class="control-label" for="input02"><i class="icon-picture icon-small" style=""> Image 2</i></label> | |
| <%= f.file_field :dimg2 %> | |
| </div> | |
| </div> | |
| </fieldset> | |
| </div> | |
| </div> <!-- end of modal body --> | |
| <div class="modal-footer"> | |
| <div class="span2"> | |
| <p class="text-error"> | |
| * Fields in red are required | |
| </p> | |
| </div> | |
| <div class="span2" style="float:right"> | |
| <div id='page-spinner' style="display:none;"><%=image_tag 'whole-page.gif'%></div> | |
| <%= f.submit "Post", :class => "btn btn-success btn-large signupoverlaybtn" %> | |
| <a href="#" class="btn btn-danger btn-large" data-dismiss="modal">Cancel</a> | |
| </div> | |
| </div> <!-- end of modal footer --> | |
| <% end %> | |
| <%- if @deal.errors.any? %> | |
| console.log('Error'); | |
| $('#dialog-form').html('<%= escape_javascript(render('deals/form')) %>'); | |
| <%- else %> | |
| console.log('Created'); | |
| $('#dialog-form').dialog('close'); | |
| $('#dialog-form').remove(); | |
| $('#page-spinner').show(); | |
| $('table').append('<%= escape_javascript(render(@deal)) %>'); | |
| <%- end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment