Changeset 484 for trunk/modules/user_guide
- Timestamp:
- 09/03/2007 03:37:01 PM (15 months ago)
- Location:
- trunk/modules/user_guide
- Files:
-
- 2 modified
-
controllers/user_guide.php (modified) (1 diff)
-
views/user_guide/js/effects.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/user_guide/controllers/user_guide.php
r483 r484 44 44 $content = rtrim('user_guide/'.$locale.'content/'.$category.'/'.$section, '/'); 45 45 46 // Load session for AJAX page storage47 $this->load->library('session');48 49 46 // Load markdown 50 47 require Kohana::find_file('vendor', 'Markdown'); 51 48 52 // Show content 53 if ($this->input->get('ajax') === 'true') 54 { 55 // Set the AJAX return page, for refreshing 56 $this->session->set('ajax_return', $this->uri->string()); 49 $template = $this->load->view('user_guide/'.$locale.'template'); 50 $template->menu = $this->load->view('user_guide/'.$locale.'menu', array('active_category' => $category, 'active_section' => $section)); 51 $template->content = $this->load->view($content)->render(FALSE, 'Markdown'); 57 52 58 // Just the content, ma'am! 59 $this->load->view($content)->render(TRUE, 'Markdown'); 60 } 61 else 62 { 63 // Return the user to the page they were on 64 if ($ajax_return = $this->session->get_once('ajax_return')) 65 url::redirect($ajax_return); 66 67 $template = $this->load->view('user_guide/'.$locale.'template'); 68 $template->menu = $this->load->view('user_guide/'.$locale.'menu', array('active_category' => $category, 'active_section' => $section)); 69 $template->content = $this->load->view($content)->render(FALSE, 'Markdown'); 70 71 // Display output 72 $template->render(TRUE); 73 } 53 // Display output 54 $template->render(TRUE); 74 55 } 75 56 -
trunk/modules/user_guide/views/user_guide/js/effects.js
r475 r484 1 1 // $Id$ 2 // Special Kohana functions3 var Kohana = {4 loading: false,5 waiting: false,6 toggleLoading: function(on) {7 // If we are waiting for an animation, retry in 5ms8 if (Kohana.waiting == true) {9 setTimeout('Kohana.toggleLoading('+on+')', 20);10 return false;11 }12 // Toggle waiting state13 Kohana.waiting = true;14 if (on == true) { // Show loading15 this.loading.slideDown(250, function() {16 Kohana.waiting = false;17 });18 } else { // Hide loading19 this.loading.slideUp(250, function() {20 Kohana.waiting = false;21 });22 }23 }24 };25 2 // Behavior attachment 26 3 $(document).ready(function(){ … … 31 8 $(this).fadeTo(300, 0.7) 32 9 }); 33 // Append the AJAX loader34 $('#container').append('<div id="loading"> </div>');35 // To prevent extra querying, add the loading element to Kohana after hiding it36 Kohana.loading = $('#loading').hide();37 10 // Apply menu sliding effect 38 11 $('#menu li.first').click(function(){ … … 55 28 // Find and hide the sub menus that are not in the active menu 56 29 .not('.active').find('ul').hide(); 57 // Add AJAX functionality to the menu links58 $('#menu a').click(function(){59 // Show loading60 Kohana.toggleLoading(true);61 // Fetch the current link62 var link = $(this);63 // Make AJAX request, using ?ajax=true64 $.get(link.attr('href'), {ajax: 'true'}, function(data) {65 // Add the hilight class to the current link66 $('#menu ul li.lite').removeClass('lite');67 link.parent().addClass('lite');68 // Load new AJAX content69 $('#body').html(data);70 // Hide loading71 Kohana.toggleLoading(false)72 });73 return false;74 });75 30 // For syntax highlighting 76 31 prettyPrint();
