[2] | 1 | <%inherit file="/display_base.mako"/> |
---|
| 2 | |
---|
| 3 | <%def name="javascripts()"> |
---|
| 4 | ${parent.javascripts()} |
---|
| 5 | <script type="text/javascript"> |
---|
| 6 | |
---|
| 7 | $(function() { |
---|
| 8 | |
---|
| 9 | // Setup embedded content: |
---|
| 10 | // (a) toggles for showing/hiding embedded content; |
---|
| 11 | // (b) ... |
---|
| 12 | $('.embedded-item').each( function() { |
---|
| 13 | var container = $(this); |
---|
| 14 | |
---|
| 15 | // Show embedded item. |
---|
| 16 | var show_embedded_item = function() { |
---|
| 17 | var ajax_url = container.find("input[type=hidden]").val(); |
---|
| 18 | // Only get item content if it's not already there. |
---|
| 19 | var item_content = $.trim(container.find(".item-content").text()); |
---|
| 20 | if (!item_content) { |
---|
| 21 | $.ajax({ |
---|
| 22 | type: "GET", |
---|
| 23 | url: ajax_url, |
---|
| 24 | error: function() { alert("Getting item content failed."); }, |
---|
| 25 | success: function( item_content ) { |
---|
| 26 | container.find(".summary-content").hide("fast"); |
---|
| 27 | container.find(".item-content").html(item_content).show("fast"); |
---|
| 28 | container.find(".toggle-expand").hide(); |
---|
| 29 | container.find(".toggle-contract").show(); |
---|
| 30 | |
---|
| 31 | // Init needed for history items. |
---|
| 32 | init_history_items( container.find("div.historyItemWrapper"), "noinit", "nochanges" ); |
---|
| 33 | container.find( "div.historyItemBody:visible" ).each( function() { |
---|
| 34 | if ( $.browser.mozilla ) { |
---|
| 35 | $(this).find( "pre.peek" ).css( "overflow", "hidden" ); |
---|
| 36 | } |
---|
| 37 | $(this).hide(); |
---|
| 38 | }); |
---|
| 39 | } |
---|
| 40 | }); |
---|
| 41 | } else { |
---|
| 42 | container.find(".summary-content").hide("fast"); |
---|
| 43 | container.find(".item-content").show("fast"); |
---|
| 44 | container.find(".toggle-expand").hide(); |
---|
| 45 | container.find(".toggle-contract").show(); |
---|
| 46 | } |
---|
| 47 | }; |
---|
| 48 | |
---|
| 49 | // Hide embedded item. |
---|
| 50 | var hide_embedded_item = function() { |
---|
| 51 | container.find(".item-content").hide("fast"); |
---|
| 52 | container.find(".summary-content").show("fast"); |
---|
| 53 | container.find(".toggle-contract").hide(); |
---|
| 54 | container.find(".toggle-expand").show(); |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | // Setup toggle expand. |
---|
| 58 | var toggle_expand = $(this).find('.toggle-expand'); |
---|
| 59 | toggle_expand.click( function() { |
---|
| 60 | show_embedded_item(); |
---|
| 61 | return false; |
---|
| 62 | }); |
---|
| 63 | |
---|
| 64 | // Setup toggle contract. |
---|
| 65 | var toggle_contract = $(this).find('.toggle-contract'); |
---|
| 66 | toggle_contract.click( function() { |
---|
| 67 | hide_embedded_item(); |
---|
| 68 | return false; |
---|
| 69 | }); |
---|
| 70 | |
---|
| 71 | // Setup toggle embed. |
---|
| 72 | var toggle_embed = $(this).find('.toggle-embed'); |
---|
| 73 | toggle_embed.click( function() { |
---|
| 74 | if (container.find(".item-content").is(":visible")) { |
---|
| 75 | hide_embedded_item(); |
---|
| 76 | } else { |
---|
| 77 | show_embedded_item(); |
---|
| 78 | } |
---|
| 79 | return false; |
---|
| 80 | }); |
---|
| 81 | }); |
---|
| 82 | }); |
---|
| 83 | |
---|
| 84 | </script> |
---|
| 85 | </%def> |
---|
| 86 | |
---|
| 87 | <%def name="stylesheets()"> |
---|
| 88 | ${parent.stylesheets()} |
---|
| 89 | ${h.css( "base", "history", "autocomplete_tagging" )} |
---|
| 90 | <style type="text/css"> |
---|
| 91 | .toggle-contract { display: none; } |
---|
| 92 | .embedded-item h4 { |
---|
| 93 | margin: 0px; |
---|
| 94 | } |
---|
| 95 | ## Format tables in pages so that they look like they do in the page editor. |
---|
| 96 | .page-body table { |
---|
| 97 | padding: 8px 5px 5px; |
---|
| 98 | min-width: 500px; |
---|
| 99 | border: none; |
---|
| 100 | } |
---|
| 101 | .page-body caption { |
---|
| 102 | text-align: left; |
---|
| 103 | background: #E4E4B0; |
---|
| 104 | padding: 5px; |
---|
| 105 | font-weight: bold; |
---|
| 106 | } |
---|
| 107 | .page-body td { |
---|
| 108 | width: 25%; |
---|
| 109 | padding: 0.2em 0.8em; |
---|
| 110 | } |
---|
| 111 | </style> |
---|
| 112 | </%def> |
---|
| 113 | |
---|
| 114 | <%def name="render_item_header( item )"> |
---|
| 115 | ## No header for pages. |
---|
| 116 | </%def> |
---|
| 117 | |
---|
| 118 | <%def name="render_item_links( page )"> |
---|
| 119 | </%def> |
---|
| 120 | |
---|
| 121 | <%def name="render_item( page, page_data=None )"> |
---|
| 122 | ${page_data} |
---|
| 123 | </%def> |
---|