From 5450bade1aeb301158a2f5a1de215c7940019b83 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 12 Jun 2019 16:20:29 +0200 Subject: [PATCH] Use built-in form sumbit translation keys for diary comments Also use a diary comment object as the basis for the form --- app/views/diary_entries/show.html.erb | 4 ++-- config/locales/en.yml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/diary_entries/show.html.erb b/app/views/diary_entries/show.html.erb index a56613b49..cc761b15d 100644 --- a/app/views/diary_entries/show.html.erb +++ b/app/views/diary_entries/show.html.erb @@ -19,9 +19,9 @@ <%= error_messages_for "diary_comment" %> - <%= form_for :diary_comment, :url => { :action => "comment" } do |f| %> + <%= form_for @entry.comments.new, :url => { :action => "comment" } do |f| %> <%= richtext_area :diary_comment, :body, :cols => 80, :rows => 15 %> - <%= submit_tag t(".save_button") %> + <%= f.submit %> <% end %> <% if @entry.subscribers.exists?(current_user.id) %>
<%= link_to t("javascripts.changesets.show.unsubscribe"), diary_entry_unsubscribe_path(:display_name => @entry.user.display_name, :id => @entry.id), :method => :post, :class => :button %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 2ba2ce8ff..6ff69733d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -7,6 +7,8 @@ en: blog: "%e %B %Y" helpers: submit: + diary_comment: + create: Save diary_entry: create: "Publish" update: "Update" @@ -324,7 +326,6 @@ en: leave_a_comment: "Leave a comment" login_to_leave_a_comment: "%{login_link} to leave a comment" login: "Login" - save_button: "Save" no_such_entry: title: "No such diary entry" heading: "No entry with the id: %{id}" -- 2.39.5