Skip to content

Commit

Permalink
Merge branch 'release/0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
romaninsh committed Feb 7, 2017
2 parents d9baeea + e40fd16 commit 96b63f6
Show file tree
Hide file tree
Showing 93 changed files with 5,136 additions and 520 deletions.
47 changes: 47 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
engines:
duplication:
enabled: true
config:
languages:
php:
mass_threshold: 50
fixme:
enabled: true
phpmd:
enabled: true
exclude_fingerprints:
- 908ad3f93985ff14c44615cee6966c72 # View have a lot of public methods. Deal with it.
checks:
Naming/ShortVariable:
enabled: false # because of on() and js() and $ui
Naming/ShortMethodName:
enabled: false # because of on() and js() and $ui
CleanCode/ElseExpression:
enabled: false # gives many incorrect suggestions
Design/CouplingBetweenObjects:
enabled: false # because we always allow to inject overrides!
Controversial/CamelCaseClassName:
enabled: false # because jQuery.php and similar class names
Controversial/CamelCasePropertyName:
enabled: false # becasue we use _xx for private properties (that must remain public)
Controversial/CamelCaseMethodName:
enabled: false # methods start with _xx for private methods (that must remain public)
Design/WeightedMethodCount:
enabled: false # because we solve complex task, our classes may be complex
Design/NpathComplexity:
enabled: false # our code is complex so that your code wouldn't be!
Design/LongMethod:
enabled: false # our code is long so that your code wouldn't be!
CyclomaticComplexity:
enabled: false # our code is complex so that your code wouldn't be!
Controversial/CamelCaseVariableName:
enabled: false # because we call variables $f_login, $m_user for better readability.
radon:
enabled: true
ratings:
paths:
- "src/**"
exclude_paths:
- "docs/**"
- "tests/**"
- "vendor/**"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/config.codekit
/phpunit.xml
/.idea
/public/semantic
/public/jquery
/vendor
docs/build
/composer.lock
/build
.DS_Store
*.codekit3
13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php

php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
Expand All @@ -10,15 +9,17 @@ php:
# - mysql

before_script:
- php -S localhost:8888 &
- composer install
# - mysql -e 'create database dsql_test;'

after_script:
- echo $TRAVIS_PHP_VERSION
- echo $TRAVIS_BRANCH
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then echo "Sending coverage report"; vendor/bin/test-reporter; fi

script:
- if [[ ${TRAVIS_PHP_VERSION:0:3} != "7.0" ]]; then NC="--no-coverage"; fi
- wget -O - http://localhost:8888/demos/button2.php
- ./vendor/phpunit/phpunit/phpunit $NC


Expand All @@ -35,3 +36,11 @@ notifications:
on_start: never # options: [always|never|change] default: always

email: false

addons:
browserstack:
username: "romansmalinovski1"
forcelocal: true
only: localhost,80,0
access_key:
secure: "MH+pRFR53eQHQuWY6a+LXEi0YY3tbvUeyKHrl3OUAgDdCm/6ztN/n9qv2iOKzHNwNAlhqz6R4rzUBkNIElaoTyXifo29/kLF8Pxg/1ggoMSzpRv5cb3iSLAhjqwIUYQxsd6rJA6q1XvN+LrvrnIc0BfsMwBN97kH5btiI1grvk6q5At7hcpu3ydxBnFfn+O9kCugEHgRrjt3i4t/J+JOD1BeIy6xUDWwOyqvweuIbBixcOdJvAoUGWhLoZc9CBgnpsWxyJGgeyJ5iGKlM2qd+b36t3dqo+6rfWCYRqTCy/OMnqVKbkVDc3VkXrNkAN0k9ZuXA125MIFTFCopeBClfdbjZjS/h3tszrE5/qkyy+x000ptA4NTbP2wOyIKaPtC5h470gWv9B7xJTHGU4kx2+y7poNwCTEMCKv4vrD1If4lTBZ0NfZjd8klblj8NPFN2VWOcwMz8Xyex7oAJfFglYnX4mhvbt7jpozp/oq3b9ADtHZqDRrv36iYeG5RGNl78bGIB+gPyHIhKNif1DlZoH0+EWx09xuG9DPo2CKAFjhTB8Ct8C6Nk7IdY9o6Yb78G4r7GQliDor2kcP9erycUkA8/Rd6oTN/x5eqCMM800D1Kool77+HW7cg0PgXQGROUxvvV5Rwdi0T0WXIMNWqxAylOCQTNFoGFLWqgQWnoB4="
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

## 0.3

* Implemented js() and on() #20
* Implemented Server-Side JS calls #28
* Implemented Form #29 and #30
* Enhanced documentation

## 0.2

* Implemented Render Tree
* Implemented Template-based Rendering #15
* Implemented Basic View #16
* Implemented Button (based around Semantic UI)
* Implemented JavaScript events
* Advanced JSChains (enclosing, etc) #18
* Implemented Very Basic Layouts

## 0.1

* Initial Release
* Bootstraped Documentation (sphinx-doc)
* Implemented CI
241 changes: 128 additions & 113 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
}
],
"require": {
"php": ">=5.5.0",
"atk4/data": "*",
"php": ">=5.6.0",
"atk4/data": "^1.1.8",
"facebook/webdriver": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "4.*",
"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": "*"
},
Expand Down
83 changes: 64 additions & 19 deletions demos/button.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,86 @@
<?php
/**
* Demonstrates how to use layouts
* Demonstrates how to use layouts.
*/
require '../vendor/autoload.php';
use \atk4\ui\Button;
use \atk4\ui\Buttons;
use \atk4\ui\H2;
use \atk4\ui\Icon;
use \atk4\ui\Label;
use \atk4\ui\Template;
use \atk4\ui\View;

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;
try {
$layout = new \atk4\ui\Layout\App(['defaultTemplate'=>'./templates/layout2.html']);

$layout->add(new H2('Basic Button'));
$layout->add(new Button())->set('Click me');

$layout->add(new H2('Properties'));

$b1 = new Button();
$b2 = new Button();
$b3 = new Button();

try {
$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 = new \atk4\ui\Layout\App(['template'=>'./templates/layout2.html']);
$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'));

$view = new View(['template'=>new Template('Hello, {$tag1}, my name is {$tag2}')]);
$layout->add($button);

$view->add(new Button('World'), 'tag1');
$view->add(new Button(['Agile UI', 'blue']), 'tag2');
$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($view);
$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);

echo $layout->render();
$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');

}catch(\atk4\core\Exception $e){
var_Dump($e->getMessage());
$layout->add($view);

var_Dump($e->getParams());
echo $layout->render();
} catch (\atk4\core\Exception $e) {
var_dump($e->getMessage());

var_dump($e->getParams());
var_dump($e->getTrace());
throw $e;
}

41 changes: 41 additions & 0 deletions demos/button2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* Demonstrates how to use interractive buttons.
*/
require '../vendor/autoload.php';
use \atk4\ui\Button;
use \atk4\ui\Buttons;
use \atk4\ui\H2;

try {
$layout = new \atk4\ui\Layout\App(['defaultTemplate'=>'./templates/layout2.html']);

$layout->js(true, new \atk4\ui\jsExpression('$.fn.api.settings.successTest = function(response) {
if(response && response.eval) {
var result = function(){ eval(response.eval); }.call(this.obj);
}
return false;
}'));

$layout->add(new H2('Basic Button'));

$b = $layout->add(new Button(['id'=>'b1']))->set('Hidden Button');
$b->js(true)->hide();

$b = $layout->add(new Button(['id'=>'b2']))->set('Hide on click Button');
$b->js('click')->hide();

$layout->add(new H2('Callbacks'));

$b = $layout->add(new Button(['id'=>'b3']))->set('Callback Test');
$b->on('click', function ($b) {
return $b->text(rand(1, 20));
});

echo $layout->render();
} catch (\atk4\core\Exception $e) {
var_dump($e->getMessage());

var_dump($e->getParams());
throw $e;
}
30 changes: 30 additions & 0 deletions demos/checkbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Testing fields.
*/
require '../vendor/autoload.php';

try {
$layout = new \atk4\ui\Layout\App(['defaultTemplate'=>'./templates/layout2.html']);

$layout->add(new \atk4\ui\H2('Checkboxes'));

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

$layout->add(new \atk4\ui\View(['ui'=>'divider']));
$layout->add(new \atk4\ui\FormField\Checkbox(['Accept terms and conditions', 'slider']));

$layout->add(new \atk4\ui\View(['ui'=>'divider']));
$layout->add(new \atk4\ui\FormField\Checkbox(['Subscribe to weekly newsletter', 'toggle']));

$layout->add(new \atk4\ui\View(['ui'=>'divider']));
$layout->add(new \atk4\ui\FormField\Checkbox(['Custom setting?']))->js(true)->checkbox('set indeterminate');

echo $layout->render();
} catch (\atk4\core\Exception $e) {
var_dump($e->getMessage());

var_dump($e->getParams());
var_dump($e->getTrace());
throw $e;
}
Loading

0 comments on commit 96b63f6

Please sign in to comment.