Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/controllers/user_showcases_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class UserShowcasesController < ApplicationController
def show
@user = User.find(params[:id])
end
end
2 changes: 1 addition & 1 deletion app/models/concerns/event/collaboration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def role_for(user)
if user == author
:author
else
user_event_roles.find_by(user: user).role.to_sym
user_event_roles.find_by(user:)&.role&.to_sym
end
end
end
2 changes: 1 addition & 1 deletion app/views/dashboards/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ h2.mt-2

.sm:grid.sm:grid-cols-3.gap-4.mt-4
- @showcased_public_recipes.each do |recipe|
= render "recipes/recipe_card", recipe:, class: "h-full"
= render "recipes/card", recipe:, classes: "h-full"

= link_to("další recepty", published_recipes_path)
2 changes: 1 addition & 1 deletion app/views/published_recipes/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
/ = "nic nemůžu najít :("

- @published_recipes.each do |recipe|
= render "recipes/recipe_card", recipe:, class: "h-full"
= render "recipes/card", recipe:, classes: "h-full"
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/# locals: (recipe:, classes: "")

= turbo_frame_tag dom_id(recipe)
= render CardComponent.new(recipe, class: local_assigns[:class]) do |card|
= render CardComponent.new(recipe, class: classes) do |card|
= card.with_heading do
.grid.grid-cols-2
= link_to(recipe.name, recipe, data: { turbo_frame: "_top" })
Expand Down
6 changes: 3 additions & 3 deletions app/views/shared/_navbar.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ nav.mb-4.hidden.sm:block
a href="/"
/ img.h-12.mr-1 src=image_url("logos/logo.png") alt="navarit"

ul.flex.font-medium.ms-2.ps-4.cursor-pointer.md:p-0.border.border-gray-100.rounded-lg.md:flex-row.md:space-x-8.md:mt-0.md:border-0.dark:bg-gray-800.md:dark:bg-gray-900.dark:border-gray-700
ul.flex.font-medium.ms-2.ps-4.cursor-pointer.md:p-0.rounded-lg.md:flex-row.md:space-x-8.md:mt-0.dark:bg-gray-800.md:dark:bg-gray-900
= render "shared/navbar_link", link: dashboard_path, icon: :house, text: "domů"
= render "shared/navbar_link", link: events_path, icon: :calendar, text: "akce"
= render "shared/navbar_link", link: published_recipes_path, icon: "book-open", text: "databáze receptů"
Expand All @@ -17,5 +17,5 @@ nav.mb-4.hidden.sm:block

div id="dropdown" class="z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700"
ul class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdownDefaultButton"
li.ps-2
= button_to "odhlásit se", destroy_user_session_path, method: :delete, class: "hover:underline hover:emerald-600 hover:decoration-emerald-700 hover:decoration-4"
li.ps-2.my-2 = link_to "veřejný profil", user_showcase_path(current_user), class: "hover:underline hover:ocean-600 hover:decoration-ocean-700 hover:decoration-4"
li.ps-2 = button_to "odhlásit se", destroy_user_session_path, method: :delete, class: "hover:underline hover:emerald-600 hover:decoration-emerald-700 hover:decoration-4"
6 changes: 3 additions & 3 deletions app/views/shared/_public_navbar.html.slim
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
nav.mt-4.mb-4
.flex.flex-wrap.items-center.py-3.px-4.mx-auto.border.border-0.border-b-2.border-green-900
nav.mb-4
.flex.flex-wrap.items-center.py-3.px-4.mx-auto.bg-ocean-800
a href="/"
/ img.h-12.mr-1 src=image_url("logos/logo.png") alt="navarit"

ul.flex.font-medium.ms-2.ps-4.cursor-pointer.md:p-0.border.border-gray-100.rounded-lg.md:flex-row.md:space-x-8.md:mt-0.md:border-0.dark:bg-gray-800.md:dark:bg-gray-900.dark:border-gray-700
ul.flex.font-medium.ms-2.ps-4.cursor-pointer.md:p-0.rounded-lg.md:flex-row.md:space-x-8.md:mt-0.md:border-0.dark:bg-gray-800.md:dark:bg-gray-900.dark:border-gray-700
= render "shared/navbar_link", link: new_user_session_path, text: "přihlásit se"
= render "shared/navbar_link", link: new_user_registration_path, text: "registrovat se"
= render "shared/navbar_link", link: published_recipes_path, icon: "book-open", text: "databáze receptů"
14 changes: 14 additions & 0 deletions app/views/user_showcases/show.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- content_for :title, "Profil #{@user.full_name}"

= "#{@user.full_name} zveřejnili #{@user.recipes.published.size} receptů!"
= icon(:confetti)

h2 Zveřejněné recepty
.md:grid.md:grid-cols-3.md:gap-4
- @user.recipes.published.each do |recipe|
= render "recipes/card", recipe:, classes: "h-full"

h2.mt-4 Zveřejněné akce
.md:grid.md:grid-cols-3.md:gap-4
- @user.events.published.each do |event|
= render "events/card", event:
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
resource :dashboard, only: :show
resource :index, only: :show

resources :user_showcases, only: :show

resources :daily_plan_recipes, only: %i[create update destroy] do
patch :sort
patch :move
Expand Down
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ alias c := console
console:
bundle exec rails c

alias r := run
run:
bin/dev

Expand Down