inpho / inphosite

The InPhO API
https://inphoproject.org
15 stars 5 forks source link

RDF import button #132

Closed JaimieMurdock closed 10 years ago

JaimieMurdock commented 10 years ago
$('#rdfselection').click(function () {
  $.get('/entity/{ID}/query_lode', function(rdfdata) {
    // render each of the rdf triples in the modal-body that gets displayed with the #rdfselection button
    //pseudo-javascript    
    for (i in rdfdata)
      inpho.admin.add_triple(modal-body-id, triple)
    // not sure if data-toggle="modal" overrides default click, in which case this will break the modal
    // might have to manually show modal:
    $('#rdfselection').modal().show();
  });
});

inpho.admin.add_triple = function(modal, triple) {
  $('#rdfmodal .modal-body').append('<label>'+triple+'</label>');
}
JaimieMurdock commented 10 years ago

For the Import LODE button add a data-url="${c.entity.url(action='query_lode')}" to the template in /templates/entity/entity.html, and then in the click function:

$('#rdfselection').click(function () {
  var url = $(this).attr('data-url');
  $.get(url, function(rdfdata) { 
    ... 
  });
});

the $(this).attr('data-url') will get the right url then

rzawar commented 10 years ago

Issue resolved!!!