Merge pull request #70 from medialab-prado/reorganize-locale-files

Change comments texts in legislation questions
This commit is contained in:
Fernando Blat
2017-01-17 16:39:08 +01:00
committed by GitHub
13 changed files with 263 additions and 259 deletions

View File

@@ -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
end

View File

@@ -6,7 +6,7 @@
<div class="row">
<div id="comments" class="small-12 column">
<h2>
<%= t("debates.show.comments_title") %>
<%= comment_tree_title_text(commentable) %>
<span class="js-comments-count">(<%= commentable.comments_count %>)</span>
</h2>

View File

@@ -2,13 +2,13 @@
<% css_id = parent_or_commentable_dom_id(parent_id, commentable) %>
<div id="js-comment-form-<%= css_id %>" <%= "style='display:none'".html_safe if toggeable %> class="comment-form">
<%= form_for Comment.new, remote: true do |f| %>
<%= label_tag "comment-body-#{css_id}", t("comments.form.leave_comment") %>
<%= label_tag "comment-body-#{css_id}", leave_comment_text(commentable) %>
<%= f.text_area :body, id: "comment-body-#{css_id}", maxlength: Comment.body_max_length, label: false %>
<%= f.hidden_field :commentable_type, value: commentable.class.name %>
<%= f.hidden_field :commentable_id, value: commentable.id %>
<%= f.hidden_field :parent_id, value: parent_id %>
<%= f.submit comment_button_text(parent_id), class: "button" %>
<%= f.submit comment_button_text(parent_id, commentable), class: "button" %>
<% if can? :comment_as_moderator, commentable %>
<div class="float-right">

View File

@@ -27,7 +27,7 @@
</div>
</div>
<%= render 'legislation/shared/comments', commentable: @annotation %>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
</div>
</div>

View File

@@ -47,7 +47,7 @@
</div>
</aside>
</div>
<%= render 'legislation/shared/comments', commentable: @question %>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
</section>

View File

@@ -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 %>
<div class="row comments">
<div id="comments" class="small-12 column">
<h3>
<%= t("legislation.shared.comments") %>
<span class="js-comments-count">(<%= commentable.comments_count %>)</span>
</h3>
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
<% if user_signed_in? %>
<%= render 'comments/form', {commentable: commentable, parent_id: nil, toggeable: false} %>
<% else %>
<br>
<div data-alert class="callout primary">
<%= t("debates.show.login_to_comment",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<% end %>
<% @comment_tree.root_comments.each do |comment| %>
<%= render 'comments/comment', comment: comment %>
<% end %>
<%= paginate @comment_tree.root_comments %>
</div>
</div>
<% end %>

View File

@@ -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

View File

@@ -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:

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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!"

View File

@@ -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