Skip to content

Commit

Permalink
Fixes #238
Browse files Browse the repository at this point in the history
Applies new card design for polls in proposals dashboard.
Fixes warnings during tests.
Adds tests for new card design for polls in proposals dashboard.
  • Loading branch information
jsperezg committed Jul 23, 2018
1 parent f632fa8 commit 3b37b4b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
10 changes: 4 additions & 6 deletions app/assets/stylesheets/poll.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
.poll-card {

.card {
background-color: #e7f3fd;
}

.clipboard-btn {
border-radius: 12pt;
padding: 0;
width: 24pt;
height: 24pt;
padding-top: 5pt;
padding-left: 1pt;
border-radius: rem-calc(12);
padding: rem-calc(5) rem-calc(10) rem-calc(10) rem-calc(10);
height: rem-calc(24);
}
}
2 changes: 1 addition & 1 deletion app/helpers/admin_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def menu_homepage?
end

def menu_proposals_dashboard?
["proposal_dashboard_actions", "administrator_tasks"].include?(controller_name)
["actions", "administrator_tasks"].include?(controller_name)
end

def official_level_options
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/_menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<% if feature?(:budgets) %>
<li class="section-title <%= "is-active" if controller_name == "budgets" ||
"budget_investment_statuses" %>">
controller_name == "budget_investment_statuses" %>">
<%= link_to admin_budgets_path do %>
<span class="icon-budget"></span>
<strong><%= t("admin.menu.budgets") %></strong>
Expand Down Expand Up @@ -240,7 +240,7 @@
<strong><%= t("admin.menu.proposals_dashboard") %></strong>
</a>
<ul <%= "class=is-active" if menu_proposals_dashboard? %>>
<li <%= "class=is-active" if controller_name == "proposal_dashboard_actions" %>>
<li <%= "class=is-active" if controller_name == "actions" %>>
<%= link_to ProposalDashboardAction.model_name.human(count: 2), admin_proposal_dashboard_actions_path %>
</li>

Expand Down
9 changes: 4 additions & 5 deletions app/views/dashboard/polls/_poll.html.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<div class="column poll-card" id="<%= dom_id(poll) %>">
<div class="card">
<div class="card-section">
<p class="text-right">
<p class="text-center">
<a href='#' class="button round hollow clipboard-btn" data-clipboard-text="<%= poll_url(poll) %>">
<i class="fi-clipboard-notes"></i>
<i class="fi-clipboard-notes"></i> <%= t("dashboard.polls.poll.copy_link") %>
</a>
</p>
<h4 class="text-center"><%= poll.title %></h4>
<h4 class="text-center"><%= link_to poll.title, poll %></h4>
<p class="text-center">
<%= t("dashboard.polls.poll.published_on") %>
<%= l(poll.starts_at.to_date) %>
<%= l(poll.starts_at.to_date) %> - <%= l(poll.ends_at.to_date) %>
</p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ en:
links: Links
additiontal_information: Additional information
poll:
published_on: Published on
copy_link: Copy link
responses:
one: "%{count} response"
other: "%{count} responses"
Expand Down
2 changes: 1 addition & 1 deletion config/locales/es/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ es:
links: Enlaces
additiontal_information: Información adicional
poll:
published_on: Publicada
copy_link: Copiar enlace
responses:
one: "%{count} respuesta"
other: "%{count} respuestas"
Expand Down
12 changes: 12 additions & 0 deletions spec/features/dashboard/polls_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,16 @@
expect(page.current_path).to eq(results_poll_path(poll))
end
end

scenario 'Poll card' do
poll = create(:poll, :expired, related: proposal)

visit proposal_dashboard_polls_path(proposal)

within "div#poll_#{poll.id}" do
expect(page).to have_content(I18n.l(poll.starts_at.to_date))
expect(page).to have_content(I18n.l(poll.ends_at.to_date))
expect(page).to have_link(poll.title)
end
end
end

0 comments on commit 3b37b4b

Please sign in to comment.