Rename SpeakerProfile to PersonalProfile
This commit is contained in:
parent
f4778c9e10
commit
f2dddcdff5
|
@ -19,6 +19,6 @@
|
||||||
/db/schema.rb
|
/db/schema.rb
|
||||||
/erd.pdf
|
/erd.pdf
|
||||||
/public/uploads/tmp/*
|
/public/uploads/tmp/*
|
||||||
/public/uploads/speaker_profile/*
|
/public/uploads/personal_profile/*
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
/coverage/
|
/coverage/
|
||||||
|
|
2
TODO
2
TODO
|
@ -20,4 +20,4 @@
|
||||||
Notes:
|
Notes:
|
||||||
- .row > .col-lg-12 -> put that outside of the "yield"?
|
- .row > .col-lg-12 -> put that outside of the "yield"?
|
||||||
- human_attribute_name -> create a short alias?
|
- human_attribute_name -> create a short alias?
|
||||||
- NullSpeakerProfile with placeholders?
|
- NullPersonalProfile with placeholders?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Management
|
module Management
|
||||||
class UsersController < ManagementController
|
class UsersController < ManagementController
|
||||||
def index
|
def index
|
||||||
@users = User.includes(:speaker_profile)
|
@users = User.includes(:personal_profile)
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle_admin
|
def toggle_admin
|
||||||
|
@ -12,12 +12,12 @@ module Management
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@user = find_user
|
@user = find_user
|
||||||
@profile = @user.speaker_profile
|
@profile = @user.personal_profile
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@user = find_user
|
@user = find_user
|
||||||
@user.build_speaker_profile if @user.speaker_profile.blank?
|
@user.personal_profile if @user.personal_profile.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
@ -46,7 +46,7 @@ module Management
|
||||||
def user_params
|
def user_params
|
||||||
params.require(:user).permit(
|
params.require(:user).permit(
|
||||||
:email,
|
:email,
|
||||||
speaker_profile_attributes: [
|
personal_profile_attributes: [
|
||||||
:picture,
|
:picture,
|
||||||
:first_name,
|
:first_name,
|
||||||
:last_name,
|
:last_name,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class SpeakerProfile < ActiveRecord::Base
|
class PersonalProfile < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
validates :first_name, presence: true
|
validates :first_name, presence: true
|
|
@ -4,17 +4,17 @@ class User < ActiveRecord::Base
|
||||||
devise :database_authenticatable, :registerable, :confirmable,
|
devise :database_authenticatable, :registerable, :confirmable,
|
||||||
:recoverable, :rememberable, :trackable, :validatable
|
:recoverable, :rememberable, :trackable, :validatable
|
||||||
|
|
||||||
has_one :speaker_profile
|
has_one :personal_profile
|
||||||
has_many :lectures
|
has_many :lectures
|
||||||
has_many :workshops
|
has_many :workshops
|
||||||
has_many :events
|
has_many :events
|
||||||
|
|
||||||
accepts_nested_attributes_for :speaker_profile, update_only: true
|
accepts_nested_attributes_for :personal_profile, update_only: true
|
||||||
|
|
||||||
default_scope { order id: :desc }
|
default_scope { order id: :desc }
|
||||||
|
|
||||||
def name
|
def name
|
||||||
speaker_profile.try(:name) || email
|
personal_profile.try(:name) || email
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle_admin!
|
def toggle_admin!
|
||||||
|
@ -22,8 +22,8 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def profile_picture
|
def profile_picture
|
||||||
if speaker_profile.present?
|
if personal_profile.present?
|
||||||
speaker_profile.picture
|
personal_profile.picture
|
||||||
else
|
else
|
||||||
PictureUploader.new
|
PictureUploader.new
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
- content_for(:title) { ":: #{t :edit_speaker_profile}" }
|
- content_for(:title) { ":: #{t :edit_personal_profile}" }
|
||||||
|
|
||||||
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f|
|
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f|
|
||||||
.form_inputs
|
.form_inputs
|
||||||
h2.entry-title = t :speaker_profile
|
h2.entry-title = t :personal_profile
|
||||||
= f.error_notification
|
= f.error_notification
|
||||||
= f.simple_fields_for :speaker_profile do |ff|
|
= f.simple_fields_for :personal_profile do |ff|
|
||||||
= ff.input :picture, as: :image_preview, input_html: {preview_version: :thumb}, required: true
|
= ff.input :picture, as: :image_preview, input_html: {preview_version: :thumb}, required: true
|
||||||
= ff.input :first_name, autofocus: true
|
= ff.input :first_name, autofocus: true
|
||||||
= ff.input :last_name
|
= ff.input :last_name
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
= ff.input :organisation
|
= ff.input :organisation
|
||||||
= ff.input :github
|
= ff.input :github
|
||||||
= ff.input :twitter
|
= ff.input :twitter
|
||||||
= ff.input :mobile_phone, input_html: {value: resource.speaker_profile.mobile_phone.try(:phony_formatted, format: :international)}
|
= ff.input :mobile_phone, input_html: {value: resource.personal_profile.mobile_phone.try(:phony_formatted, format: :international)}
|
||||||
= ff.input :biography
|
= ff.input :biography
|
||||||
|
|
||||||
.form-inputs
|
.form-inputs
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
hr
|
hr
|
||||||
.row
|
.row
|
||||||
.col-lg-12
|
.col-lg-12
|
||||||
- speaker_profile = @user.speaker_profile
|
- personal_profile = @user.personal_profile
|
||||||
|
|
||||||
= f.simple_fields_for :speaker_profile do |ff|
|
= f.simple_fields_for :personal_profile do |ff|
|
||||||
- if speaker_profile.picture.present?
|
- if personal_profile.picture.present?
|
||||||
.col-sm-offset-3.col-sm-9
|
.col-sm-offset-3.col-sm-9
|
||||||
= image_tag speaker_profile.picture.medium.url, class: 'img-thumbnail'
|
= image_tag personal_profile.picture.medium.url, class: 'img-thumbnail'
|
||||||
|
|
||||||
= ff.input :picture, wrapper: :horizontal_file_input
|
= ff.input :picture, wrapper: :horizontal_file_input
|
||||||
|
|
||||||
|
|
|
@ -10,30 +10,30 @@
|
||||||
= link_to icon(:edit), edit_management_user_path(@user), class: 'btn btn-xs btn-danger pull-right'
|
= link_to icon(:edit), edit_management_user_path(@user), class: 'btn btn-xs btn-danger pull-right'
|
||||||
.panel-body
|
.panel-body
|
||||||
.center
|
.center
|
||||||
= image_tag @user.speaker_profile.picture.medium.url, class: "profile-image"
|
= image_tag @user.personal_profile.picture.medium.url, class: "profile-image"
|
||||||
- if @user.speaker_profile.organisation.present?
|
- if @user.personal_profile.organisation.present?
|
||||||
div
|
div
|
||||||
=> icon :briefcase
|
=> icon :briefcase
|
||||||
= @user.speaker_profile.organisation
|
= @user.personal_profile.organisation
|
||||||
div.social
|
div.social
|
||||||
= link_to "mailto://#{@user.email}"
|
= link_to "mailto://#{@user.email}"
|
||||||
= icon :envelope
|
= icon :envelope
|
||||||
- if @user.speaker_profile.github.present?
|
- if @user.personal_profile.github.present?
|
||||||
= link_to "https://github.com/#{@user.speaker_profile.github}"
|
= link_to "https://github.com/#{@user.personal_profile.github}"
|
||||||
= icon :github
|
= icon :github
|
||||||
- if @user.speaker_profile.twitter.present?
|
- if @user.personal_profile.twitter.present?
|
||||||
= link_to "https://twitter.com/#{@user.speaker_profile.twitter}"
|
= link_to "https://twitter.com/#{@user.personal_profile.twitter}"
|
||||||
= icon :twitter
|
= icon :twitter
|
||||||
|
|
||||||
hr
|
hr
|
||||||
|
|
||||||
h4 = SpeakerProfile.human_attribute_name(:biography)
|
h4 = PersonalProfile.human_attribute_name(:biography)
|
||||||
= simple_format @user.speaker_profile.biography
|
= simple_format @user.personal_profile.biography
|
||||||
|
|
||||||
h4 = t :contacts
|
h4 = t :contacts
|
||||||
- if @user.speaker_profile.twitter.present?
|
- if @user.personal_profile.twitter.present?
|
||||||
p #{icon :twitter} @#{@user.speaker_profile.twitter}
|
p #{icon :twitter} @#{@user.personal_profile.twitter}
|
||||||
- if @user.speaker_profile.public_email.present?
|
- if @user.personal_profile.public_email.present?
|
||||||
p #{icon :envelope} #{@user.speaker_profile.public_email} (#{t(:public)})
|
p #{icon :envelope} #{@user.personal_profile.public_email} (#{t(:public)})
|
||||||
p #{icon :envelope} #{@user.email} (#{t(:private)})
|
p #{icon :envelope} #{@user.email} (#{t(:private)})
|
||||||
p #{glyph :phone} #{Phony.format(@user.speaker_profile.mobile_phone, format: :international)}
|
p #{glyph :phone} #{Phony.format(@user.personal_profile.mobile_phone, format: :international)}
|
||||||
|
|
|
@ -106,7 +106,7 @@ bg:
|
||||||
password: Парола
|
password: Парола
|
||||||
password_confirmation: Отново паролата
|
password_confirmation: Отново паролата
|
||||||
remember_me: Запомни ме
|
remember_me: Запомни ме
|
||||||
speaker_profile:
|
personal_profile:
|
||||||
picture: Снимка
|
picture: Снимка
|
||||||
first_name: Име
|
first_name: Име
|
||||||
last_name: Фамилия
|
last_name: Фамилия
|
||||||
|
@ -135,7 +135,7 @@ bg:
|
||||||
invalid: не е валиден e-mail адрес
|
invalid: не е валиден e-mail адрес
|
||||||
password_confirmation:
|
password_confirmation:
|
||||||
confirmation: не съответства на паролата
|
confirmation: не съответства на паролата
|
||||||
speaker_profile:
|
personal_profile:
|
||||||
attributes:
|
attributes:
|
||||||
twitter:
|
twitter:
|
||||||
invalid: може да съдържа максимум 15 символа, които могат да бъдат само букви, числа или долна черта
|
invalid: може да съдържа максимум 15 символа, които могат да бъдат само букви, числа или долна черта
|
||||||
|
|
|
@ -45,7 +45,7 @@ en:
|
||||||
password: Password
|
password: Password
|
||||||
password_confirmation: Password confirmation
|
password_confirmation: Password confirmation
|
||||||
remember_me: Remember me
|
remember_me: Remember me
|
||||||
speaker_profile:
|
personal_profile:
|
||||||
picture: Photo
|
picture: Photo
|
||||||
first_name: First name
|
first_name: First name
|
||||||
last_name: Last name
|
last_name: Last name
|
||||||
|
@ -74,7 +74,7 @@ en:
|
||||||
invalid: is not a valid e-mail address
|
invalid: is not a valid e-mail address
|
||||||
password_confirmation:
|
password_confirmation:
|
||||||
confirmation: does not match the password
|
confirmation: does not match the password
|
||||||
speaker_profile:
|
personal_profile:
|
||||||
attributes:
|
attributes:
|
||||||
twitter:
|
twitter:
|
||||||
invalid: can contain a maximum of 15 symbols that need to be alphabet charachters, digits or an underscore
|
invalid: can contain a maximum of 15 symbols that need to be alphabet charachters, digits or an underscore
|
||||||
|
|
|
@ -22,7 +22,7 @@ bg:
|
||||||
email: e-mail адресът Ви. Ще бъде видим само от организаторите
|
email: e-mail адресът Ви. Ще бъде видим само от организаторите
|
||||||
password: Парола с дължина между 8 и 128 символа
|
password: Парола с дължина между 8 и 128 символа
|
||||||
password_confirmation: Отново въведената отгоре парола
|
password_confirmation: Отново въведената отгоре парола
|
||||||
speaker_profile:
|
personal_profile:
|
||||||
picture: Ваша снимка
|
picture: Ваша снимка
|
||||||
organisation: Организацията, която представлявате
|
organisation: Организацията, която представлявате
|
||||||
public_email: E-mail адрес, който ще бъде видим за посетителите
|
public_email: E-mail адрес, който ще бъде видим за посетителите
|
||||||
|
|
|
@ -12,7 +12,7 @@ en:
|
||||||
email: Your e-mail address. Will be visible to the organizers only.
|
email: Your e-mail address. Will be visible to the organizers only.
|
||||||
password: Password with length between 8 and 128 symbols
|
password: Password with length between 8 and 128 symbols
|
||||||
password_confirmation: Repeat the password
|
password_confirmation: Repeat the password
|
||||||
speaker_profile:
|
personal_profile:
|
||||||
picture: Your photo
|
picture: Your photo
|
||||||
organisation: Your organization
|
organisation: Your organization
|
||||||
public_email: E-mail address, visible to the visitors
|
public_email: E-mail address, visible to the visitors
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class RenameSpeakerProfilesToPersonalProfiles < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
rename_table :speaker_profiles, :personal_profiles
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue