File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class Petition < ActiveRecord::Base
5959 default_scope { preload ( :parliament ) }
6060
6161 delegate :threshold_for_response , :threshold_for_debate , to : :parliament
62+ delegate :show_on_a_map? , to : :parliament
6263
6364 with_options allow_nil : true , prefix : true do
6465 delegate :name , :email , to : :creator
Original file line number Diff line number Diff line change 33class Parliament < ActiveRecord ::Base
44 include ActiveSupport ::NumberHelper
55
6+ CUTOFF_DATE = Date . civil ( 2015 , 5 , 7 )
7+
68 has_many :petitions , inverse_of : :parliament , class_name : "Archived::Petition"
79
810 class << self
@@ -184,4 +186,8 @@ def formatted_threshold_for_response
184186 def formatted_threshold_for_debate
185187 number_to_delimited ( threshold_for_debate )
186188 end
189+
190+ def show_on_a_map?
191+ opening_at > CUTOFF_DATE
192+ end
187193end
Original file line number Diff line number Diff line change 6666 < div class ="signature-count-graph " aria-hidden ="true ">
6767 < span class ="signature-count-current " style ="width: <%= archived_threshold_percentage ( @petition ) %> "> </ span >
6868 </ div >
69+ <% if @petition . show_on_a_map? %>
70+ < p class ="signatures-on-a-map ">
71+ < a href ="https://petitionmap.unboxedconsulting.com/?petition= <%= @petition . id %> "> Show on a map</ a >
72+ </ p >
73+ <% end %>
6974 < p class ="signature-count-goal ">
7075 <%= number_with_delimiter ( archived_threshold ( @petition ) ) %>
7176 </ p >
You can’t perform that action at this time.
0 commit comments