Skip to content

Commit 020a8bc

Browse files
authored
Merge pull request #152 from TreinaDev/feat/lateral-menu
Melhorias na navegabilidade da página detalhes de um evento
2 parents 7322d32 + 941603c commit 020a8bc

31 files changed

Lines changed: 207 additions & 54 deletions
Lines changed: 3 additions & 0 deletions
Loading

app/assets/images/announcement.svg

Lines changed: 3 additions & 0 deletions
Loading

app/assets/images/close.svg

Lines changed: 9 additions & 0 deletions
Loading

app/assets/images/details.svg

Lines changed: 3 additions & 0 deletions
Loading

app/assets/images/star-disable.svg

Lines changed: 3 additions & 0 deletions
Loading

app/assets/images/ticket.svg

Lines changed: 3 additions & 0 deletions
Loading

app/assets/stylesheets/application.tailwind.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
@layer components {
66
.site-header {
7-
@apply sticky z-10 top-0 flex justify-between items-center py-4 px-32 bg-primary p-5 drop-shadow-[5px_5px_20px_rgba(51,102,40,0.4)] min-h-20;
7+
@apply fixed z-10 top-0 w-screen flex justify-between items-center py-4 px-32 bg-primary p-5 drop-shadow-[5px_5px_20px_rgba(51,102,40,0.4)] min-h-20;
88
}
99

1010
.site-main {
@@ -56,7 +56,7 @@
5656
}
5757

5858
.notice {
59-
@apply p-5 bg-success text-textPrimary rounded-3xl font-bold absolute top-[90px] right-32 left-32;
59+
@apply p-5 bg-success text-textPrimary rounded-3xl font-bold mx-32;
6060
}
6161

6262
.alert {
@@ -114,4 +114,12 @@
114114
.filter_button {
115115
@apply bg-primary text-white;
116116
}
117+
118+
.sidebar-item-div {
119+
@apply flex relative justify-center items-center p-2 min-h-[50px];
120+
}
121+
122+
.sidebar-tooltip {
123+
@apply absolute px-4 py-2 rounded-full left-24 bg-[#C2CFDE] hidden;
124+
}
117125
}

app/controllers/announcements_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class AnnouncementsController < ApplicationController
2-
layout "dashboard"
2+
layout "dashboard_with_sidebar"
33
before_action :authenticate_user!
44
before_action :set_event
55
before_action :check_if_published
@@ -24,9 +24,9 @@ def create
2424
@announcement.user = current_user
2525
@announcement.event = @event
2626
if @announcement.save
27-
redirect_to event_announcements_path(@event), notice: t(".success")
27+
redirect_to event_announcements_path(@event)
2828
else
29-
@announcements = @event.announcements
29+
@announcements = @event.announcements.order(created_at: :desc)
3030
flash.now[:alert] = t(".failure")
3131
render :index, status: :unprocessable_entity
3232
end

app/controllers/application_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ class ApplicationController < ActionController::Base
44
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
55
allow_browser versions: :modern
66

7+
helper_method :current_event
8+
79
def after_sign_in_path_for(resource)
810
dashboard_path
911
end
1012

1113
protected
14+
15+
def current_event
16+
@event ||= Event.find_by(id: params[:event_id]) || Event.find_by(id: params[:id])
17+
end
18+
1219
def configure_permitted_parameters
1320
devise_parameter_sanitizer.permit(:sign_up, keys: [ :name, :family_name, :registration_number ])
1421
end

app/controllers/events_controller.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class EventsController < ApplicationController
2-
layout "dashboard"
2+
layout :determine_layout
33
before_action :authenticate_user!
44
before_action :check_if_admin, only: [ :history ]
55
before_action :authorize_event_access, only: [ :show, :publish, :destroy, :edit, :update ]
@@ -76,6 +76,14 @@ def history
7676

7777
private
7878

79+
def determine_layout
80+
if [ "index", "new", "create", "history" ].include?(action_name)
81+
"dashboard"
82+
else
83+
"dashboard_with_sidebar"
84+
end
85+
end
86+
7987
def event_params
8088
params.require(:event).permit(:name, :address, :event_type, :participants_limit, :url, :logo, :banner, :description, :start_date, :end_date, category_ids: [])
8189
end

0 commit comments

Comments
 (0)