1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

[feature] add user's job to profile

This commit is contained in:
Sylvain 2016-05-26 12:34:30 +02:00
parent d009cf3fc1
commit 0be0935474
7 changed files with 25 additions and 4 deletions

View File

@ -226,7 +226,19 @@
placeholder="{{ 'website' | translate }} (http://...)"
ng-disabled="preventField['profile.website'] && user.profile.website && !userForm['user[profile_attributes][website]'].$dirty"/>
</div>
<span class="help-block" ng-show="userForm['user[profile_attributes][website]'].$dirty && userForm['user[profile_attributes][website]'].$error.required" translate>{{ 'phone_number_is_required' }}</span>
</div>
<div class="form-group" ng-class="{'has-error': userForm['user[profile_attributes][job]'].$dirty && userForm['user[profile_attributes][job]'].$invalid}">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-briefcase"></i> </span>
<input type="text"
name="user[profile_attributes][job]"
ng-model="user.profile.job"
class="form-control"
id="user_job"
placeholder="{{ 'job' | translate }}"
ng-disabled="preventField['profile.job'] && user.profile.job && !userForm['user[profile_attributes][job]'].$dirty"/>
</div>
</div>
<div class="form-group">

View File

@ -139,14 +139,14 @@ class API::MembersController < API::ApiController
def user_params
if current_user.id == params[:id].to_i
params.require(:user).permit(:username, :email, :password, :password_confirmation, :group_id, :is_allow_contact,
profile_attributes: [:id, :first_name, :last_name, :gender, :birthday, :phone, :interest, :software_mastered, :website,
profile_attributes: [:id, :first_name, :last_name, :gender, :birthday, :phone, :interest, :software_mastered, :website, :job,
:facebook, :twitter, :google_plus, :viadeo, :linkedin, :instagram, :youtube, :vimeo, :dailymotion, :github, :echosciences, :pinterest, :lastfm, :flickr,
:user_avatar_attributes => [:id, :attachment, :_destroy], :address_attributes => [:id, :address]])
elsif current_user.is_admin?
params.require(:user).permit(:username, :email, :password, :password_confirmation, :invoicing_disabled, :is_allow_contact,
:group_id, training_ids: [], tag_ids: [],
profile_attributes: [:id, :first_name, :last_name, :gender, :birthday, :phone, :interest, :software_mastered, :website,
profile_attributes: [:id, :first_name, :last_name, :gender, :birthday, :phone, :interest, :software_mastered, :website, :job,
:facebook, :twitter, :google_plus, :viadeo, :linkedin, :instagram, :youtube, :vimeo, :dailymotion, :github, :echosciences, :pinterest, :lastfm, :flickr,
user_avatar_attributes: [:id, :attachment, :_destroy], address_attributes: [:id, :address]])

View File

@ -20,6 +20,7 @@ json.profile do
end if @member.profile.address
json.phone @member.profile.phone
json.website @member.profile.website
json.job @member.profile.job
json.extract! @member.profile, :facebook, :twitter, :google_plus, :viadeo, :linkedin, :instagram, :youtube, :vimeo, :dailymotion, :github, :echosciences, :pinterest, :lastfm, :flickr
end
json.subscribed_plan do

View File

@ -105,6 +105,7 @@ en:
date_of_birth: "Date of birth"
date_of_birth_is_required: "Date of birth is required."
website: "Website"
job: "Occupation"
project:
# project edition form

View File

@ -105,6 +105,7 @@ fr:
date_of_birth: "Date de naissance"
date_of_birth_is_required: "La date de naissance est requise."
website: "Site web"
job: "Profession"
project:
# formulaire d'étition d'un projet

View File

@ -0,0 +1,5 @@
class AddJobToProfile < ActiveRecord::Migration
def change
add_column :profiles, :job, :string
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160526095550) do
ActiveRecord::Schema.define(version: 20160526102307) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -326,6 +326,7 @@ ActiveRecord::Schema.define(version: 20160526095550) do
t.string "pinterest"
t.string "lastfm"
t.string "flickr"
t.string "job"
end
add_index "profiles", ["user_id"], name: "index_profiles_on_user_id", using: :btree