Skip to content

Commit

Permalink
Feature/new faqs (#442)
Browse files Browse the repository at this point in the history
* add migration and models to faq sections and subsections from feature/new-faq

* fix faq test

* create new admin modules for new faq models

* create new admin modules for new faq models

(cherry picked from commit 2caa326)

* add missing copies

* remove unnecessary template

* fixes on faq admin controller

* fix bug on faqsection admin controller

* change type of subsections and sections ids

* make improvements based on review

* use of new methods from models and fixes

* refactor faqsection getfaqs function

* files from #400 related to the views of the new faqs

* fix integration

* add missing copies

* refactor in partials of faq header and classes
  • Loading branch information
davidbeig authored Jun 3, 2022
1 parent 406b190 commit ad4068e
Show file tree
Hide file tree
Showing 69 changed files with 3,118 additions and 66 deletions.
6 changes: 5 additions & 1 deletion Resources/permissions.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# Full list of Permissions in Goteo
#
# Some permission require to check if the user and the model.id is present in
# Some permission require checking if the user and the model.id is present in
# a table.
#
# Example:
Expand Down Expand Up @@ -252,6 +252,10 @@ admin-module-communication: # Can access to module CommunicationAdminController
model: null
relational: null

admin-module-faqs: # Can access to module FaqAdminController
model: null
relational: null

receive-test-communications: # Can receive test communications
model: null
relational: null
Expand Down
1 change: 1 addition & 0 deletions Resources/roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ manager:
- edit-published-calls # Edit any published call
- admin-module-blog # create/edit/delete non-project posts
- admin-module-stories # create/edit/delete non-project posts
- admin-module-faqs # create/edit/delete faqs
- full-html-edit # Affects if the user is allowed dangerous tags (iframe,...) in posts
- admin-module-stats # Can access to stats
level: 50
Expand Down
51 changes: 51 additions & 0 deletions Resources/templates/responsive/admin/faq/detail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

$this->layout('admin/communication/layout');

$this->section('admin-container-head');

?>

<?php $this->append() ?>


<?php $this->section('admin-container-body') ?>


<div class="panel section-content spacer">
<div class="panel-body">

<h5><?= $this->text('admin-communications-id') ?></h5>
<p id = "communication-id"><?= $this->communication->id ?></p>

<h5><?= $this->text('admin-mailing-subject') ?></h5>
<p><?= $this->communication->subject ?></p>

<h5 class="spacer-20"><?= $this->text('regular-date') ?></h5>
<p><?= $this->communication->date ?></p>

<?= $this->insert('admin/partials/material_table', ['list' => $this->model_list_entries($this->mails, ['id', 'subject', 'lang', 'receivers', 'sent', 'failed', 'pending', 'success', 'status', 'percent'])]) ?>


<div class="spacer-20 forms">
<p class="buttons">
<?php if (!$this->communication->isSent() && $this->communication->isActive()): ?>
<a class="show-form btn btn-danger btn-lg" href="/admin/communication/cancel/<?= $this->communication->id?>"><i class="fa fa-ban"></i> <?= $this->text('admin-communications-cancel') ?></a>
<?php elseif (!$this->communication->isActive() && !$this->communication->isSent()): ?>
<a class="show-form btn btn-cyan btn-lg" href="/admin/communication/send/<?= $this->communication->id?>"><i class="fa fa-send"></i> <?= $this->text('admin-communications-send') ?></a>
<?php endif ?>
<a class="show-form btn btn-cyan btn-lg" href="/admin/communication/preview/<?= $this->communication->id?>"><i class="fa fa-eye"></i> <?= $this->text('regular-preview') ?></a>
<?php if(!$this->communication->isActive()) : ?>
<a class="show-form btn btn-cyan btn-lg" href="/admin/communication/edit/<?= $this->communication->id?>"><i class="fa fa-pencil"></i> <?= $this->text('regular-edit') ?></a>
<?php endif ?>
</p>

</div>

</div>
</div>

</div>
</div>

<?php $this->replace() ?>
20 changes: 20 additions & 0 deletions Resources/templates/responsive/admin/faq/edit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

$this->layout('admin/faq/layout');

$this->section('admin-container-head');

?>

<?php $this->append() ?>


<?php $this->section('admin-container-body') ?>

<?= $this->form_form($this->raw('form')) ?>

<?php $this->replace() ?>

<?php $this->section('footer') ?>

<?php $this->append() ?>
20 changes: 20 additions & 0 deletions Resources/templates/responsive/admin/faq/layout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

$this->layout('admin/container');

$this->section('admin-container-head');

?>
<h2><?= $this->text('admin-faqs') ?></h2>

<?= $this->insert('admin/partials/search_box') ?>

<?= $this->supply('admin-faq-head') ?>

<?php $this->replace() ?>

<?php $this->section('footer') ?>

<script type="text/javascript" defer src="<?= $this->asset('js/admin/faqs.js') ?>"></script>

<?php $this->append() ?>
38 changes: 38 additions & 0 deletions Resources/templates/responsive/admin/faq/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

$this->layout('admin/faq/layout');

$this->section('admin-search-box-addons');

if ($this->current_subsection)
$keys = ['id', 'title', 'order', 'subsection', 'actions'];
else
$keys = ['id', 'title', 'subsection', 'actions'];
?>

<label for="sections-filter"><?= $this->t('admin-faq-subsections') ?></label>
<div class="form form-group">
<select id="sections-filter" name="sections-list" class="form-control" style="margin-bottom:1em;" onchange="window.location.href='/admin/faq/subsection/' + this.value">
<?php if (!$this->current_subsection) : ?>
<option selected="selected"><?= $this->t('admin-faq-subsections-all')?></option>
<?php endif; ?>
<?php foreach ($this->faq_subsections as $section => $subsections) : ?>
<optgroup label="<?= $section ?>">
<?php foreach($subsections as $id => $name): ?>
<option value="<?= $id ?>" <?= ($id == $this->current_subsection)? 'selected="selected"': '' ?>><?= $name; ?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</div>

<a class="btn btn-cyan" href="/admin/faq/add"><i class="fa fa-plus"></i> <?= $this->text('admin-faq-add') ?></a>

<?php $this->replace() ?>

<?php $this->section('admin-container-body') ?>

<h5><?= $this->text('admin-list-total', $this->total) ?></h5>
<?= $this->insert('admin/partials/material_table', ['list' => $this->model_list_entries($this->list, $keys)]) ?>

<?php $this->replace() ?>
20 changes: 20 additions & 0 deletions Resources/templates/responsive/admin/faq/section/edit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

$this->layout('admin/faq/section/layout');

$this->section('admin-container-head');

?>

<?php $this->append() ?>


<?php $this->section('admin-container-body') ?>

<?= $this->form_form($this->raw('form')) ?>

<?php $this->replace() ?>

<?php $this->section('footer') ?>

<?php $this->append() ?>
20 changes: 20 additions & 0 deletions Resources/templates/responsive/admin/faq/section/layout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

$this->layout('admin/container');

$this->section('admin-container-head');

?>
<h2><?= $this->text('admin-faqs') ?></h2>

<?= $this->insert('admin/partials/search_box') ?>

<?= $this->supply('admin-faq-head') ?>

<?php $this->replace() ?>

<?php $this->section('footer') ?>

<script type="text/javascript" defer src="<?= $this->asset('js/admin/faqs.js') ?>"></script>

<?php $this->append() ?>
26 changes: 26 additions & 0 deletions Resources/templates/responsive/admin/faq/section/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

$this->layout('admin/faq/section/layout');

$this->section('admin-search-box-addons');

$keys = [
'id',
'name',
'slug',
'actions'
]
?>

<h2><?= $this->t('admin-faq-sections') ?></h2>

<a class="btn btn-cyan" href="/admin/faqsection/add"><i class="fa fa-plus"></i> <?= $this->text('admin-faq-sections-add') ?></a>

<?php $this->replace() ?>

<?php $this->section('admin-container-body') ?>

<h5><?= $this->text('admin-list-total', $this->total) ?></h5>
<?= $this->insert('admin/partials/material_table', ['list' => $this->model_list_entries($this->list, $keys)]) ?>

<?php $this->replace() ?>
20 changes: 20 additions & 0 deletions Resources/templates/responsive/admin/faq/subsection/edit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

$this->layout('admin/faq/subsection/layout');

$this->section('admin-container-head');

?>

<?php $this->append() ?>


<?php $this->section('admin-container-body') ?>

<?= $this->form_form($this->raw('form')) ?>

<?php $this->replace() ?>

<?php $this->section('footer') ?>

<?php $this->append() ?>
21 changes: 21 additions & 0 deletions Resources/templates/responsive/admin/faq/subsection/layout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

$this->layout('admin/container');

$this->section('admin-container-head');

?>

<h2><?= $this->text('admin-faq-subsections') ?></h2>

<?= $this->insert('admin/partials/search_box') ?>

<?= $this->supply('admin-faq-head') ?>

<?php $this->replace() ?>

<?php $this->section('footer') ?>

<script type="text/javascript" defer src="<?= $this->asset('js/admin/faqs.js') ?>"></script>

<?php $this->append() ?>
37 changes: 37 additions & 0 deletions Resources/templates/responsive/admin/faq/subsection/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

$this->layout('admin/faq/subsection/layout');

$this->section('admin-search-box-addons');

$keys = [
'id',
'name',
'subsection',
'order',
'actions'
];
?>

<label for="sections-filter"><?= $this->t('admin-faq-sections') ?></label>
<div class="form form-group">
<select id="sections-filter" name="sections-list" class="form-control" style="margin-bottom:1em;" onchange="window.location.href='/admin/faqsubsection/section/' + this.value">
<?php if (!$this->current_section) : ?>
<option selected="selected"><?= $this->t('admin-faq-sections-all')?></option>
<?php endif; ?>
<?php foreach ($this->faq_sections as $section) : ?>
<option value="<?= $section->id ?>" <?= ($section->id == $this->current_section)? 'selected="selected"': '' ?>><?= $section->name; ?></option>
<?php endforeach; ?>
</select>
</div>

<a class="btn btn-cyan" href="/admin/faqsubsection/add"><i class="fa fa-plus"></i> <?= $this->text('admin-faq-subsections-add') ?></a>

<?php $this->replace() ?>

<?php $this->section('admin-container-body') ?>

<h5><?= $this->text('admin-list-total', $this->total) ?></h5>
<?= $this->insert('admin/partials/material_table', ['list' => $this->model_list_entries($this->list, $keys)]) ?>

<?php $this->replace() ?>
31 changes: 31 additions & 0 deletions Resources/templates/responsive/faq/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php $this->layout('faq/layout') ?>

<?php $this->section('faq-content') ?>

<!-- Start -- Cesc -->
<?= $this->insert('faq/partials/header') ?>

<section class="container step1">
<div class="row">
<?php foreach ($this->faq_sections as $section): ?>
<?php if ($section_faq = $section->getFaqs()): ?>
<article class="col-sm-6 col-lg-3">
<div class="faqs_module card">
<header class="<?= $section->slug ?>">
<h2><?= $section->name ?></h2>
</header>
<ul>
<?php foreach ($section_faq as $faq): ?>
<?php $faq_id = $faq->slug ?? $faq->id; ?>
<li><a href="<?= '/faq/' . $section->slug . '/' . $faq_id ?>"><?= $faq->title ?></a></li>
<?php endforeach; ?>
</ul>
<footer class="see_everything">
<hr><a href="<?= '/faq/'.$section->slug ?>"><?= $section->button_action ?></a>
</footer>
</div>
</article>
<?php endif; ?>
<?php endforeach; ?>

<?php $this->replace() ?>
45 changes: 45 additions & 0 deletions Resources/templates/responsive/faq/individual.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php $this->layout('faq/layout') ?>

<?php $this->section('faq-content') ?>

<nav id="breadcrumb" class="container-fluid">
<div class="container">
<a href="/faq"><?= $this->t('faq-title') ?></a><span class="slash"> / </span><a href="<?= '/faq/'.$this->faq_section->slug ?>"><?= $this->faq_section->name ?></a><span class="slash"> / </span><?= $this->faq->title ?>
</div>
</nav>

<?= $this->insert('faq/partials/header') ?>

<section class="step3">
<div class="row">
<article class="col-sm-8 col-sm-offset-1 col-sm-push-3">
<?= $this->markdown($this->faq->description) ?>
<footer class="unsolved_faq">
<a href="/contact" class="btn"><?= $this->t('faq-unsolved-footer') ?></a>
</footer>
</article>
<aside class="col-sm-3 col-sm-pull-9" id="accordion">
<?php foreach ($this->subsections as $subsection): ?>
<?php $faq_subsection = $subsection->getFaqs(); ?>
<section>
<h3 role="button" data-toggle="collapse" href="<?= '#collapse-'.$subsection->id ?>" aria-expanded="<?= $this->faq->subsection_id==$subsection->id ? 'true' : 'false' ?>">
<?= $subsection->name ?>
</h3>
<ul class="description collapse <?= $this->faq->subsection_id==$subsection->id ? 'in' : 'false' ?>" id="<?= 'collapse-'.$subsection->id ?>">
<?php foreach($faq_subsection as $faq): ?>
<?php if($faq->id==$this->faq->id): ?>
<li class="select"><?= $faq->title ?></li>
<?php else: ?>
<li>
<a href="<?= '/faq/'.$this->faq_section->slug.'/'.$faq->slug ?>"><?= $faq->title ?></a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</section>
<?php endforeach; ?>
</aside>
</div>
</section>

<?php $this->replace() ?>
Loading

0 comments on commit ad4068e

Please sign in to comment.