[2] | 1 | ## |
---|
| 2 | ## Base file for generating HTML for embedded objects. |
---|
| 3 | ## |
---|
| 4 | ## parameters: item, item_data |
---|
| 5 | ## |
---|
| 6 | <%namespace file="/display_common.mako" import="*" /> |
---|
| 7 | |
---|
| 8 | ## HTML structure. |
---|
| 9 | <div class='embedded-item display ${get_class_display_name( item.__class__ ).lower()}'> |
---|
| 10 | <div class='title'> |
---|
| 11 | ${self.render_title( item )} |
---|
| 12 | <hr/> |
---|
| 13 | </div> |
---|
| 14 | <div class='summary-content'> |
---|
| 15 | ${self.render_summary_content( item, item_data )} |
---|
| 16 | </div> |
---|
| 17 | <div class='item-content'> |
---|
| 18 | </div> |
---|
| 19 | </div> |
---|
| 20 | |
---|
| 21 | ## Render item links. |
---|
| 22 | <%def name="render_item_links( item )"> |
---|
| 23 | <% |
---|
| 24 | item_display_name = get_class_display_name( item.__class__ ).lower() |
---|
| 25 | item_controller = "/%s" % get_controller_name( item ) |
---|
| 26 | item_user = get_item_user( item ) |
---|
| 27 | item_slug = get_item_slug( item ) |
---|
| 28 | display_href = h.url_for( controller=item_controller, action='display_by_username_and_slug', username=item_user.username, slug=item_slug ) |
---|
| 29 | %> |
---|
| 30 | |
---|
| 31 | ## Links for importing and viewing an item. |
---|
| 32 | <a href="${h.url_for( controller=item_controller, action='imp', id=trans.security.encode_id( item.id ) )}" title="Import ${item_display_name}" class="icon-button import tooltip"></a> |
---|
| 33 | <a class="icon-button go-to-full-screen tooltip" href="${display_href}" title="Go to ${item_display_name}"></a> |
---|
| 34 | </%def> |
---|
| 35 | |
---|
| 36 | <%def name="render_title( item )"> |
---|
| 37 | <% |
---|
| 38 | item_display_name = get_class_display_name( item.__class__ ).lower() |
---|
| 39 | item_controller = "/%s" % get_controller_name( item ) |
---|
| 40 | item_user = get_item_user( item ) |
---|
| 41 | item_slug = get_item_slug( item ) |
---|
| 42 | display_href = h.url_for( controller=item_controller, action='display_by_username_and_slug', username=item_user.username, slug=item_slug ) |
---|
| 43 | %> |
---|
| 44 | <div style="float: left"> |
---|
| 45 | <a class="display_in_embed icon-button toggle-expand tooltip" item_id="${trans.security.encode_id( item.id )}" item_class="$item.__class__.__name__" href="${display_href}" |
---|
| 46 | title="Show ${item_display_name} content"></a> |
---|
| 47 | <a class="toggle-contract icon-button tooltip" href="${display_href}" title="Hide ${item_display_name} content"></a> |
---|
| 48 | </div> |
---|
| 49 | <div style="float: right"> |
---|
| 50 | ${self.render_item_links( item )} |
---|
| 51 | </div> |
---|
| 52 | <h4><a class="toggle-embed tooltip" href="${display_href}" title="Show or hide ${item_display_name} content">Galaxy ${get_class_display_name( item.__class__ )} | ${get_item_name( item )}</a></h4> |
---|
| 53 | %if hasattr( item, "annotation") and item.annotation: |
---|
| 54 | <div class="annotation">${item.annotation}</div> |
---|
| 55 | %endif |
---|
| 56 | |
---|
| 57 | ## Use a hidden var to store the ajax URL for getting an item's content. |
---|
| 58 | <input type="hidden" name="ajax-item-content-url" value="${h.url_for( controller=item_controller, action='get_item_content_async', id=trans.security.encode_id( item.id ) )}"/> |
---|
| 59 | </%def> |
---|
| 60 | |
---|
| 61 | ## Methods to override to render summary content. |
---|
| 62 | <%def name="render_summary_content( item, item_data )"> |
---|
| 63 | </%def> |
---|