Skip to content

Commit

Permalink
A coffeescript that can be used to disable/enable form submit buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjy committed Nov 10, 2014
1 parent 6e3b76d commit b16593b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/assets/javascripts/display.js.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# display.js.coffee
# A temporary place to write display altering bindings


render_attribute_set_headers = () ->
for i in $('.attribute_set')
do (i) ->
Expand Down
11 changes: 8 additions & 3 deletions app/views/images/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= form_for(@image) do |f| %>
<%= form_for(@image, multipart: true) do |f| %>
<% if @image.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@image.errors.count, "error") %> prohibited this image from being saved:</h2>
Expand All @@ -13,9 +13,14 @@

<div class="field">
<%= f.label :image_file %><br>
<%= f.file_field :image_file %>

<div> <%= image_tag(@image.image_file.url(:thumb)) -%> </div>

<%= f.file_field :image_file, class: :required_for_submit %>
</div>

<div class="actions">
<%= f.submit %>
<%= f.submit id: 'submit_with_required', disabled: :disabled %>
</div>
<% end %>

2 changes: 0 additions & 2 deletions app/views/images/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@

<%= render 'form' %>

<%= link_to 'Show', @image %> |
<%= link_to 'Back', images_path %>

0 comments on commit b16593b

Please sign in to comment.