Templates based on classes, cache custom paths
This commit is contained in:
parent
dde4185ad7
commit
6d6ec109ca
26 changed files with 236 additions and 156 deletions
14
views/models/BaseTemplate.php
Normal file
14
views/models/BaseTemplate.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Views\Models;
|
||||
|
||||
/**
|
||||
* Base for all templates, needs a Title to set
|
||||
*/
|
||||
class BaseTemplate {
|
||||
public string $title;
|
||||
public string $version;
|
||||
|
||||
function __construct(string $title) {
|
||||
$this->title = $title;
|
||||
}
|
||||
}
|
||||
14
views/models/FeedTemplate.php
Normal file
14
views/models/FeedTemplate.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Views\Models;
|
||||
|
||||
/**
|
||||
* Base for templates with a feed
|
||||
*/
|
||||
class FeedTemplate extends BaseTemplate {
|
||||
public object $feed;
|
||||
|
||||
function __construct(string $title, object $feed) {
|
||||
parent::__construct($title);
|
||||
$this->feed = $feed;
|
||||
}
|
||||
}
|
||||
14
views/models/FollowingTemplate.php
Normal file
14
views/models/FollowingTemplate.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Views\Models;
|
||||
|
||||
/**
|
||||
* Exclusive for /following
|
||||
*/
|
||||
class FollowingTemplate extends FeedTemplate {
|
||||
public array $following;
|
||||
|
||||
function __construct(array $following, object $feed) {
|
||||
parent::__construct('Following', $feed);
|
||||
$this->following = $following;
|
||||
}
|
||||
}
|
||||
14
views/models/ItemTemplate.php
Normal file
14
views/models/ItemTemplate.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Views\Models;
|
||||
|
||||
/**
|
||||
* Base for templates with item (only /video at the time)
|
||||
*/
|
||||
class ItemTemplate extends BaseTemplate {
|
||||
public object $item;
|
||||
|
||||
function __construct(string $title, object $item) {
|
||||
parent::__construct($title);
|
||||
$this->item = $item;
|
||||
}
|
||||
}
|
||||
19
views/models/SettingsTemplate.php
Normal file
19
views/models/SettingsTemplate.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
namespace Views\Models;
|
||||
|
||||
use \Helpers\Following;
|
||||
use \Helpers\Settings;
|
||||
|
||||
/**
|
||||
* Exclusive for /settings
|
||||
*/
|
||||
class SettingsTemplate extends BaseTemplate {
|
||||
public array $proxy_elements = [];
|
||||
public array $following = [];
|
||||
|
||||
function __construct() {
|
||||
parent::__construct('Settings');
|
||||
$this->proxy_elements = Settings::PROXY;
|
||||
$this->following = Following::get();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue