Skip to content

Commit 6ac0af6

Browse files
author
Gaurav SinghaRoy
committed
refactored rdb download function
1 parent 003e6df commit 6ac0af6

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

app/assets/javascripts/resources/sparql.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ SPARQL = {
3535
}
3636
return true;
3737
}
38+
},
39+
download : {
40+
rdb : function(){
41+
window.open(Utils.rdf2any.server+Utils.rdf2any.actions.convert+"/rdb-converter.sql?query="+encodeURIComponent($("#txt_sparql_query").val()))
42+
}
3843
}
3944

4045

app/assets/javascripts/resources/utilities.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Utils = {
1717
alert : function(message){
1818
$("#alert_modal").find(".modal-body").first().html(message);
1919
$("#alert_modal").modal("show");
20+
},
21+
rdf2any : {
22+
server : "http://localhost:8080/",
23+
actions : {
24+
convert : "rdf2any/v1.0/convert/"
25+
}
2026
}
2127

2228
};

app/views/query/_search_results.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</div>
3838
<div class="modal-body">
3939
<div class="btn-group ">
40-
<button type="button" class="btn btn-default btn-primary" onclick="download_sparql_result_set('rdb')"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;RDB Script</button>
40+
<button type="button" class="btn btn-default btn-primary" onclick="SPARQL.download.rdb()"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;RDB Script</button>
4141
<button type="button" class="btn btn-default btn-success" onclick="download_sparql_result_set('csv')"><span class="glyphicon glyphicon-align-justify"></span>&nbsp;CSV</button>
4242
<button type="button" class="btn btn-default btn-info"><span class="glyphicon glyphicon-road"></span>&nbsp;JSON</button>
4343
<button type="button" class="btn btn-default btn-warning" onclick="download_sparql_result_set('pdf')"><span class="glyphicon glyphicon-file"></span>&nbsp;PDF</button>

0 commit comments

Comments
 (0)