Skip to content

Commit ea5934e

Browse files
committed
addFields in Form
+ Modal onHidden + addHtmlComp param type
1 parent a4369d0 commit ea5934e

File tree

10 files changed

+39
-7
lines changed

10 files changed

+39
-7
lines changed

Ajax/common/BaseGui.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
use Ajax\common\components\SimpleComponent;
77
use Ajax\JsUtils;
8+
use Ajax\common\html\BaseHtml;
89

910
/**
1011
* BaseGui Phalcon library
@@ -63,8 +64,8 @@ public function addComponent(SimpleComponent $component, $attachTo, $params) {
6364
return $component;
6465
}
6566

66-
public function addHtmlComponent($htmlComponent) {
67-
$this->htmlComponents []=$htmlComponent;
67+
public function addHtmlComponent(BaseHtml $htmlComponent) {
68+
$this->htmlComponents [$htmlComponent->getIdentifier()]=$htmlComponent;
6869
return $htmlComponent;
6970
}
7071

Ajax/common/Widget.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ public function addField($field){
167167
return $this;
168168
}
169169

170+
public function addFields($fields){
171+
$this->_instanceViewer->addFields($fields);
172+
return $this;
173+
}
174+
170175
public function addMessage($attributes=NULL,$fieldName="message"){
171176
$this->_instanceViewer->addField($fieldName);
172177
$count=$this->_instanceViewer->visiblePropertiesCount();

Ajax/semantic/components/Modal.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ public function showDimmer(){
2323
public function setInverted(){
2424
$this->params["inverted"]=true;
2525
}
26+
27+
public function setOnHidden($jsCode) {
28+
$jsCode=str_ireplace("\"","%quote%", $jsCode);
29+
return $this->setParam("onHidden", "%function(){".$jsCode."}%");
30+
}
2631
}

Ajax/semantic/html/modules/HtmlModal.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ public function addAction($action){
6666
return $this->addElementInPart($action, "actions");
6767
}
6868

69+
/**
70+
* @param int $index
71+
* @return HtmlButton
72+
*/
73+
public function getAction($index){
74+
return $this->content["actions"]->getContent()[$index];
75+
}
76+
6977
public function addContent($content,$before=false){
7078
$this->content["content"]->addContent($content,$before);
7179
return $this;
@@ -175,4 +183,8 @@ public function jsDo($behavior) {
175183
public function jsHide() {
176184
return $this->jsDo("hide");
177185
}
186+
187+
public function onHidden($js){
188+
$this->_params["onHidden"]=$js;
189+
}
178190
}

Ajax/semantic/traits/SemanticHtmlCollectionsTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
use Ajax\semantic\html\collections\HtmlBreadcrumb;
1010
use Ajax\semantic\html\collections\menus\HtmlIconMenu;
1111
use Ajax\semantic\html\collections\menus\HtmlLabeledIconMenu;
12+
use Ajax\common\html\BaseHtml;
1213

1314

1415
trait SemanticHtmlCollectionsTrait {
1516

16-
abstract public function addHtmlComponent($htmlComponent);
17+
abstract public function addHtmlComponent(BaseHtml $htmlComponent);
1718

1819
/**
1920
* @param string $identifier

Ajax/semantic/traits/SemanticHtmlElementsTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
use Ajax\semantic\html\elements\HtmlImage;
2323
use Ajax\semantic\html\base\constants\State;
2424
use Ajax\semantic\html\elements\HtmlLabelGroups;
25+
use Ajax\common\html\BaseHtml;
2526

2627
trait SemanticHtmlElementsTrait {
2728

28-
abstract public function addHtmlComponent($htmlComponent);
29+
abstract public function addHtmlComponent(BaseHtml $htmlComponent);
2930

3031
public function addState($state, $elements) {
3132
State::add($state, $elements);

Ajax/semantic/traits/SemanticHtmlModulesTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
trait SemanticHtmlModulesTrait {
2222

23-
abstract public function addHtmlComponent($htmlComponent);
23+
abstract public function addHtmlComponent(BaseHtml $htmlComponent);
2424

2525
/**
2626
* Module checkbox

Ajax/semantic/traits/SemanticHtmlViewsTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
use Ajax\semantic\html\views\HtmlCard;
66
use Ajax\semantic\html\views\HtmlCardGroups;
77
use Ajax\semantic\html\views\HtmlItems;
8+
use Ajax\common\html\BaseHtml;
89

910
trait SemanticHtmlViewsTrait {
1011

11-
abstract public function addHtmlComponent($htmlComponent);
12+
abstract public function addHtmlComponent(BaseHtml $htmlComponent);
1213

1314
/**
1415
*

Ajax/semantic/traits/SemanticWidgetsTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
use Ajax\semantic\widgets\business\user\FormLogin;
88
use Ajax\semantic\widgets\datatable\JsonDataTable;
99
use Ajax\semantic\widgets\business\user\FormAccount;
10+
use Ajax\common\html\BaseHtml;
1011

1112
trait SemanticWidgetsTrait {
1213

13-
abstract public function addHtmlComponent($htmlComponent);
14+
abstract public function addHtmlComponent(BaseHtml $htmlComponent);
1415

1516
/**
1617
* @param string $identifier

Ajax/semantic/widgets/base/InstanceViewer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ public function addField($field){
153153
return $this;
154154
}
155155

156+
public function addFields($fields){
157+
$this->visibleProperties=\array_merge($this->visibleProperties,$fields);
158+
return $this;
159+
}
160+
156161
public function count(){
157162
return \sizeof($this->properties);
158163
}

0 commit comments

Comments
 (0)