app/views/users/edit.html.haml
%html
%head
= cloudinary_js_config
%body
:javascript
$(function() {
if($.fn.cloudinary_fileupload !== undefined) {
$("input.cloudinary-fileupload[type=file]").cloudinary_fileupload();
}
});
:javascript
$(document).ready(function() {
$('.cloudinary-fileupload').bind('cloudinarydone', function(e, data) {
$('.preview').html(
$.cloudinary.image(data.result.public_id,
{ format: data.result.format, version: data.result.version,
crop: 'fill', width: 200, height: 150 })
);
$('.image_public_id').val(data.result.public_id);
return true;
});
$('.cloudinary-fileupload').fileupload('option', 'replaceFileInput', false);
})
%div.hosting-box
%p= flash[:notice] if flash[:notice]
%h1.center Edit Profile Information
<br>
%h4.center Edit any of the fields below.
%h5 Upload or change your profile picture:
= form_tag update_profile_picture_users_path(@user), method: :update_profile_picture do
= cl_image_upload_tag :image_id, id: "img_profile_picture"
= submit_tag 'Upload', id: "upload_profile_picture"
-if @user.cloud_profile_picture_id
= cl_image_tag @user.cloud_profile_picture_id, :width => 300, :height => 200,id: "profile_picture"
<br>
<br>
%h5 Upload or change the picture of your residence:
= form_tag update_house_picture_users_path(@user), method: :update_house_picture do
= cl_image_upload_tag :image_id, id: "img_house_picture"
= submit_tag 'Upload', id: "upload_house_picture"
<br>
-if @user.cloud_house_picture_id
= cl_image_tag @user.cloud_house_picture_id, :width => 300, :height => 200, id: "house_picture"
<br>
%h5 Upload more pictures of your residence!
= form_tag update_multiple_pictures_users_path(@user), method: :update_multiple_pictures do
= cl_image_upload_tag :image_id, id: "img_more_picture"
= submit_tag 'Upload', id: "upload_more_picture"
<br>
-# if @user.house_images
-# - @user.house_images.each do |image|
-# = image_tag "user_images/#{@user.email}/#{image}", height: '150', weight: '20',hspace: '150', vspace: '10'
-if @user.cloud_house_image_ids
- @user.cloud_house_image_ids.each do |image|
= cl_image_tag image, :width => 300, :height => 200
<br>
= form_tag user_path(@user), :method => :patch do
<br>
%h4 Personal Information
= label :user, :email, 'E-mail Address'
= @user.email
<br>
= label :user, :first_name, 'First Name'
= text_field :user, 'first_name', :value=>@user.first_name
<br>
= label :user, :last_name, 'Last Name'
= text_field :user, 'last_name', :value=>@user.last_name
<br>
= label :user, :personal_description, 'Personal Description'
= text_field :user, 'personal_description', :value=>@user.personal_description
<br>
<br>
%h4 Billing Information
= label :user, :billing_first_name, 'First Name'
= text_field :user, 'billing_first_name', :value=>@user.billing_first_name
<br>
= label :user, :billing_last_name, 'Last Name'
= text_field :user, 'billing_last_name', :value=>@user.billing_last_name
<br>
= label :user, :billing_street_address, 'Street Address'
= text_field :user, 'billing_street_address', :value=>@user.billing_street_address
<br>
= label :user, :billing_city, 'City'
= text_field :user, 'billing_city', :value=>@user.billing_city
<br>
= label :user, :billing_state, 'State'
= text_field :user, 'billing_state', :value=>@user.billing_state
<br>
= label :user, :billing_zip_code, 'Zip Code'
= text_field :user, 'billing_zip_code', :value=>@user.billing_zip_code
<br>
= label :user, :credit_card_number, 'Credit Card Number'
= text_field :user, 'credit_card_number', :value=>@user.credit_card_number
<br>
= label :user, :expiration_date, 'Expiration Date'
= text_field :user, 'expiration_date', :value=>@user.expiration_date
<br>
= label :user, :cvv, 'CVV'
= text_field :user, 'cvv', :value=>@user.cvv
<br>
<br>
%h4 Hosting Information
= label :user, :home_street_address, "Street Address"
= text_field :user, :home_street_address, :value=>@user.home_street_address
<br>
= label :user, :home_city, "City"
= text_field :user, :home_city, :value=>@user.home_city
<br>
= label :user, :home_state, "State"
= text_field :user, :home_state, :value=>@user.home_state
<br>
= label :user, :home_zip_code, "Zip"
= text_field :user, :home_zip_code, :value=>@user.home_zip_code
<br>
= label :user, :house_description, "Description"
= text_field :user, :house_description, :value=>@user.house_description
<br>
= label :user, :title, "Title (i.e. \"Cozy flat\")"
= text_field :user, :title, value: @user.title
<br>
= label :user, :capacity, "Capacity"
= text_field :user, :capacity, value: @user.capacity
people
<br>
= label :user, :price, "Price (per day)"
= text_field :user, :price, :value=>@user.price
<br>
= label :user, :available_time, "Times Available"
%input{type: "time", name: "user[available_time_start]", value: @user.available_time_start}
to
%input{type: "time", name: "user[available_time_end]", value: @user.available_time_end}
<br>
= label :user, :searchable, "Would you like your location to be searchable?"
= check_box :user, :searchable, :value=>@user.searchable
<br>
%table
%tbody
- @user.amenity_list.attributes.each do |amenity|
- unless amenity.first.include? 'id'
%tr
%td= check_box :amenity_list, amenity[0], checked: @user.amenity_list[amenity[0]]
%td{align: :center}= image_tag "amenity_icons/#{amenity[0]}", height: '20', weight: '20',hspace: '10', vspace: '10'
%td= amenity[0]
<br>
<br>
= submit_tag 'Save Changes'
<br>
= button_to 'Delete Profile', user_path(@user), :method => :delete, :confirm => "Are you sure?"
<br>
= link_to "Back to Main Page", root_path