Skip to content

Commit d79a602

Browse files
Merge pull request #1 from technicalguru/1.0-dev
1.0-dev creation
2 parents 04e3807 + d929a7e commit d79a602

17 files changed

+214
-25
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"extra": {
3131
"branch-alias": {
32-
"dev-master": "main-dev"
32+
"dev-master": "1.0-dev"
3333
}
3434
}
3535
}

src/WebApp/BootstrapTheme/Grid.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace WebApp\BootstrapTheme;
4+
5+
class Grid extends \WebApp\Component\Div {
6+
7+
public function __construct($parent) {
8+
parent::__construct($parent);
9+
}
10+
11+
public function createRow() {
12+
return new GridRow($this);
13+
}
14+
}
15+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace WebApp\BootstrapTheme;
4+
5+
class GridCell extends \WebApp\Component\Div {
6+
7+
protected $gridSizes;
8+
9+
public function __construct($parent, $content = NULL) {
10+
parent::__construct($parent, $content);
11+
$this->gridSizes = array();
12+
}
13+
14+
public function getGridSizes() {
15+
return $this->gridSizes;
16+
}
17+
18+
public function addSize($class, $span = 0) {
19+
$this->gridSizes[$class] = $span;
20+
return $this;
21+
}
22+
}
23+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace WebApp\BootstrapTheme;
4+
5+
class GridCellRenderer extends \WebApp\DefaultTheme\DivRenderer {
6+
7+
public function __construct($theme, $component) {
8+
parent::__construct($theme, $component);
9+
$sizes = $this->component->getGridSizes();
10+
if (count($sizes) > 0) {
11+
foreach ($sizes AS $class => $span) {
12+
if ($span > 0) {
13+
$this->addClass('col-'.$class.'-'.$span);
14+
} else {
15+
$this->addClass('col-'.$class);
16+
}
17+
}
18+
} else {
19+
$this->addClass('col');
20+
}
21+
}
22+
}
23+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace WebApp\BootstrapTheme;
4+
5+
class GridRenderer extends \WebApp\DefaultTheme\DivRenderer {
6+
7+
public function __construct($theme, $component) {
8+
parent::__construct($theme, $component);
9+
$this->addClass('container');
10+
}
11+
}
12+

src/WebApp/BootstrapTheme/GridRow.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace WebApp\BootstrapTheme;
4+
5+
class GridRow extends \WebApp\Component\Div {
6+
7+
public function __construct($parent) {
8+
parent::__construct($parent);
9+
}
10+
11+
public function createCell($content = NULL) {
12+
return new GridCell($this, $content);
13+
}
14+
}
15+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace WebApp\BootstrapTheme;
4+
5+
class GridRowRenderer extends \WebApp\DefaultTheme\DivRenderer {
6+
7+
public function __construct($theme, $component) {
8+
parent::__construct($theme, $component);
9+
$this->addClass('row');
10+
}
11+
}
12+

src/WebApp/BootstrapTheme/LoginPage.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ public function __construct($app) {
1212
}
1313

1414
public function getPublicMain() {
15-
$rc = new \WebApp\Component\Div($this);
16-
$rc->addClass('jumbotron');
17-
$rc->setStyle('margin-top', '1em');
18-
$title = new \WebApp\Component\Title($rc, 'login_title');
15+
$rc = new \WebApp\Component\MainContent($this);
16+
$panel = new \WebApp\Component\Div($rc);
17+
$panel->addClass('jumbotron');
18+
$title = new \WebApp\Component\Title($panel, 'login_title');
1919
$title->setStyle('margin-top', '0');
2020
$title->setStyle('margin-bottom', '0.5rem');
21-
$lead = new \WebApp\Component\Subtitle($rc, 'please_login');
22-
$rc->addChild('<hr class="my-4">');
23-
$rc->addChild($this->getMessages());
24-
$rc->addChild($this->getLoginForm());
21+
$lead = new \WebApp\Component\Subtitle($panel, 'please_login');
22+
$panel->addChild('<hr class="my-4">');
23+
$panel->addChild($this->getMessages());
24+
$panel->addChild($this->getLoginForm());
2525
return $rc;
2626
}
2727

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace WebApp\BootstrapTheme;
4+
5+
class MainContentRenderer extends \WebApp\DefaultTheme\DivRenderer {
6+
7+
public function __construct($theme, $component) {
8+
parent::__construct($theme, $component);
9+
$this->addClass('container-fluid');
10+
}
11+
}
12+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace WebApp\BootstrapTheme;
4+
5+
class SubtitleRenderer extends \WebApp\DefaultTheme\ContainerRenderer {
6+
7+
public function __construct($theme, $component) {
8+
parent::__construct($theme, $component, 'p');
9+
$this->addClass('lead');
10+
}
11+
}
12+

0 commit comments

Comments
 (0)