Merge pull request #1333 from jackyq2015/feature/metadata
check if the project has the userMetadata
This commit is contained in:
commit
43b6cb8001
@ -414,7 +414,7 @@ public class WikitextImporter extends TabularImportingParserBase {
|
|||||||
} else if ("name".equals(currentXmlAttr)) {
|
} else if ("name".equals(currentXmlAttr)) {
|
||||||
currentReferenceName = xmlAttrStringBuilder.toString();
|
currentReferenceName = xmlAttrStringBuilder.toString();
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException _) {
|
} catch (NumberFormatException nfe) {
|
||||||
}
|
}
|
||||||
currentXmlAttr = null;
|
currentXmlAttr = null;
|
||||||
xmlAttrStringBuilder = null;
|
xmlAttrStringBuilder = null;
|
||||||
@ -425,7 +425,7 @@ public class WikitextImporter extends TabularImportingParserBase {
|
|||||||
try {
|
try {
|
||||||
currentXmlAttr = e.getAsString();
|
currentXmlAttr = e.getAsString();
|
||||||
|
|
||||||
} catch (UnsupportedOperationException _) {
|
} catch (UnsupportedOperationException soe) {
|
||||||
currentXmlAttr = null;
|
currentXmlAttr = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public class StandardReconConfig extends ReconConfig {
|
|||||||
job.text = query;
|
job.text = query;
|
||||||
job.code = stringWriter.toString();
|
job.code = stringWriter.toString();
|
||||||
return job;
|
return job;
|
||||||
} catch (JSONException _) {
|
} catch (JSONException je) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,6 +508,7 @@ function init() {
|
|||||||
"externals/imgareaselect/jquery.imgareaselect.js",
|
"externals/imgareaselect/jquery.imgareaselect.js",
|
||||||
"externals/date.js",
|
"externals/date.js",
|
||||||
"externals/jquery.i18n.js",
|
"externals/jquery.i18n.js",
|
||||||
|
"externals/underscore-min.js",
|
||||||
"scripts/preferences.js",
|
"scripts/preferences.js",
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -108,19 +108,22 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
|
|||||||
var project = data.projects[n];
|
var project = data.projects[n];
|
||||||
project.id = n;
|
project.id = n;
|
||||||
project.date = moment(project.modified).format('YYYY-MM-DD HH:mm A');
|
project.date = moment(project.modified).format('YYYY-MM-DD HH:mm A');
|
||||||
for (var n in data.customMetadataColumns) {
|
|
||||||
var found = false;
|
if (typeof project.userMetadata !== "undefined") {
|
||||||
for(var i = 0; i < project.userMetadata.length; i++) {
|
for (var n in data.customMetadataColumns) {
|
||||||
if (project.userMetadata[i].name === data.customMetadataColumns[n].name) {
|
var found = false;
|
||||||
found = true;
|
for(var i = 0; i < project.userMetadata.length; i++) {
|
||||||
break;
|
if (project.userMetadata[i].name === data.customMetadataColumns[n].name) {
|
||||||
}
|
found = true;
|
||||||
if (!found) {
|
break;
|
||||||
project.userMetadata.push({
|
}
|
||||||
name: data.customMetadataColumns[n].name,
|
if (!found) {
|
||||||
dispay: data.customMetadataColumns[n].display,
|
project.userMetadata.push({
|
||||||
value: ""
|
name: data.customMetadataColumns[n].name,
|
||||||
});
|
dispay: data.customMetadataColumns[n].display,
|
||||||
|
value: ""
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,13 @@ dictionary = data;
|
|||||||
$.i18n.setDictionary(dictionary);
|
$.i18n.setDictionary(dictionary);
|
||||||
//End internationalization
|
//End internationalization
|
||||||
|
|
||||||
|
function deDupUserMetaData(arrObj) {
|
||||||
|
var result = _.uniq(JSON.parse(arrObj), function(x){
|
||||||
|
return x.name;
|
||||||
|
});
|
||||||
|
|
||||||
|
return JSON.stringify(result).replace(/"/g, '\"');
|
||||||
|
}
|
||||||
|
|
||||||
function PreferenceUI(tr, key, value) {
|
function PreferenceUI(tr, key, value) {
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -65,7 +72,11 @@ function PreferenceUI(tr, key, value) {
|
|||||||
$('<button class="button">').text($.i18n._('core-index')["edit"]).appendTo(td2).click(function() {
|
$('<button class="button">').text($.i18n._('core-index')["edit"]).appendTo(td2).click(function() {
|
||||||
var newValue = window.prompt($.i18n._('core-index')["change-value"]+" " + key, value);
|
var newValue = window.prompt($.i18n._('core-index')["change-value"]+" " + key, value);
|
||||||
if (newValue !== null) {
|
if (newValue !== null) {
|
||||||
|
if (key === "userMetadata") {
|
||||||
|
newValue = deDupUserMetaData(newValue);
|
||||||
|
}
|
||||||
$(td1).text(newValue);
|
$(td1).text(newValue);
|
||||||
|
|
||||||
$.post(
|
$.post(
|
||||||
"command/core/set-preference",
|
"command/core/set-preference",
|
||||||
{
|
{
|
||||||
@ -137,7 +148,11 @@ function populatePreferences(prefs) {
|
|||||||
if (value !== null) {
|
if (value !== null) {
|
||||||
var tr = table.insertRow(table.rows.length - 1);
|
var tr = table.insertRow(table.rows.length - 1);
|
||||||
preferenceUIs.push(new PreferenceUI(tr, key, value));
|
preferenceUIs.push(new PreferenceUI(tr, key, value));
|
||||||
|
|
||||||
|
if (key === "userMetadata") {
|
||||||
|
value = deDupUserMetaData(value);
|
||||||
|
}
|
||||||
|
|
||||||
$.post(
|
$.post(
|
||||||
"command/core/set-preference",
|
"command/core/set-preference",
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
}
|
}
|
||||||
|
|
||||||
#metadata-body td {
|
#metadata-body td {
|
||||||
padding: 8px
|
padding: 1px
|
||||||
}
|
}
|
||||||
|
|
||||||
#metadata-body tr:nth-child(even) {background: #f2f2f2}
|
#metadata-body tr:nth-child(even) {background: #f2f2f2}
|
||||||
|
Loading…
Reference in New Issue
Block a user