From 9c8102b9f31a74e3378c31a04093720aab7d1330 Mon Sep 17 00:00:00 2001 From: Amaia Castro Date: Tue, 17 Jan 2017 17:26:05 +0100 Subject: [PATCH 1/2] Refactor path helpers for comments --- app/helpers/comments_helper.rb | 11 +++++++++-- app/helpers/legislation_helper.rb | 8 -------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index 491944c03..c3532b578 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -41,8 +41,15 @@ module CommentsHelper end def commentable_path(comment) - if comment.commentable_type == "Budget::Investment" - budget_investment_path(comment.commentable.budget_id, comment.commentable) + commentable = comment.commentable + + case comment.commentable_type + when "Budget::Investment" + budget_investment_path(commentable.budget_id, commentable) + when "Legislation::Question" + legislation_process_question_path(commentable.process, commentable) + when "Legislation::Annotation" + legislation_process_draft_version_annotation_path(commentable.draft_version.process, commentable.draft_version, commentable) else comment.commentable end diff --git a/app/helpers/legislation_helper.rb b/app/helpers/legislation_helper.rb index a49bb1e8e..3a993d683 100644 --- a/app/helpers/legislation_helper.rb +++ b/app/helpers/legislation_helper.rb @@ -6,12 +6,4 @@ module LegislationHelper def format_date_for_calendar_form(date) l(date, format: "%d/%m/%Y") if date end - - def legislation_question_path(question) - legislation_process_question_path(question.process, question) - end - - def legislation_annotation_path(annotation) - legislation_process_draft_version_annotation_path(annotation.draft_version.process, annotation.draft_version, annotation) - end end From c0a958b7083e55894e8048ba832d1fc526e6b092 Mon Sep 17 00:00:00 2001 From: Amaia Castro Date: Wed, 18 Jan 2017 11:56:37 +0100 Subject: [PATCH 2/2] Remove subscription html --- app/views/legislation/processes/_header.html.erb | 8 ++------ app/views/legislation/processes/_header_full.html.erb | 4 ---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/views/legislation/processes/_header.html.erb b/app/views/legislation/processes/_header.html.erb index 945d1c59f..546f238d1 100644 --- a/app/views/legislation/processes/_header.html.erb +++ b/app/views/legislation/processes/_header.html.erb @@ -5,13 +5,9 @@

<%= process.title %>

- +

<%= t('legislation.processes.header_full.description') %>

@@ -31,7 +27,7 @@
- +