Fixed issue shown resources in the dashboard
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
class ProposalsDashboardController < ApplicationController
|
class ProposalsDashboardController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
||||||
helper_method :proposal, :proposed_actions, :proposal_dashboard_action
|
helper_method :proposal, :proposed_actions, :resources, :proposal_dashboard_action
|
||||||
respond_to :html
|
respond_to :html
|
||||||
layout 'proposals_dashboard'
|
layout 'proposals_dashboard'
|
||||||
|
|
||||||
@@ -76,4 +76,8 @@ class ProposalsDashboardController < ApplicationController
|
|||||||
def proposed_actions
|
def proposed_actions
|
||||||
@proposed_actions ||= ProposalDashboardAction.proposed_actions.active_for(proposal)
|
@proposed_actions ||= ProposalDashboardAction.proposed_actions.active_for(proposal)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def resources
|
||||||
|
@resources ||= ProposalDashboardAction.resources.active_for(proposal)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ class ProposalDashboardAction < ActiveRecord::Base
|
|||||||
|
|
||||||
scope :active, -> { where(active: true) }
|
scope :active, -> { where(active: true) }
|
||||||
scope :inactive, -> { where(active: false) }
|
scope :inactive, -> { where(active: false) }
|
||||||
scope :resources, -> { where(action_type: 'resource') }
|
scope :resources, -> { where(action_type: 1) }
|
||||||
scope :proposed_actions, -> { where(action_type: 'proposed_action') }
|
scope :proposed_actions, -> { where(action_type: 0) }
|
||||||
scope :active_for, ->(proposal) do
|
scope :active_for, ->(proposal) do
|
||||||
published_at = proposal.published_at&.to_date || Date.today
|
published_at = proposal.published_at&.to_date || Date.today
|
||||||
|
|
||||||
|
|||||||
@@ -75,13 +75,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if proposed_actions.resources.any? %>
|
<% if resources.any? %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-2 columns"></div>
|
<div class="small-2 columns"></div>
|
||||||
<div class="small-10 columns"><%= t '.resources' %></div>
|
<div class="small-10 columns"><%= t '.resources' %></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% proposed_actions.resources.each do |resource| %>
|
<% resources.each do |resource| %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-2 columns"></div>
|
<div class="small-2 columns"></div>
|
||||||
<div class="small-10 columns">
|
<div class="small-10 columns">
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ Capybara.register_driver :headless_chrome do |app|
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Capybara::Screenshot.register_driver(:headless_chrome) do |driver, path|
|
||||||
|
driver.browser.save_screenshot(path)
|
||||||
|
end
|
||||||
|
|
||||||
Capybara.asset_host = 'http://localhost:3000'
|
Capybara.asset_host = 'http://localhost:3000'
|
||||||
Capybara::Screenshot.prune_strategy = :keep_last_run
|
Capybara::Screenshot.prune_strategy = :keep_last_run
|
||||||
Capybara.javascript_driver = :headless_chrome
|
Capybara.javascript_driver = :headless_chrome
|
||||||
|
|||||||
Reference in New Issue
Block a user