diff options
author | Kyle Wilkinson <kai@wikyd.org> | 2011-06-21 15:45:56 -0700 |
---|---|---|
committer | Kyle Wilkinson <kai@wikyd.org> | 2011-06-21 15:45:56 -0700 |
commit | 767346b6941dbdff3aa2ef1f58a87429597da212 (patch) | |
tree | 300680922d3dde9bd9cf0e40cecd697e1e1bfb86 /app | |
parent | e23af6bca75532ed7377462f10efa4ca9c002acc (diff) | |
download | refinerycms-blog-767346b6941dbdff3aa2ef1f58a87429597da212.tar.gz refinerycms-blog-767346b6941dbdff3aa2ef1f58a87429597da212.tar.bz2 refinerycms-blog-767346b6941dbdff3aa2ef1f58a87429597da212.zip |
Add button to copy the blog post's body to the teaser editor to get started on creating a custom teaser.
Diffstat (limited to 'app')
-rw-r--r-- | app/views/admin/blog/posts/_form.css.erb | 8 | ||||
-rw-r--r-- | app/views/admin/blog/posts/_form.js.erb | 16 | ||||
-rw-r--r-- | app/views/admin/blog/posts/_teaser_part.html.erb | 7 |
3 files changed, 31 insertions, 0 deletions
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; + } </style> 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); </script> 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 @@ <div class='page_part' id='page_part_teaser'> <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%> + <p> + <span class='clearfix label_inline_with_link'> + <%= link_to t('admin.blog.posts.form.copy_body'), "#", + :id => 'copy_body_link', + :title => t('admin.blog.posts.form.copy_body_help') %> + </span> + </p> </div> |