diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb
index b9e69ddf9..491944c03 100644
--- a/app/helpers/comments_helper.rb
+++ b/app/helpers/comments_helper.rb
@@ -1,11 +1,31 @@
module CommentsHelper
+ def comment_tree_title_text(commentable)
+ if commentable.class == Legislation::Question
+ t("legislation.questions.comments.comments_title")
+ else
+ t("comments_helper.comments_title")
+ end
+ end
+
+ def leave_comment_text(commentable)
+ if commentable.class == Legislation::Question
+ t("legislation.questions.comments.form.leave_comment")
+ else
+ t("comments.form.leave_comment")
+ end
+ end
+
def comment_link_text(parent_id)
parent_id.present? ? t("comments_helper.reply_link") : t("comments_helper.comment_link")
end
- def comment_button_text(parent_id)
- parent_id.present? ? t("comments_helper.reply_button") : t("comments_helper.comment_button")
+ def comment_button_text(parent_id, commentable)
+ if commentable.class == Legislation::Question
+ parent_id.present? ? t("comments_helper.reply_button") : t("legislation.questions.comments.comment_button")
+ else
+ parent_id.present? ? t("comments_helper.reply_button") : t("comments_helper.comment_button")
+ end
end
def parent_or_commentable_dom_id(parent_id, commentable)
@@ -48,4 +68,4 @@ module CommentsHelper
end
end
-end
\ No newline at end of file
+end
diff --git a/app/views/comments/_comment_tree.html.erb b/app/views/comments/_comment_tree.html.erb
index 0581809fb..746ab9225 100644
--- a/app/views/comments/_comment_tree.html.erb
+++ b/app/views/comments/_comment_tree.html.erb
@@ -6,7 +6,7 @@
- <%= t("debates.show.comments_title") %>
+ <%= comment_tree_title_text(commentable) %>
diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb
index e3399c383..9d9767e73 100644
--- a/app/views/comments/_form.html.erb
+++ b/app/views/comments/_form.html.erb
@@ -2,13 +2,13 @@
<% css_id = parent_or_commentable_dom_id(parent_id, commentable) %>
- <%= render 'legislation/shared/comments', commentable: @annotation %>
+ <%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
diff --git a/app/views/legislation/questions/show.html.erb b/app/views/legislation/questions/show.html.erb
index c74bd9efa..b99e7b17f 100644
--- a/app/views/legislation/questions/show.html.erb
+++ b/app/views/legislation/questions/show.html.erb
@@ -47,7 +47,7 @@
-
- <%= render 'legislation/shared/comments', commentable: @question %>
+
+ <%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
diff --git a/app/views/legislation/shared/_comments.html.erb b/app/views/legislation/shared/_comments.html.erb
deleted file mode 100644
index 25b4ce18d..000000000
--- a/app/views/legislation/shared/_comments.html.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<% cache [locale_and_user_status, @current_order, commentable_cache_key(commentable), @comment_tree.comments, @comment_tree.comment_authors, commentable.comments_count, @comment_flags] do %>
-
-<% end %>
diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml
index 1ddf4f67c..65051fbf4 100644
--- a/config/i18n-tasks.yml
+++ b/config/i18n-tasks.yml
@@ -33,6 +33,7 @@ data:
- config/locales/responders.%{locale}.yml
- config/locales/kaminari.%{locale}.yml
- config/locales/budgets.%{locale}.yml
+ - config/locales/legislation.%{locale}.yml
# Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
# `i18n-tasks normalize -p` will force move the keys according to these rules
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5fa5d6727..2f192cb0c 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -62,6 +62,7 @@ en:
comments_helper:
comment_button: Publish comment
comment_link: Comment
+ comments_title: Comments
reply_button: Publish reply
reply_link: Reply
debates:
@@ -224,113 +225,6 @@ en:
text_sign_in: login
text_sign_up: sign up
title: How I can comment this document?
- legislation:
- annotations:
- comments:
- see_all: See all
- see_complete: See complete
- comments_count:
- one: "%{count} comment"
- other: "%{count} comments"
- replies_count:
- one: "%{count} reply"
- other: "%{count} replies"
- cancel: Cancel
- publish_comment: Publish Comment
- form:
- phase_not_open: This phase is not open
- login_to_comment: You must %{signin} or %{signup} to leave a comment.
- signin: Sign in
- signup: Sign up
- index:
- title: Comments
- comments_about: Comments about
- see_in_context: See in context
- comments_count:
- one: "%{count} comment"
- other: "%{count} comments"
- show:
- title: Comment
- version_chooser:
- seeing_version: Commments for version
- see_text: See text draft
- draft_versions:
- changes:
- title: Changes
- seeing_changelog_version: Revision changes summary
- see_text: See text draft
- show:
- loading_comments: Loading comments
- seeing_version: You're seeing draft version
- select_draft_version: Select draft
- select_version_submit: see
- updated_at: updated at %{date}
- see_changes: see changes summary
- see_comments: See all comments
- text_toc: Table of contents
- text_body: Text
- text_comments: Comments
- processes:
- header:
- view_process_information: View process information
- debate:
- empty_questions: There aren't any questions
- participate: Participate in the debate
- header_full:
- title: Participate
- description: Description
- target: Target
- how_to_participate: How to participate
- more_info: More information and context
- index:
- hightlighted_processes: HIGHLIGHTED PROCESSES
- filters:
- open: Open processes
- next: Next
- past: Past
- no_open_processes: There aren't open processes
- no_next_processes: There aren't planned processes
- no_past_processes: There aren't past processes
- phase_not_open:
- not_open: This phase is not open yet
- phase_empty:
- empty: Nothing published yet
- process:
- see_latest_comments: See latest comments
- see_latest_comments_title: Comment on this process
- shared:
- key_dates: "Key dates:"
- debate_dates: Debate
- draft_publication_date: Draft publication
- allegations_dates: Allegations
- final_publication_date: Final result publication
- questions:
- question:
- comments:
- zero: No comments
- one: "%{count} comment"
- other: "%{count} comments"
- debate: Debate
- show:
- answer_question: Submit answer
- next_question: Next question
- first_question: First question
- share: Share
- share_twitter: Share on Twitter
- share_facebook: Share on Facebook
- share_gplus: Share on Google+
- title: Collaborative legislation process
- participation:
- phase_not_open: This phase is not open
- organizations: Organisations are not permitted to participate in the debate
- signin: Sign in
- signup: Sign up
- unauthenticated: You must %{signin} or %{signup} to participate.
- verified_only: Only verified users can participate, %{verify_account}.
- verify_account: verify your account
- debate_phase_not_open: Debate phase has finished and answers are not accepted anymore
- shared:
- comments: Comments
locale: English
notifications:
index:
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 2732af08f..7c418521f 100755
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -62,6 +62,7 @@ es:
comments_helper:
comment_button: Publicar comentario
comment_link: Comentar
+ comments_title: Comentarios
reply_button: Publicar respuesta
reply_link: Responder
debates:
@@ -224,113 +225,6 @@ es:
text_sign_in: iniciar sesión
text_sign_up: registrarte
title: "¿Cómo puedo comentar este documento?"
- legislation:
- annotations:
- comments:
- see_all: Ver todos
- see_complete: Ver completo
- comments_count:
- one: "%{count} comentario"
- other: "%{count} comentarios"
- replies_count:
- one: "%{count} respuesta"
- other: "%{count} respuestas"
- cancel: Cancelar
- publish_comment: Publicar Comentario
- form:
- phase_not_open: Esta fase del proceso no está abierta
- login_to_comment: Necesitas %{signin} o %{signup} para comentar.
- signin: iniciar sesión
- signup: registrarte
- index:
- title: Comentarios
- see_in_context: Ver en contexto
- comments_about: Comentarios sobre
- comments_count:
- one: "%{count} comentario"
- other: "%{count} comentarios"
- show:
- title: Comentario
- version_chooser:
- seeing_version: Comentarios para la versión
- see_text: Ver borrador del texto
- draft_versions:
- changes:
- title: Cambios
- seeing_changelog_version: Resumen de cambios de la revisión
- see_text: Ver borrador del texto
- show:
- loading_comments: Cargando comentarios
- seeing_version: Estás viendo la revisión
- select_draft_version: Seleccionar borrador
- select_version_submit: ver
- updated_at: actualizada el %{date}
- see_changes: ver resumen de cambios
- see_comments: Ver todos los comentarios
- text_toc: Índice
- text_body: Texto
- text_comments: Comentarios
- processes:
- header:
- view_process_information: Ver información del proceso
- debate:
- empty_questions: No hay preguntas
- participate: Realiza tus aportaciones al debate previo participando en los siguientes temas.
- header_full:
- title: Colabora en la elaboración de la normativa sobre
- description: En qué consiste
- target: A quién va dirigido
- how_to_participate: Cómo puedes participar
- more_info: Más información y contexto
- index:
- hightlighted_processes: PROCESOS DESTACADOS
- filters:
- open: Procesos activos
- next: Próximamente
- past: Terminados
- no_open_processes: No hay procesos activos
- no_next_processes: No hay procesos planeados
- no_past_processes: No hay procesos terminados
- phase_not_open:
- not_open: Esta fase del proceso todavía no está abierta
- phase_empty:
- empty: No hay nada publicado todavía
- process:
- see_latest_comments: Ver últimas aportaciones
- see_latest_comments_title: Aportar a este proceso
- shared:
- key_dates: "Fechas clave:"
- debate_dates: Debate previo
- draft_publication_date: Publicación borrador
- allegations_dates: Alegaciones
- final_publication_date: Publicación resultados
- questions:
- question:
- comments:
- zero: Sin comentarios
- one: "%{count} comentario"
- other: "%{count} comentarios"
- debate: Debate
- show:
- answer_question: Enviar respuesta
- next_question: Siguiente pregunta
- first_question: Primera pregunta
- share: Compartir
- share_twitter: Compartir en Twitter
- share_facebook: Compartir en Facebook
- share_gplus: Compartir en Google+
- title: Proceso de legislación colaborativa
- participation:
- phase_not_open: Esta fase no está abierta
- organizations: Las organizaciones no pueden participar en el debate
- signin: iniciar sesión
- signup: registrarte
- unauthenticated: Necesitas %{signin} o %{signup} para participar en el debate.
- verified_only: Solo los usuarios verificados pueden participar en el debate, %{verify_account}.
- verify_account: verifica tu cuenta
- debate_phase_not_open: La fase de debate previo ya ha finalizado y en este momento no se aceptan respuestas
- shared:
- comments: Comentarios
locale: Español
notifications:
index:
diff --git a/config/locales/legislation.en.yml b/config/locales/legislation.en.yml
new file mode 100644
index 000000000..294d35104
--- /dev/null
+++ b/config/locales/legislation.en.yml
@@ -0,0 +1,112 @@
+---
+en:
+ legislation:
+ annotations:
+ comments:
+ see_all: See all
+ see_complete: See complete
+ comments_count:
+ one: "%{count} comment"
+ other: "%{count} comments"
+ replies_count:
+ one: "%{count} reply"
+ other: "%{count} replies"
+ cancel: Cancel
+ publish_comment: Publish Comment
+ form:
+ phase_not_open: This phase is not open
+ login_to_comment: You must %{signin} or %{signup} to leave a comment.
+ signin: Sign in
+ signup: Sign up
+ index:
+ title: Comments
+ comments_about: Comments about
+ see_in_context: See in context
+ comments_count:
+ one: "%{count} comment"
+ other: "%{count} comments"
+ show:
+ title: Comment
+ version_chooser:
+ seeing_version: Commments for version
+ see_text: See text draft
+ draft_versions:
+ changes:
+ title: Changes
+ seeing_changelog_version: Revision changes summary
+ see_text: See text draft
+ show:
+ loading_comments: Loading comments
+ seeing_version: You're seeing draft version
+ select_draft_version: Select draft
+ select_version_submit: see
+ updated_at: updated at %{date}
+ see_changes: see changes summary
+ see_comments: See all comments
+ text_toc: Table of contents
+ text_body: Text
+ text_comments: Comments
+ processes:
+ header:
+ view_process_information: View process information
+ debate:
+ empty_questions: There aren't any questions
+ participate: Participate in the debate
+ header_full:
+ title: Participate
+ description: Description
+ target: Target
+ how_to_participate: How to participate
+ more_info: More information and context
+ index:
+ hightlighted_processes: HIGHLIGHTED PROCESSES
+ filters:
+ open: Open processes
+ next: Next
+ past: Past
+ no_open_processes: There aren't open processes
+ no_next_processes: There aren't planned processes
+ no_past_processes: There aren't past processes
+ phase_not_open:
+ not_open: This phase is not open yet
+ phase_empty:
+ empty: Nothing published yet
+ process:
+ see_latest_comments: See latest comments
+ see_latest_comments_title: Comment on this process
+ shared:
+ key_dates: "Key dates:"
+ debate_dates: Debate
+ draft_publication_date: Draft publication
+ allegations_dates: Allegations
+ final_publication_date: Final result publication
+ questions:
+ comments:
+ comment_button: Publish answer
+ comments_title: Open answers
+ form:
+ leave_comment: Leave your answer
+ question:
+ comments:
+ zero: No comments
+ one: "%{count} comment"
+ other: "%{count} comments"
+ debate: Debate
+ show:
+ answer_question: Submit answer
+ next_question: Next question
+ first_question: First question
+ share: Share
+ share_twitter: Share on Twitter
+ share_facebook: Share on Facebook
+ share_gplus: Share on Google+
+ title: Collaborative legislation process
+ participation:
+ phase_not_open: This phase is not open
+ organizations: Organisations are not permitted to participate in the debate
+ signin: Sign in
+ signup: Sign up
+ unauthenticated: You must %{signin} or %{signup} to participate.
+ verified_only: Only verified users can participate, %{verify_account}.
+ verify_account: verify your account
+ debate_phase_not_open: Debate phase has finished and answers are not accepted anymore
diff --git a/config/locales/legislation.es.yml b/config/locales/legislation.es.yml
new file mode 100644
index 000000000..6f0d5d5e7
--- /dev/null
+++ b/config/locales/legislation.es.yml
@@ -0,0 +1,112 @@
+---
+es:
+ legislation:
+ annotations:
+ comments:
+ see_all: Ver todos
+ see_complete: Ver completo
+ comments_count:
+ one: "%{count} comentario"
+ other: "%{count} comentarios"
+ replies_count:
+ one: "%{count} respuesta"
+ other: "%{count} respuestas"
+ cancel: Cancelar
+ publish_comment: Publicar Comentario
+ form:
+ phase_not_open: Esta fase del proceso no está abierta
+ login_to_comment: Necesitas %{signin} o %{signup} para comentar.
+ signin: iniciar sesión
+ signup: registrarte
+ index:
+ title: Comentarios
+ see_in_context: Ver en contexto
+ comments_about: Comentarios sobre
+ comments_count:
+ one: "%{count} comentario"
+ other: "%{count} comentarios"
+ show:
+ title: Comentario
+ version_chooser:
+ seeing_version: Comentarios para la versión
+ see_text: Ver borrador del texto
+ draft_versions:
+ changes:
+ title: Cambios
+ seeing_changelog_version: Resumen de cambios de la revisión
+ see_text: Ver borrador del texto
+ show:
+ loading_comments: Cargando comentarios
+ seeing_version: Estás viendo la revisión
+ select_draft_version: Seleccionar borrador
+ select_version_submit: ver
+ updated_at: actualizada el %{date}
+ see_changes: ver resumen de cambios
+ see_comments: Ver todos los comentarios
+ text_toc: Índice
+ text_body: Texto
+ text_comments: Comentarios
+ processes:
+ header:
+ view_process_information: Ver información del proceso
+ debate:
+ empty_questions: No hay preguntas
+ participate: Realiza tus aportaciones al debate previo participando en los siguientes temas.
+ header_full:
+ title: Colabora en la elaboración de la normativa sobre
+ description: En qué consiste
+ target: A quién va dirigido
+ how_to_participate: Cómo puedes participar
+ more_info: Más información y contexto
+ index:
+ hightlighted_processes: PROCESOS DESTACADOS
+ filters:
+ open: Procesos activos
+ next: Próximamente
+ past: Terminados
+ no_open_processes: No hay procesos activos
+ no_next_processes: No hay procesos planeados
+ no_past_processes: No hay procesos terminados
+ phase_not_open:
+ not_open: Esta fase del proceso todavía no está abierta
+ phase_empty:
+ empty: No hay nada publicado todavía
+ process:
+ see_latest_comments: Ver últimas aportaciones
+ see_latest_comments_title: Aportar a este proceso
+ shared:
+ key_dates: "Fechas clave:"
+ debate_dates: Debate previo
+ draft_publication_date: Publicación borrador
+ allegations_dates: Alegaciones
+ final_publication_date: Publicación resultados
+ questions:
+ comments:
+ comment_button: Publicar respuesta
+ comments_title: Respuestas abiertas
+ form:
+ leave_comment: Deja tu respuesta
+ question:
+ comments:
+ zero: Sin comentarios
+ one: "%{count} comentario"
+ other: "%{count} comentarios"
+ debate: Debate
+ show:
+ answer_question: Enviar respuesta
+ next_question: Siguiente pregunta
+ first_question: Primera pregunta
+ share: Compartir
+ share_twitter: Compartir en Twitter
+ share_facebook: Compartir en Facebook
+ share_gplus: Compartir en Google+
+ title: Proceso de legislación colaborativa
+ participation:
+ phase_not_open: Esta fase no está abierta
+ organizations: Las organizaciones no pueden participar en el debate
+ signin: iniciar sesión
+ signup: registrarte
+ unauthenticated: Necesitas %{signin} o %{signup} para participar en el debate.
+ verified_only: Solo los usuarios verificados pueden participar en el debate, %{verify_account}.
+ verify_account: verifica tu cuenta
+ debate_phase_not_open: La fase de debate previo ya ha finalizado y en este momento no se aceptan respuestas
diff --git a/spec/features/comments/legislation_questions_spec.rb b/spec/features/comments/legislation_questions_spec.rb
index c8f929b9e..253c25b99 100644
--- a/spec/features/comments/legislation_questions_spec.rb
+++ b/spec/features/comments/legislation_questions_spec.rb
@@ -164,7 +164,7 @@ feature 'Commenting legislation questions' do
visit legislation_process_question_path(legislation_question.process, legislation_question)
fill_in "comment-body-legislation_question_#{legislation_question.id}", with: 'Have you thought about...?'
- click_button 'Publish comment'
+ click_button 'Publish answer'
within "#comments" do
expect(page).to have_content 'Have you thought about...?'
@@ -176,7 +176,7 @@ feature 'Commenting legislation questions' do
login_as(user)
visit legislation_process_question_path(legislation_question.process, legislation_question)
- click_button 'Publish comment'
+ click_button 'Publish answer'
expect(page).to have_content "Can't be blank"
end
@@ -295,11 +295,11 @@ feature 'Commenting legislation questions' do
visit legislation_process_question_path(legislation_question.process, legislation_question)
fill_in "comment-body-legislation_question_#{legislation_question.id}", with: 'Testing submit button!'
- click_button 'Publish comment'
+ click_button 'Publish answer'
# The button's text should now be "..."
# This should be checked before the Ajax request is finished
- expect(page).to_not have_button 'Publish comment'
+ expect(page).to_not have_button 'Publish answer'
expect(page).to have_content('Testing submit button!')
end
@@ -313,7 +313,7 @@ feature 'Commenting legislation questions' do
fill_in "comment-body-legislation_question_#{legislation_question.id}", with: "I am moderating!"
check "comment-as-moderator-legislation_question_#{legislation_question.id}"
- click_button "Publish comment"
+ click_button "Publish answer"
within "#comments" do
expect(page).to have_content "I am moderating!"
@@ -369,7 +369,7 @@ feature 'Commenting legislation questions' do
fill_in "comment-body-legislation_question_#{legislation_question.id}", with: "I am your Admin!"
check "comment-as-administrator-legislation_question_#{legislation_question.id}"
- click_button "Publish comment"
+ click_button "Publish answer"
within "#comments" do
expect(page).to have_content "I am your Admin!"
diff --git a/spec/features/legislation/questions_spec.rb b/spec/features/legislation/questions_spec.rb
index c9513e9de..77503b5a9 100644
--- a/spec/features/legislation/questions_spec.rb
+++ b/spec/features/legislation/questions_spec.rb
@@ -38,7 +38,7 @@ feature 'Legislation' do
visit legislation_process_question_path(@process, @process.questions.first)
expect(page).to have_content("Question 1")
- expect(page).to have_content("Comments (0)")
+ expect(page).to have_content("Open answers (0)")
end
scenario 'shows next question link in question page' do
- <%= t("debates.show.comments_title") %> + <%= comment_tree_title_text(commentable) %> (<%= commentable.comments_count %>)
diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index e3399c383..9d9767e73 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -2,13 +2,13 @@ <% css_id = parent_or_commentable_dom_id(parent_id, commentable) %>