Permalink
Browse files

Editing places works.

  • Loading branch information...
1 parent 33dc8cc commit 334fa6ad92dadf1fae3a75e5fa123716c8f9456d @mjm committed Apr 20, 2012
@@ -2,7 +2,7 @@
<div class="modal-header">
<a class="close" data-dismiss="modal">x</a>
- <h3>Add a New Place</h3>
+ <h3><%= place.new_record? and "Add a New Place" or "Edit a Place" %></h3>
</div>
<div class="modal-body">
@@ -5,9 +5,7 @@
<div class="btn-group pull-right">
<%= link_to '<i class="icon-ok"></i>'.html_safe, votes_path(:place => place), method: :post, remote: true, class: 'btn btn-mini' %>
<% if @current_user == place.person %>
- <button class="btn btn-mini">
- <i class="icon-pencil"></i>
- </button>
+ <%= link_to '<i class="icon-pencil"></i>'.html_safe, edit_place_path(place), remote: true, class: 'btn btn-mini' %>
<button class="btn btn-mini btn-danger">
<i class="icon-remove icon-white"></i>
</button>
@@ -1,12 +1,4 @@
(function() {
this.html("<%= escape_javascript render(partial: 'place', locals: {place: @place}) %>");
- var submit = this.find('input:submit');
- var form = this.find('form');
- submit.hide();
- this.dialog('option', 'buttons', [{
- text: submit.val(),
- click: function() {
- form.submit();
- }
- }]).dialog('open');
-}).call($('#edit-place-dialog'));
+ this.modal()
+}).call($('#edit-place'));
@@ -5,3 +5,6 @@
<div id="places">
<%= render :partial => 'places' %>
</div>
+
+
+<div id="edit-place" class="modal fade"></div>
@@ -3,7 +3,7 @@ $('#places')
.trigger('beforeupdate')
.html('<%= escape_javascript(render :partial => "places") %>')
.trigger('update');
-$('#edit-place-dialog').dialog('close');
+$('#edit-place').modal('hide');
<%= js_notice t('.success', :name => @place.name) %>
<% else %>
<%= js_error @place %>

0 comments on commit 334fa6a

Please sign in to comment.