PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/templates/visualization/display.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 105 lines | 83 code | 16 blank | 6 comment | 6 complexity | f15209340e82b3e01999e32fff53dd0a MD5 | raw file
  1<%inherit file="/display_base.mako"/>
  2
  3<%def name="javascripts()">
  4    <% config = item_data %>
  5    ${parent.javascripts()}
  6    
  7    <!--[if lt IE 9]>
  8      <script type='text/javascript' src="${h.url_for('/static/scripts/excanvas.js')}"></script>
  9    <![endif]-->
 10    
 11    ${h.js( "jquery.event.drag", "jquery.autocomplete", "jquery.mousewheel", "jquery.autocomplete", "trackster", "trackster_ui", "jquery.ui.sortable.slider", "jquery.scrollTo", "farbtastic" )}
 12</%def>
 13
 14<%def name="stylesheets()">
 15    ${parent.stylesheets()}
 16    
 17    ## For page:
 18    <style type="text/css">
 19        .page-body {
 20            padding: 0px;
 21        }
 22    </style>
 23
 24    ## For visualization (TODO: copied from browser.mako):
 25    ${h.css( "trackster", "overcast/jquery-ui-1.8.5.custom" )}
 26    <style type="text/css">
 27        #browser-container {
 28            overflow: none;
 29        }
 30        .nav-container {
 31            width: 100%;
 32            ## Overriding styles from trackster.css to push nav up into title bar
 33            height: 0;
 34            text-align: center;
 35        }
 36        .nav {
 37            ## Overriding styles from trackster.css to push nav up into title bar
 38            position: relative;
 39            display: inline-block;
 40            top: -2em;
 41            background: transparent;
 42            border: none;
 43        }
 44    </style>
 45</%def>
 46
 47<%def name="render_item_header( item )">
 48    ## Don't need to show header
 49</%def>
 50
 51<%def name="render_item_links( visualization )">
 52    <a 
 53        href="${h.url_for( controller='/visualization', action='imp', id=trans.security.encode_id( visualization.id ) )}"
 54        class="icon-button import"
 55        ## Needed to overwide initial width so that link is floated left appropriately.
 56        style="width: 100%"
 57        title="Import visualization">Import visualization</a>
 58</%def>
 59
 60<%def name="render_item( visualization, config )">
 61    <div id="${trans.security.encode_id( visualization.id )}" class="unified-panel-body" style="overflow:none;top:0px;"></div>
 62
 63    <script type="text/javascript">
 64        // TODO: much of this code is copied from browser.mako -- create shared base and use in both places.
 65    
 66        //
 67        // Place URLs here so that url_for can be used to generate them.
 68        // 
 69        var default_data_url = "${h.url_for( controller='/tracks', action='data' )}",
 70            raw_data_url = "${h.url_for( controller='/tracks', action='raw_data' )}",
 71            run_tool_url = "${h.url_for( controller='/tracks', action='run_tool' )}",
 72            rerun_tool_url = "${h.url_for( controller='/tracks', action='rerun_tool' )}",
 73            reference_url = "${h.url_for( controller='/tracks', action='reference' )}",
 74            chrom_url = "${h.url_for( controller='/tracks', action='chroms' )}",
 75            dataset_state_url = "${h.url_for( controller='/tracks', action='dataset_state' )}",
 76            converted_datasets_state_url = "${h.url_for( controller='/tracks', action='converted_datasets_state' )}",
 77            addable_track_types = { "LineTrack": LineTrack, "FeatureTrack": FeatureTrack, "ReadTrack": ReadTrack },
 78            view,
 79            container_element = $("#${trans.security.encode_id( visualization.id )}");
 80        
 81        $(function() {
 82            
 83            if (container_element.parents(".item-content").length > 0) { // Embedded viz
 84                container_element.parents(".item-content").css( { "max-height": "none", "overflow": "visible" } );
 85            } else { // Viewing just one shared viz
 86                $("#right-border").click(function() { view.resize_window(); });
 87            }
 88            
 89            // Create visualization.
 90            var callback;
 91            %if 'viewport' in config:
 92                var callback = function() { view.change_chrom( '${config['viewport']['chrom']}', ${config['viewport']['start']}, ${config['viewport']['end']} ); }
 93            %endif
 94            view = create_visualization( container_element, "${config.get('title') | h}", 
 95                                         "${config.get('vis_id')}", "${config.get('dbkey')}", callback,
 96                                         JSON.parse('${ h.to_json_string( config.get('tracks') ) }'),
 97                                         JSON.parse('${ h.to_json_string( config.get('bookmarks') ) }')
 98                                         );
 99            
100            // Set up keyboard navigation.
101            init_keyboard_nav(view);
102        });
103
104    </script>
105</%def>