Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faz melhorias no seeds e alguma correções e melhorias #137

Merged
merged 14 commits into from
Feb 7, 2025
Merged
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
37 changes: 14 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Este é um sistema completo de gerenciamento de eventos, permitindo que organiza
- Cadastro de eventos
- Cadastro de Agenda de eventos
- Categorias de eventos com palavras-chave associadas
- Cadastro de Lotes
- Cadastro de Comunicados
- Cadastro de Locais de eventos
- Cadastro de Recomendações de eventos
- Verificação do usuário
- Feedback do evento
- Histórico de eventos

## Gems utilizadas

Expand All @@ -24,6 +31,9 @@ Este é um sistema completo de gerenciamento de eventos, permitindo que organiza
- Rspec
- Capybara
- Devise
- Faraday
- Timecop
- Discard

## Pré-requisitos

Expand All @@ -45,6 +55,9 @@ node 16.20.2

# Execute a aplicação
$ bin/setup

# A aplicação estará disponível em
http://localhost:3003
```

## Como rodar testes
Expand All @@ -65,29 +78,7 @@ node 16.20.2

# APIs

GET /api/v1/events

Caso não hajam eventos cadastrados, a API retorna:
`status: 200, json: []`

Caso contrário, a API retorna `status: 200` e todos os eventos publicados no seguinte formato:

```json
{
"events": [
{
"id": 1,
"name": "Evento 1",
"description": "Descrição do evento 1",
"address": "Rua 1, 123",
"logo_url": "https://www.example.com/logo1.png",
"banner_url": "https://www.example.com/banner1.png",
"participants_limit": 100,
"event_owner": "João"
}
]
}
```
Para ver os endpoint acesse esse link: [Documentação da API](doc/API_README.md).

## Contribuidores

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/announcements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ class AnnouncementsController < ApplicationController
before_action :set_event
before_action :check_if_published
before_action :check_if_event_manager, only: [ :create ]

add_breadcrumb "Home", :dashboard_path


def index
@announcements = @event.announcements
@announcements = @event.announcements.order(created_at: :desc)
@announcement = Announcement.new

add_breadcrumb "#{@event.name}", Proc.new { event_path(@event) }
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/schedules_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class SchedulesController < ApplicationController

def show
@schedule = Schedule.find_by(id: params[:id])
@schedule_items = @schedule.schedule_items.order(start_time: :desc)
@schedule_items = @schedule.schedule_items.order(start_time: :asc)


add_breadcrumb "#{@event.name}", Proc.new { event_path(@event) }
add_breadcrumb "Agenda de #{I18n.l(@schedule.date.to_date, format: :short)}"
Expand Down
5 changes: 4 additions & 1 deletion app/views/announcements/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<div class="max-w-[60vw] min-w-[50vw] mx-auto">
<section class="p-5 shadow-md rounded bg-white">
<%= form_with model: [@event, @announcement], local: true do |f| %>
<h2 class="p-2"><%= t('.title')%></h2>
Expand All @@ -15,7 +16,7 @@
<% @announcements.each do |a|%>
<div class="bg-white shadow-md rounded mt-10">
<p class="p-2"><%= l a.created_at, format: :short%></p>
<h1 class="bg-blue-200 py-6 px-3"><%= a.title%></h1>
<h1 class="bg-blue-200 py-6 px-3" data-announcement-title><%= a.title%></h1>
<div class="min-h-[6rem] p-3 px-3">
<%= render layout: 'layouts/action_text/contents/content' do %>
<%= a.description %>
Expand All @@ -25,5 +26,7 @@

<% end %>

</div>



4 changes: 2 additions & 2 deletions app/views/events/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<div class="input_container">
<%= f.label :start_date, class: 'input_label' %>
<%= f.date_field :start_date, class: "input" %>
<%= f.datetime_field :start_date, class: "input" %>
<% if event.errors[:start_date].any? %>
<% event.errors.full_messages_for(:start_date).each do |e| %>
<span class="form_error"><%= e %></span>
Expand All @@ -62,7 +62,7 @@

<div class="input_container">
<%= f.label :end_date, class: 'input_label' %>
<%= f.date_field :end_date, class: "input" %>
<%= f.datetime_field :end_date, class: "input" %>
<% if event.errors[:end_date].any? %>
<% event.errors.full_messages_for(:end_date).each do |e| %>
<span class="form_error"><%= e %></span>
Expand Down
30 changes: 15 additions & 15 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<div class="bg-white p-10 rounded shadow-md">
<div class="flex items-center justify-between">
<div class="flex items-center gap-4">
<% if @event.logo.attached? %>
Expand Down Expand Up @@ -38,30 +39,22 @@
</div>
<% end %>

<p class="font-light text-textSecondary">
<span class="font-bold text-textPrimary">Status:</span>
<div class="flex gap-4">
<p class="font-light text-textSecondary">
<% if @event.draft? %>
<span class="text-warning font-bold"><%= Event.human_enum_name(:status, @event.status)%> 🏷️</span>
<% else %>
<span class="text-success font-bold"><%= Event.human_enum_name(:status, @event.status)%> ✅</span>
<% end %>
</p>
</p>
<p class="font-bold text-textPrimary"><%= Event.human_enum_name(:event_type, @event.event_type)%></p>
</div>

<p class="font-light text-textSecondary">
<span class="font-bold text-textPrimary">Limite de Participantes:</span>
<%= @event.participants_limit %>
</p>


<div class="font-light text-textSecondary">
<span class="font-bold text-textPrimary mr-2">Descrição:</span>
<%= render layout: 'layouts/action_text/contents/content' do %>
<%= @event.description %>
<% end %>
</div>

<p class="font-bold text-textPrimary">Evento <%= Event.human_enum_name(:event_type, @event.event_type)%></p>

<p class="font-light text-textSecondary">
<span class="font-bold text-textPrimary">Site do Evento:</span>
<%= @event.url %>
Expand All @@ -73,14 +66,21 @@
<%= @event.address %>
</p>
<% end %>

<div class="font-light text-textSecondary">
<%= render layout: 'layouts/action_text/contents/content' do %>
<%= @event.description %>
<% end %>
</div>
</article>

<aside class="flex flex-col gap-4 items-end pl-10 min-w-fit">
<h2 class="text-right">Agendas do Evento</h2>
<% @event.schedules.each do |schedule| %>
<% @event.schedules.order(date: :asc).each do |schedule| %>
<%= link_to event_schedule_path(@event, schedule), class: "text-right justify-end underline underline-offset-4 decoration-primary hover:bg-textPrimary/15 p-3 rounded-md transition duration-150 font-bold hover:brightness-90" do %>
Dia <%= l schedule.date.to_date, format: :short %>
<% end %>
<% end %>
</aside>
</section>
</section>
</div>
4 changes: 2 additions & 2 deletions app/views/schedules/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>

<div class="flex justify-between w-full">
<p class="ml-8 font-bold text-primary"><%= item.name %></p>
<p class="ml-8 font-bold text-primary" data-item-name><%= item.name %></p>
<p class="font-light"><span class="font-bold mr-2">Responsável:</span><%= item.responsible_name %></p>
</div>
<% else %>
Expand All @@ -39,7 +39,7 @@
</div>

<div class="flex justify-between w-full">
<p class="ml-8 font-bold text-primaryLight"><%= item.name %></p>
<p class="ml-8 font-bold text-primaryLight" data-item-name><%= item.name %></p>
</div>
<% end %>
</article>
Expand Down
Loading