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 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( $this->add_init_script(
<<< EOF <<< EOF
try try

View File

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

View File

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

View File

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