aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/refinery/admin/blog/posts/_form.js.erb
blob: 87ad23f1fcb800f67f40d70cc378e2076a7acae1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script>
  (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>