Create new messages section for proposal's dashboard
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
class DashboardController < Dashboard::BaseController
|
||||
helper_method :dashboard_action, :active_resources, :course
|
||||
before_action :set_done_and_pending_actions, only: [:recommended_actions, :progress]
|
||||
before_action :authorize_dashboard, only: [:show, :progress, :community, :recommended_actions, :messages]
|
||||
|
||||
def show
|
||||
authorize! :dashboard, proposal
|
||||
end
|
||||
|
||||
def publish
|
||||
@@ -14,15 +14,15 @@ class DashboardController < Dashboard::BaseController
|
||||
end
|
||||
|
||||
def progress
|
||||
authorize! :dashboard, proposal
|
||||
end
|
||||
|
||||
def community
|
||||
authorize! :dashboard, proposal
|
||||
end
|
||||
|
||||
def recommended_actions
|
||||
authorize! :dashboard, proposal
|
||||
end
|
||||
|
||||
def messages
|
||||
end
|
||||
|
||||
private
|
||||
@@ -42,4 +42,8 @@ class DashboardController < Dashboard::BaseController
|
||||
@done_actions = proposed_actions.joins(:proposals).where("proposals.id = ?", proposal.id)
|
||||
@pending_actions = proposed_actions - @done_actions
|
||||
end
|
||||
|
||||
def authorize_dashboard
|
||||
authorize! :dashboard, proposal
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,6 +7,10 @@ module ProposalsDashboardHelper
|
||||
controller_name == "dashboard" && action_name == "community"
|
||||
end
|
||||
|
||||
def messages_menu_active?
|
||||
controller_name == "dashboard" && action_name == "messages"
|
||||
end
|
||||
|
||||
def progress_menu_active?
|
||||
is_proposed_action_request? || (controller_name == "dashboard" && action_name == "progress")
|
||||
end
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
<ul class="no-bullet resources">
|
||||
<% if can?(:manage_polls, proposal) %>
|
||||
<li>
|
||||
<%= link_to proposal_dashboard_polls_path(proposal.to_param),
|
||||
class: "#{'submenu-active' if polls_menu_active?}" do %>
|
||||
<span data-tooltip title="<%= Setting['proposals.poll_short_title'] ||
|
||||
<%= link_to proposal_dashboard_polls_path(proposal),
|
||||
class: "#{"submenu-active" if polls_menu_active?}" do %>
|
||||
<span data-tooltip title="<%= Setting["proposals.poll_short_title"] ||
|
||||
t("dashboard.menu.polls") %>">
|
||||
<%= t("dashboard.menu.polls") %>
|
||||
</span>
|
||||
@@ -47,9 +47,9 @@
|
||||
|
||||
<% if can?(:manage_mailing, proposal) %>
|
||||
<li>
|
||||
<%= link_to new_proposal_dashboard_mailing_path(proposal.to_param),
|
||||
class: "#{'submenu-active' if mailing_menu_active?}" do %>
|
||||
<span data-tooltip title="<%= Setting['proposals.email_short_title'] ||
|
||||
<%= link_to new_proposal_dashboard_mailing_path(proposal),
|
||||
class: "#{"submenu-active" if mailing_menu_active?}" do %>
|
||||
<span data-tooltip title="<%= Setting["proposals.email_short_title"] ||
|
||||
t("dashboard.menu.mailing") %>">
|
||||
<%= t("dashboard.menu.mailing") %>
|
||||
</span>
|
||||
@@ -59,9 +59,9 @@
|
||||
|
||||
<% if can?(:manage_poster, proposal) %>
|
||||
<li>
|
||||
<%= link_to new_proposal_dashboard_poster_path(proposal.to_param),
|
||||
class: "#{'submenu-active' if poster_menu_active?}" do %>
|
||||
<span data-tooltip title="<%= Setting['proposals.poster_short_title'] ||
|
||||
<%= link_to new_proposal_dashboard_poster_path(proposal),
|
||||
class: "#{"submenu-active" if poster_menu_active?}" do %>
|
||||
<span data-tooltip title="<%= Setting["proposals.poster_short_title"] ||
|
||||
t("dashboard.menu.poster") %>">
|
||||
<%= t("dashboard.menu.poster") %>
|
||||
</span>
|
||||
@@ -85,8 +85,15 @@
|
||||
|
||||
<li class="section-title <%= 'is-active' if community_menu_active? %>">
|
||||
<span class="icon-organizations"></span>
|
||||
<%= link_to community_proposal_dashboard_path(proposal.to_param) do %>
|
||||
<%= link_to community_proposal_dashboard_path(proposal) do %>
|
||||
<strong><%= t("dashboard.menu.community") %></strong>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="section-title <%= "is-active" if messages_menu_active? %>">
|
||||
<span class="icon-letter"></span>
|
||||
<%= link_to messages_proposal_dashboard_path(proposal) do %>
|
||||
<strong><%= t("dashboard.menu.messages") %></strong>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
7
app/views/dashboard/messages.html.erb
Normal file
7
app/views/dashboard/messages.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<% content_for :action_title, t("dashboard.menu.messages") %>
|
||||
|
||||
<%= link_to t("dashboard.messages.send_notification"),
|
||||
new_proposal_notification_path(proposal_id: proposal.id), class: "button" %>
|
||||
|
||||
<%= link_to t("dashboard.messages.previous_notifications"),
|
||||
proposal_path(proposal, anchor: "tab-notifications"), class: "button hollow" %>
|
||||
Reference in New Issue
Block a user