Skip to content

Commit 042d3b4

Browse files
committed
Merge branch 'release/1.0.2'
2 parents 0adda17 + b6045a7 commit 042d3b4

40 files changed

+539
-176
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## 1.0.2
2+
3+
* Button::$rightIcon renamed into $iconRight to follow global pattern
4+
* Removed depreciated classes H2, Fields and MiniApp
5+
* Cleaned up demos/button.php
6+
* Added documentation for Button class
7+
* Refactored Button internals (simplified), now uses button.html
8+
* Added comments for a Form
9+
* Cleaned up Grid type-hinting
10+
* Added example for top/bottom attached buttons to Grid.
11+
* You can disable "header" for grid now
12+
13+
## 1.0.1
14+
15+
Qucik post-release bugfixes
16+
117
## 1.0.0
218

319
* Implement Grid

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "atk4/ui",
33
"type": "library",
4-
"description": "Agile UI - User Interface Component Library",
5-
"keywords": ["framework", "ui", "web", "form", "widget", "render", "gadget", "button", "grid", "crud"],
6-
"homepage": "https://github.com/atk4/ui",
4+
"description": "Agile UI - Web Component Framework written in PHP",
5+
"keywords": ["framework", "ui", "web", "form", "component", "widget", "render", "gadget", "button", "grid", "crud"],
6+
"homepage": "https://agiletoolkit.org/ui",
77
"license": "MIT",
88
"authors": [
99
{
@@ -14,7 +14,7 @@
1414
],
1515
"require": {
1616
"php": ">=5.6.0",
17-
"atk4/data": "^1.1.9",
17+
"atk4/data": "^1.1.11",
1818
"atk4/core": "^1.1.11"
1919
},
2020
"require-dev": {

demos/button.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,70 +5,79 @@
55
require 'init.php';
66
use \atk4\ui\Button;
77
use \atk4\ui\Buttons;
8-
use \atk4\ui\H2;
8+
use \atk4\ui\Header;
99
use \atk4\ui\Icon;
1010
use \atk4\ui\Label;
1111
use \atk4\ui\Template;
1212
use \atk4\ui\View;
1313

14-
$layout->add(new H2('Basic Button'));
14+
$layout->add(new Header(['Basic Button', 'size'=>2]));
1515
$layout->add(new Button())->set('Click me');
1616

17-
$layout->add(new H2('Properties'));
17+
$layout->add(new Header(['Properties', 'size'=>2]));
1818

1919
$b1 = new Button();
2020
$b2 = new Button();
2121
$b3 = new Button();
22+
$b4 = new Button();
2223

2324
$b1->set(['Load', 'primary']);
2425
$b2->set(['Load', 'labeled', 'icon'=>'pause']);
25-
$b3->set(['Next', 'right labeled', 'icon'=>'right arrow']);
26+
$b3->set(['Next', 'iconRight'=>'right arrow']);
27+
$b4->set([false, 'circular', 'icon'=>'settings']);
2628
$layout->add($b1);
2729
$layout->add($b2);
2830
$layout->add($b3);
31+
$layout->add($b4);
2932

3033
$button = new Button();
3134
$button->set('Click me');
3235
$button->set(['primary' => true]);
3336
$button->set(['icon'=>'check']);
3437
$button->set(['size big'=>true]);
3538

36-
$layout->add(new H2('Big Button'));
39+
$layout->add(new Header(['Big Button', 'size'=>2]));
3740

3841
$layout->add($button);
3942

40-
$layout->add(new H2('Button Intent'));
43+
$layout->add(new Header(['Button Intent', 'size'=>2]));
4144

4245
$b_yes = new Button(['Yes', 'positive basic']);
4346
$b_no = new Button(['No', 'negative basic']);
4447
$layout->add($b_yes);
4548
$layout->add($b_no);
4649

47-
$layout->add(new H2('Combining Buttons'));
50+
$layout->add(new Header(['Combining Buttons', 'size'=>2]));
4851
$bar = new Buttons('vertical'); // NOTE: class called Buttons, not Button
4952
$bar->add(new Button(['Play', 'icon'=>'play']));
5053
$bar->add(new Button(['Pause', 'icon'=>'pause']));
5154
$bar->add(new Button(['Shuffle', 'icon'=>'shuffle']));
5255

5356
$layout->add($bar);
5457

55-
$layout->add(new H2('Icon Bar'));
58+
$layout->add(new Header(['Icon Bar', 'size'=>2]));
5659
$bar = new Buttons('blue big');
5760
$bar->add(new Button(['icon'=>'file']));
5861
$bar->add(new Button(['icon'=>['save', 'yellow']]));
5962
$bar->add(new Button(['icon'=>'upload', 'disabled'=>true]));
6063
$layout->add($bar);
6164

62-
$layout->add(new H2('Forks'));
65+
$layout->add(new Header(['Forks', 'size'=>2]));
6366
$forks = new Button(['labeled'=> true]); // Button, not Buttons!
6467
$forks->add(new Button(['Forks', 'blue']))->add(new Icon('fork'));
6568
$forks->add(new Label(['1,048', 'basic blue left pointing']));
6669
$layout->add($forks);
6770

68-
$layout->add(new H2('Custom Template'));
71+
$layout->add(new Header(['Custom Template', 'size'=>2]));
6972
$view = new View(['template'=>new Template('Hello, {$tag1}, my name is {$tag2}')]);
7073

7174
$view->add(new Button('World'), 'tag1');
7275
$view->add(new Button(['Agile UI', 'blue']), 'tag2');
7376

7477
$layout->add($view);
78+
79+
$layout->add(new Header(['Attaching', 'size'=>2]));
80+
81+
$layout->add(['Button', 'Scroll Up', 'top attached']);
82+
$layout->add(['Grid', 'attached', 'header'=>false])->setSource(['One', 'Two', 'Three', 'Four']);
83+
$layout->add(['Button', 'Scroll Up', 'bottom attached']);

demos/checkbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
try {
88
$layout = new \atk4\ui\Layout\App(['defaultTemplate'=>'./templates/layout2.html']);
99

10-
$layout->add(new \atk4\ui\H2('Checkboxes'));
10+
$layout->add(new \atk4\ui\Header(['Checkboxes', 'size'=>2]));
1111

1212
$layout->add(new \atk4\ui\FormField\Checkbox('Make my profile visible'));
1313

demos/field.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
*/
55
require 'init.php';
66

7-
$layout->add(new \atk4\ui\H2('Types'));
7+
$layout->add(new \atk4\ui\Header(['Types', 'size'=>2]));
88

99
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search']));
1010
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search', 'loading'=>true]));
1111
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search', 'loading'=>'left']));
1212
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search', 'icon'=>'search', 'disabled'=>true]));
1313
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search', 'error'=>true]));
1414

15-
$layout->add(new \atk4\ui\H2('Icon Variations'));
15+
$layout->add(new \atk4\ui\Header(['Icon Variations', 'size'=>2]));
1616

1717
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search users', 'left'=>true, 'icon'=>'users']));
1818
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search users', 'icon'=>'circular search link']));
1919
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search users', 'icon'=>'inverted circular search link']));
2020

21-
$layout->add(new \atk4\ui\H2('Labels'));
21+
$layout->add(new \atk4\ui\Header(['Labels', 'size'=>2]));
2222

2323
$layout->add(new \atk4\ui\FormField\Line(['placeholder'=>'Search users', 'label'=>'http://']));
2424

@@ -55,7 +55,7 @@
5555
'label'=> $label,
5656
]))->addClass('corner');
5757

58-
$layout->add(new \atk4\ui\H2('Actions'));
58+
$layout->add(new \atk4\ui\Header(['Actions', 'size'=>2]));
5959

6060
$layout->add(new \atk4\ui\FormField\Line(['action'=>'Search']));
6161

@@ -76,14 +76,14 @@
7676
->add(new \atk4\ui\Button('Search'), 'AfterAfterInput');
7777

7878
$layout->add(new \atk4\ui\FormField\Line(['action'=> new \atk4\ui\Button([
79-
'Copy', 'rightIcon'=>'copy', 'teal',
79+
'Copy', 'iconRight'=>'copy', 'teal',
8080
])]));
8181

8282
$layout->add(new \atk4\ui\FormField\Line(['action'=> new \atk4\ui\Button([
8383
'icon'=> 'search',
8484
])]));
8585

86-
$layout->add(new \atk4\ui\H2('Modifiers'));
86+
$layout->add(new \atk4\ui\Header(['Modifiers', 'size'=>2]));
8787

8888
$layout->add(new \atk4\ui\FormField\Line(['icon'=>'search', 'transparent'=>true, 'placeholder'=>'transparent']));
8989
$layout->add(new \atk4\ui\FormField\Line(['icon'=>'search', 'fluid'=>true, 'placeholder'=>'fluid']));

demos/form.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'ui'=> 'ignored warning message',
1818
]));
1919

20-
$layout->add(new \atk4\ui\H2('DefaultForm'));
20+
$layout->add(new \atk4\ui\Header(['DefaultForm', 'size'=>2]));
2121

2222
$a = [];
2323
$m_register = new \atk4\data\Model(new \atk4\data\Persistence_Array($a));
@@ -39,7 +39,7 @@
3939
}
4040
});
4141

42-
$layout->add(new \atk4\ui\H2('Another Form'));
42+
$layout->add(new \atk4\ui\Header(['Another Form', 'size'=>2]));
4343

4444
$f = $layout->add(new \atk4\ui\Form(['segment']));
4545
$f->setModel(new \atk4\data\Model());

demos/form2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function init()
2626
'ui'=> 'ignored warning message',
2727
]));
2828

29-
$layout->add(new \atk4\ui\H2('Fully-interractive, responsive and slick-looking form in 20 lines of PHP code'));
29+
$layout->add(new \atk4\ui\Header(['Fully-interractive, responsive and slick-looking form in 20 lines of PHP code', 'size'=>2]));
3030

3131
$form = $layout->add(new \atk4\ui\Form(['segment']));
3232

docs/button.rst

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
2+
.. _button:
3+
4+
======
5+
Button
6+
======
7+
8+
.. php:namespace:: atk4\ui\Button
9+
10+
.. php:class:: Button
11+
12+
Implements a clickable button::
13+
14+
$button = $view->add(new \atk4\ui\Button('Click me'));
15+
16+
Button will typically inherit all same properties of a :php:class:`View`. Functionality
17+
of View alone yields in many various usage patterns such as::
18+
19+
$b1 = new Button(['Load', 'primary']);
20+
21+
$button = new Button('Hello there');
22+
$button->addClass('size big');
23+
24+
Icons
25+
-----
26+
27+
.. php:attr:: icon
28+
29+
Includes icon on the button::
30+
31+
$bar = new Buttons('vertical'); // NOTE: class called Buttons, not Button
32+
$bar->add(new Button(['Play', 'icon'=>'play']));
33+
$bar->add(new Button(['Pause', 'icon'=>'pause']));
34+
$bar->add(new Button(['Shuffle', 'icon'=>'shuffle']));
35+
36+
Icon can also be specified as object::
37+
38+
$b1 = new Button(['Forks', 'blue', 'icon'=>new Icon('fork'));
39+
40+
.. php:attr:: iconRight
41+
42+
Setting this will display icon on the right of the button::
43+
44+
45+
$b1 = new Button(['Next', 'iconRight'=>'right arrow']);
46+
47+
Apart from being on the right, same rules apply as :php:attr:`Button::$icon`. Both
48+
icons cannot be specified simultaniously.
49+
50+
Linking
51+
-------
52+
53+
.. php:method:: link
54+
55+
Will link button to a destination URL or page::
56+
57+
$button->link('http://google.com/');
58+
// or
59+
$button->link(['details', 'id'=>123]);
60+
61+
If array is used, it's routed to :php:meth:`App::url`
62+
63+
For other JavaScript actions you can use :ref:`js`::
64+
65+
$button->js('click', new jsExpression('document.location.reload()'));
66+
67+
Complex Buttons
68+
---------------
69+
70+
Knowledge of Semantic UI button (http://semantic-ui.com/elements/button.html) can help you
71+
in creating more complex buttons::
72+
73+
$forks = new Button(['labeled'=> true]); // Button, not Buttons!
74+
$forks->add(new Button(['Forks', 'blue']))->add(new Icon('fork'));
75+
$forks->add(new Label(['1,048', 'basic blue left pointing']));
76+
$layout->add($forks);

docs/form.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ a model. I will also add one extra checkbox where user can accept terms and cond
111111
$form->setModel(new Person($db));
112112

113113
$form->addField(
114-
'terms',
114+
'terms',
115115
['type'=>'boolean', 'ui'=>['caption'=>'Accept Terms and Conditions']]
116116
);
117117

@@ -120,7 +120,7 @@ Form Submit Handling
120120

121121
.. php:method:: onSubmit($callback)
122122
123-
Specify a PHP call-back that will be executed on successful form submission.
123+
Specify a PHP call-back that will be executed on successful form submission.
124124

125125
.. php:method:: error($field, $message)
126126
@@ -268,4 +268,4 @@ form inside a segment (outline) and will make fields appear smaller::
268268

269269
$f = new \atk4\ui\Form(['small segment']));
270270

271-
For further styling see documentation on :php:class:`View`.
271+
For further styling see documentation on :php:class:`View`.

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Contents:
1414
view
1515
js
1616
callbacks
17+
button
1718
field
1819
form
1920
grid
@@ -22,7 +23,7 @@ Contents:
2223

2324

2425
..
25-
26+
2627
base-components
2728
core
2829
layouts

0 commit comments

Comments
 (0)