PageRenderTime 23ms CodeModel.GetById 13ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/templates/library/common/library_dataset_search_results.mako

Relevant Search: With Applications for Solr and Elasticsearch

For more in depth reading about search, ranking and generally everything you could ever want to know about how lucene, elasticsearch or solr work under the hood I highly suggest this book. Easily one of the most interesting technical books I have read in a long time. If you are tasked with solving search relevance problems even if not in Solr or Elasticsearch it should be your first reference. Amazon Affiliate Link
https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 137 lines | 120 code | 13 blank | 4 comment | 13 complexity | f9280bd795fc00dfffafce6d6ab57bb1 MD5 | raw file
  1<%namespace file="/message.mako" import="render_msg" />
  2<%namespace file="/library/common/browse_library.mako" import="render_dataset" />
  3<%namespace file="/library/common/common.mako" import="render_actions_on_multiple_items" />
  4<%namespace file="/library/common/common.mako" import="render_compression_types_help" />
  5<%namespace file="/library/common/common.mako" import="common_javascripts" />
  6
  7<%!
  8    def inherit(context):
  9        if context.get('use_panels'):
 10            return '/webapps/galaxy/base_panels.mako'
 11        else:
 12            return '/base.mako'
 13%>
 14<%inherit file="${inherit(context)}"/>
 15
 16<%def name="init()">
 17<%
 18    self.has_left_panel=False
 19    self.has_right_panel=False
 20    self.message_box_visible=False
 21    self.active_view="user"
 22    self.overlay_visible=False
 23%>
 24</%def>
 25
 26##
 27## Override methods from base.mako and base_panels.mako
 28##
 29<%def name="center_panel()">
 30   <div style="overflow: auto; height: 100%;">
 31       <div class="page-container" style="padding: 10px;">
 32           ${render_content()}
 33       </div>
 34   </div>
 35</%def>
 36
 37## Render the grid's basic elements. Each of these elements can be subclassed.
 38<%def name="body()">
 39    ${render_content()}
 40</%def>
 41
 42<%def name="stylesheets()">
 43    ${parent.stylesheets()}
 44    ${h.css( "library" )}
 45</%def>
 46
 47<%def name="javascripts()">
 48    ${parent.javascripts()}
 49    ${h.js("jstorage")}
 50    ${common_javascripts()}
 51</%def>
 52
 53<%def name="render_searched_components()">
 54    <ul style="padding-left: 1em; list-style-type: disc;">
 55        <li>name</li>
 56        <li>info</li>
 57        <li>dbkey (genome build)</li>
 58        <li>message</li>
 59        %if trans.app.config.enable_lucene_library_search:
 60            <li>disk file content</li>
 61        %endif
 62    </ul>
 63    <br/>
 64</%def>
 65
 66<%def name="render_content()">
 67    <%
 68        from galaxy import util
 69        from galaxy.web.controllers.library_common import branch_deleted
 70        from time import strftime
 71 
 72        class RowCounter( object ):
 73            def __init__( self ):
 74                self.count = 0
 75            def increment( self ):
 76                self.count += 1
 77            def __str__( self ):
 78                return str( self.count )
 79    %>
 80 
 81    <br/><br/>
 82    <ul class="manage-table-actions">
 83        <li>
 84            <a class="action-button" href="${h.url_for( controller=cntrller, action='browse_libraries' )}" target="galaxy_main">Browse data libraries</a></div>
 85        </li>
 86    </ul>
 87
 88    <h2>Results for search on &ldquo;${search_term}&rdquo;</h2>
 89 
 90    %if message:
 91        ${render_msg( message, status )}
 92    %endif
 93 
 94    %if lddas:
 95        <p>The string "${search_term}" was found in at least one of the following information components of the displayed library datasets.</p>
 96        ${render_searched_components()}
 97        <form name="act_on_multiple_datasets" action="${h.url_for( controller='library_common', action='act_on_multiple_datasets', cntrller=cntrller, use_panels=use_panels, show_deleted=show_deleted )}" onSubmit="javascript:return checkForm();" method="post">
 98            <input type="hidden" name="search_term" value="${search_term}"/>
 99            <table cellspacing="0" cellpadding="0" border="0" width="100%" class="grid" id="library-grid">
100                <thead>
101                    <tr class="libraryTitle">
102                        <th>
103                            <input type="checkbox" id="checkAll" name=select_all_datasets_checkbox value="true" onclick='checkAllFields(1);'/><input type="hidden" name=select_all_datasets_checkbox value="true"/>
104                            Name
105                        </th>
106                        <th>Message</th>
107                        <th>Uploaded By</th>
108                        <th>Date</th>
109                        <th>File Size</th>
110                    </tr>
111                </thead>
112                <%
113                    tracked_datasets = {}
114                    row_counter = RowCounter()
115                    my_row = row_counter.count
116                %>
117                %for ldda in lddas:
118                    <%
119                        library_dataset = ldda.library_dataset
120                        folder = library_dataset.folder
121                        library = folder.parent_library
122                    %>
123                    ${render_dataset( cntrller, ldda, library_dataset, False, library, folder, 0, my_row, row_counter, tracked_datasets, show_deleted=False )}
124                    <%
125                        my_row = row_counter.count
126                        row_counter.increment()
127                    %>
128                %endfor
129                ${render_actions_on_multiple_items( actions_to_exclude=[ 'manage_permissions' ] )}
130            </table>
131        </form>
132        ${render_compression_types_help( comptypes )}
133    %elif status != 'error':
134        <p>The string "${search_term}" was not found in any of the following information components for any library datasets that you can access.</p>
135        ${render_searched_components()}
136    %endif
137</%def>