From 306a94de8c72e9e5926f1205cec31f5cd641ce32 Mon Sep 17 00:00:00 2001 From: Romans Malinovskis Date: Thu, 8 Dec 2016 13:00:42 +0000 Subject: [PATCH 001/100] updated dependency, which fixes bug --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 648f03ec9a..fac014bdaf 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "facebook/webdriver": "^1.1", "phpunit/phpunit-selenium": ">=1.2", "fzaninotto/faker": "*", - "atk4/core": "~1.1.6", + "atk4/core": "~1.1.8", "semantic/ui": "*", "codeclimate/php-test-reporter": "*" }, From e6b40eb7a023f2f62f590d6badb59599d826f30b Mon Sep 17 00:00:00 2001 From: Romans Malinovskis Date: Thu, 8 Dec 2016 13:16:14 +0000 Subject: [PATCH 002/100] enhanced demo for buttons --- demos/button.php | 75 ++++++++++++++++++++++++++----- demos/index.php | 38 ---------------- demos/templates/layout1.html | 46 +++---------------- demos/templates/layout1.jade | 87 +++--------------------------------- src/H2.php | 11 +++++ 5 files changed, 87 insertions(+), 170 deletions(-) delete mode 100644 demos/index.php create mode 100644 src/H2.php diff --git a/demos/button.php b/demos/button.php index 7a73c44405..964d098282 100644 --- a/demos/button.php +++ b/demos/button.php @@ -4,12 +4,13 @@ */ require'../vendor/autoload.php'; - use \atk4\ui\Button; - use \atk4\ui\Buttons; - use \atk4\ui\Label; - use \atk4\ui\Icon; - use \atk4\ui\View; - use \atk4\ui\Template; +use \atk4\ui\Button; +use \atk4\ui\Buttons; +use \atk4\ui\Label; +use \atk4\ui\Icon; +use \atk4\ui\View; +use \atk4\ui\Template; +use \atk4\ui\H2; @@ -19,16 +20,70 @@ $layout = new \atk4\ui\Layout\App(['template'=>'./templates/layout2.html']); -$view = new View(['template'=>new Template('Hello, {$tag1}, my name is {$tag2}')]); + $layout->add(new H2('Basic Button')); + $layout->add(new Button())->set('Click me'); -$view->add(new Button('World'), 'tag1'); -$view->add(new Button(['Agile UI', 'blue']), 'tag2'); + $layout->add(new H2('Properties')); + $b1 = new Button(); + $b2 = new Button(); + $b3 = new Button(); + $b1->set(['Load', 'primary']); + $b2->set(['Load', 'labeled', 'icon'=>'pause']); + $b3->set(['Next', 'right labeled', 'icon'=>'right arrow']); + $layout->add($b1); + $layout->add($b2); + $layout->add($b3); -$layout->add($view); + $button = new Button(); + $button->set('Click me'); + $button->set(['primary' => true]); + $button->set(['icon'=>'check']); + $button->set(['size big'=>true]); + $layout->add(new H2('Big Button')); + + $layout->add($button); + + $layout->add(new H2('Button Intent')); + + $b_yes = new Button(['Yes', 'positive basic']); + $b_no = new Button(['No', 'negative basic']); + $layout->add($b_yes); + $layout->add($b_no); + + $layout->add(new H2('Combining Buttons')); + $bar = new Buttons('vertical'); // NOTE: class called Buttons, not Button + $bar->add(new Button(['Play', 'icon'=>'play'])); + $bar->add(new Button(['Pause', 'icon'=>'pause'])); + $bar->add(new Button(['Shuffle', 'icon'=>'shuffle'])); + + $layout->add($bar); + + $layout->add(new H2('Icon Bar')); + $bar = new Buttons('blue big'); + $bar->add(new Button(['icon'=>'file'])); + $bar->add(new Button(['icon'=>['save','yellow']])); + $bar->add(new Button(['icon'=>'upload', 'disabled'=>true])); + $layout->add($bar); + + $layout->add(new H2('Forks')); + $forks = new Button(['labeled'=> true]); // Button, not Buttons! + $forks->add(new Button(['Forks', 'blue']))->add(new Icon('fork')); + $forks->add(new Label(['1,048', 'basic blue left pointing'])); + $layout->add($forks); + + + + $layout->add(new H2('Custom Template')); + $view = new View(['template'=>new Template('Hello, {$tag1}, my name is {$tag2}')]); + + $view->add(new Button('World'), 'tag1'); + $view->add(new Button(['Agile UI', 'blue']), 'tag2'); + + $layout->add($view); echo $layout->render(); diff --git a/demos/index.php b/demos/index.php deleted file mode 100644 index e2d323d550..0000000000 --- a/demos/index.php +++ /dev/null @@ -1,38 +0,0 @@ -'Hello'], - ['name'=>'World'] -]; - -$db = new \atk4\data\Persistence_Array($data); -$examples = new \atk4\ui\Lister('templates/index1.html'); - -$m = new \atk4\data\Model($db); -$m->addField('name'); - -$examples->setModel($m); -$examples->render(); - -$html = $examples->getHTML(); -$js = $examples->getJS(); - -?> - - - - - - - - - - - diff --git a/demos/templates/layout1.html b/demos/templates/layout1.html index f63efcf716..edb4da9743 100644 --- a/demos/templates/layout1.html +++ b/demos/templates/layout1.html @@ -17,52 +17,16 @@ bottom: 0; width: 100%; } - .main.segment { - margin-top: 3em; + body { + padding-top: 3em; } } -