diff --git a/public/assets/css/cover/cover.css b/plugins/Cover/css/cover/cover.css similarity index 100% rename from public/assets/css/cover/cover.css rename to plugins/Cover/css/cover/cover.css diff --git a/templates/cover/cover.html.twig b/plugins/Cover/templates/cover/cover.html.twig similarity index 100% rename from templates/cover/cover.html.twig rename to plugins/Cover/templates/cover/cover.html.twig diff --git a/templates/cover/view.html.twig b/plugins/Cover/templates/cover/view.html.twig similarity index 100% rename from templates/cover/view.html.twig rename to plugins/Cover/templates/cover/view.html.twig diff --git a/public/assets/css/directory/actors.css b/plugins/Directory/css/directory/actors.css similarity index 100% rename from public/assets/css/directory/actors.css rename to plugins/Directory/css/directory/actors.css diff --git a/public/assets/css/directory/groups.css b/plugins/Directory/css/directory/groups.css similarity index 100% rename from public/assets/css/directory/groups.css rename to plugins/Directory/css/directory/groups.css diff --git a/plugins/Poll/Controller/AnswerPoll.php b/plugins/Poll/Controller/AnswerPoll.php index 8ea6c7ee5f..c859abb66a 100644 --- a/plugins/Poll/Controller/AnswerPoll.php +++ b/plugins/Poll/Controller/AnswerPoll.php @@ -92,6 +92,6 @@ class AnswerPoll } } - return ['_template' => 'Poll/respondpoll.html.twig', 'question' => $question, 'form' => $form->createView()]; + return ['_template' => 'poll/respondpoll.html.twig', 'question' => $question, 'form' => $form->createView()]; } } diff --git a/plugins/Poll/Controller/NewPoll.php b/plugins/Poll/Controller/NewPoll.php index 15b66185fd..9f316087cc 100644 --- a/plugins/Poll/Controller/NewPoll.php +++ b/plugins/Poll/Controller/NewPoll.php @@ -101,6 +101,6 @@ class NewPoll } } - return ['_template' => 'Poll/newpoll.html.twig', 'form' => $form->createView()]; + return ['_template' => 'poll/newpoll.html.twig', 'form' => $form->createView()]; } } diff --git a/templates/poll/newpoll.html.twig b/plugins/Poll/templates/poll/newpoll.html.twig similarity index 100% rename from templates/poll/newpoll.html.twig rename to plugins/Poll/templates/poll/newpoll.html.twig diff --git a/plugins/Poll/templates/poll/respondpoll.html.twig b/plugins/Poll/templates/poll/respondpoll.html.twig new file mode 100644 index 0000000000..4aa1af2abf --- /dev/null +++ b/plugins/Poll/templates/poll/respondpoll.html.twig @@ -0,0 +1,18 @@ +{% extends 'stdgrid.html.twig' %} + +{% block title %}Poll{% endblock %} + +{% block body %} +
+
+

Q. {{ question }}

+ {% block form %} +
+ {{ form(form) }} +
+ {% endblock form %} +
+
+{% endblock body %} + +{% block javascripts %}{% endblock %} \ No newline at end of file diff --git a/templates/poll/showpoll.html.twig b/plugins/Poll/templates/poll/showpoll.html.twig similarity index 100% rename from templates/poll/showpoll.html.twig rename to plugins/Poll/templates/poll/showpoll.html.twig diff --git a/templates/poll/view.html.twig b/plugins/Poll/templates/poll/view.html.twig similarity index 100% rename from templates/poll/view.html.twig rename to plugins/Poll/templates/poll/view.html.twig diff --git a/plugins/ProfileColor/Controller/ProfileColor.php b/plugins/ProfileColor/Controller/ProfileColor.php index c7ef4b10bc..1ee8ca1930 100644 --- a/plugins/ProfileColor/Controller/ProfileColor.php +++ b/plugins/ProfileColor/Controller/ProfileColor.php @@ -60,7 +60,7 @@ class ProfileColor $pcolor = DB::find('profile_color', ['actor_id' => $actor_id]); $color = '#000000'; if ($pcolor != null) { - $color = $pcolor->getColor(); + $color = $pcolor; } $form = Form::create([ @@ -73,17 +73,17 @@ class ProfileColor if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); - if ($pcolor != null) { + if ($pcolor !== null) { DB::remove($pcolor); DB::flush(); } - $pcolor = Entity\ProfileColor::create(['actor_id' => $actor_id, 'color' => $data['color']]); + $pcolor = Entity\ProfileColor::create(['actor_id' => $actor_id, 'profile_color' => $data['color']]); DB::persist($pcolor); DB::flush(); throw new RedirectException(); } - return ['_template' => 'profilecolor/profilecolor.html.twig', 'form' => $form->createView()]; + return ['_template' => 'profileColor/profileColorSettings.html.twig', 'form' => $form->createView()]; } } diff --git a/plugins/ProfileColor/ProfileColor.php b/plugins/ProfileColor/ProfileColor.php index efb7478bb1..f13b1245a7 100644 --- a/plugins/ProfileColor/ProfileColor.php +++ b/plugins/ProfileColor/ProfileColor.php @@ -25,6 +25,7 @@ use App\Core\Event; use App\Core\Modules\Plugin; use App\Core\Router\RouteLoader; use App\Util\Common; +use App\Util\Formatting; use Plugin\ProfileColor\Controller as C; use Symfony\Component\HttpFoundation\Request; @@ -65,39 +66,26 @@ class ProfileColor extends Plugin 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['profile_tabs'][] = [ - * 'title' => 'Color', - * 'desc' => 'Change your profile color.', - * 'path' => 'profilecolor/profilecolor.html.twig', - * ]; - * if (Common::user() != null) { - * $color = DB::find('profile_color', ['actor_id' => Common::user()->getId()]); - * if ($color != null) { - * $vars['profile_extras'][] = ['name' => 'profilecolor', 'vars' => ['color' => $color->getColor()]]; - * } - * } - * return Event::next; - * }*/ /** - * Output our dedicated stylesheet + * Renders profileColorView, which changes the background color of that profile. * - * @param array $styles stylesheets path - * - * @return bool hook value; true means continue processing, false means stop. + * @param $vars + * @param $res + * @return bool */ - public function onStartShowStyles(array &$styles): bool + public function onAppendCardProfile(&$res): bool { - $styles[] = 'profilecolor/profilecolor.css'; + $user = Common::user(); + if ($user !== null) { + $actor_id = $user->getId(); + + $color = DB::find('profile_color', ['actor_id' => $actor_id]); + if ($color !== null) { + $res[] = Formatting::twigRenderFile('/profileColor/profileColorView.html.twig', ['profile' => $color]); + } + } + return Event::next; } } diff --git a/templates/profilecolor/profilecolor.html.twig b/plugins/ProfileColor/templates/profileColor/profileColorSettings.html.twig similarity index 100% rename from templates/profilecolor/profilecolor.html.twig rename to plugins/ProfileColor/templates/profileColor/profileColorSettings.html.twig diff --git a/plugins/ProfileColor/templates/profileColor/profileColorView.html.twig b/plugins/ProfileColor/templates/profileColor/profileColorView.html.twig new file mode 100644 index 0000000000..ea62f678ac --- /dev/null +++ b/plugins/ProfileColor/templates/profileColor/profileColorView.html.twig @@ -0,0 +1,7 @@ +{% block stylesheets %} + +{% endblock stylesheets %} \ No newline at end of file diff --git a/public/assets/css/left/left.css b/public/assets/css/left/view.css similarity index 100% rename from public/assets/css/left/left.css rename to public/assets/css/left/view.css diff --git a/public/assets/css/profilecolor/profilecolor.css b/public/assets/css/profilecolor/profilecolor.css deleted file mode 100644 index 920478f021..0000000000 --- a/public/assets/css/profilecolor/profilecolor.css +++ /dev/null @@ -1,16 +0,0 @@ -.pcolor { - width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 0; - z-index: -1; -} - -.profile-color { - width: 100%; - height: 100%; - background-color: transparent; - box-sizing: border-box; - border: 5px solid; -} diff --git a/public/assets/css/right/right.css b/public/assets/css/right/view.css similarity index 100% rename from public/assets/css/right/right.css rename to public/assets/css/right/view.css diff --git a/public/assets/css/settings/settings.css b/public/assets/css/settings/view.css similarity index 100% rename from public/assets/css/settings/settings.css rename to public/assets/css/settings/view.css diff --git a/templates/cards/profile/view.html.twig b/templates/cards/profile/view.html.twig index 8c2f787b83..2b300b084c 100644 --- a/templates/cards/profile/view.html.twig +++ b/templates/cards/profile/view.html.twig @@ -34,6 +34,10 @@ {{ '(No tags)' | trans }} {% endif %} + + {% for block in handle_event('AppendCardProfile') %} + {{ block | raw }} + {% endfor %}
diff --git a/templates/sidepanel/left/left.html.twig b/templates/left/view.html.twig similarity index 84% rename from templates/sidepanel/left/left.html.twig rename to templates/left/view.html.twig index 7f03d7e12e..b931f0b41f 100644 --- a/templates/sidepanel/left/left.html.twig +++ b/templates/left/view.html.twig @@ -1,3 +1,8 @@ +{% block stylesheets %} + +{% endblock stylesheets %} + +{% block leftpanel %}
@@ -17,4 +22,5 @@ {{ block("footer", "cards/navigation/view.html.twig") }} -
\ No newline at end of file + +{% endblock leftpanel %} diff --git a/templates/poll/respondpoll.html.twig b/templates/poll/respondpoll.html.twig deleted file mode 100644 index 2d111b8d8b..0000000000 --- a/templates/poll/respondpoll.html.twig +++ /dev/null @@ -1,40 +0,0 @@ -{% extends 'stdgrid.html.twig' %} - -{% block meta %} - {{ parent() }} -{% endblock %} - -{% block title %}Poll{% endblock %} - -{% block stylesheets %} - {{ parent() }} - - - -{% endblock %} - -{% block header %} - {{ parent() }} -{% endblock %} - -{% block left %} - {{ parent() }} -{% endblock %} - -{% block body %} -
-
-

Q. {{ question }}

- {% block form %} -
- {{ form(form) }} -
- {% endblock form %} -
-
-{% endblock body %} - -{% block javascripts %}{% endblock %} \ No newline at end of file diff --git a/templates/profilecolor/view.html.twig b/templates/profilecolor/view.html.twig deleted file mode 100644 index 1b0e35bb6c..0000000000 --- a/templates/profilecolor/view.html.twig +++ /dev/null @@ -1,5 +0,0 @@ - - {% if vars is not empty %} -
- {% endif %} -
\ No newline at end of file diff --git a/templates/sidepanel/right/right.html.twig b/templates/right/view.html.twig similarity index 92% rename from templates/sidepanel/right/right.html.twig rename to templates/right/view.html.twig index af559a7caf..5b31d94986 100644 --- a/templates/sidepanel/right/right.html.twig +++ b/templates/right/view.html.twig @@ -1,3 +1,8 @@ +{% block stylesheets %} + +{% endblock stylesheets %} + +{% block rightpanel %}
@@ -51,3 +56,4 @@
+{% endblock rightpanel %} diff --git a/templates/settings/base.html.twig b/templates/settings/base.html.twig index b1064668dc..a457085fff 100644 --- a/templates/settings/base.html.twig +++ b/templates/settings/base.html.twig @@ -9,7 +9,7 @@ {% block stylesheets %} {{ parent() }} - + {% endblock %} {% block header %} diff --git a/templates/sidepanel/left/left_stylesheets.html.twig b/templates/sidepanel/left/left_stylesheets.html.twig deleted file mode 100644 index 864db12501..0000000000 --- a/templates/sidepanel/left/left_stylesheets.html.twig +++ /dev/null @@ -1 +0,0 @@ - diff --git a/templates/sidepanel/right/right_stylesheets.html.twig b/templates/sidepanel/right/right_stylesheets.html.twig deleted file mode 100644 index b0e45b90a7..0000000000 --- a/templates/sidepanel/right/right_stylesheets.html.twig +++ /dev/null @@ -1 +0,0 @@ - diff --git a/templates/stdgrid.html.twig b/templates/stdgrid.html.twig index 2083dbfc2a..00b0567f2a 100644 --- a/templates/stdgrid.html.twig +++ b/templates/stdgrid.html.twig @@ -1,12 +1,15 @@ {% extends '/base.html.twig' %} + {% block stylesheets %} {{ parent() }} - {% include '/sidepanel/left/left_stylesheets.html.twig' %} - {% include '/sidepanel/right/right_stylesheets.html.twig' %} + {{ block("stylesheets", "/left/view.html.twig") }} + {{ block("stylesheets", "/right/view.html.twig") }} {% endblock %} + {% block leftpanel %} - {% include '/sidepanel/left/left.html.twig' %} + {% include '/left/view.html.twig' %} {% endblock %} + {% block rightpanel %} - {% include '/sidepanel/right/right.html.twig' %} + {% include '/right/view.html.twig' %} {% endblock %} \ No newline at end of file