Extract method to include stat graphs JavaScript
We're going to use this method everywhere in the admin stats section.
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
<% content_for :head do %>
|
<% include_stat_graphs_javascript %>
|
||||||
<%= javascript_include_tag "stat_graphs", "data-turbolinks-track" => "reload" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= back_link_to budgets_admin_stats_path %>
|
<%= back_link_to budgets_admin_stats_path %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class Admin::Stats::BudgetSupportingComponent < ApplicationComponent
|
class Admin::Stats::BudgetSupportingComponent < ApplicationComponent
|
||||||
attr_reader :budget
|
attr_reader :budget
|
||||||
|
use_helpers :include_stat_graphs_javascript
|
||||||
|
|
||||||
def initialize(budget)
|
def initialize(budget)
|
||||||
@budget = budget
|
@budget = budget
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ module ApplicationHelper
|
|||||||
WYSIWYGSanitizer.new.sanitize(text)
|
WYSIWYGSanitizer.new.sanitize(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include_stat_graphs_javascript
|
||||||
|
content_for :head do
|
||||||
|
javascript_include_tag "stat_graphs", "data-turbolinks-track" => "reload"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def author_of?(authorable, user)
|
def author_of?(authorable, user)
|
||||||
return false if authorable.blank? || user.blank?
|
return false if authorable.blank? || user.blank?
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<% content_for :head do %>
|
<% include_stat_graphs_javascript %>
|
||||||
<%= javascript_include_tag "stat_graphs", "data-turbolinks-track" => "reload" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= back_link_to admin_stats_path %>
|
<%= back_link_to admin_stats_path %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<% content_for :head do %>
|
<% include_stat_graphs_javascript %>
|
||||||
<%= javascript_include_tag "stat_graphs", "data-turbolinks-track" => "reload" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div id="stats" class="stats">
|
<div id="stats" class="stats">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
Reference in New Issue
Block a user