| 11 | | <div class="a-subnav-wrapper blog"> |
| 12 | | <div class="a-subnav-inner"> |
| 13 | | <ul class="a-admin-action-controls"> |
| 14 | | <?php include_partial('aEventAdmin/list_actions', array('helper' => $helper)) ?> |
| 15 | | </ul> |
| 16 | | </div> |
| 17 | | </div> |
| | 10 | <div class="a-subnav-wrapper blog"> |
| | 11 | <div class="a-subnav-inner"> |
| | 12 | <ul class="a-admin-action-controls"> |
| | 13 | <li><a href="<?php echo url_for('@a_blog_admin'); ?>" class="all-posts-btn"><?php echo __('All Posts', array(), 'apostrophe-blog') ?></a></li> |
| | 14 | <?php include_partial('list_actions', array('helper' => $helper)) ?> |
| | 15 | </ul> |
| | 16 | <div id="a-blog-post-status-indicator"></div> |
| | 17 | </div> |
| | 18 | </div> |
| 23 | | <div class="a-admin-content main"> |
| 24 | | <?php include_partial('aEvent/'.$a_event->getTemplate(), array('a_event' => $a_event)) ?> |
| | 21 | <?php include_partial('flashes') ?> |
| | 22 | |
| | 23 | <div class="a-admin-content main"> |
| | 24 | |
| | 25 | <?php if (0): ?> |
| | 26 | <?php // We aren't using status messages right now ?> |
| | 27 | <dl id="a-blog-post-status-messages"></dl> |
| | 28 | <?php endif ?> |
| | 29 | |
| | 30 | <div id="a-blog-post-title-interface" class="a-blog-post-title-interface"> |
| | 31 | <input type="text" id="a_blog_post_title_interface" value="<?php echo ($a_event->title == 'untitled')? '':$a_event->title ?>" /> |
| | 32 | <div id="a-blog-post-title-placeholder"><?php echo __('Title your post...', array(), 'apostrophe-blog') ?></div> |
| | 33 | </div> |
| | 34 | |
| | 35 | <div id="a-blog-post-permalink-interface"> |
| | 36 | <h6>Permalink:</h6> |
| | 37 | <div class="a-blog-post-permalink-wrapper url"> |
| | 38 | <span><?php echo aTools::urlForPage($a_event->findBestEngine()->getSlug()).'/' ?></span><?php // Dan, Can you echo the REAL URL prefix here -- I don't know how to build a URL based on the complex blog route business we are doing ?> |
| | 39 | </div> |
| | 40 | <div class="a-blog-post-permalink-wrapper slug"> |
| | 41 | <input type="text" name="a_blog_post_permalink_interface" value="<?php echo $a_event->slug ?>" id="a_blog_post_permalink_interface"> |
| | 42 | <ul class="a-controls slug"> |
| | 43 | <li><a href="#" class="a-btn a-save mini"><?php echo __('Save', array(), 'apostrophe_blog') ?></a></li> |
| | 44 | <li><a href="#" class="a-btn a-cancel no-label mini"><?php echo __('Cancel', array(), 'apostrophe_blog') ?></a></li> |
| | 45 | </ul> |
| | 46 | </div> |
| | 47 | </div> |
| | 48 | |
| | 49 | <?php include_partial('aBlog/'.$a_event->getTemplate(), array('a_blog_post' => $a_event)) ?> |
| | 50 | |
| | 65 | |
| | 66 | |
| | 67 | <script type="text/javascript" charset="utf-8"> |
| | 68 | function updateBlog(event) |
| | 69 | { |
| | 70 | if(event.target.name == 'select-<?php echo $form['categories_list']->renderName() ?>[]' && |
| | 71 | event.target.options[0].selected == true) |
| | 72 | { |
| | 73 | |
| | 74 | } |
| | 75 | else if(event.target.name == 'add-text') {} |
| | 76 | else |
| | 77 | { |
| | 78 | updateBlogForm('<?php echo url_for('a_blog_admin_update', $a_event) ?>', event); |
| | 79 | } |
| | 80 | } |
| | 81 | |
| | 82 | $(document).ready(function(){ |
| | 83 | |
| | 84 | // Title Interface |
| | 85 | // ============================================= |
| | 86 | var titleInterface = $('#a_blog_post_title_interface'); |
| | 87 | var titlePlaceholder = $('#a-blog-post-title-placeholder'); |
| | 88 | var originalTitle = "<?php echo $a_event->title ?>"; |
| | 89 | |
| | 90 | <?php if ($a_event->title == 'untitled'): ?> |
| | 91 | titleInterface.focus(); // The blog post is 'Untitled' -- Focus the input |
| | 92 | <?php endif ?> |
| | 93 | |
| | 94 | // Title: On Change Compare |
| | 95 | titleInterface.change(function(){ |
| | 96 | if ($(this).val() != '') { // If the input is not empty |
| | 97 | $('#a_blog_post_title').val($(this).val()); // Pass the value to the admin form and update |
| | 98 | updateBlogForm('<?php echo url_for('a_blog_admin_update',$a_event) ?>'); |
| | 99 | }; |
| | 100 | }); |
| | 101 | |
| | 102 | titleInterface.blur(function(){ |
| | 103 | // Check for Empty Title Field |
| | 104 | if ($(this).val() == '') |
| | 105 | { |
| | 106 | $(this).next().show(); |
| | 107 | } |
| | 108 | }); |
| | 109 | |
| | 110 | titleInterface.focus(function(){ |
| | 111 | // Always hide the placeholder on focus |
| | 112 | $(this).next().hide(); |
| | 113 | }); |
| | 114 | |
| | 115 | titlePlaceholder.mousedown(function(){ |
| | 116 | // If you click the placeholder text |
| | 117 | // focus the input (Mousedown is faster than click here) |
| | 118 | titleInterface.focus(); |
| | 119 | }).hide(); |
| | 120 | |
| | 121 | // Permalink Interface |
| | 122 | // ============================================= |
| | 123 | var permalinkInterface = $('#a-blog-post-permalink-interface'); |
| | 124 | var pInput = permalinkInterface.find('input'); |
| | 125 | var pControls = permalinkInterface.find('ul.a-controls'); |
| | 126 | var originalSlug = '<?php echo $a_event->slug ?>'; |
| | 127 | |
| | 128 | // Permalink: On Focus Listen for Changes |
| | 129 | pInput.focus(function(){ |
| | 130 | $(this).select(); |
| | 131 | $(this).keyup(function(){ |
| | 132 | if ($(this).val().trim() != originalSlug) |
| | 133 | { |
| | 134 | permalinkInterface.addClass('has-changes'); |
| | 135 | pControls.fadeIn(); |
| | 136 | } |
| | 137 | }); |
| | 138 | }); |
| | 139 | |
| | 140 | // Permalink Interface Controls: Save | Cancel |
| | 141 | // ============================================= |
| | 142 | pControls.click(function(event){ |
| | 143 | event.preventDefault(); |
| | 144 | $target = $(event.target); |
| | 145 | |
| | 146 | if ($target.hasClass('a-save')) |
| | 147 | { |
| | 148 | if (pInput.val() == '') { |
| | 149 | pInput.val(originalSlug); |
| | 150 | pControls.hide(); |
| | 151 | } |
| | 152 | if ((pInput.val() != '') && (pInput.val().trim() != originalSlug)) { |
| | 153 | $('#a_blog_post_slug').val(pInput.val()); // Pass the value to the admin form and update |
| | 154 | updateBlogForm('<?php echo url_for('a_blog_admin_update',$a_event) ?>'); |
| | 155 | } |
| | 156 | } |
| | 157 | |
| | 158 | if ($target.hasClass('a-cancel')) |
| | 159 | { |
| | 160 | pInput.val(originalSlug); |
| | 161 | pControls.hide(); |
| | 162 | } |
| | 163 | }); |
| | 164 | |
| | 165 | // Comments Toggle |
| | 166 | // ============================================= |
| | 167 | $('.section.comments a.allow_comments_toggle').click(function(event){ |
| | 168 | event.preventDefault(); |
| | 169 | toggleCheckbox($('#a_blog_post_allow_comments')); |
| | 170 | updateBlogForm('<?php echo url_for('a_blog_admin_update',$a_event) ?>'); |
| | 171 | }); |
| | 172 | |
| | 173 | }); |
| | 174 | </script> |