Skip to content

Commit

Permalink
a little fixing for Medial (missed that); work on #317
Browse files Browse the repository at this point in the history
  • Loading branch information
kltm committed Mar 17, 2016
1 parent 67df35d commit a20957e
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 39 deletions.
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ var web_compilables = [
'GeneralSearchForwarding.js',
'GOOSE.js',
'Grebe.js',
'Medial.js',
'LandingGraphs.js',
'LiveSearchGOlr.js',
'LoadDetails.js',
Expand Down
101 changes: 69 additions & 32 deletions javascript/web/Medial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
//// Add extra data/links to searches dealing with single terms.
////

// Let jshint pass over over our external globals (browserify takes
// care of it all).
/* global jQuery */
/* global global_acc */

var us = require('underscore');
var bbop = require('bbop-core');
var widgets = require('bbop-widget-set');
var html = widgets.html;

// Config.
var amigo = new (require('amigo2-instance-data'))(); // no overload
var golr_conf = require('golr-conf');
var gconf = new golr_conf.conf(amigo.data.golr);
var sd = amigo.data.server;
var gserv = amigo.data.server.golr_base;
var defs = amigo.data.definitions;
// Linker.
var linker = amigo.linker;
// Handler.
var handler = amigo.handler;
// Management.
var jquery_engine = require('bbop-rest-manager').jquery;
var golr_manager = require('bbop-manager-golr');
var golr_response = require('bbop-response-golr');

//
function MedialInit(){

Expand All @@ -19,12 +45,6 @@ function MedialInit(){
ll('No candidate--skipping');
}else{

// Ready the configuration that we'll use.
var gconf = new bbop.golr.conf(amigo.data.golr);
var sd = new amigo.data.server();
var solr_server = sd.golr_base();
var al = new amigo.linker();

///
/// Create a bookmark for searching annotations and
/// bioentities with this term. Generate links and activate
Expand All @@ -33,37 +53,54 @@ function MedialInit(){

// Get bookmark for annotations.
(function(){
var man = new bbop.golr.manager.jquery(solr_server, gconf);
man.set_personality('annotation');
man.add_query_filter('document_category', 'annotation', ['*']);
man.add_query_filter('regulates_closure', global_acc);
//ll('qurl: ' + man.get_query_url());
//var lstate = encodeURIComponent(man.get_state_url());
var lstate = man.get_filter_query_string();
var lurl = al.url(lstate, 'search', 'annotation');

// Add it to the DOM.
jQuery('#prob_ann_href').attr('href', lurl);
jQuery('#prob_ann').removeClass('hidden');
})();

// Manager setup.
var engine = new jquery_engine(golr_response);
engine.method('GET');
engine.use_jsonp(true);
var man = new golr_manager(gserv, gconf, engine, 'async');

man.set_personality('annotation');
man.add_query_filter('document_category', 'annotation', ['*']);
man.add_query_filter('regulates_closure', global_acc);
//ll('qurl: ' + man.get_query_url());
//var lstate = encodeURIComponent(man.get_state_url());
var lstate = man.get_filter_query_string();
var lurl = linker.url(lstate, 'search', 'annotation');

// Add it to the DOM.
jQuery('#prob_ann_href').attr('href', lurl);
jQuery('#prob_ann').removeClass('hidden');
})();
}

// Get bookmark for bioentities.
(function(){
var man = new bbop.golr.manager.jquery(solr_server, gconf);
man.set_personality('annotation');
man.add_query_filter('document_category', 'bioentity', ['*']);
man.add_query_filter('regulates_closure', global_acc);
//ll('qurl: ' + man.get_query_url());
//var lstate = encodeURIComponent(man.get_state_url());
var lstate = man.get_filter_query_string();
var lurl = al.url(lstate, 'search', 'bioentity');

// Add it to the DOM.
jQuery('#prob_bio_href').attr('href', lurl);
jQuery('#prob_bio').removeClass('hidden');
})();

// Manager setup.
var engine = new jquery_engine(golr_response);
engine.method('GET');
engine.use_jsonp(true);
var man = new golr_manager(gserv, gconf, engine, 'async');

man.set_personality('annotation');
man.add_query_filter('document_category', 'bioentity', ['*']);
man.add_query_filter('regulates_closure', global_acc);
//ll('qurl: ' + man.get_query_url());
//var lstate = encodeURIComponent(man.get_state_url());
var lstate = man.get_filter_query_string();
var lurl = linker.url(lstate, 'search', 'bioentity');

// Add it to the DOM.
jQuery('#prob_bio_href').attr('href', lurl);
jQuery('#prob_bio').removeClass('hidden');
})();

//
ll('MedialInit done.');
}

// Embed the jQuery setup runner.
(function (){
jQuery(document).ready(function(){ MedialInit(); });
})();
8 changes: 1 addition & 7 deletions perl/lib/AmiGO/WebApp/HTMLClient.pm
Original file line number Diff line number Diff line change
Expand Up @@ -768,20 +768,14 @@ sub mode_medial_search {
[
'com.jquery',
'com.bootstrap',
'com.jquery-ui',
'bbop',
'amigo2'
'com.jquery-ui'
],
javascript =>
[
$self->{JS}->get_lib('GeneralSearchForwarding.js'),
$self->{JS}->get_lib('Medial.js'),
$self->{JS}->make_var('global_acc', $probable_term)
],
javascript_init =>
[
'MedialInit();'
],
content =>
[
'pages/medial_search.tmpl'
Expand Down

0 comments on commit a20957e

Please sign in to comment.