diff options
author | Joe Sak <joe@joesak.com> | 2011-06-23 09:43:53 -0500 |
---|---|---|
committer | Joe Sak <joe@joesak.com> | 2011-06-23 09:43:53 -0500 |
commit | 787a0916b1514a7b904f5653d0c2810aab4ffa94 (patch) | |
tree | fc747e8f06428af8d057f1666082750f5d603811 /app/views/admin | |
parent | e906ed2eca96a87b737052d55ef635ce60fbffdc (diff) | |
parent | 767346b6941dbdff3aa2ef1f58a87429597da212 (diff) | |
download | refinerycms-blog-787a0916b1514a7b904f5653d0c2810aab4ffa94.tar.gz refinerycms-blog-787a0916b1514a7b904f5653d0c2810aab4ffa94.tar.bz2 refinerycms-blog-787a0916b1514a7b904f5653d0c2810aab4ffa94.zip |
Merge branch 'custom_teasers' of https://github.com/wikyd/refinerycms-blog into wikyd-custom-teasers
Diffstat (limited to 'app/views/admin')
-rw-r--r-- | app/views/admin/blog/posts/_form.css.erb | 8 | ||||
-rw-r--r-- | app/views/admin/blog/posts/_form.html.erb | 10 | ||||
-rw-r--r-- | app/views/admin/blog/posts/_form.js.erb | 20 | ||||
-rw-r--r-- | app/views/admin/blog/posts/_teaser_part.html.erb | 11 |
4 files changed, 47 insertions, 2 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.html.erb b/app/views/admin/blog/posts/_form.html.erb index abff4f2..20a8fe1 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -13,9 +13,12 @@ <div class='field'> <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'> <ul id='page_parts'> - <li class='ui-state-default'> + <li class='ui-state-default ui-state-active'> <%= link_to "Body", "#page_part_body" %> </li> + <li class='ui-state-default'> + <%= link_to "Teaser", "#page_part_teaser" %> + </li> <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %> <li class='ui-state-default' id="custom_<%= tab.name %>_tab"> <%= 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| %> <div class='page_part' id='<%= "custom_tab_#{tab_index}" %>'> <%= render :partial => tab.partial, :locals => {:f => f} %> diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb index b829ec2..87ad23f 100644 --- a/app/views/admin/blog/posts/_form.js.erb +++ b/app/views/admin/blog/posts/_form.js.erb @@ -1,5 +1,23 @@ <script> (function($) { - $('#page-tabs').tabs(); + $(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 new file mode 100644 index 0000000..d615812 --- /dev/null +++ b/app/views/admin/blog/posts/_teaser_part.html.erb @@ -0,0 +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> + |