Add progress tab as initial page on Dashboard.

This commit is contained in:
taitus
2018-12-27 17:35:09 +01:00
parent b6b49c435c
commit aa908d8d60
6 changed files with 18 additions and 13 deletions

View File

@@ -9,10 +9,10 @@ class DashboardController < Dashboard::BaseController
authorize! :publish, proposal authorize! :publish, proposal
proposal.publish proposal.publish
redirect_to proposal_dashboard_path(proposal), notice: t('proposals.notice.published') redirect_to progress_proposal_dashboard_path(proposal), notice: t("proposals.notice.published")
end end
def progress def progress
authorize! :dashboard, proposal authorize! :dashboard, proposal
end end
@@ -21,7 +21,7 @@ class DashboardController < Dashboard::BaseController
end end
private private
def active_resources def active_resources
@active_resources ||= Dashboard::Action.active.resources.order(required_supports: :asc, day_offset: :asc) @active_resources ||= Dashboard::Action.active.resources.order(required_supports: :asc, day_offset: :asc)
end end

View File

@@ -8,7 +8,7 @@
<% if can?(:dashboard, @proposal) %> <% if can?(:dashboard, @proposal) %>
<%= link_to t("proposals.created.dashboard"), <%= link_to t("proposals.created.dashboard"),
proposal_dashboard_path(@proposal), progress_proposal_dashboard_path(@proposal),
class: "button" %> class: "button" %>
<% end %> <% end %>

View File

@@ -34,7 +34,7 @@
</p> </p>
<div class="small-12 medium-6 large-4 column small-centered"> <div class="small-12 medium-6 large-4 column small-centered">
<%= link_to t("proposals.share.dashboard"), <%= link_to t("proposals.share.dashboard"),
proposal_dashboard_path(@proposal), class: "button expanded" %> progress_proposal_dashboard_path(@proposal), class: "button expanded" %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@@ -138,7 +138,7 @@
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h2><%= t("proposals.show.author") %></h2> <h2><%= t("proposals.show.author") %></h2>
<div class="show-actions-menu"> <div class="show-actions-menu">
<%= link_to proposal_dashboard_path(@proposal), <%= link_to progress_proposal_dashboard_path(@proposal),
class: 'button hollow expanded', class: 'button hollow expanded',
id: "proposal-dashboard-#{@proposal.id}" do %> id: "proposal-dashboard-#{@proposal.id}" do %>
<span class="icon-edit"></span> <span class="icon-edit"></span>
@@ -218,4 +218,4 @@
<%= render "proposals/notifications" %> <%= render "proposals/notifications" %>
</div> </div>
<% end %> <% end %>

View File

@@ -21,7 +21,7 @@
<% elsif can?(:dashboard, proposal) %> <% elsif can?(:dashboard, proposal) %>
<td> <td>
<%= link_to t("proposals.show.dashboard_proposal_link"), <%= link_to t("proposals.show.dashboard_proposal_link"),
proposal_dashboard_path(proposal), class: "button hollow expanded" %> progress_proposal_dashboard_path(proposal), class: "button hollow expanded" %>
</td> </td>
<% else %> <% else %>
<td class="text-center"> <td class="text-center">

View File

@@ -442,7 +442,10 @@ feature 'Proposals' do
expect(page.html).not_to include "<script>alert('hey')</script>" expect(page.html).not_to include "<script>alert('hey')</script>"
click_link 'Dashboard' click_link 'Dashboard'
click_link 'Edit proposal' within "#side_menu" do
click_link "My proposal"
end
click_link "Edit proposal"
expect(page).to have_current_path(edit_proposal_path(Proposal.last)) expect(page).to have_current_path(edit_proposal_path(Proposal.last))
expect(page).not_to have_link('click me') expect(page).not_to have_link('click me')
@@ -515,10 +518,12 @@ feature 'Proposals' do
visit user_path(proposal.author) visit user_path(proposal.author)
within("#proposal_#{proposal.id}") do within("#proposal_#{proposal.id}") do
click_link 'Dashboard' click_link "Dashboard"
end end
within "#side_menu" do
click_link 'Retire proposal' click_link "My proposal"
end
click_link "Retire proposal"
expect(page).to have_current_path(retire_form_proposal_path(proposal)) expect(page).to have_current_path(retire_form_proposal_path(proposal))