Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popover update #155

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/app/static/css/starter-template.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ input[type="checkbox"]{
margin-left: 0px !important;
margin-top: -3px !important;
}

.popover-content {
overflow-x: auto;
max-height: 380px;
}
27 changes: 18 additions & 9 deletions src/app/templates/app/submit_new_license.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,30 +170,29 @@
{% block script_block %}
<script type="text/javascript">
$(document).ready(function () {
var is_touch_device = "ontouchstart" in document.documentElement;
$('#fullnameInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "License Full Name", content: "\u2022 The full name may omit certain word, such as 'the,' for alphabetical sorting purposes. \
$('#fullnameInfo').popover({trigger: "click", title: "License Full Name", content: "\u2022 The full name may omit certain word, such as 'the,' for alphabetical sorting purposes. \
<br /> \u2022 No commas in full name of license or exception. \
<br /> \u2022 The word 'version' is not spelled out; 'v' or nothing is used to indicate license version (for space reasons) \
<br /> \u2022 For version, use lower case v and no period or space between v and the number. \
<br /> \u2022 No abbreviations are included (in parenthesis) after the full name.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#shortIdentifierInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "Short Identifier", content: "\u2022 Short identifier to be used to identify a license or exception match to licenses or exceptions in the context of an SPDX file, a source file, or elsewhere. \
$('#shortIdentifierInfo').popover({trigger: "click", title: "Short Identifier", content: "\u2022 Short identifier to be used to identify a license or exception match to licenses or exceptions in the context of an SPDX file, a source file, or elsewhere. \
<br /> \u2022 Short identifiers consist of ASCII letters (A-Za-z), digits (0-9), full stops (.) and hyphen or minus signs (-) \
<br /> \u2022 Short identifiers consist of an abbreviation based on a common short name or acronym for the license or exception. \
<br /> \u2022 Where applicable, the abbreviation will be followed by a dash and then the version number, in X.Y format. \
<br /> \u2022 Where applicable, and if possible, the short identifier should be harmonized with other well-known open source naming sources (i.e., OSI, Fedora, etc.) \
<br /> \u2022 Short identifiers should be as short in length as possible while staying consistent with all other naming criteria.", html: "true", viewport: '.panel-body', container: 'body'});
$('#sourceUrlInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "Source URL", content: "\u2022 Include URL for the official text of the license or exception. \
$('#sourceUrlInfo').popover({trigger: "click", title: "Source URL", content: "\u2022 Include URL for the official text of the license or exception. \
<br /> \u2022 If the license is OSI approved, also include URL for OSI license page. \
<br /> \u2022 Include another URL that has text version of license, if neither of the first two options are available. \
<br /> \u2022 Note that the source URL may refer to an original URL for the license which is no longer active. We don't remove inactive URLs. New or best available URLs may be added. \
<br /> \u2022 Link to the license or exception in its native language is used where specified (e.g. French for CeCILL). Link to English version where multiple, equivalent official translations (e.g. EUPL)", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#licenseHeaderInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "Standard License Header", content: "\u2022 Should only include text intended to be put in the header of source files or other files as specified in the license or license appendix when specifically delineated. \
$('#licenseHeaderInfo').popover({trigger: "click", title: "Standard License Header", content: "\u2022 Should only include text intended to be put in the header of source files or other files as specified in the license or license appendix when specifically delineated. \
<br /> \u2022 Indicate if there is any variation in the header (i.e. for files developed by a contributor versus when applying license to original work) \
<br /> \u2022 Do not include NOTICE info intended for a separate notice file. \
<br /> \u2022 Leave this field blank if there is no standard header as specifically defined in the license.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#commentsInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "Comments", content: "\u2022 Provide a short explanation regarding the need for this license or exception to be included on the SPDX License List. \
$('#commentsInfo').popover({trigger: "click", title: "Comments", content: "\u2022 Provide a short explanation regarding the need for this license or exception to be included on the SPDX License List. \
<br /> \u2022 Identify at least one program that uses it or any other related information.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#textInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "License Text", content: "Full license of the license text.", viewport: '.panel-body', container: '.panel-body'});
$('#textInfo').popover({trigger: "click", title: "License Text", content: "Full license of the license text.", viewport: '.panel-body', container: '.panel-body'});
$("#licenserequest").addClass('linkactive');
$("#submitnewlicensepage").addClass('linkactive');
$('input').addClass('form-control');
Expand Down Expand Up @@ -223,6 +222,16 @@
window.location = githubLoginLink;
});
</script>
<script>
$(document).on('click', function (e) {
$('[data-toggle=popover]').each(function () {
// hide any open popovers when the anywhere else in the body is clicked
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
</script>
<script type="text/javascript">
$(document).on('click', '#addSourceUrl', function(){
var html = '<div class="col-sm-12 btn-group" style="padding:6px 0; margin-top:2"><input type="text" class="form-control" id="sourceUrl" placeholder="" name = "sourceurl"></div>';
Expand Down Expand Up @@ -547,7 +556,7 @@
async function generate_text_diff(base, newtxt){
var sm = new difflib.SequenceMatcher(base, newtxt);
var opcodes = sm.get_opcodes();

// build the diff view and add it to the current DOM
var diff = $(diffview.buildView({
baseTextLines: base,
Expand All @@ -570,7 +579,7 @@
$(".modal-dialog").addClass("diff-modal-dialog");
$("#myModal").modal({
backdrop: 'static',
keyboard: true,
keyboard: true,
show: true
});
await new Promise(resolve => setTimeout(resolve, 2000));
Expand Down
27 changes: 18 additions & 9 deletions src/app/templates/app/submit_new_license_namespace.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,14 @@
{% block script_block %}
<script type="text/javascript">
$(document).ready(function () {
var is_touch_device = "ontouchstart" in document.documentElement;
$('#submitterFullnameInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "Namespace submitter", content: "\u2022 The full name of the license namespace submitter.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#namespaceInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "Namespace", content: "\u2022 License namespace in dns-style request or a free-format.", html: "true", viewport: '.panel-body', container: 'body'});
$('#namespaceId').popover({trigger: is_touch_device ? "click" : "hover", title: "Namespace ID", content: "\u2022 License namespace short identifier.", html: "true", viewport: '.panel-body', container: 'body'});
$('#urlInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "Namespace URL", content: "\u2022 Include URL for the official text of the license namespace.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#licenseListUrlInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "License list URL", content: "\u2022 Include URL for the official text of the license list namespace.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#githubRepoUrlInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "GITHUB Repo URL", content: "\u2022 Include URL for the official github page of the license namespace.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#organisation').popover({trigger: is_touch_device ? "click" : "hover", title: "Namespace Organisation", content: "\u2022 Select organisation of the license namespace.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#descriptionInfo').popover({trigger: is_touch_device ? "click" : "hover", title: "License namespace description", content: "Description of the license namespace", viewport: '.panel-body', container: '.panel-body'});
$('#submitterFullnameInfo').popover({trigger: "click", title: "Namespace submitter", content: "\u2022 The full name of the license namespace submitter.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#namespaceInfo').popover({trigger: "click", title: "Namespace", content: "\u2022 License namespace in dns-style request or a free-format.", html: "true", viewport: '.panel-body', container: 'body'});
$('#namespaceId').popover({trigger: "click", title: "Namespace ID", content: "\u2022 License namespace short identifier.", html: "true", viewport: '.panel-body', container: 'body'});
$('#urlInfo').popover({trigger: "click", title: "Namespace URL", content: "\u2022 Include URL for the official text of the license namespace.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#licenseListUrlInfo').popover({trigger: "click", title: "License list URL", content: "\u2022 Include URL for the official text of the license list namespace.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#githubRepoUrlInfo').popover({trigger: "click", title: "GITHUB Repo URL", content: "\u2022 Include URL for the official github page of the license namespace.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#organisation').popover({trigger: "click", title: "Namespace Organisation", content: "\u2022 Select organisation of the license namespace.", html: "true", viewport: '.panel-body', container: '.panel-body'});
$('#descriptionInfo').popover({trigger: "click", title: "License namespace description", content: "Description of the license namespace", viewport: '.panel-body', container: '.panel-body'});
$("#licensenamespace").addClass('linkactive');
$("#submitnewlicensenamespacepage").addClass('linkactive');
$('input').addClass('form-control');
Expand Down Expand Up @@ -275,6 +274,16 @@
$(element).css({ 'border-color':'#f00','box-shadow': '1px 1px 8px #f04a4a' });
}

</script>
<script>
$(document).on('click', function (e) {
$('[data-toggle=popover]').each(function () {
// hide any open popovers when the anywhere else in the body is clicked
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
</script>

<script type="text/javascript">
Expand Down