added motivation header
This commit is contained in:
parent
40f0e87fdc
commit
685b0efe83
|
@ -10,9 +10,9 @@ class UserController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authenticate_user!
|
authenticate_user!
|
||||||
user_attributes = params.require(:user).permit(:display_name)
|
user_attributes = params.require(:user).permit(:display_name, :motivation_header)
|
||||||
unless current_user.update_attributes(user_attributes)
|
unless current_user.update_attributes(user_attributes)
|
||||||
flash[:error] = "fork it"
|
flash[:error] = 'fork it'
|
||||||
end
|
end
|
||||||
redirect_to edit_user_profile_path
|
redirect_to edit_user_profile_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
.panel-heading
|
.panel-heading
|
||||||
%h3.panel-title
|
%h3.panel-title
|
||||||
Ask something!
|
- if @user.motivation_header.blank?
|
||||||
|
Ask something!
|
||||||
|
- else
|
||||||
|
= @user.motivation_header
|
||||||
.panel-body
|
.panel-body
|
||||||
#question-box
|
#question-box
|
||||||
.row
|
.row
|
||||||
|
|
|
@ -7,4 +7,6 @@
|
||||||
|
|
||||||
= f.text_field :display_name, label: "Your name"
|
= f.text_field :display_name, label: "Your name"
|
||||||
|
|
||||||
|
= f.text_field :motivation_header, label: "Motivation header"
|
||||||
|
|
||||||
= f.submit "Save settings", class: 'btn btn-primary'
|
= f.submit "Save settings", class: 'btn btn-primary'
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddMotivationHeaderToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :motivation_header, :string, default: '', null: false
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20141126154451) do
|
ActiveRecord::Schema.define(version: 20141129211448) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -81,6 +81,7 @@ ActiveRecord::Schema.define(version: 20141126154451) do
|
||||||
t.string "display_name"
|
t.string "display_name"
|
||||||
t.integer "smiled_count", default: 0, null: false
|
t.integer "smiled_count", default: 0, null: false
|
||||||
t.boolean "admin", default: false, null: false
|
t.boolean "admin", default: false, null: false
|
||||||
|
t.string "motivation_header", default: "", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||||
|
|
Loading…
Reference in New Issue