Show the time when a poll starts and ends
This is consistent with the way we show the duration of a budget and its phases. Since budgets are the section with the most recent changes in the admin area, we're using it as a reference. Note that, unlike budgets (which are shown to finish at the beginning of their ending day), a poll has always been considered to finish at the end of their ending day, so we're showing it this way. We're also solving a minor usability issue. While it's pretty intuitive that a poll starting on a certain date will start at the beginning of the day, a poll ending on a certain date isn't clear about when it finishes exactly: is it at the beginning of the day, or at the end of the day? So now we're making this point clear.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<tr id="<%= dom_id(poll) %>" class="poll">
|
<tr id="<%= dom_id(poll) %>" class="poll">
|
||||||
<td><strong><%= poll.name %></strong></td>
|
<td><strong><%= poll.name %></strong></td>
|
||||||
<td class="text-center"><%= l poll.starts_at.to_date %></td>
|
<td class="text-center"><%= l poll.starts_at.beginning_of_day, format: :short_datetime %></td>
|
||||||
<td class="text-center"><%= l poll.ends_at.to_date %></td>
|
<td class="text-center"><%= l poll.ends_at.end_of_day, format: :short_datetime %></td>
|
||||||
<% if feature?(:sdg) %>
|
<% if feature?(:sdg) %>
|
||||||
<td class="text-center"><%= poll.sdg_goal_list %></td>
|
<td class="text-center"><%= poll.sdg_goal_list %></td>
|
||||||
<td class="text-center"><%= poll.sdg_target_list %></td>
|
<td class="text-center"><%= poll.sdg_target_list %></td>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<div class="inline-block">
|
<div class="inline-block">
|
||||||
<strong><%= t("admin.polls.index.dates") %></strong>
|
<strong><%= t("admin.polls.index.dates") %></strong>
|
||||||
<br>
|
<br>
|
||||||
<%= l @poll.starts_at.to_date %> - <%= l @poll.ends_at.to_date %>
|
<%= render Admin::DateRangeComponent.new(@poll.starts_at.beginning_of_day, @poll.ends_at.end_of_day) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @poll.geozone_restricted %>
|
<% if @poll.geozone_restricted %>
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ describe "Admin polls", :admin do
|
|||||||
|
|
||||||
expect(page).to have_content "Poll created successfully"
|
expect(page).to have_content "Poll created successfully"
|
||||||
expect(page).to have_content "Upcoming poll"
|
expect(page).to have_content "Upcoming poll"
|
||||||
expect(page).to have_content I18n.l(start_date)
|
expect(page).to have_content "#{I18n.l(start_date)} 00:00"
|
||||||
expect(page).to have_content I18n.l(end_date)
|
expect(page).to have_content "#{I18n.l(end_date)} 23:59"
|
||||||
|
|
||||||
visit poll_path(id: "upcoming-poll")
|
visit poll_path(id: "upcoming-poll")
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ describe "Admin polls", :admin do
|
|||||||
|
|
||||||
expect(page).to have_content "Poll updated successfully"
|
expect(page).to have_content "Poll updated successfully"
|
||||||
expect(page).to have_content "Next Poll"
|
expect(page).to have_content "Next Poll"
|
||||||
expect(page).to have_content I18n.l(end_date.to_date)
|
expect(page).to have_content "#{I18n.l(end_date)} 23:59"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Edit from index" do
|
scenario "Edit from index" do
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ describe "Admin Budgets", :admin do
|
|||||||
|
|
||||||
expect(page).to have_current_path(/admin\/polls\/\d+/)
|
expect(page).to have_current_path(/admin\/polls\/\d+/)
|
||||||
expect(page).to have_content(budget.name)
|
expect(page).to have_content(budget.name)
|
||||||
expect(page).to have_content(balloting_phase.starts_at.to_date)
|
expect(page).to have_content("#{balloting_phase.starts_at.to_date} 00:00")
|
||||||
expect(page).to have_content(balloting_phase.ends_at.to_date)
|
expect(page).to have_content("#{balloting_phase.ends_at.to_date} 23:59")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Create poll in current locale if the budget does not have a poll associated" do
|
scenario "Create poll in current locale if the budget does not have a poll associated" do
|
||||||
|
|||||||
Reference in New Issue
Block a user