From e2afc2c31c0a99df3cd8a76e986e83d0202965f5 Mon Sep 17 00:00:00 2001 From: aaronzdavis Date: Mon, 14 Mar 2016 13:35:38 -0700 Subject: [PATCH 1/2] Add subtitle field to backend --- .../spree/admin/blog_entries/_form.html.erb | 18 +++++++++++++----- config/locales/en.yml | 1 + ...60314132600_add_subtitle_to_blog_entries.rb | 5 +++++ 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20160314132600_add_subtitle_to_blog_entries.rb diff --git a/app/views/spree/admin/blog_entries/_form.html.erb b/app/views/spree/admin/blog_entries/_form.html.erb index af46272c..f3ff59bc 100644 --- a/app/views/spree/admin/blog_entries/_form.html.erb +++ b/app/views/spree/admin/blog_entries/_form.html.erb @@ -2,11 +2,19 @@
<%= form.field_container :title do %> -
- <%= form.label :title, Spree.t(:title) %> *
- <%= form.text_field :title, :class => 'form-control' %> - <%= form.error_message_on :title %> -
+
+ <%= form.label :title, Spree.t(:title) %> *
+ <%= form.text_field :title, :class => 'form-control' %> + <%= form.error_message_on :title %> +
+ <% end %> + + <%= form.field_container :subtitle do %> +
+ <%= form.label :subtitle, Spree.t(:subtitle) %> *
+ <%= form.text_field :subtitle, :class => 'form-control' %> + <%= form.error_message_on :subtitle %> +
<% end %> <%= form.field_container :permalink do %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 84b03f04..8d5e25a5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -30,6 +30,7 @@ en: permalink: Permalink published_at: Published at visible: Visible + subtitle: subtitle author_id: Author tag_list: Tags category_list: Categories diff --git a/db/migrate/20160314132600_add_subtitle_to_blog_entries.rb b/db/migrate/20160314132600_add_subtitle_to_blog_entries.rb new file mode 100644 index 00000000..f1f8c475 --- /dev/null +++ b/db/migrate/20160314132600_add_subtitle_to_blog_entries.rb @@ -0,0 +1,5 @@ +class AddSubtitleToBlogEntries < ActiveRecord::Migration + def change + add_column :spree_blog_entries, :subtitle, :string + end +end From afc85147e01e02ebb5522ecb0b52264ac92b4b83 Mon Sep 17 00:00:00 2001 From: aaronzdavis Date: Mon, 14 Mar 2016 13:48:07 -0700 Subject: [PATCH 2/2] add subtitle to the show.json --- app/views/spree/blog_entries/show.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/spree/blog_entries/show.json.jbuilder b/app/views/spree/blog_entries/show.json.jbuilder index 75a9b499..a5b7813f 100644 --- a/app/views/spree/blog_entries/show.json.jbuilder +++ b/app/views/spree/blog_entries/show.json.jbuilder @@ -10,6 +10,7 @@ end json.set! :blog_entry do json.title @blog_entry.title + json.title @blog_entry.subtitle json.body @blog_entry.body json.permalink @blog_entry.permalink json.created_at @blog_entry.created_at