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 d2f60e5
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 35 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
43 changes: 29 additions & 14 deletions app/views/profiles/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,44 @@
<% 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>
<% if @profile.bio.present? %>
<p class="text-base font-medium mt-6"><%= @profile.bio %></p>
<% end %>
<div class="flex flex-row items-center justify-center gap-4 w-full">
<% if @profile.github_url.present? %>
<a href="<%= @profile.github_url %>" class="flex flex-row grow items-center justify-center w-28 h-14 rounded-lg bg-red mt-6">
<img src="<%= asset_path 'github.svg' %>" alt="github" class="w-6 h-6">
</a>
<%= link_to(
@profile.github_url,
class: [
"flex flex-row grow items-center justify-center w-28 h-14 rounded-lg mt-6",
"bg-red": @profile.github_url.present?,
"bg-gray-6 cursor-not-allowed": @profile.github_url.blank?
]
) do %>
<img src="<%= asset_path 'github.svg' %>" alt="github" class="w-6 h-6">
<% end %>
<% if @profile.linkedin_url.present? %>
<a href="<%= @profile.linkedin_url %>" class="flex flex-row grow items-center justify-center w-28 h-14 rounded-lg bg-red mt-6">
<img src="<%= asset_path 'linkedin.svg' %>" alt="linkedin" class="w-6 h-6">
</a>
<%= link_to(
@profile.twitter_url,
class: [
"flex flex-row grow items-center justify-center w-28 h-14 rounded-lg mt-6",
"bg-red": @profile.twitter_url.present?,
"bg-gray-6 cursor-not-allowed": @profile.twitter_url.blank?
]
) do %>
<img src="<%= asset_path 'twitter.svg' %>" alt="twitter" class="w-6 h-6">
<% end %>
<% if @profile.twitter_url.present? %>
<a href="<%= @profile.twitter_url %>" class="flex flex-row grow items-center justify-center w-28 h-14 rounded-lg bg-red mt-6">
<img src="<%= asset_path 'twitter.svg' %>" alt="twitter" class="w-6 h-6">
</a>
<%= link_to(
@profile.linkedin_url,
class: [
"flex flex-row grow items-center justify-center w-28 h-14 rounded-lg mt-6",
"bg-red": @profile.linkedin_url.present?,
"bg-gray-6 cursor-not-allowed": @profile.linkedin_url.blank?
]
) do %>
<img src="<%= asset_path 'linkedin.svg' %>" alt="linkedin" class="w-6 h-6">
<% 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 d2f60e5

Please sign in to comment.