Skip to content

Commit

Permalink
Use job title instead of location
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio-e committed Jul 25, 2024
1 parent 134d6ce commit f522139
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def current_profile

def profile_params
params.require(:profile).permit(
:name, :location, :bio, :is_public, :image,
:name, :job_title, :bio, :is_public, :image,
:twitter_url, :linkedin_url, :github_url,
:in_app_notifications, :mail_notifications
)
Expand Down
2 changes: 1 addition & 1 deletion app/models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# github_url :string
# in_app_notifications :boolean default(TRUE), not null
# is_public :boolean default(FALSE), not null
# job_title :string
# linkedin_url :string
# location :string
# mail_notifications :boolean default(TRUE), not null
# name :string
# profileable_type :string not null
Expand Down
26 changes: 13 additions & 13 deletions app/views/profiles/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,47 @@
<%= render partial: "shared/form_errors", locals: { errors: form.object.errors.full_messages } %>
<%= form.label :name, class: "font-bold text-white text-base mb-2" %>
<%= form.text_field :name, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6" %>
<%= form.text_field :name, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "John P. Doe" %>
<%= form.label :bio, class: "font-bold text-white text-base mb-2" %>
<%= form.text_area :bio, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "Short bio" %>
<%= form.text_area :bio, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "I'm a Ruby on Rails developer with six years of experience. Outside of work, I enjoy hiking and using dating apps." %>
<%= form.label :location, class: "font-bold text-white text-base mb-2" %>
<%= form.text_field :location, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "Location" %>
<%= form.label :job_title, class: "font-bold text-white text-base mb-2" %>
<%= form.text_field :job_title, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "Senior Developer at Telos Labs" %>
<%= form.label :github_url, "GitHub", class: "font-bold text-white text-base mb-2" %>
<%= form.text_field :github_url, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "GitHub link" %>
<%= form.text_field :github_url, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "https://github.com/johnp" %>
<%= form.label :linkedin_url, "LinkedIn", class: "font-bold text-white text-base mb-2" %>
<%= form.text_field :linkedin_url, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "LinkedIn link" %>
<%= form.text_field :linkedin_url, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "https://www.linkedin.com/in/johnp" %>
<%= form.label :twitter_url, "X (formerly Twitter)", class: "font-bold text-white text-base mb-2" %>
<%= form.text_field :twitter_url, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "X link" %>
<%= form.text_field :twitter_url, class: FormsHelper::TEXT_FIELD_CLASSES + " mb-6", placeholder: "https://x.com/johnp" %>

<p class="text-white font-bold">Discoverability</p>
<p class="text-white font-bold mb-2">Discoverability</p>
<div class="flex flex-row items-center bg-white justify-between rounded-md w-full p-4">
<%= form.label :is_public, "Public profile", class: "grow font-medium text-slate-900 text-base cursor-pointer mr-2" %>
<label class="inline-flex items-center cursor-pointer">
<%= form.check_box :is_public, class: "sr-only peer" %>
<div class="relative w-11 h-6 bg-gray-6 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-red dark:peer-focus:ring-red rounded-full peer dark:bg-slate-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-slate-600 peer-checked:bg-red"></div>
<div class="relative w-11 h-6 bg-gray-6 rounded-full peer dark:bg-gray-6 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red"></div>
</label>
</div>
<p class="text-xs text-white mb-6">Allow other persons to view your profile through a QR code.</p>
<p class="text-xs text-white mt-1 mb-6">Allow other persons to view your profile through a QR code.</p>

<p class="text-white font-bold">Notifications</p>
<p class="text-white font-bold mb-2">Notifications</p>
<div class="rounded-md w-full overflow-hidden mb-10">
<div class="flex flex-row items-center bg-white justify-between w-full p-4 border-b border-gray-6">
<%= form.label :mail_notifications, "Mail notifications", class: "grow font-medium text-slate-900 text-base cursor-pointer mr-2" %>
<label class="inline-flex items-center cursor-pointer">
<%= form.check_box :mail_notifications, class: "sr-only peer" %>
<div class="relative w-11 h-6 bg-gray-6 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-red dark:peer-focus:ring-red rounded-full peer dark:bg-slate-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-slate-600 peer-checked:bg-red"></div>
<div class="relative w-11 h-6 bg-gray-6 rounded-full peer dark:bg-gray-6 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red"></div>
</label>
</div>
<div class="flex flex-row items-center bg-white justify-between w-full p-4">
<%= form.label :in_app_notifications, "In-app notifications", class: "grow font-medium text-slate-900 text-base cursor-pointer mr-2" %>
<label class="inline-flex items-center cursor-pointer">
<%= form.check_box :in_app_notifications, class: "sr-only peer" %>
<div class="relative w-11 h-6 bg-gray-6 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-red dark:peer-focus:ring-red rounded-full peer dark:bg-slate-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-slate-600 peer-checked:bg-red"></div>
<div class="relative w-11 h-6 bg-gray-6 rounded-full peer dark:bg-gray-6 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red"></div>
</label>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/profiles/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<% end %>
<div class="flex flex-col items-start ml-5">
<div class="text-red text-xl font-black italic"> <%= @profile.name.presence || "Anonymous" %> </div>
<% if @profile.location.present? %>
<div class="text-lg"><%= @profile.location %></div>
<% if @profile.job_title.present? %>
<div class="text-lg"><%= @profile.job_title %></div>
<% end %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20240628210301_create_profiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def change
create_table :profiles do |t|
t.string :name
t.text :bio
t.string :location
t.string :job_title
t.string :github_url
t.string :linkedin_url
t.string :twitter_url
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Profiles
user.create_profile!(
name: "John Doe",
job_title: "Software Developer",
bio: "I'm a Ruby on Rails developer.",
is_public: true,
mail_notifications: true,
Expand All @@ -34,11 +35,11 @@
Speaker.create!(
profile_attributes: {
name: Faker::Name.name,
job_title: Faker::Job.title,
bio: Faker::Lorem.paragraph,
github_url: Faker::Internet.url(host: "github.com"),
twitter_url: Faker::Internet.url(host: "twitter.com"),
linkedin_url: Faker::Internet.url(host: "linkedin.com"),
location: Faker::Address.city,
is_public: [true, false].sample
}
)
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/profiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# github_url :string
# in_app_notifications :boolean default(TRUE), not null
# is_public :boolean default(FALSE), not null
# job_title :string
# linkedin_url :string
# location :string
# mail_notifications :boolean default(TRUE), not null
# name :string
# profileable_type :string not null
Expand All @@ -25,7 +25,7 @@
factory :profile do
name { "John Doe" }
bio { "About me" }
location { "New York" }
job_title { "Developer" }
is_public { false }
github_url { "https://github.com" }
linkedin_url { "https://linkedin.com" }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# github_url :string
# in_app_notifications :boolean default(TRUE), not null
# is_public :boolean default(FALSE), not null
# job_title :string
# linkedin_url :string
# location :string
# mail_notifications :boolean default(TRUE), not null
# name :string
# profileable_type :string not null
Expand Down

0 comments on commit f522139

Please sign in to comment.