2019-09-25 19:19:42 +03:00
|
|
|
/* eslint-disable */
|
2016-01-21 17:35:15 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3
|
|
|
|
* or later.
|
|
|
|
*
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
(function(OC) {
|
|
|
|
/**
|
|
|
|
* @namespace
|
|
|
|
*/
|
|
|
|
OC.SystemTags = {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {OC.SystemTags.SystemTagModel|Object|String} tag
|
2019-09-25 19:19:42 +03:00
|
|
|
* @returns {jQuery}
|
2016-01-21 17:35:15 +03:00
|
|
|
*/
|
|
|
|
getDescriptiveTag: function(tag) {
|
|
|
|
if (_.isUndefined(tag.name) && !_.isUndefined(tag.toJSON)) {
|
2019-09-25 19:19:42 +03:00
|
|
|
tag = tag.toJSON()
|
2016-01-21 17:35:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_.isUndefined(tag.name)) {
|
|
|
|
return $('<span>').addClass('non-existing-tag').text(
|
|
|
|
t('core', 'Non-existing tag #{tag}', {
|
|
|
|
tag: tag
|
|
|
|
})
|
2019-09-25 19:19:42 +03:00
|
|
|
)
|
2016-01-21 17:35:15 +03:00
|
|
|
}
|
|
|
|
|
2019-09-25 19:19:42 +03:00
|
|
|
var $span = $('<span>')
|
|
|
|
$span.append(escapeHTML(tag.name))
|
2016-01-27 17:49:11 +03:00
|
|
|
|
2019-09-25 19:19:42 +03:00
|
|
|
var scope
|
2016-01-27 17:49:11 +03:00
|
|
|
if (!tag.userAssignable) {
|
2019-09-25 19:19:42 +03:00
|
|
|
scope = t('core', 'restricted')
|
2016-01-27 17:49:11 +03:00
|
|
|
}
|
|
|
|
if (!tag.userVisible) {
|
|
|
|
// invisible also implicitly means not assignable
|
2019-09-25 19:19:42 +03:00
|
|
|
scope = t('core', 'invisible')
|
2016-01-27 17:49:11 +03:00
|
|
|
}
|
|
|
|
if (scope) {
|
2020-03-21 07:44:30 +03:00
|
|
|
$span.append($('<em>').text(' (' + scope + ')'))
|
2016-01-27 17:49:11 +03:00
|
|
|
}
|
2019-09-25 19:19:42 +03:00
|
|
|
return $span
|
2016-01-21 17:35:15 +03:00
|
|
|
}
|
2019-09-25 19:19:42 +03:00
|
|
|
}
|
|
|
|
})(OC)
|