-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/add-user-identification_as_anonymous
- Loading branch information
Showing
23 changed files
with
167 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
<%=page_title(t('.title'))%> | ||
|
||
<% if @event_ids.empty? %> | ||
<p class="text-lg text-center text-gray-500 dark:text-black-300 mt-6"><%= t('.no_tickets') %></p> | ||
<div class="flex justify-center items-center h-64"> | ||
<p class="text-xl text-center text-gray-500 dark:text-gray-300"> | ||
<%= t('.no_tickets') %> | ||
</p> | ||
</div> | ||
<% else %> | ||
<p class="text-lg text-center text-gray-500 dark:text-black-300 mt-6"><%= t('.no_server') if @my_events.empty? %></p> | ||
|
||
<% @my_events.each do |event| %> | ||
<div id="event_id_<%=event.event_id%>" class="bg-white shadow-lg rounded-lg overflow-hidden hover:shadow-xl transition"> | ||
<div class="container mx-auto px-4"> | ||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6"> | ||
<% @my_events.each do |event| %> | ||
<div id="event_id_<%=event.event_id%>" class="bg-white shadow-lg rounded-lg overflow-hidden hover:shadow-xl transition transform hover:scale-105"> | ||
<%= render '/events/event', event: event %> | ||
<%= link_to t('.event_details'), my_event_path(id: event.event_id), class: 'mt-4 w-full bg-blue-600 text-white py-2 rounded-lg hover:bg-blue-700 transition block p-6 text-center' %> | ||
<% if event.end_date < Date.today %> | ||
<%= link_to t('.add_feedback'), new_my_event_feedback_path(event.event_id), class: 'mt-4 w-full bg-blue-600 text-white py-2 rounded-lg hover:bg-blue-700 transition block p-6 text-center' %> | ||
<%= link_to t('.see_feedbacks'), my_event_feedbacks_path(event.event_id), class: 'mt-4 w-full bg-blue-600 text-white py-2 rounded-lg hover:bg-blue-700 transition block p-6 text-center' %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
|
||
<div class="p-4"> | ||
<%= link_to t('.event_details'), my_event_path(id: event.event_id), | ||
class: 'block w-full bg-blue-600 text-white py-2 rounded-lg hover:bg-blue-700 transition text-center font-medium' %> | ||
|
||
<% if event.end_date < Date.today %> | ||
<%= link_to t('.add_feedback'), new_my_event_feedback_path(event.event_id), | ||
class: 'block w-full mt-2 bg-green-600 text-white py-2 rounded-lg hover:bg-green-700 transition text-center font-medium' %> | ||
|
||
<%= link_to t('.see_feedbacks'), my_event_feedbacks_path(event.event_id), | ||
class: 'block w-full mt-2 bg-gray-600 text-white py-2 rounded-lg hover:bg-gray-700 transition text-center font-medium' %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
<%= link_to event_post_path(event_id: post.event_id, id: post.id), class: "block" do %> | ||
<h3 class="text-2xl font-bold text-gray-900"><%= post.title %></h3> | ||
<p class="text-gray-600 text-sm mt-2"> | ||
<%= t('.created_by') %> <span class="font-medium text-gray-800"><%= post.user.name %></span> <%= t('.in') %> | ||
<span class="text-gray-500"><%= l(post.created_at, format: :short) %></span> | ||
<%= link_to event_post_path(event_id: post.event_id, id: post.id), class: "block hover:bg-gray-100 p-4 rounded-lg transition" do %> | ||
<h3 class="text-2xl font-bold text-gray-900 mb-1"> | ||
📢 <%= post.title %> | ||
</h3> | ||
<p class="text-gray-600 text-sm flex items-center"> | ||
👤 <span class="ml-1 font-medium text-gray-800"><%= post.user.name %></span> • | ||
📅 <span class="ml-1 text-gray-500"><%= l(post.created_at, format: :short) %></span> | ||
</p> | ||
<% if request.path == "/dashboard" %> | ||
<p class="mt-3 text-gray-700 text-sm"> <%= I18n.t('event.one') %>: <span class="font-semibold"><%= @events.find { |event| event.event_id == post.event_id}.name if @events.any? %></span></p> | ||
<p class="mt-3 text-gray-700 text-sm"> 🎉 <%= I18n.t('event.one') %>: | ||
<span class="font-semibold"><%= @events.find { |event| event.event_id == post.event_id}.name if @events.any? %></span> | ||
</p> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
en: | ||
dashboard: | ||
index: | ||
no_posts: 🚀 Explore incredible events and be part of the experience! | ||
join_now: Join Now | ||
no_posts: There are no publications yet. | ||
participate: 🚀 Participate in events and see new content! | ||
join_now: Participate Now | ||
dashboard: Dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
pt-BR: | ||
dashboard: | ||
index: | ||
no_posts: 🚀 Explore eventos incríveis e faça parte da experiência! | ||
join_now: Participar Agora | ||
no_posts: Ainda não há publicações. | ||
participate: 🚀 Participe de eventos e veja novos conteúdos! | ||
join_now: Participar Agora | ||
dashboard: Dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
en: | ||
shared: | ||
feedback_form: | ||
save: Add Feedback | ||
form_title: Review |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pt-BR: | ||
shared: | ||
feedback_form: | ||
save: Adicionar Feedback | ||
form_title: Avaliação | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,3 @@ en: | |
my_events: My Events | ||
my_profile: My Profile | ||
hello: "Hello, %{name}" | ||
feedback_form: | ||
save: Add Feedback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,10 +26,12 @@ | |
user: user, schedule_item_id: schedule_item.schedule_item_id, public: true) | ||
|
||
post "/api/v1/item_feedbacks/#{item_feedback.id}/feedback_answers", params: { | ||
name: 'Nome do Participante Teste', | ||
email: '[email protected]', | ||
comment: 'Comentário Teste' | ||
} | ||
feedback_answer: { | ||
name: 'Nome do Participante Teste', | ||
email: '[email protected]', | ||
comment: 'Comentário Teste' | ||
} | ||
} | ||
|
||
expect(response).to have_http_status 201 | ||
expect(response.content_type).to include 'application/json' | ||
|
@@ -65,10 +67,12 @@ | |
user: user, schedule_item_id: schedule_item.schedule_item_id, public: true) | ||
|
||
post "/api/v1/item_feedbacks/#{item_feedback.id}/feedback_answers", params: { | ||
name: '', | ||
feedback_answer: { | ||
name: '', | ||
email: '', | ||
comment: '' | ||
} | ||
} | ||
|
||
expect(response).to have_http_status 406 | ||
expect(response.content_type).to include 'application/json' | ||
|
@@ -98,10 +102,12 @@ | |
login_as user | ||
|
||
post "/api/v1/item_feedbacks/#{item_feedback_id}/feedback_answers", params: { | ||
name: 'Nome do Participante Teste', | ||
email: '[email protected]', | ||
comment: 'Comentário Teste' | ||
} | ||
feedback_answer: { | ||
name: 'Nome do Participante Teste', | ||
email: '[email protected]', | ||
comment: 'Comentário Teste' | ||
} | ||
} | ||
|
||
expect(response).to have_http_status 404 | ||
expect(response.content_type).to include 'application/json' | ||
|
@@ -134,10 +140,12 @@ | |
allow(FeedbackAnswer).to receive(:new).and_raise(ActiveRecord::ActiveRecordError) | ||
|
||
post "/api/v1/item_feedbacks/#{item_feedback.id}/feedback_answers", params: { | ||
name: 'Nome do Participante Teste', | ||
email: '[email protected]', | ||
comment: 'Comentário Teste' | ||
} | ||
feedback_answer: { | ||
name: 'Nome do Participante Teste', | ||
email: '[email protected]', | ||
comment: 'Comentário Teste' | ||
} | ||
} | ||
|
||
expect(response).to have_http_status 500 | ||
expect(response.content_type).to include 'application/json' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,4 +47,31 @@ | |
expect(response.status).to eq 500 | ||
end | ||
end | ||
|
||
it 'e mostra respostas a um feedback' do | ||
user = create(:user, name: 'David', last_name: 'Martinez') | ||
item_feedback = create(:item_feedback, title: 'Título do feedback de item', comment: 'Comentário Padrão de item', mark: 4, event_id: '1', schedule_item_id: '1', public: true, user: user) | ||
post "/api/v1/item_feedbacks/#{item_feedback.id}/feedback_answers", params: { | ||
feedback_answer: { | ||
name: 'Nome do Participante Teste', | ||
email: '[email protected]', | ||
comment: 'Comentário Teste' | ||
} | ||
} | ||
|
||
get "/api/v1/schedule_items/1/item_feedbacks" | ||
|
||
expect(response.status).to eq 200 | ||
expect(response.content_type).to include 'application/json' | ||
json_response = JSON.parse(response.body) | ||
expect(json_response["item_feedbacks"][0]["id"]).to eq 1 | ||
expect(json_response["item_feedbacks"][0]["schedule_item_id"]).to eq '1' | ||
expect(json_response["item_feedbacks"][0]["title"]).to eq 'Título do feedback de item' | ||
expect(json_response["item_feedbacks"][0]["comment"]).to eq 'Comentário Padrão de item' | ||
expect(json_response["item_feedbacks"][0]["mark"]).to eq 4 | ||
expect(json_response["item_feedbacks"][0]["user"]).to eq 'David Martinez' | ||
expect(json_response["item_feedbacks"][0]["feedback_answers"][0]["name"]).to eq 'Nome do Participante Teste' | ||
expect(json_response["item_feedbacks"][0]["feedback_answers"][0]["email"]).to eq '[email protected]' | ||
expect(json_response["item_feedbacks"][0]["feedback_answers"][0]["comment"]).to eq 'Comentário Teste' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.