d3fce41e60
no functional change here, but familiar Rails users will see view files in the locations they expect. this also slightly simplifies controller code there is one attendant change in the wiki at `rails_3/A1-SQL-Injection-Interpolation.md` that I'm happy to make after the PR is merged.
97 lines
2.8 KiB
Plaintext
Executable File
97 lines
2.8 KiB
Plaintext
Executable File
<!-- Begin Modal -->
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
|
||
×
|
||
</button>
|
||
<h4 id="myModalLabel1">
|
||
Account Settings
|
||
</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="row-fluid">
|
||
<div class="span8">
|
||
<%= form_for @user, :html => {:id => "account_edit"} do |f| %>
|
||
<div class="control-group">
|
||
<%= f.label :email, nil, {:class => "control-label"}%>
|
||
<%= f.text_field :email, {:class => "span12"}%>
|
||
</div>
|
||
|
||
<div class="control-group">
|
||
<%= f.label :first_name, nil, {:class => "control-label"}%>
|
||
<%= f.text_field :first_name, {:class => "span12"} %>
|
||
</div>
|
||
|
||
<div class="control-group">
|
||
<%= f.label :last_name, nil, {:class => "control-label"}%>
|
||
<%= f.text_field :last_name, {:class => "span12"} %>
|
||
</div>
|
||
|
||
<div class="control-group">
|
||
<%= f.label :password, nil, {:class => "control-label"}%>
|
||
<%= f.password_field :password, {:class => "span12", :placeholder => "Enter Password"}%>
|
||
</div>
|
||
|
||
<div class="control-group">
|
||
<%= f.label :password_confirmation, nil, {:class => "control-label"}%>
|
||
<%= f.password_field :password_confirmation, {:class => "span12", :placeholder => "Enter Password"} %>
|
||
</div>
|
||
|
||
<%= f.label :admin, nil, {:class => "control-label"}%>
|
||
<%= f.select(:admin, @admin_select) %>
|
||
</div>
|
||
</div>
|
||
<div class="row-fluid">
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn" data-dismiss="modal" aria-hidden="true">
|
||
Close
|
||
</button>
|
||
<%= link_to "Delete", "#", {:id => "delete_button", :class => "btn btn-danger pull-left"} %>
|
||
<%= f.submit "Submit", {:id => 'submit_button', :class => "btn btn-primary pull-right"} %>
|
||
</div>
|
||
<% end %>
|
||
<!-- End Modal -->
|
||
|
||
<%= javascript_include_tag ('validation.js')%>
|
||
|
||
<script type="text/javascript">
|
||
|
||
$('#submit_button').click(function() {
|
||
var valuesToSubmit = $("#account_edit").serialize();
|
||
$("#editAcct").modal('hide');
|
||
|
||
$.ajax({
|
||
url: "/admin/" + <%= @user.user_id %> + "/update_user.json",
|
||
data: valuesToSubmit,
|
||
type: "POST",
|
||
success: function(response) {
|
||
$('#success').show(500).delay(1500).fadeOut();
|
||
loadTable();
|
||
},
|
||
error: function(event) {
|
||
$('#failure').show(500).delay(1500).fadeOut();
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
$('#delete_button').click(function() {
|
||
$("#editAcct").modal('hide');
|
||
|
||
$.ajax({
|
||
url: "/admin/" + <%= params[:admin_id] %> + "/delete_user.json",
|
||
type: "POST",
|
||
success: function(response) {
|
||
$('#success').show(500).delay(1500).fadeOut();
|
||
loadTable();
|
||
},
|
||
error: function(event) {
|
||
$('#failure').show(500).delay(1500).fadeOut();
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
</script>
|