Class: MartSearch::Server
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- MartSearch::Server
- Includes:
- ProjectUtils, ServerUtils
- Defined in:
- lib/martsearch/server.rb
Overview
MartSearch::Server - Sinatra based web interface for MartSearch
Constant Summary
- VERSION =
We're going to use the version number as a cache breaker for the CSS and javascript code. Update with each release of your portal (especially if you change the CSS or JS)!!!
'0.1.27'- DEFAULT_CSS_FILES =
[ 'reset.css', 'jquery.prettyPhoto.css', 'jquery.tablesorter.css', 'jquery.fontresize.css', 'jquery-ui-1.8.9.redmond.css', 'jquery.qtip.css', 'screen.css' ]
- DEFAULT_HEAD_JS_FILES =
[ 'jquery-1.4.4.min.js', 'martsearch-head.js' ]
- DEFAULT_BASE_JS_FILES =
[ 'jquery.prettyPhoto.js', 'jquery.tablesorter.js', 'jquery.cookie.js', 'jquery.fontResize.js', 'jquery.scrollTo-1.4.2.js', 'jquery.jstree.js', 'jquery.qtip.js', 'jquery-ui-1.8.9.min.js', 'modernizr-1.6.min.js', 'martsearch-base.js' ]
Instance Method Summary (collapse)
-
- (Object) dv
Load in any custom (per dataset) routes.
- - (Object) get_project_page_data(project_id, params)
-
- (Server) initialize
constructor
A new instance of Server.
-
- (Object) options
hack/monkey-patch whatever stop with your 'Sinatra::Base#options is deprecated and will be removed, use #settings instead.'.
-
- (Object) path
IKMC Project Reports.
Methods included from ProjectUtils
Methods included from ServerViewHelpers
#content_tag, #partial, #url_for
Methods included from MartSearch::ServerViewHelpers::OrderButtons
#emma_mouse_order_button, #escell_order_button, #mouse_order_button, #vector_order_button
Methods included from MartSearch::ServerViewHelpers::MiscDbLinks
#emma_link_url, #htgt_design_url, #interpro_link_url
Methods included from MartSearch::ServerViewHelpers::GbrowseLinks
Methods included from MartSearch::ServerViewHelpers::UcscLinks
Methods included from MartSearch::ServerViewHelpers::EnsemblLinks
#ensembl_link_url_from_coords, #ensembl_link_url_from_exon, #ensembl_link_url_from_gene, #ensembl_link_url_from_transcript, #vega_link_url_from_exon, #vega_link_url_from_gene
Methods included from DataSetUtils
#allele_type, #fix_superscript_text_in_attribute
Methods included from Utils
#build_http_client, #convert_array_to_hash
Methods included from ServerUtils
#compressed_base_js, #compressed_css, #compressed_head_js
Constructor Details
- (Server) initialize
A new instance of Server
67 68 69 70 71 72 73 |
# File 'lib/martsearch/server.rb', line 67 def initialize @ms = MartSearch::Controller.instance() @config = @ms.config[:server] @portal_name = @config[:portal_name] super end |
Instance Method Details
- (Object) dv
Load in any custom (per dataset) routes
359 360 361 362 363 |
# File 'lib/martsearch/server.rb', line 359 MartSearch::Controller.instance().dataviews.each do |dv| if dv.use_custom_routes? load "#{MARTSEARCH_PATH}/config/server/dataviews/#{dv.internal_name}/routes.rb" end end |
- (Object) get_project_page_data(project_id, params)
294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/martsearch/server.rb', line 294 def get_project_page_data( project_id, params ) @ms.logger.debug("[MartSearch::Server] ::get_project_page_data - running get_project_page_data( '#{project_id}', '#{params}' )") @data = @ms.fetch_from_cache("project-report-#{project_id}") if @data.nil? or params[:fresh] == "true" results = get_ikmc_project_page_data( project_id ) @data = results[:data] @errors = { :project_page_errors => results[:errors] } unless @data.nil? @ms.write_to_cache( "project-report-#{project_id}", @data ) end end @ms.logger.debug("[MartSearch::Server] ::get_project_page_data - running get_project_page_data( '#{project_id}', '#{params}' ) - DONE") end |
- (Object) options
hack/monkey-patch whatever stop with your 'Sinatra::Base#options is deprecated and will be removed, use #settings instead.'
27 |
# File 'lib/martsearch/server.rb', line 27 def ; settings; end |
- (Object) path
IKMC Project Reports
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/martsearch/server.rb', line 248 ['/project/:id','/project/?'].each do |path| get path do project_id = params[:id] redirect "#{request.script_name}/" if project_id.nil? @current = "home" @page_title = "IKMC Project: #{project_id}" @ms.logger.debug("[MartSearch::Server] /project/#{params[:id]} - running get_project_page_data") get_project_page_data( project_id, params ) @ms.logger.debug("[MartSearch::Server] /project/#{params[:id]} - running get_project_page_data - DONE") if @data.nil? status 404 erb :not_found else if params[:wt] == 'json' @ms.logger.debug("[MartSearch::Server] /project/#{params[:id]} - rendering JSON") content_type 'application/json', :charset => 'utf-8' return JSON.generate( @data, :max_nesting => false ) else @ms.logger.debug("[MartSearch::Server] /project/#{params[:id]} - rendering templates") erb :project_report end end end end |