Пример #1
0
 function testRenderableOuterTags()
 {
     $t = new Tag();
     $actual = $t->html([$t->head(), $t->body(a::c1ass('container'), [$t->header(['style' => 'width: 1px solid #000;'], a::id('my-header'), $t->h1('header'))], new Panel('Test', 'inside content'))]);
     $expected = '<html><head></head><body class="container"><header style="width: 1px solid #000;"' . ' id="my-header"><h1>header</h1></header><div class="panel panel-default"><div class="panel-heading">' . '<h3 class="panel-title">Test</h3></div><div class="panel-body">inside content</div></div></body></html>';
     $this->assertEquals($expected, $actual);
 }
Пример #2
0
 public function index()
 {
     $t = new Tag();
     echo "\n";
     echo "\n";
     echo $t->doctype($t->html(['ng-app' => 'nameApp'], [$t->head([$t->meta(['charset' => 'utf-8']), $t->title('Angular.js Example'), $t->script(['src' => 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.1/angular.min.js']), $t->script([' var nameApp = angular.module(\'nameApp\', []);
                             nameApp.controller(\'NameCtrl\', function( $scope ) {
                                 $scope.names = [\'Lary\', \'Curly\', \'Moe\'];
                                 $scope.addName = function () {
                                     $scope.names.push($scope.enteredName);
                                 }
                                 //$scope.firstName = \'John\';
                                 //
                                 //$scope.$watch(\'lastName\', function(newValue, oldValue) {
                                 //    console.log(\'new value is \' + newValue);
                                 //});
                                 //
                                 //setTimeout(function(){
                                 //    $scope.lastName = \'Smith\';
                                 //    $scope.$apply();
                                 //}, 1000);
                             });'])]), $t->body(['ng-controller' => 'NameCtrl'], [$t->ul([$t->li(['ng-repeat' => 'name in names track by $index'], ['{{name}}'])]), $t->form(['ng-submit' => 'addName()'], [$t->input(['type' => 'text', 'ng-model' => 'enteredName']), $t->input(['type' => 'submit', 'value' => 'add'])])])]));
     echo "\n";
 }
Пример #3
0
 private function body(Tag $t, $controllerName)
 {
     return $t->body(new Attributes($this->getBodyAttributes()), [$this->getContent(), $this->getFooterJs(), $this->getControllerJs($t, $controllerName)]);
 }