Rename SpeakerProfile to PersonalProfile
This commit is contained in:
parent
f4778c9e10
commit
f2dddcdff5
|
@ -19,6 +19,6 @@
|
|||
/db/schema.rb
|
||||
/erd.pdf
|
||||
/public/uploads/tmp/*
|
||||
/public/uploads/speaker_profile/*
|
||||
/public/uploads/personal_profile/*
|
||||
.sass-cache/
|
||||
/coverage/
|
||||
|
|
2
TODO
2
TODO
|
@ -20,4 +20,4 @@
|
|||
Notes:
|
||||
- .row > .col-lg-12 -> put that outside of the "yield"?
|
||||
- human_attribute_name -> create a short alias?
|
||||
- NullSpeakerProfile with placeholders?
|
||||
- NullPersonalProfile with placeholders?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Management
|
||||
class UsersController < ManagementController
|
||||
def index
|
||||
@users = User.includes(:speaker_profile)
|
||||
@users = User.includes(:personal_profile)
|
||||
end
|
||||
|
||||
def toggle_admin
|
||||
|
@ -12,12 +12,12 @@ module Management
|
|||
|
||||
def show
|
||||
@user = find_user
|
||||
@profile = @user.speaker_profile
|
||||
@profile = @user.personal_profile
|
||||
end
|
||||
|
||||
def edit
|
||||
@user = find_user
|
||||
@user.build_speaker_profile if @user.speaker_profile.blank?
|
||||
@user.personal_profile if @user.personal_profile.blank?
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -46,7 +46,7 @@ module Management
|
|||
def user_params
|
||||
params.require(:user).permit(
|
||||
:email,
|
||||
speaker_profile_attributes: [
|
||||
personal_profile_attributes: [
|
||||
:picture,
|
||||
:first_name,
|
||||
:last_name,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SpeakerProfile < ActiveRecord::Base
|
||||
class PersonalProfile < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
|
||||
validates :first_name, presence: true
|
|
@ -4,17 +4,17 @@ class User < ActiveRecord::Base
|
|||
devise :database_authenticatable, :registerable, :confirmable,
|
||||
:recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
has_one :speaker_profile
|
||||
has_one :personal_profile
|
||||
has_many :lectures
|
||||
has_many :workshops
|
||||
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 }
|
||||
|
||||
def name
|
||||
speaker_profile.try(:name) || email
|
||||
personal_profile.try(:name) || email
|
||||
end
|
||||
|
||||
def toggle_admin!
|
||||
|
@ -22,8 +22,8 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def profile_picture
|
||||
if speaker_profile.present?
|
||||
speaker_profile.picture
|
||||
if personal_profile.present?
|
||||
personal_profile.picture
|
||||
else
|
||||
PictureUploader.new
|
||||
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|
|
||||
.form_inputs
|
||||
h2.entry-title = t :speaker_profile
|
||||
h2.entry-title = t :personal_profile
|
||||
= 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 :first_name, autofocus: true
|
||||
= ff.input :last_name
|
||||
|
@ -12,7 +12,7 @@
|
|||
= ff.input :organisation
|
||||
= ff.input :github
|
||||
= 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
|
||||
|
||||
.form-inputs
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
hr
|
||||
.row
|
||||
.col-lg-12
|
||||
- speaker_profile = @user.speaker_profile
|
||||
- personal_profile = @user.personal_profile
|
||||
|
||||
= f.simple_fields_for :speaker_profile do |ff|
|
||||
- if speaker_profile.picture.present?
|
||||
= f.simple_fields_for :personal_profile do |ff|
|
||||
- if personal_profile.picture.present?
|
||||
.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
|
||||
|
||||
|
|
|
@ -10,30 +10,30 @@
|
|||
= link_to icon(:edit), edit_management_user_path(@user), class: 'btn btn-xs btn-danger pull-right'
|
||||
.panel-body
|
||||
.center
|
||||
= image_tag @user.speaker_profile.picture.medium.url, class: "profile-image"
|
||||
- if @user.speaker_profile.organisation.present?
|
||||
= image_tag @user.personal_profile.picture.medium.url, class: "profile-image"
|
||||
- if @user.personal_profile.organisation.present?
|
||||
div
|
||||
=> icon :briefcase
|
||||
= @user.speaker_profile.organisation
|
||||
= @user.personal_profile.organisation
|
||||
div.social
|
||||
= link_to "mailto://#{@user.email}"
|
||||
= icon :envelope
|
||||
- if @user.speaker_profile.github.present?
|
||||
= link_to "https://github.com/#{@user.speaker_profile.github}"
|
||||
- if @user.personal_profile.github.present?
|
||||
= link_to "https://github.com/#{@user.personal_profile.github}"
|
||||
= icon :github
|
||||
- if @user.speaker_profile.twitter.present?
|
||||
= link_to "https://twitter.com/#{@user.speaker_profile.twitter}"
|
||||
- if @user.personal_profile.twitter.present?
|
||||
= link_to "https://twitter.com/#{@user.personal_profile.twitter}"
|
||||
= icon :twitter
|
||||
|
||||
hr
|
||||
|
||||
h4 = SpeakerProfile.human_attribute_name(:biography)
|
||||
= simple_format @user.speaker_profile.biography
|
||||
h4 = PersonalProfile.human_attribute_name(:biography)
|
||||
= simple_format @user.personal_profile.biography
|
||||
|
||||
h4 = t :contacts
|
||||
- if @user.speaker_profile.twitter.present?
|
||||
p #{icon :twitter} @#{@user.speaker_profile.twitter}
|
||||
- if @user.speaker_profile.public_email.present?
|
||||
p #{icon :envelope} #{@user.speaker_profile.public_email} (#{t(:public)})
|
||||
- if @user.personal_profile.twitter.present?
|
||||
p #{icon :twitter} @#{@user.personal_profile.twitter}
|
||||
- if @user.personal_profile.public_email.present?
|
||||
p #{icon :envelope} #{@user.personal_profile.public_email} (#{t(:public)})
|
||||
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_confirmation: Отново паролата
|
||||
remember_me: Запомни ме
|
||||
speaker_profile:
|
||||
personal_profile:
|
||||
picture: Снимка
|
||||
first_name: Име
|
||||
last_name: Фамилия
|
||||
|
@ -135,7 +135,7 @@ bg:
|
|||
invalid: не е валиден e-mail адрес
|
||||
password_confirmation:
|
||||
confirmation: не съответства на паролата
|
||||
speaker_profile:
|
||||
personal_profile:
|
||||
attributes:
|
||||
twitter:
|
||||
invalid: може да съдържа максимум 15 символа, които могат да бъдат само букви, числа или долна черта
|
||||
|
@ -175,4 +175,4 @@ bg:
|
|||
unlocks:
|
||||
did_not_receive_unlock_instructions: Не сте получили инструкции за отключване?
|
||||
resend_unlock_instructions: Изпращане на инструкции за отключване
|
||||
resend: Изпрати
|
||||
resend: Изпрати
|
||||
|
|
|
@ -45,7 +45,7 @@ en:
|
|||
password: Password
|
||||
password_confirmation: Password confirmation
|
||||
remember_me: Remember me
|
||||
speaker_profile:
|
||||
personal_profile:
|
||||
picture: Photo
|
||||
first_name: First name
|
||||
last_name: Last name
|
||||
|
@ -74,7 +74,7 @@ en:
|
|||
invalid: is not a valid e-mail address
|
||||
password_confirmation:
|
||||
confirmation: does not match the password
|
||||
speaker_profile:
|
||||
personal_profile:
|
||||
attributes:
|
||||
twitter:
|
||||
invalid: can contain a maximum of 15 symbols that need to be alphabet charachters, digits or an underscore
|
||||
|
@ -82,4 +82,4 @@ en:
|
|||
invalid: can contain only alphabet characters, digits or a dash and cannot start with a dash
|
||||
errors:
|
||||
messages:
|
||||
improbable_phone: 'not a valid phone number'
|
||||
improbable_phone: 'not a valid phone number'
|
||||
|
|
|
@ -22,7 +22,7 @@ bg:
|
|||
email: e-mail адресът Ви. Ще бъде видим само от организаторите
|
||||
password: Парола с дължина между 8 и 128 символа
|
||||
password_confirmation: Отново въведената отгоре парола
|
||||
speaker_profile:
|
||||
personal_profile:
|
||||
picture: Ваша снимка
|
||||
organisation: Организацията, която представлявате
|
||||
public_email: E-mail адрес, който ще бъде видим за посетителите
|
||||
|
|
|
@ -12,7 +12,7 @@ en:
|
|||
email: Your e-mail address. Will be visible to the organizers only.
|
||||
password: Password with length between 8 and 128 symbols
|
||||
password_confirmation: Repeat the password
|
||||
speaker_profile:
|
||||
personal_profile:
|
||||
picture: Your photo
|
||||
organisation: Your organization
|
||||
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