diff --git a/plugins/Cover/Controller/Cover.php b/plugins/Cover/Controller/Cover.php new file mode 100644 index 0000000000..bfa9d634de --- /dev/null +++ b/plugins/Cover/Controller/Cover.php @@ -0,0 +1,42 @@ +. + +// }}} + +namespace Plugin\Cover\Controller; + +use App\Core\Form; +use function App\Core\I18n\_m; +use Symfony\Component\Form\Extension\Core\Type\FileType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\HttpFoundation\Request; + +class Cover +{ + public function cover(Request $request) + { + $form = Form::create([ + ['cover', FileType::class, ['label' => _m('Cover'), 'help' => _m('You can upload your personal cover. The maximum file size is 2MB.')]], + ['hidden', HiddenType::class, []], + ['save', SubmitType::class, ['label' => _m('Submit')]], + ]); + return ['_template' => 'Cover/cover.html.twig', 'form' => $form->createView()]; + } +} diff --git a/plugins/Cover/Cover.php b/plugins/Cover/Cover.php new file mode 100644 index 0000000000..fcad2f2560 --- /dev/null +++ b/plugins/Cover/Cover.php @@ -0,0 +1,75 @@ +. + +// }}} + +namespace Plugin\Cover; + +use App\Core\Event; +use App\Core\Module; +use App\Core\Router\RouteLoader; + +class Cover extends Module +{ + /** + * Map URLs to actions + * + * @param RouteLoader $r + * + * @return bool hook value; true means continue processing, false means stop. + */ + public function onAddRoute(RouteLoader $r): bool + { + $r->connect('settings_cover', 'settings/cover', [Controller\Cover::class, 'cover']); + + return Event::next; + } + + /** + * Populate twig vars + * + * @param array $vars + * + * @return bool hook value; true means continue processing, false means stop. + */ + public function onStartTwigPopulateVars(array &$vars): bool + { + /* + $vars['tabs'] = [['title' => 'Poll', + 'href' => 'newpoll', + ]]; + */ + $vars['profile_tabs'] = [['title' => 'Cover', + 'href' => 'settings_cover', + ]]; + return Event::next; + } + + /** + * Output our dedicated stylesheet + * + * @param array $styles stylesheets path + * + * @return bool hook value; true means continue processing, false means stop. + */ + public function onStartShowStyles(array &$styles): bool + { + //$styles[] = 'poll/poll.css'; + return Event::next; + } +} diff --git a/templates/Cover/cover.html.twig b/templates/Cover/cover.html.twig new file mode 100644 index 0000000000..5d47cddec0 --- /dev/null +++ b/templates/Cover/cover.html.twig @@ -0,0 +1,26 @@ +{% extends 'settings/profile.html.twig' %} + +{% block title %}Cover Settings{% endblock %} + +{% block stylesheets %} + {{ parent() }} + + +{% endblock %} + +{% block body %} + {{ parent() }} +{% endblock body %} + +{% block form %} +
+ {{ form(form) }} +
+ +
+
+{% endblock form %} + +{% block javascripts %} + +{% endblock javascripts %} \ No newline at end of file diff --git a/templates/Cover/view.html.twig b/templates/Cover/view.html.twig new file mode 100644 index 0000000000..9564d05288 --- /dev/null +++ b/templates/Cover/view.html.twig @@ -0,0 +1,3 @@ + +
+
\ No newline at end of file diff --git a/templates/settings/profile.html.twig b/templates/settings/profile.html.twig index 8e589ccaad..3ba1b73c7c 100644 --- a/templates/settings/profile.html.twig +++ b/templates/settings/profile.html.twig @@ -13,9 +13,6 @@ {% block secundary_nav %} {% endblock secundary_nav %}