Merge branch 'user-location' into 'master'

Location field in user profile

Twitter allows you to set string with location information.
I find it very useful in work to know where user from. It allows to communicate with knowing time difference and cultural things.

See merge request !411
This commit is contained in:
Dmitriy Zaporozhets 2015-03-21 00:54:03 +00:00
commit f0d052b6e7
7 changed files with 18 additions and 2 deletions

View File

@ -14,6 +14,7 @@ v 7.10.0 (unreleased)
- Move "Import existing repository by URL" option to button. - Move "Import existing repository by URL" option to button.
- Improve error message when save profile has error. - Improve error message when save profile has error.
- Passing the name of pushed ref to CI service (requires GitLab CI 7.9+) - Passing the name of pushed ref to CI service (requires GitLab CI 7.9+)
- Add location field to user profile
v 7.9.0 (unreleased) v 7.9.0 (unreleased)
- Add HipChat integration documentation (Stan Hu) - Add HipChat integration documentation (Stan Hu)

View File

@ -69,7 +69,7 @@ class ProfilesController < ApplicationController
params.require(:user).permit( params.require(:user).permit(
:email, :password, :password_confirmation, :bio, :name, :username, :email, :password, :password_confirmation, :bio, :name, :username,
:skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id,
:avatar, :hide_no_ssh_key, :hide_no_password :avatar, :hide_no_ssh_key, :hide_no_password, :location
) )
end end
end end

View File

@ -53,6 +53,9 @@
.form-group .form-group
= f.label :website_url, 'Website', class: "control-label" = f.label :website_url, 'Website', class: "control-label"
.col-sm-10= f.text_field :website_url, class: "form-control" .col-sm-10= f.text_field :website_url, class: "form-control"
.form-group
= f.label :location, 'Location', class: "control-label"
.col-sm-10= f.text_field :location, class: "form-control"
.form-group .form-group
= f.label :bio, class: "control-label" = f.label :bio, class: "control-label"
.col-sm-10 .col-sm-10

View File

@ -21,6 +21,10 @@
%li %li
%span.light Website: %span.light Website:
%strong= link_to user.short_website_url, user.full_website_url %strong= link_to user.short_website_url, user.full_website_url
- unless user.location.blank?
%li
%span.light Location:
%strong= user.location
- unless user.bio.blank? - unless user.bio.blank?
%li %li
%span.light Bio: %span.light Bio:

View File

@ -0,0 +1,5 @@
class AddLocationToUser < ActiveRecord::Migration
def change
add_column :users, :location, :string
end
end

View File

@ -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: 20150313012111) do ActiveRecord::Schema.define(version: 20150320234437) 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"
@ -473,6 +473,7 @@ ActiveRecord::Schema.define(version: 20150313012111) do
t.boolean "password_automatically_set", default: false t.boolean "password_automatically_set", default: false
t.string "bitbucket_access_token" t.string "bitbucket_access_token"
t.string "bitbucket_access_token_secret" t.string "bitbucket_access_token_secret"
t.string "location"
end end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree add_index "users", ["admin"], name: "index_users_on_admin", using: :btree

View File

@ -11,6 +11,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
fill_in "user_linkedin", with: "testlinkedin" fill_in "user_linkedin", with: "testlinkedin"
fill_in "user_twitter", with: "testtwitter" fill_in "user_twitter", with: "testtwitter"
fill_in "user_website_url", with: "testurl" fill_in "user_website_url", with: "testurl"
fill_in "user_location", with: "Ukraine"
click_button "Save changes" click_button "Save changes"
@user.reload @user.reload
end end
@ -20,6 +21,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
@user.linkedin.should == 'testlinkedin' @user.linkedin.should == 'testlinkedin'
@user.twitter.should == 'testtwitter' @user.twitter.should == 'testtwitter'
@user.website_url.should == 'testurl' @user.website_url.should == 'testurl'
find("#user_location").value.should == "Ukraine"
end end
step 'I change my avatar' do step 'I change my avatar' do