Skip to content

Commit 9db12b7

Browse files
committed
icon + itemSelector on items
1 parent a95fe76 commit 9db12b7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Ajax/semantic/html/content/view/HtmlViewGroups.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Ajax\semantic\html\base\HtmlSemCollection;
66
use Ajax\service\JArray;
77
use Ajax\semantic\html\base\constants\Wide;
8+
use Ajax\JsUtils;
89

910
abstract class HtmlViewGroups extends HtmlSemCollection {
1011

@@ -57,4 +58,9 @@ public function getItemContent($itemIndex, $contentIndex) {
5758
public function fromDatabaseObject($object, $function) {
5859
return $this->addItem($function($object));
5960
}
61+
62+
public function run(JsUtils $js){
63+
$result=parent::run($js);
64+
return $result->setItemSelector(".item");
65+
}
6066
}

Ajax/semantic/html/content/view/HtmlViewItem.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Ajax\semantic\html\base\constants\RevealType;
1313
use Ajax\semantic\html\elements\HtmlButtonGroups;
1414
use Ajax\semantic\html\content\view\HtmlViewContent;
15+
use Ajax\semantic\html\elements\HtmlIcon;
1516

1617
abstract class HtmlViewItem extends HtmlSemDoubleElement {
1718
use ContentPartTrait;
@@ -56,6 +57,10 @@ private function addElementIn($key, $element) {
5657
return $element;
5758
}
5859

60+
public function addIcon($icon,$before=true){
61+
return $this->addElementIn("icon",new HtmlIcon("icon-" . $this->identifier, $icon));
62+
}
63+
5964

6065
public function addHeader($header, $niveau=4, $type="page") {
6166
if (!$header instanceof HtmlHeader) {
@@ -145,7 +150,7 @@ public function getItemHeader() {
145150
* @see HtmlSemDoubleElement::compile()
146151
*/
147152
public function compile(JsUtils $js=NULL, &$view=NULL) {
148-
$this->content=JArray::sortAssociative($this->content, ["header","image","content","extra-content"]);
153+
$this->content=JArray::sortAssociative($this->content, ["header","image","icon","content","extra-content"]);
149154
return parent::compile($js, $view);
150155
}
151156

0 commit comments

Comments
 (0)