Skip to content

Commit

Permalink
Merge changes from master branch to be included in the RC2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenwalker committed Oct 27, 2017
1 parent d7f4808 commit f79a18d
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 32 deletions.
18 changes: 16 additions & 2 deletions metacatui/src/main/webapp/js/models/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
all: [],
creator: [],
taxon: [],
documents: false,
resourceMap: false,
yearMin: 1900, //The user-selected minimum year
yearMax: new Date().getUTCFullYear(), //The user-selected maximum year
Expand Down Expand Up @@ -65,7 +66,7 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],

fieldLabels: {
attribute : "Data attribute",
resourceMap : "Only results with data",
documents : "Only results with data",
annotation : "Annotation",
dataSource : "Data source",
creator : "Creator",
Expand All @@ -83,11 +84,12 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
attribute : "attribute",
annotation : "sem_annotation",
dataSource : "datasource",
documents : "documents",
formatType : "formatType",
all : "",
creator : "originText",
spatial : "siteText",
resourceMap : "documents",
resourceMap : "resourceMap",
pubYear : ["datePublished", "dateUploaded"],
id : ["id", "documents", "resourceMap"],
rightsHolder : "rightsHolder",
Expand Down Expand Up @@ -290,6 +292,18 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
query += "+" + this.fieldNameMap["resourceMap"] + ':*';
}

//---documents---
if(this.filterIsAvailable("documents") && ((filter == "documents") || getAll)){
var documents = this.get('documents');

//If the documents search setting is a list ofdocuments IDs
if(Array.isArray(documents))
query += "+" + this.getGroupedQuery(this.fieldNameMap["documents"], documents, { operator: "OR" });
//Otherwise, treat it as a binary setting
else if(documents)
query += "+" + this.fieldNameMap["documents"] + ':*';
}

//---Username: search for this username in rightsHolder and submitter ---
if(this.filterIsAvailable("username") && ((filter == "username") || getAll) && this.get('username').length){
var username = this.get('username');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,8 @@ define(['jquery', 'underscore', 'backbone', 'models/DataONEObject'],
// Validate a coordinate String by making sure it can be coerced into a number and
// is within the given bounds.
// Note: Min and max are inclusive
validateCoordinate: function(value) {

var min = -180, max = 180;

validateCoordinate: function(value, min, max) {

if (typeof value === "undefined" || value === null || value === "" && isNaN(value)) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions metacatui/src/main/webapp/js/templates/dataItem.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Icon column -->
<!-- Icon column -->
<% if ( typeof type !== "undefined" && type !== null && type == "Metadata" ) { %>
<% var indentFolder = nodeLevel * 40; %>
<td class="type-icon">
Expand All @@ -14,7 +14,7 @@
<!-- Files column -->

<td class="name" title="Click to rename" >
<% if(uploadStatus != "l" && uploadStatus != "p" && type != "Metadata"){ %>
<% if(uploadStatus != "l" && uploadStatus != "p"){ %>
<div contenteditable="true">
<% } else { %>
<div>
Expand Down
2 changes: 1 addition & 1 deletion metacatui/src/main/webapp/js/templates/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<div id="metadata-container"><%=loading%></div>
</section>
<section id="editor-footer" class="editor-controls hidden">
<a class="btn btn-primary save" id="save-editor">Submit</a>
<a class="btn btn-primary save" id="save-editor">Submit Dataset</a>
</section>
</article>
12 changes: 6 additions & 6 deletions metacatui/src/main/webapp/js/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ <h5>My Search</h5>
<ul id="current-all-filters" class="current-filters" data-category="all"></ul>
<ul id="current-attribute-filters" class="current-filters" data-category="attribute"></ul>
<ul id="current-annotation-filters" class="current-filters" data-category="annotation"></ul>
<ul id="current-resourceMap-filters" class="current-filters" data-category="resourceMap">
<% if (searchModelRef.filterIsAvailable("resourceMap") && resourceMap){ %>
<li class="current-filter"><span class="category"><%=searchModelRef.fieldLabels["resourceMap"]%></span><i class="icon-remove remove-filter"></i></li>
<ul id="current-documents-filters" class="current-filters" data-category="documents">
<% if (searchModelRef.filterIsAvailable("documents") && documents){ %>
<li class="current-filter"><span class="category"><%=searchModelRef.fieldLabels["documents"]%></span><i class="icon-remove remove-filter"></i></li>
<% } %>
</ul>
<ul id="current-dataSource-filters" class="current-filters" data-category="dataSource"></ul>
Expand Down Expand Up @@ -71,8 +71,8 @@ <h5 id="filters-header">Filter by:</h5>

<% } %>

<% if(searchModelRef.filterIsAvailable("resourceMap")){ %>
<div class="filter-contain collapsable" id="includes-files" data-category="resourceMap">
<% if(searchModelRef.filterIsAvailable("documents")){ %>
<div class="filter-contain collapsable" id="includes-files" data-category="documents">
<label class="expand-collapse-control">
<i class="icon icon-caret-right expand"></i>
<i class="icon icon-caret-down collapse"></i>
Expand All @@ -87,7 +87,7 @@ <h5 id="filters-header">Filter by:</h5>
<i class="icon icon-check-empty"></i>
Only results with data
</label>
<input class="filter" type="checkbox" id="includes_data" data-category="resourceMap" name="includes_data" <% if (searchModelRef.filterIsAvailable("resourceMap") && resourceMap){ print("checked"); } %> />
<input class="filter" type="checkbox" id="includes_data" data-category="documents" name="includes_data" <% if (searchModelRef.filterIsAvailable("documents") && documents){ print("checked"); } %> />
<i class="icon icon-question-sign more-info tooltip-this" data-trigger="hover" data-title="Checking this option will only return packages that include data files. Leaving this unchecked may return packages that only include metadata." data-placement="top"></i>
</div>
<div class="clear"></div>
Expand Down
22 changes: 18 additions & 4 deletions metacatui/src/main/webapp/js/themes/arctic/models/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
all: [],
creator: [],
taxon: [],
//resourceMap: false,
//documents: false,
resourceMap: false,
yearMin: 1900, //The user-selected minimum year
yearMax: new Date().getUTCFullYear(), //The user-selected maximum year
pubYear: false,
Expand All @@ -43,7 +44,7 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
//annotation: [],
additionalCriteria: [],
id: [],
seriesId: MetacatUI.appModel.get("useSeriesId")? [] : undefined,
seriesId: [],
formatType: [{
value: "METADATA",
label: "science metadata",
Expand All @@ -65,7 +66,7 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],

fieldLabels: {
attribute : "Data attribute",
resourceMap : "Only results with data",
documents : "Only results with data",
annotation : "Annotation",
dataSource : "Data source",
creator : "Creator",
Expand All @@ -83,11 +84,12 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
attribute : "attribute",
annotation : "sem_annotation",
dataSource : "datasource",
documents : "documents",
formatType : "formatType",
all : "",
creator : "originText",
spatial : "siteText",
resourceMap : "documents",
resourceMap : "resourceMap",
pubYear : ["datePublished", "dateUploaded"],
id : ["id", "documents", "resourceMap"],
rightsHolder : "rightsHolder",
Expand Down Expand Up @@ -290,6 +292,18 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
query += "+" + this.fieldNameMap["resourceMap"] + ':*';
}

//---documents---
if(this.filterIsAvailable("documents") && ((filter == "documents") || getAll)){
var documents = this.get('documents');

//If the documents search setting is a list ofdocuments IDs
if(Array.isArray(documents))
query += "+" + this.getGroupedQuery(this.fieldNameMap["documents"], documents, { operator: "OR" });
//Otherwise, treat it as a binary setting
else if(documents)
query += "+" + this.fieldNameMap["documents"] + ':*';
}

//---Username: search for this username in rightsHolder and submitter ---
if(this.filterIsAvailable("username") && ((filter == "username") || getAll) && this.get('username').length){
var username = this.get('username');
Expand Down
18 changes: 16 additions & 2 deletions metacatui/src/main/webapp/js/themes/dataone/models/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
all: [],
creator: [],
taxon: [],
documents: false,
resourceMap: false,
yearMin: 1900, //The user-selected minimum year
yearMax: new Date().getUTCFullYear(), //The user-selected maximum year
Expand Down Expand Up @@ -66,7 +67,7 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],

fieldLabels: {
attribute : "Data attribute",
resourceMap : "Only results with data",
documents : "Only results with data",
annotation : "Annotation",
dataSource : "Data source",
creator : "Creator",
Expand All @@ -85,8 +86,9 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
formatType : "formatType",
all : "",
creator : "originText",
documents : "documents",
spatial : "siteText",
resourceMap : "documents",
resourceMap : "resourceMap",
pubYear : ["dateUploaded", "datePublished"],
dataSource : "datasource",
id : ["id", "documents", "resourceMap"],
Expand Down Expand Up @@ -308,6 +310,18 @@ define(['jquery', 'underscore', 'backbone', 'models/SolrResult'],
query += "+" + this.fieldNameMap["resourceMap"] + ':*';
}

//---documents---
if(this.filterIsAvailable("documents") && ((filter == "documents") || getAll)){
var documents = this.get('documents');

//If the documents search setting is a list ofdocuments IDs
if(Array.isArray(documents))
query += "+" + this.getGroupedQuery(this.fieldNameMap["documents"], documents, { operator: "OR" });
//Otherwise, treat it as a binary setting
else if(documents)
query += "+" + this.fieldNameMap["documents"] + ':*';
}

//---Username: search for this username in rightsHolder and submitter ---
if(this.filterIsAvailable("username") && ((filter == "username") || getAll) && this.get('username').length){
var username = this.get('username');
Expand Down
6 changes: 3 additions & 3 deletions metacatui/src/main/webapp/js/themes/goa/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ <h3 class="nav-header"><i class="icon icon-table"></i><label>Data Attributes</la
<button class="filter btn" id="attribute_btn" data-category="attribute"><i class="icon icon-search"></i></button>
</div>

<% if(searchModelRef.filterIsAvailable("resourceMap")){ %>
<div class="filter-contain" id="includes-files" data-category="resourceMap">
<% if(searchModelRef.filterIsAvailable("documents")){ %>
<div class="filter-contain" id="includes-files" data-category="documents">
<label>
<img src="img/data-table.png" class="icon" />
<span class="tooltip-this" data-trigger="hover" data-title="Check this to only view datasets that include downloadable data files" data-placement="top">
Expand All @@ -40,7 +40,7 @@ <h3 class="nav-header"><i class="icon icon-table"></i><label>Data Attributes</la
<i class="icon icon-check-empty"></i>
Only results with data
</label>
<input class="filter" type="checkbox" id="includes_data" data-category="resourceMap" name="includes_data" <% if (searchModelRef.filterIsAvailable("resourceMap") && resourceMap){ print("checked"); } %> />
<input class="filter" type="checkbox" id="includes_data" data-category="documents" name="includes_data" <% if (searchModelRef.filterIsAvailable("documents") && documents){ print("checked"); } %> />
<i class="icon icon-question-sign more-info tooltip-this" data-trigger="hover" data-title="Checking this option will only return packages that include data files. Leaving this unchecked may return packages that only include metadata." data-placement="top"></i>
</div>
<div class="clear"></div>
Expand Down
2 changes: 1 addition & 1 deletion metacatui/src/main/webapp/js/views/DataCatalogView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ define(['jquery',
$("#max_year").val(this.searchModel.get('yearMax'));

//Reset the checkboxes
$("#includes_data").prop("checked", this.searchModel.get("resourceMap"));
$("#includes_data").prop("checked", this.searchModel.get("documents"));
$("#data_year").prop("checked", this.searchModel.get("dataYear"));
$("#publish_year").prop("checked", this.searchModel.get("pubYear"));
this.listDataSources();
Expand Down
16 changes: 13 additions & 3 deletions metacatui/src/main/webapp/js/views/DataItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define(['underscore', 'jquery', 'backbone', 'models/DataONEObject',
/* Events this view listens to */
events: {
"focusout .name" : "updateName",
//"click .name" : "emptyName",
"click .name" : "emptyName",
/* "click .rename" : "rename", */
"click .duplicate" : "duplicate", // Edit dropdown, duplicate scimeta/rdf
"click .addFolder" : "handleAddFolder", // Edit dropdown, add nested scimeta/rdf
Expand Down Expand Up @@ -632,8 +632,18 @@ define(['underscore', 'jquery', 'backbone', 'models/DataONEObject',
},

emptyName: function(e){
if(this.$(".name .required-icon").length)
this.$(".name").children().empty();

var editableCell = this.$(".name [contenteditable]");

if(editableCell.text().indexOf("Untitled") > -1){
editableCell.attr("data-original-text", editableCell.text().trim())
.text("")
.addClass("empty")
.on("focusout", function(){
if(!editableCell.text())
editableCell.text(editableCell.attr("data-original-text")).removeClass("empty");
});
}
},

showValidation: function(attr, errorMsg){
Expand Down
16 changes: 12 additions & 4 deletions metacatui/src/main/webapp/js/views/metadata/EML211View.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ define(['underscore', 'jquery', 'backbone',
$(overviewEl).html(this.overviewTemplate());

//Title
var titleEl = this.createBasicTextFields("title", "Example: Greater Yellowstone Rivers from 1:126,700 U.S. Forest Service Visitor Maps (1961-1983)", false);
$(overviewEl).find(".title-container").append(titleEl);
this.renderTitle();
this.listenTo(this.model, "change:title", this.renderTitle);

//Abstract
_.each(this.model.get("abstract"), function(abs){
Expand Down Expand Up @@ -242,6 +242,11 @@ define(['underscore', 'jquery', 'backbone',

},

renderTitle: function(){
var titleEl = this.createBasicTextFields("title", "Example: Greater Yellowstone Rivers from 1:126,700 U.S. Forest Service Visitor Maps (1961-1983)", false);
this.$container.find(".overview").find(".title-container").html(titleEl);
},

/*
* Renders the People section of the page
*/
Expand Down Expand Up @@ -1302,8 +1307,11 @@ define(['underscore', 'jquery', 'backbone',
.attr("data-category", category)
.addClass("basic-text");
textRow.append(input.clone().val(value));
textRow.append(this.createRemoveButton(null, category, 'div.basic-text-row', 'div.text-container'));
textContainer.append(textRow);

if(category != "title")
textRow.append(this.createRemoveButton(null, category, 'div.basic-text-row', 'div.text-container'));

textContainer.append(textRow);

//At the end, append an empty input for the user to add a new one
if(i+1 == allModelValues.length && category != "title") {
Expand Down

0 comments on commit f79a18d

Please sign in to comment.