Skip to content

Instantly share code, notes, and snippets.

@nilbus
Created May 23, 2016 00:26
Show Gist options
  • Save nilbus/8c7ae6c95d1461d62ccbb4ee4a2e8c42 to your computer and use it in GitHub Desktop.
Save nilbus/8c7ae6c95d1461d62ccbb4ee4a2e8c42 to your computer and use it in GitHub Desktop.
def update
find_user
if @user.update_attributes(user_params)
respond_to do |format|
format.html {
redirect_to admin_user_path(@user)
flash[:notice] = 'User updated'
}
format.js {
}
end
else
render :edit
flash[:notice] = 'User not updated'
end
end
#contract-start.row{style: @user.approved ? '' : 'display:none'}
.col-md-12
%table.table.table-condensed
%thead
%tr.text-uppercase
%th{:colspan => "4"}
contract information
%tbody
%tr
%td.text-left
Pro bono
%td.text-right
%ul.list-inline.nomb
%li
= form_for([:admin, @user], remote: true) do |f|
= hidden_field(:user, :pro_bono, value: true)
= f.button(class: "nob noba nolp norp", id: "approve-pro-bono") do
%i.glyphicon.glyphicon-ok.ml10.flat-green
%li
= form_for([:admin, @user], remote: true) do |f|
= hidden_field(:user, :pro_bono, value: false)
= f.button(class: "nob noba nolp norp", id: "approve-pro-bono") do
%i.glyphicon.glyphicon-remove.ml10.flat-red
- if params["user"]["approved"]
$("#contract-start").fadeIn();
console.log("hello")
- if params["user"]["pro_bono"]["t"]
$(".is-pro-bono").fadeIn();
- if params["user"]["pro_bono"]["f"]
$(".is-pro-bono").fadeOut();
- if params["user"]["office_location"]
$("#office_location").fadeIn();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment