Skip to content

Commit

Permalink
Give users a choice between full-width and fixed-width designs #migra…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
drusepth committed May 17, 2017
1 parent a6b15b7 commit 82e8da4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def sign_up_params
end

def account_update_params
params.require(:user).permit(:name, :email, :password, :password_confirmation, :current_password, :email_updates)
params.require(:user).permit(:name, :email, :password, :password_confirmation, :current_password, :email_updates, :fluid_preference)
end

protected
Expand Down
14 changes: 13 additions & 1 deletion app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@
</div>
</div>

<div class="card">
<div class="card-content">
<h4>Your Notebook.ai design</h4>
<div class="field">
<%= f.check_box :fluid_preference %>
<%= f.label :fluid_preference do %>
I want to use <strong>full-width</strong> Notebook.ai. Great for small screens, but not so much for very large ones.
<% end %>
</div>
</div>
</div>

<div class="card">
<div class="card-content">
<h4>Email preferences</h4>
Expand All @@ -58,7 +70,7 @@

<div class="center">
<div class="actions">
<%= f.submit "Update your account information", class: 'btn' %>
<%= f.submit "Update your account information", class: 'btn blue' %>
<%= link_to "Cancel", :back, class: 'btn grey' %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<% end %>

<main>
<div class="container">
<div class="container<% if user_signed_in? && current_user.fluid_preference %>-fluid<% end %>">
<div class="row">
<div class="col s12">
<%# todo: move these to toasts and/or make dismissable %>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20170517164648_add_fluid_preference_to_user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddFluidPreferenceToUser < ActiveRecord::Migration
def change
add_column :users, :fluid_preference, :boolean
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170517152023) do
ActiveRecord::Schema.define(version: 20170517164648) do

create_table "archenemyships", force: :cascade do |t|
t.integer "user_id"
Expand Down Expand Up @@ -736,6 +736,7 @@
t.integer "selected_billing_plan_id"
t.integer "upload_bandwidth_kb", default: 50000
t.string "secure_code"
t.boolean "fluid_preference"
end

add_index "users", ["email"], name: "index_users_on_email", unique: true
Expand Down

0 comments on commit 82e8da4

Please sign in to comment.