Fix style bugs

This commit is contained in:
Dennis Eichhorn 2017-06-27 21:48:27 +02:00
parent 8940a9e5a1
commit 93426a8a9d
5 changed files with 84 additions and 18 deletions

View File

@ -21,6 +21,7 @@ use phpOMS\Message\ResponseAbstract;
use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\WebInterface;
use phpOMS\Views\View;
use phpOMS\Asset\AssetType;
use Modules\QA\Models\QAQuestionMapper;
@ -79,7 +80,7 @@ class Controller extends ModuleAbstract implements WebInterface
protected static $dependencies = [
];
public function setUpBackend()
public function setUpBackend(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$head = $response->get('Content')->getData('head');
$head->addAsset(AssetType::CSS, $request->getUri()->getBase() . 'Modules/QA/Theme/Backend/styles.css');
@ -107,4 +108,15 @@ class Controller extends ModuleAbstract implements WebInterface
return $view;
}
public function viewQADoc(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/QA/Theme/Backend/qa-question');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response));
$question = QAQuestionMapper::get((int) $request->getData('id'));
$view->addData('question', $question);
return $view;
}
}

View File

@ -6,10 +6,21 @@ echo $this->getData('nav')->render(); ?>
<div class="col-xs-12">
<?php foreach($questions as $question) : ?>
<section class="box wf-100 qa-list">
<div class=".score"><?= count($question->getAnswers()); ?><div><h1><?= $question->getName(); ?></h1>
<?php $badges = $question->getBadges(); foreach($badges as $badge) : ?>
<?= $badge->getName(); ?>
<?php endforeach; ?>
<div class="inner">
<div class="row middle-xs">
<div class="col-xs-1 scores">
<span class="score"><?= count($question->getAnswers()); ?></span>
</div>
<div class="title col-xs-11">
<a href="<?= \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/qa/question?{?}&id=' . $question->getId()) ?>"><?= $question->getName(); ?></a>
</div>
</div>
<div class="tags">
<?php $badges = $question->getBadges(); foreach($badges as $badge) : ?>
<span class="tag red"><?= $badge->getName(); ?></span>
<?php endforeach; ?>
</div>
</div>
</section>
<?php endforeach; ?>
</div>

View File

@ -0,0 +1,29 @@
<?php
$question = $this->getData('question');
$answers = $question->getAnswers();
echo $this->getData('nav')->render();
?>
<div class="row">
<div class="col-xs-12">
<section class="box wf-100">
<header><h1><?= $question->getName(); ?></h1></header>
<div class="inner">
<?= $question->getQuestion(); ?>
</div>
</section>
</div>
</div>
<?php foreach($answers as $answer) : ?>
<div class="row">
<div class="col-xs-12">
<section class="box wf-100">
<div class="inner">
<?= $answer->getAnswer(); ?><?= $answer->getCreatedAt()->format('Y-m-d'); ?><?= $answer->getCreatedBy(); ?><?= $answer->getStatus(); ?><?= $answer->isAccepted(); ?>
</div>
</section>
</div>
</div>
<?php endforeach; ?>

View File

@ -1,8 +1,16 @@
.qa-list .score.closed {
background: #f00; }
.qa-list .score.open {
background: #ff0; }
.qa-list .score.done {
background: #0f0; }
.qa-list h1 {
.qa-list .score {
padding: 10px;
margin-right: 10px;
border: 1px solid #ccc; }
.qa-list .score.closed {
background: #f00; }
.qa-list .score.open {
background: #ff0; }
.qa-list .score.done {
background: #0f0; }
.qa-list .scores {
flex-basis: min-content; }
.qa-list .title a {
font-size: 2rem; }
.qa-list .tags {
margin-top: 10px; }

View File

@ -11,17 +11,23 @@
&.done {
background: #0f0;
}
padding: 10px;
margin-right: 10px;
border: 1px solid #ccc;
}
h1 {
font-size: 2rem;
.scores {
flex-basis: min-content;
}
.date {
.title {
a {
font-size: 2rem;
}
}
.user {
.tags {
margin-top: 10px;
}
}