document categorie may have a color

This commit is contained in:
Uwe Steinmann 2021-05-13 16:15:06 +02:00
parent 83dc876ac4
commit d12ff1eb13
3 changed files with 15 additions and 1 deletions

View File

@ -100,6 +100,11 @@ else if ($action == "editcategory") {
if (!$category->setName($name)) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}
$color = $_POST["color"];
if (!$category->setColor($color)) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}
}
else {

View File

@ -125,6 +125,15 @@ $(document).ready( function() {
'value'=>($category ? htmlspecialchars($category->getName()) : '')
)
);
$this->formField(
getMLText("color"),
array(
'element'=>'input',
'type'=>'text',
'name'=>'color',
'value'=>($category ? htmlspecialchars($category->getColor()) : '')
)
);
$this->contentContainerEnd();
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('save'));
?>

View File

@ -3007,7 +3007,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
if($categories = $document->getCategories()) {
$content .= "<br />";
foreach($categories as $category)
$content .= "<span class=\"badge bg-secondary\">".$category->getName()."</span> ";
$content .= "<span class=\"badge bg-secondary\"".($category->getColor() ? ' style="background-color: #'.$category->getColor().' !important;"' : '').">".$category->getName()."</span> ";
}
if(!empty($extracontent['bottom_title']))
$content .= $extracontent['bottom_title'];