forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into test
- Loading branch information
Showing
12 changed files
with
75 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class PropertiesController < ApplicationController | ||
def show | ||
@property = LinkedData::Client::HTTP.get("/ontologies/#{params[:acronym]}/properties/#{helpers.encode_param(params[:id])}") | ||
|
||
@acronym = params[:acronym] | ||
render partial: 'show' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,8 @@ | ||
= turbo_frame_tag 'properties' do | ||
%div.ont-properties{data:{controller: 'container-splitter'}} | ||
%div#propTree{data:{'container-splitter-target': 'container'}} | ||
%div#prop_contents.pl-3{data:{'container-splitter-target': 'container'}} | ||
|
||
:plain | ||
<script id="property-details" type="text/x-handlebars-template"> | ||
<table cellpadding="0" cellspacing="0" class="minimal concept_details" width="100%"> | ||
{{#if label}} | ||
<tr> | ||
<td class="label"> | ||
Labels | ||
</td> | ||
<td> | ||
<p> | ||
{{label}} | ||
</p> | ||
</td> | ||
</tr> | ||
{{/if}} | ||
{{#if definition}} | ||
<tr> | ||
<td class="label"> | ||
Definitions | ||
</td> | ||
<td> | ||
<p> | ||
{{definition}} | ||
</p> | ||
</td> | ||
</tr> | ||
{{/if}} | ||
<tr> | ||
<td class="label">ID</td> | ||
<td> | ||
<p> | ||
{{id}} | ||
</p> | ||
</td> | ||
</tr> | ||
{{#if parents}} | ||
<tr> | ||
<td class="label">Parent</td> | ||
<td> | ||
<p> | ||
{{parents}} | ||
</p> | ||
</td> | ||
</tr> | ||
{{/if}} | ||
</table> | ||
</script> | ||
|
||
:javascript | ||
$(document).ready(function(){ | ||
jQuery(document).data().bp.ontPropertiesTab = {}; | ||
|
||
jQuery(document).data().bp.ontPropertiesTab.init = function() { | ||
var source = jQuery("#property-details").html(); | ||
var propDetailsTemp = Handlebars.compile(source); | ||
|
||
$("#propTree").NCBOPropertyTree({ | ||
ontology: "#{@ontology.acronym}", | ||
ncboUIURL: jQuery(document).data().bp.config.ui_url, | ||
width: "100%", | ||
onInit: function() { | ||
var ontPropTree = $("#propTree").data().NCBOPropertyTree; | ||
var data = $("#propTree").find("a:first").data(); | ||
if (data) { | ||
ontPropTree.selectClass(data.id); | ||
data.id = decodeURIComponent(data.id); | ||
jQuery("#prop_contents").html(propDetailsTemp(data)); | ||
} | ||
} | ||
}).on("afterSelect", function (e, classId, label, node) { | ||
var data = node.data(); | ||
data.id = decodeURIComponent(data.id); | ||
jQuery("#prop_contents").html(propDetailsTemp(data)); | ||
}); | ||
} | ||
|
||
jQuery(document).data().bp.ontPropertiesTab.init(); | ||
|
||
}) | ||
= render TurboFrameComponent.new(id: "properties", data: {"turbo-frame-target": "frame"} ) do | ||
%div.ont-properties{data: {controller: 'container-splitter turbo-frame', 'turbo-frame': { | ||
'url-value': "/ontologies/#{@ontology.acronym}/properties/show" | ||
}}} | ||
%div#propTree{data: {'container-splitter-target': 'container', action: 'change->turbo-frame#updateFrame'}} | ||
= render partial: 'properties/properties_tree' | ||
%div#prop_contents.pl-3{data: {'container-splitter-target': 'container'}} | ||
= render partial: 'properties/show' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
%div#propTree | ||
|
||
:javascript | ||
// TODO migrate this backend rendered component | ||
$(document).ready(() => { | ||
$('#propTree').NCBOPropertyTree({ | ||
ontology: '#{@ontology.acronym}', | ||
ncboUIURL: '', | ||
width: '100%', | ||
onInit: function () { | ||
let activeElem = $('#propTree a')[0] | ||
if (activeElem) { | ||
activeElem.click() | ||
} | ||
} | ||
}).on('afterSelect', function (e, classId, label, node) { | ||
e.target.dispatchEvent(new CustomEvent('change', { | ||
bubbles: true, | ||
detail: { | ||
data: {id: decodeURIComponent(node.data().id)} | ||
} | ||
})) | ||
}) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
= render TurboFrameComponent.new(id: 'property', data: {"turbo-frame-target": "frame"}) do | ||
- if !@property | ||
= render LoaderComponent.new | ||
- else | ||
= render ConceptDetailsComponent.new(id:'property-details', acronym: @acronym, | ||
properties: OpenStruct.new(LinkedData::Client::Models::Property.properties_to_hash(@property).first), | ||
top_keys: [], | ||
bottom_keys: [], | ||
exclude_keys: []) do |c| | ||
- c.header(stripped: true) do |t| | ||
- t.add_row({th: 'ID'}, {td: c.concept_properties[:id][:values]}) if c.concept_properties[:id][:values].present? | ||
- t.add_row({th: 'Labels'}, {td: c.concept_properties[:prefLabel][:values]}) if c.concept_properties[:prefLabel][:values].present? | ||
- t.add_row({th: 'Definitions'}, {td: c.concept_properties[:definition][:values]}) if c.concept_properties[:definition][:values].present? | ||
- t.add_row({th: 'Parent'}, {td: c.concept_properties[:parents][:values]}) if c.concept_properties[:parents][:values].present? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters