From 3c0412bfaa3c2dc3fff319af0c812f7a9fb286a3 Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Tue, 21 Jun 2011 02:48:48 -0700 Subject: Add tab field for the custom teaser. Currently, width is set to zero for teaser editor... need to debug. --- app/views/admin/blog/posts/_form.html.erb | 8 ++++++++ app/views/admin/blog/posts/_teaser_part.html.erb | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 app/views/admin/blog/posts/_teaser_part.html.erb (limited to 'app/views/admin') diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index abff4f2..4eb4cf4 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -16,6 +16,9 @@
  • <%= link_to "Body", "#page_part_body" %>
  • +
  • + <%= link_to "Teaser", "#page_part_teaser" %> +
  • <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
  • <%= link_to tab.name.titleize, "#custom_tab_#{tab_index}" %> @@ -31,6 +34,11 @@ :f => f, :part_index => (part_index += 1), } -%> + <%= render :partial => 'teaser_part', + :locals => { + :f => f, + :part_index => (part_index += 1), + } -%> <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
    <%= render :partial => tab.partial, :locals => {:f => f} %> diff --git a/app/views/admin/blog/posts/_teaser_part.html.erb b/app/views/admin/blog/posts/_teaser_part.html.erb new file mode 100644 index 0000000..22711a9 --- /dev/null +++ b/app/views/admin/blog/posts/_teaser_part.html.erb @@ -0,0 +1,4 @@ +
    + <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%> +
    + -- cgit v1.2.3 From e23af6bca75532ed7377462f10efa4ca9c002acc Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Tue, 21 Jun 2011 03:13:28 -0700 Subject: Call tabs() method on admin tabs section only after the document is ready. This fixes the problem where the teaser editor was showing with a width of 0. Set the active tab to the initial tab on the blog post editor. --- app/views/admin/blog/posts/_form.html.erb | 2 +- app/views/admin/blog/posts/_form.js.erb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'app/views/admin') diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 4eb4cf4..20a8fe1 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -13,7 +13,7 @@
      -
    • +
    • <%= link_to "Body", "#page_part_body" %>
    • diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb index b829ec2..9ad8c19 100644 --- a/app/views/admin/blog/posts/_form.js.erb +++ b/app/views/admin/blog/posts/_form.js.erb @@ -1,5 +1,7 @@ -- cgit v1.2.3 From 767346b6941dbdff3aa2ef1f58a87429597da212 Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Tue, 21 Jun 2011 15:45:56 -0700 Subject: Add button to copy the blog post's body to the teaser editor to get started on creating a custom teaser. --- app/views/admin/blog/posts/_form.css.erb | 8 ++++++++ app/views/admin/blog/posts/_form.js.erb | 16 ++++++++++++++++ app/views/admin/blog/posts/_teaser_part.html.erb | 7 +++++++ 3 files changed, 31 insertions(+) (limited to 'app/views/admin') diff --git a/app/views/admin/blog/posts/_form.css.erb b/app/views/admin/blog/posts/_form.css.erb index 05c18cf..48bbbfa 100644 --- a/app/views/admin/blog/posts/_form.css.erb +++ b/app/views/admin/blog/posts/_form.css.erb @@ -4,4 +4,12 @@ margin: 0px; padding: 0px; } + a#copy_body_link { + background: url("/images/refinery/icons/add.png") no-repeat scroll 0 6px transparent; + border-bottom: 0 none; + display: inline; + line-height: 29px; + margin-top: 0; + padding-left: 20px; + } diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb index 9ad8c19..87ad23f 100644 --- a/app/views/admin/blog/posts/_form.js.erb +++ b/app/views/admin/blog/posts/_form.js.erb @@ -2,6 +2,22 @@ (function($) { $(function() { $('#page-tabs').tabs(); + $('#copy_body_link').click(function(event) { + // Find the WYMEditor that maps to the custom_teaser field + var teaserTextArea = $('#blog_post_custom_teaser')[0]; + var teaserEditor = null; + $.each(WYMeditor.INSTANCES, function(index, editor) { + if (editor._element[0] == teaserTextArea) { + teaserEditor = editor; + } + }); + + if (teaserEditor) { + teaserEditor.html($('#blog_post_body').attr('value')); + } + + event.preventDefault(); + }); }); })(jQuery); diff --git a/app/views/admin/blog/posts/_teaser_part.html.erb b/app/views/admin/blog/posts/_teaser_part.html.erb index 22711a9..d615812 100644 --- a/app/views/admin/blog/posts/_teaser_part.html.erb +++ b/app/views/admin/blog/posts/_teaser_part.html.erb @@ -1,4 +1,11 @@
      <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%> +

      + + <%= link_to t('admin.blog.posts.form.copy_body'), "#", + :id => 'copy_body_link', + :title => t('admin.blog.posts.form.copy_body_help') %> + +

      -- cgit v1.2.3