diff --git a/.gitignore b/.gitignore index de6439a..f344825 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,6 @@ /db/schema.rb /erd.pdf /public/uploads/tmp/* -/public/uploads/speaker_profile/* +/public/uploads/personal_profile/* .sass-cache/ /coverage/ diff --git a/TODO b/TODO index 5256d27..f6f8b4d 100644 --- a/TODO +++ b/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? diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb index cb1e220..428b28f 100644 --- a/app/controllers/management/users_controller.rb +++ b/app/controllers/management/users_controller.rb @@ -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, diff --git a/app/models/speaker_profile.rb b/app/models/personal_profile.rb similarity index 94% rename from app/models/speaker_profile.rb rename to app/models/personal_profile.rb index c026383..bce606e 100644 --- a/app/models/speaker_profile.rb +++ b/app/models/personal_profile.rb @@ -1,4 +1,4 @@ -class SpeakerProfile < ActiveRecord::Base +class PersonalProfile < ActiveRecord::Base belongs_to :user validates :first_name, presence: true diff --git a/app/models/user.rb b/app/models/user.rb index 3412dda..6c4452f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/views/devise/registrations/edit.html.slim b/app/views/devise/registrations/edit.html.slim index 7158882..3f87f5c 100644 --- a/app/views/devise/registrations/edit.html.slim +++ b/app/views/devise/registrations/edit.html.slim @@ -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 diff --git a/app/views/management/users/edit.html.slim b/app/views/management/users/edit.html.slim index 73fce02..238c336 100644 --- a/app/views/management/users/edit.html.slim +++ b/app/views/management/users/edit.html.slim @@ -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 diff --git a/app/views/management/users/show.html.slim b/app/views/management/users/show.html.slim index 016cedd..394a77d 100644 --- a/app/views/management/users/show.html.slim +++ b/app/views/management/users/show.html.slim @@ -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)} diff --git a/config/locales/bg.yml b/config/locales/bg.yml index ed37f15..fe15f53 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -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: Изпрати \ No newline at end of file + resend: Изпрати diff --git a/config/locales/en.yml b/config/locales/en.yml index e778d79..9e28bce 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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' \ No newline at end of file + improbable_phone: 'not a valid phone number' diff --git a/config/locales/simple_form.bg.yml b/config/locales/simple_form.bg.yml index 2c62fc9..03cafa6 100644 --- a/config/locales/simple_form.bg.yml +++ b/config/locales/simple_form.bg.yml @@ -22,7 +22,7 @@ bg: email: e-mail адресът Ви. Ще бъде видим само от организаторите password: Парола с дължина между 8 и 128 символа password_confirmation: Отново въведената отгоре парола - speaker_profile: + personal_profile: picture: Ваша снимка organisation: Организацията, която представлявате public_email: E-mail адрес, който ще бъде видим за посетителите diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 227fe0c..224a5a5 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -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 diff --git a/db/migrate/20150530181525_rename_speaker_profiles_to_personal_profiles.rb b/db/migrate/20150530181525_rename_speaker_profiles_to_personal_profiles.rb new file mode 100644 index 0000000..c4ee3f1 --- /dev/null +++ b/db/migrate/20150530181525_rename_speaker_profiles_to_personal_profiles.rb @@ -0,0 +1,5 @@ +class RenameSpeakerProfilesToPersonalProfiles < ActiveRecord::Migration + def change + rename_table :speaker_profiles, :personal_profiles + end +end