forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from ncbo/kgcl-change-requests
Add initial support for ontology change requests
- Loading branch information
Showing
45 changed files
with
142,222 additions
and
99 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,7 @@ | ||
jQuery(document).ready(function() { | ||
|
||
jQuery('#changeRequestModal').on('submit', function() { | ||
$('#changeRequestModal').modal('hide'); | ||
}); | ||
|
||
}); |
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,33 @@ | ||
.concept_details .label { | ||
vertical-align: top; | ||
width: 180px; | ||
max-width: 200px; | ||
} | ||
|
||
.concept_details tbody td { | ||
white-space: normal; /* css-3 */ | ||
white-space: -moz-normal; /* Mozilla, since 1999 */ | ||
word-wrap: break-word; /* Internet Explorer 5.5+ */ | ||
|
||
p { | ||
margin-bottom: 0; | ||
} | ||
|
||
a.btn.btn-link { | ||
padding: 0; | ||
} | ||
} | ||
|
||
.concept_details td:nth-child(1) { | ||
white-space: nowrap; | ||
} | ||
|
||
div.synonym-change-request { | ||
display: flex; | ||
column-gap: 5px; | ||
justify-content: flex-end; | ||
} | ||
|
||
div.synonym-change-request button { | ||
padding: 0px; | ||
} |
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,37 @@ | ||
# frozen_string_literal: true | ||
|
||
class ChangeRequestsController < ApplicationController | ||
def create_synonym | ||
@concept_label = params[:concept_label] | ||
@concept_id = params[:concept_id] | ||
@ont_acronym = params[:ont_acronym] | ||
@username = session[:user].username | ||
|
||
respond_to :js | ||
end | ||
|
||
def create | ||
params[:curie] = generate_curie(params[:ont_acronym], params[:concept_id]) | ||
params[:content] = KGCL::IssueContentGenerator.call(params) | ||
@issue = IssueCreatorService.call(params) | ||
flash.now.notice = helpers.change_request_success_message if @issue['id'].present? | ||
|
||
respond_to :js | ||
end | ||
|
||
private | ||
|
||
def generate_curie(ont_acronym, concept_id) | ||
ontology = LinkedData::Client::Models::Ontology.find_by_acronym(ont_acronym).first | ||
query_string = { display: 'notation,prefixIRI', display_links: false, display_context: false } | ||
concept = ontology.explore.single_class(query_string, concept_id) | ||
|
||
if concept.notation | ||
concept.notation | ||
elsif concept.prefixIRI | ||
concept.prefixIRI | ||
else | ||
concept_id | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
module ChangeRequestsHelper | ||
def change_request_success_message | ||
url = link_to 'details', @issue['url'], target: '_blank', class: 'alert-link' | ||
"Your change request was successfully submitted! View the #{url} on GitHub.".html_safe | ||
end | ||
|
||
def change_request_alert_context | ||
flash.notice.present? ? 'alert-success' : 'alert-danger' | ||
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
Oops, something went wrong.