mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2025-09-14 05:13:46 +02:00
wip: 2024-06-16T15:07:31+0200 (1718543251)
This commit is contained in:
parent
773fae62c1
commit
d7e1db7bcb
5 changed files with 22 additions and 43 deletions
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"name": "local/api.endpoints",
|
|
||||||
"description": "Endpoint pathmappings for VLW API",
|
|
||||||
"type": "library",
|
|
||||||
"version": "1.0.0-dev",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Victor Westerlund",
|
|
||||||
"email": "victor@vlw.se"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"VLW\\API\\": "src/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace VLW\API;
|
|
||||||
|
|
||||||
enum Endpoints: string {
|
|
||||||
case WORK = "/work";
|
|
||||||
case SEARCH = "/search";
|
|
||||||
case MESSAGES = "/messages";
|
|
||||||
case WORK_TAGS = "/work/tags";
|
|
||||||
case WORK_ACTIONS = "/work/actions";
|
|
||||||
}
|
|
|
@ -5,12 +5,16 @@
|
||||||
use VLW\Client\API;
|
use VLW\Client\API;
|
||||||
use VLW\API\Endpoints;
|
use VLW\API\Endpoints;
|
||||||
|
|
||||||
use VLW\API\Databases\VLWdb\Models\Work\WorkModel;
|
use VLW\API\Databases\VLWdb\Models\Work\{
|
||||||
|
WorkModel,
|
||||||
|
WorkActionsModel
|
||||||
|
};
|
||||||
|
|
||||||
require_once Path::root("src/client/API.php");
|
require_once Path::root("src/client/API.php");
|
||||||
require_once Path::root("api/src/Endpoints.php");
|
require_once Path::root("api/src/Endpoints.php");
|
||||||
|
|
||||||
require_once Path::root("api/src/databases/models/Work/Work.php");
|
require_once Path::root("api/src/databases/models/Work/Work.php");
|
||||||
|
require_once Path::root("api/src/databases/models/Work/WorkActions.php");
|
||||||
|
|
||||||
// Search endpoint query paramter
|
// Search endpoint query paramter
|
||||||
const SEARCH_PARAM = "q";
|
const SEARCH_PARAM = "q";
|
||||||
|
@ -53,23 +57,25 @@
|
||||||
<p><?= $result[WorkModel::SUMMARY->value] ?></p>
|
<p><?= $result[WorkModel::SUMMARY->value] ?></p>
|
||||||
<p><?= date(API::DATE_FORMAT, $result[WorkModel::DATE_CREATED->value]) ?></p>
|
<p><?= date(API::DATE_FORMAT, $result[WorkModel::DATE_CREATED->value]) ?></p>
|
||||||
|
|
||||||
<?php // Result has actions defined ?>
|
<?php // Get action buttons for work entity by id ?>
|
||||||
<?php /*if (!empty($result["actions"])): ?>
|
<?php $actions = $api->call(Endpoints::WORK_ACTIONS->value)->params([WorkActionsModel::REF_WORK_ID->value => $result[WorkModel::ID->value]])->get(); ?>
|
||||||
<div class="actions">
|
|
||||||
|
|
||||||
<?php // List all actions ?>
|
<?php // List each action button for work entity if exists ?>
|
||||||
<?php foreach ($result["actions"] as $action): ?>
|
<?php if ($actions->ok): ?>
|
||||||
|
<div class="actions">
|
||||||
|
<?php foreach ($actions->json() as $action): ?>
|
||||||
|
|
||||||
<?php if (!$action["external"]): ?>
|
<?php // Bind VV Interactions if link is same origin, else open in new tab ?>
|
||||||
<a href="<?= $action["href"] ?>" vv="search" vv-call="navigate"><button class="inline <?= $action["class_list"] ?>"><?= $action["display_text"] ?></button></a>
|
<?php if (!$action[WorkActionsModel::EXTERNAL->value]): ?>
|
||||||
|
<a href="<?= $action[WorkActionsModel::HREF->value] ?>" vv="search" vv-call="navigate"><button class="inline <?= $action[WorkActionsModel::CLASS_LIST->value] ?>"><?= $action[WorkActionsModel::DISPLAY_TEXT->value] ?></button></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a href="<?= $action["href"] ?>" target="_blank"><button class="inline <?= $action["class_list"] ?>"><?= $action["display_text"] ?></button></a>
|
<a href="<?= $action[WorkActionsModel::HREF->value] ?>" target="_blank"><button class="inline <?= $action[WorkActionsModel::CLASS_LIST->value] ?>"><?= $action[WorkActionsModel::DISPLAY_TEXT->value] ?></button></a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif;*/ ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
use VLW\Client\API;
|
use VLW\Client\API;
|
||||||
use VLW\API\Endpoints;
|
use VLW\API\Endpoints;
|
||||||
|
|
||||||
use VLW\API\Databases\VLWdb\Models\Work\WorkModel;
|
use VLW\API\Databases\VLWdb\Models\Work\{
|
||||||
use VLW\API\Databases\VLWdb\Models\Work\WorkTagsModel;
|
WorkModel,
|
||||||
use VLW\API\Databases\VLWdb\Models\Work\WorkActionsModel;
|
WorkTagsModel,
|
||||||
|
WorkActionsModel
|
||||||
|
};
|
||||||
|
|
||||||
require_once Path::root("src/client/API.php");
|
require_once Path::root("src/client/API.php");
|
||||||
require_once Path::root("api/src/Endpoints.php");
|
require_once Path::root("api/src/Endpoints.php");
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace VLW\Client;
|
namespace VLW\Client;
|
||||||
|
|
||||||
use Vegvisir\Path;
|
|
||||||
use Reflect\Client;
|
use Reflect\Client;
|
||||||
|
|
||||||
class API extends Client {
|
class API extends Client {
|
||||||
|
|
Loading…
Add table
Reference in a new issue