Taxons: UI WIP.

This commit is contained in:
Molkobain
2018-09-20 14:41:56 +02:00
parent baf4662ed8
commit 38278f3432
5 changed files with 33 additions and 3 deletions

View File

@@ -259,6 +259,24 @@ EOF;
EOF
);
// Attribute tag tooltips
$this->add_ready_script(
<<<EOF
$('.attribute-tag').each(function(){
$(this).qtip({
content: {
text: $(this).attr('data-description'),
title: { text: $(this).attr('data-label')},
},
show: { delay: 300, when: 'mouseover' },
hide: { delay: 140, when: 'mouseout', fixed: true },
style: { name: 'dark', tip: 'bottomLeft' },
position: { corner: { target: 'topMiddle', tooltip: 'bottomLeft' }}
});
});
EOF
);
$this->add_init_script(
<<< EOF
try

View File

@@ -7166,6 +7166,8 @@ class AttributeTagSet extends AttributeDBFieldVoid
$sClass = MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode());
$sAttCode = $this->GetCode();
$sTagCode = $oTag->Get('code');
$sTagLabel = $oTag->Get('label');
$sTagDescription = $oTag->Get('description');
$oFilter = DBSearch::FromOQL("SELECT $sClass WHERE $sAttCode MATCHES '$sTagCode'");
$oAppContext = new ApplicationContext();
$sContext = $oAppContext->GetForLink();
@@ -7173,11 +7175,11 @@ class AttributeTagSet extends AttributeDBFieldVoid
$sFilter = urlencode($oFilter->serialize());
$sUrl = utils::GetAbsoluteUrlAppRoot()."pages/$sUIPage?operation=search&filter=".$sFilter."&{$sContext}";
$sHtml .= '<a href="'.$sUrl.'" class="attribute-tag">'.$oTag->Get('label').'</a>';
$sHtml .= '<a href="'.$sUrl.'" class="attribute-tag" data-label="'.$sTagLabel.'" data-description="'.htmlentities($sTagDescription, ENT_QUOTES, 'UTF-8').'">'.$sTagLabel.'</a>';
}
else
{
$sHtml .= '<span class="attribute-tag">'.$oTag.'</span>';
$sHtml .= '<span class="attribute-tag-undefined">'.$oTag.'</span>';
}
}
$sHtml .= '</span>';

View File

@@ -65,7 +65,7 @@ abstract class TagSetFieldData extends cmdbAbstractObject
"is_null_allowed" => false,
"depends_on" => array()
)));
MetaModel::Init_AddAttribute(new AttributeString("description", array(
MetaModel::Init_AddAttribute(new AttributeHTML("description", array(
"allowed_values" => null,
"sql" => 'description',
"default_value" => '',

View File

@@ -2918,7 +2918,12 @@ table.listResults .originColor {
.attribute-tagset .attribute-tag {
display: inline-block;
margin-right: 3px;
margin-bottom: 3px;
padding: 4px 6px;
max-width: 120px;
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #fdfdfd;
border-radius: 2px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 1px 1px #f1f1f1;

View File

@@ -3342,7 +3342,12 @@ table.listResults .originColor{
.attribute-tagset .attribute-tag{
display: inline-block;
margin-right: 3px;
margin-bottom: 3px;
padding: 4px 6px;
max-width: 120px;
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #fdfdfd;
border-radius: 2px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 1px 1px rgb(241, 241, 241, 0.7);