diff --git a/mpcontribs-portal/mpcontribs/portal/assets/css/main.scss b/mpcontribs-portal/mpcontribs/portal/assets/css/main.scss
index ca175dc1f..4e56e68b9 100644
--- a/mpcontribs-portal/mpcontribs/portal/assets/css/main.scss
+++ b/mpcontribs-portal/mpcontribs/portal/assets/css/main.scss
@@ -1,8 +1,5 @@
@charset "utf-8";
@import url('https://fonts.googleapis.com/css?family=Nunito:400,700');
-@import "~select2/dist/css/select2.min.css";
-@import "~@fortawesome/fontawesome-free/css/all.css";
-@import '~handsontable/dist/handsontable.full.css';
$family-sans-serif: "Nunito", sans-serif;
$tooltip-background-opacity: 1;
@@ -48,9 +45,10 @@ $checkradio-focus: none;
@import "~bulma/sass/utilities/mixins";
@import "~bulma-tooltip/src/sass/index";
@import "~bulma-checkradio/src/sass/index";
-@import "~bulma-tagsinput/src/sass/index";
@import "~highlight.js/styles/stackoverflow-dark";
-@import "select2";
+@import "~select2/src/scss/core";
+@import "~@fortawesome/fontawesome-free/scss/fontawesome";
+@import "~handsontable/dist/handsontable.full.css";
.has-loading {
&.is-loading {
@@ -105,3 +103,5 @@ pre code.hljs { padding: 0px; }
}
tr.htHover:hover td { background-color: $old-grey-light; }
+
+span.dotted { border-bottom: 1px dotted $grey-darker; }
diff --git a/mpcontribs-portal/mpcontribs/portal/assets/js/apply.js b/mpcontribs-portal/mpcontribs/portal/assets/js/apply.js
index f179d4050..3d5a0cf68 100644
--- a/mpcontribs-portal/mpcontribs/portal/assets/js/apply.js
+++ b/mpcontribs-portal/mpcontribs/portal/assets/js/apply.js
@@ -1,76 +1,46 @@
-import 'jquery-form';
-import 'jquery-validation';
-import 'czmore';
-import * as bulmaTagsinput from 'bulma-tagsinput/dist/js/bulma-tagsinput';
+import "parsley";
-function prepareRequest(formData, jqForm, options) {
- $('#apply-button').addClass('is-loading');
- $('#apply-response').addClass('is-hidden');
- var start = 6;
- var nrefs_str = formData.splice(start, 1)[0]['value'];
- var nrefs = parseInt(nrefs_str);
- if (nrefs < 1) {
- $('#apply-response .message-body').html('Please add references.');
- $('#apply-response').removeClass('is-hidden');
- return false;
- }
- var urls = {name: 'references', value: []};
- for (var i = 0; i < nrefs; i++) {
- var key_url = formData.splice(start, 2);
- urls['value'].push({
- "label": key_url[0]['value'],
- "url": key_url[1]['value']
- })
- }
- formData.push(urls);
- return true;
-}
-
-function processJson(data) { // 'data' is the json object returned from the server
- var msg = `Thank you for submitting your project application. Please check your inbox (and spam) for an
- e-mail asking you to subscribe for MPContribs notifications. Once your e-mail address is
- confirmed we will notify you if/when your project has been accepted for dissemination.`
- $('#apply-response .message-body').html(msg);
- $('#apply-response').removeClass('is-danger').addClass('is-success').removeClass('is-hidden');
- $('#apply-button').removeClass('is-loading');
-}
-
-function processError(data) {
- $('#apply-response .message-body').html(data.responseText);
- $('#apply-response').removeClass('is-success').addClass('is-danger').removeClass('is-hidden');
- $('#apply-button').removeClass('is-loading');
-}
+const form = $("#apply-form");
-$(document).ready(function () {
- bulmaTagsinput.attach('[type="tags"]');
- var li = $('#apply-toggle').parent();
- li.siblings().removeClass('is-active');
- li.addClass('is-active');
-
- $.validator.addMethod("alphanumeric", function(value, element) {
- return this.optional(element) || /^[\w_]+$/i.test(value);
- }, "Please use letters, numbers, and underscores only.");
-
- $('#apply-form').validate({
- rules: {
- name: {alphanumeric: true}, url_1: {url: true, required: true},
- url_2: {url: true}, url_3: {url: true}, url_4: {url: true}, url_5: {url: true}
- },
- highlight: function (element) {
- $(element).parent().children().removeClass('is-success').addClass('is-danger');
- },
- unhighlight: function (element) {
- $(element).parent().children().removeClass('is-danger').addClass('is-success');
- },
- errorElement: 'p', errorClass: 'help',
- errorPlacement: function(error, element) { element.parent().append(error); },
- submitHandler: function(form) { $(form).ajaxSubmit({
- beforeSubmit: prepareRequest, success: processJson, error: processError,
- url: window.api['host'] + 'projects/', headers: window.api['headers'],
- type: 'POST', dataType: 'json', requestFormat: 'json'
- }); }
+if (form.length) {
+ form.parsley({
+ errorClass: "is-danger", successClass: "is-primary",
+ errorsWrapper: '
'
});
-
- $("#czContainer").czMore({max: 5, styleOverride: true});
- $('.btnPlus').click();
-});
+ form.on("submit", function(e) {
+ e.preventDefault();
+ $('#apply-button').addClass('is-loading');
+ $('#apply-response').addClass('is-hidden');
+ var data = Object.fromEntries(new FormData(e.target).entries());
+ data["owner"] = $("#owner").val();
+ data["references"] = [
+ {"label": data["ref_label"], "url": data["ref_url"]}
+ ]
+ delete data["ref_label"];
+ delete data["ref_url"];
+ $.post({
+ url: window.api['host'] + 'projects/',
+ headers: window.api['headers'],
+ data: JSON.stringify(data),
+ dataType: "json", contentType: 'application/json',
+ success: function(response) {
+ var msg = `Thank you for submitting your project application. Please check your
+ inbox (and spam) for an e-mail asking you to subscribe for MPContribs
+ notifications. Once your e-mail address is confirmed we will notify you if/when
+ your project has been accepted for dissemination.`;
+ $('#apply-response .message-body').html(msg);
+ $('#apply-response').removeClass('is-danger').addClass('is-success').removeClass('is-hidden');
+ $('#apply-button').removeClass('is-loading');
+ },
+ error: function(response) {
+ var msg;
+ if (response.responseJSON) { msg = response.responseJSON["error"]; }
+ else { msg = response.responseText; }
+ $('#apply-response .message-body').html(msg);
+ $('#apply-response').removeClass('is-success').addClass('is-danger').removeClass('is-hidden');
+ $('#apply-button').removeClass('is-loading');
+ }
+ });
+ return false;
+ });
+}
diff --git a/mpcontribs-portal/mpcontribs/portal/assets/js/browse.js b/mpcontribs-portal/mpcontribs/portal/assets/js/browse.js
index 35b5c7327..488b814fa 100644
--- a/mpcontribs-portal/mpcontribs/portal/assets/js/browse.js
+++ b/mpcontribs-portal/mpcontribs/portal/assets/js/browse.js
@@ -1,9 +1,6 @@
import Handsontable from "handsontable";
$("#table_filter").addClass('is-loading');
-var li = $('#browse-toggle').parent();
-li.siblings().removeClass('is-active');
-li.addClass('is-active');
const main_columns = ["title", "public", "author"];
const stats_columns = ["columns", "contributions", "structures", "tables", "attachments"];
@@ -39,52 +36,60 @@ $.get({
}).done(function(response) {
var data = [];
var rlen = response.data.length;
- for (var r = 0; r < rlen; r++) {
- var doc = response['data'][r];
- var d = ["" + doc["title"] + "";
- d.push(doc["is_public"] ? "Yes" : "No");
- var author = doc["authors"].split(",")[0].substring(0,30);
- var owner = doc["owner"].split(":")[1];
- var mailto = 'mailto:' + owner + ',contribs@materialsproject.org';
- var at = '';
- at += '';
- at += author + '';
- d.push(at);
- for (var c = 0; c < stats_columns.length; c++) {
- var col = stats_columns[c];
- d.push(doc["stats"][col]);
+ if (rlen < 1) {
+ $("", {
+ class: "notification is-warning is-marginless",
+ html: "No public projects available. Please log in to view accessible projects."
+ }).insertAfter(".navbar.is-fixed-top");
+ } else {
+ for (var r = 0; r < rlen; r++) {
+ var doc = response['data'][r];
+ var d = ["" + doc["title"] + "";
+ d.push(doc["is_public"] ? "Yes" : "No");
+ var author = doc["authors"].split(",")[0].substring(0,30);
+ var owner = doc["owner"].split(":")[1];
+ var mailto = 'mailto:' + owner + ',contribs@materialsproject.org';
+ var at = '';
+ at += '';
+ at += author + '';
+ d.push(at);
+ for (var c = 0; c < stats_columns.length; c++) {
+ var col = stats_columns[c];
+ d.push(doc["stats"][col]);
+ }
+ data.push(d);
}
- data.push(d);
+ data.push([]);
+ nrows = data.length;
+ hot = new Handsontable(container, {
+ data,
+ colHeaders: colHeaders,
+ columns: columns,
+ columnSummary: columnSummary,
+ dropdownMenu: ['filter_by_condition', 'filter_action_bar'],
+ filters: true,
+ hiddenRows: {indicators: true, rows: []},
+ rowHeaders: false,
+ width: '100%',
+ stretchH: 'all',
+ preventOverflow: 'horizontal',
+ licenseKey: 'non-commercial-and-evaluation',
+ disableVisualSelection: true,
+ className: "htCenter htMiddle",
+ //columnSorting: {initialConfig: {column: 4, sortOrder: 'desc'}}
+ });
+ hot.addHook('afterOnCellMouseOver', function(e, coords, TD) {
+ var row = coords["row"];
+ if (row > 0) { $(TD).parent().addClass("htHover"); }
+ });
+ hot.addHook('afterOnCellMouseOut', function(e, coords, TD) {
+ var row = coords["row"];
+ if (row > 0) { $(TD).parent().removeClass("htHover"); }
+ });
+ $("#table_filter").removeClass('is-loading');
+ $("#browse").removeClass("is-hidden");
}
- data.push([]);
- nrows = data.length;
- hot = new Handsontable(container, {
- data,
- colHeaders: colHeaders,
- columns: columns,
- columnSummary: columnSummary,
- dropdownMenu: ['filter_by_condition', 'filter_action_bar'],
- filters: true,
- hiddenRows: {indicators: true, rows: []},
- rowHeaders: false,
- width: '100%',
- stretchH: 'all',
- preventOverflow: 'horizontal',
- licenseKey: 'non-commercial-and-evaluation',
- disableVisualSelection: true,
- className: "htCenter htMiddle",
- //columnSorting: {initialConfig: {column: 4, sortOrder: 'desc'}}
- });
- hot.addHook('afterOnCellMouseOver', function(e, coords, TD) {
- var row = coords["row"];
- if (row > 0) { $(TD).parent().addClass("htHover"); }
- });
- hot.addHook('afterOnCellMouseOut', function(e, coords, TD) {
- var row = coords["row"];
- if (row > 0) { $(TD).parent().removeClass("htHover"); }
- });
- $("#table_filter").removeClass('is-loading');
});
$('#table_filter').on('click', function(e) {
diff --git a/mpcontribs-portal/mpcontribs/portal/assets/js/search.js b/mpcontribs-portal/mpcontribs/portal/assets/js/search.js
index d2559072d..37bd9c54d 100644
--- a/mpcontribs-portal/mpcontribs/portal/assets/js/search.js
+++ b/mpcontribs-portal/mpcontribs/portal/assets/js/search.js
@@ -149,10 +149,6 @@ function search(event) {
}
$(document).ready(function () {
- var li = $('#search-toggle').parent();
- li.siblings().removeClass('is-active');
- li.addClass('is-active');
-
$.each(fields, function(idx, field) {
$('#'+field+'s_list').select2({
placeholder: 'Select '+field+'(s) ...',
diff --git a/mpcontribs-portal/mpcontribs/portal/templates/apply.html b/mpcontribs-portal/mpcontribs/portal/templates/apply.html
index e39861767..f87be3967 100644
--- a/mpcontribs-portal/mpcontribs/portal/templates/apply.html
+++ b/mpcontribs-portal/mpcontribs/portal/templates/apply.html
@@ -3,168 +3,139 @@
{% block content %}
-
-
-
-
- Fill out this form to apply for your own project on MPContribs. Upon submission of your
- information an email will be sent to an admin to approve your request. If approved, you can
- start uploading data to your project which will appear on the project landing page. You
- can choose to add e-mails of other MPContribs users who you'd like to be added to your
- project group as collaborators. Collaborators and owners have identical permissions but
- the number of projects an owner can create is limited. Your data will only be visible
- to you and your collaborators until you choose to make it public. Only public
- contributions will appear on the detail pages of
-
Materials Project.
-
-
+
+ Fill out and submit this form to apply for your own project on MPContribs. Upon submission of your
+ information an email will be sent to an admin to approve your request. If approved, you can
+ start
uploading data to your project
+ which will appear on the project landing page.
+
Email us
+ to add other MPContribs users who you'd like to be added to your
+ project group as collaborators. Collaborators and owners have identical permissions but
+ the number of projects an owner can create is limited. Your data will only be visible
+ to you and your collaborators until you choose to make it public. Only public
+ contributions will appear on the detail pages of
+
Materials Project.
+
+
{% if not request.META.HTTP_X_ANONYMOUS_CONSUMER %}
-
-
-
Guidance and validation
-
- Authors
- Add multiple authors by hitting enter. The preferred format is
- FirstInitial. LastName
. Only the first author will always be shown and
- the remaining authors will be wrapped into an expandable et al.
link.
- If multiple first authors are needed, separate them by a slash (/
).
- The email address for the owner/submitter is automatically pre-filled.
-
-
- Project
- The first field in Project
is a short (3-30 characters) URL-safe
- name. Please only use lower-case and alpha-numeric characters separated by
- underscores. The other two fields in Project
are short title (5-30
- characters) and long title (5-55 characters).
-
-
- Description
- The Description
field contains a brief paragraph using 5-1500
- characters to describe the project. The first sentence will always be shown and the
- remaining sentences will be wrapped into an expandable More
link.
-
-
- References
- References
is a list of label/URL pairs to point to additional
- resources for the project (papers, websites etc.). Labels are preferred to be short
- form like journal abbreviations (e.g. PRL, Nature). Please try to use DOIs as URLs
- whenever possible in the form of https://doi.org/...
. At least one
- reference is required.
-
-
-