Skip to content

Commit 82e8da4

Browse files
committed
Give users a choice between full-width and fixed-width designs #migration
1 parent a6b15b7 commit 82e8da4

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

app/controllers/registrations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def sign_up_params
1515
end
1616

1717
def account_update_params
18-
params.require(:user).permit(:name, :email, :password, :password_confirmation, :current_password, :email_updates)
18+
params.require(:user).permit(:name, :email, :password, :password_confirmation, :current_password, :email_updates, :fluid_preference)
1919
end
2020

2121
protected

app/views/devise/registrations/edit.html.erb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@
3636
</div>
3737
</div>
3838

39+
<div class="card">
40+
<div class="card-content">
41+
<h4>Your Notebook.ai design</h4>
42+
<div class="field">
43+
<%= f.check_box :fluid_preference %>
44+
<%= f.label :fluid_preference do %>
45+
I want to use <strong>full-width</strong> Notebook.ai. Great for small screens, but not so much for very large ones.
46+
<% end %>
47+
</div>
48+
</div>
49+
</div>
50+
3951
<div class="card">
4052
<div class="card-content">
4153
<h4>Email preferences</h4>
@@ -58,7 +70,7 @@
5870

5971
<div class="center">
6072
<div class="actions">
61-
<%= f.submit "Update your account information", class: 'btn' %>
73+
<%= f.submit "Update your account information", class: 'btn blue' %>
6274
<%= link_to "Cancel", :back, class: 'btn grey' %>
6375
</div>
6476
</div>

app/views/layouts/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<% end %>
2323

2424
<main>
25-
<div class="container">
25+
<div class="container<% if user_signed_in? && current_user.fluid_preference %>-fluid<% end %>">
2626
<div class="row">
2727
<div class="col s12">
2828
<%# todo: move these to toasts and/or make dismissable %>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddFluidPreferenceToUser < ActiveRecord::Migration
2+
def change
3+
add_column :users, :fluid_preference, :boolean
4+
end
5+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20170517152023) do
14+
ActiveRecord::Schema.define(version: 20170517164648) do
1515

1616
create_table "archenemyships", force: :cascade do |t|
1717
t.integer "user_id"
@@ -736,6 +736,7 @@
736736
t.integer "selected_billing_plan_id"
737737
t.integer "upload_bandwidth_kb", default: 50000
738738
t.string "secure_code"
739+
t.boolean "fluid_preference"
739740
end
740741

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

0 commit comments

Comments
 (0)