Browse Source

[PLUGINS][ProfileColor] Re-organized plugins templates and assets. ProfileColor plugin fixed.

remotes/upstream/experimental
Eliseu Amaro 8 months ago
parent
commit
57b94af9f6
28 changed files with 72 additions and 103 deletions
  1. +0
    -0
      plugins/Cover/css/cover/cover.css
  2. +0
    -0
      plugins/Cover/templates/cover/cover.html.twig
  3. +0
    -0
      plugins/Cover/templates/cover/view.html.twig
  4. +0
    -0
      plugins/Directory/css/directory/actors.css
  5. +0
    -0
      plugins/Directory/css/directory/groups.css
  6. +1
    -1
      plugins/Poll/Controller/AnswerPoll.php
  7. +1
    -1
      plugins/Poll/Controller/NewPoll.php
  8. +0
    -0
      plugins/Poll/templates/poll/newpoll.html.twig
  9. +18
    -0
      plugins/Poll/templates/poll/respondpoll.html.twig
  10. +0
    -0
      plugins/Poll/templates/poll/showpoll.html.twig
  11. +0
    -0
      plugins/Poll/templates/poll/view.html.twig
  12. +4
    -4
      plugins/ProfileColor/Controller/ProfileColor.php
  13. +16
    -28
      plugins/ProfileColor/ProfileColor.php
  14. +0
    -0
      plugins/ProfileColor/templates/profileColor/profileColorSettings.html.twig
  15. +7
    -0
      plugins/ProfileColor/templates/profileColor/profileColorView.html.twig
  16. +0
    -0
      public/assets/css/left/view.css
  17. +0
    -16
      public/assets/css/profilecolor/profilecolor.css
  18. +0
    -0
      public/assets/css/right/view.css
  19. +0
    -0
      public/assets/css/settings/view.css
  20. +4
    -0
      templates/cards/profile/view.html.twig
  21. +7
    -1
      templates/left/view.html.twig
  22. +0
    -40
      templates/poll/respondpoll.html.twig
  23. +0
    -5
      templates/profilecolor/view.html.twig
  24. +6
    -0
      templates/right/view.html.twig
  25. +1
    -1
      templates/settings/base.html.twig
  26. +0
    -1
      templates/sidepanel/left/left_stylesheets.html.twig
  27. +0
    -1
      templates/sidepanel/right/right_stylesheets.html.twig
  28. +7
    -4
      templates/stdgrid.html.twig

public/assets/css/cover/cover.css → plugins/Cover/css/cover/cover.css View File


templates/cover/cover.html.twig → plugins/Cover/templates/cover/cover.html.twig View File


templates/cover/view.html.twig → plugins/Cover/templates/cover/view.html.twig View File


public/assets/css/directory/actors.css → plugins/Directory/css/directory/actors.css View File


public/assets/css/directory/groups.css → plugins/Directory/css/directory/groups.css View File


+ 1
- 1
plugins/Poll/Controller/AnswerPoll.php View File

@@ -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()];
}
}

+ 1
- 1
plugins/Poll/Controller/NewPoll.php View File

@@ -101,6 +101,6 @@ class NewPoll
}
}

return ['_template' => 'Poll/newpoll.html.twig', 'form' => $form->createView()];
return ['_template' => 'poll/newpoll.html.twig', 'form' => $form->createView()];
}
}

templates/poll/newpoll.html.twig → plugins/Poll/templates/poll/newpoll.html.twig View File


+ 18
- 0
plugins/Poll/templates/poll/respondpoll.html.twig View File

@@ -0,0 +1,18 @@
{% extends 'stdgrid.html.twig' %}

{% block title %}Poll{% endblock %}

{% block body %}
<div class="content">
<div class="poll">
<p class="poll-question">Q. {{ question }}</p>
{% block form %}
<div class='form-single'>
{{ form(form) }}
</div>
{% endblock form %}
</div>
</div>
{% endblock body %}

{% block javascripts %}{% endblock %}

templates/poll/showpoll.html.twig → plugins/Poll/templates/poll/showpoll.html.twig View File


templates/poll/view.html.twig → plugins/Poll/templates/poll/view.html.twig View File


+ 4
- 4
plugins/ProfileColor/Controller/ProfileColor.php View File

@@ -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()];
}
}

+ 16
- 28
plugins/ProfileColor/ProfileColor.php View File

@@ -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;
}
}

templates/profilecolor/profilecolor.html.twig → plugins/ProfileColor/templates/profileColor/profileColorSettings.html.twig View File


+ 7
- 0
plugins/ProfileColor/templates/profileColor/profileColorView.html.twig View File

@@ -0,0 +1,7 @@
{% block stylesheets %}
<style>
.profile {
background: {{ profile.color }} !important;
}
</style>
{% endblock stylesheets %}

public/assets/css/left/left.css → public/assets/css/left/view.css View File


+ 0
- 16
public/assets/css/profilecolor/profilecolor.css View File

@@ -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;
}

public/assets/css/right/right.css → public/assets/css/right/view.css View File


public/assets/css/settings/settings.css → public/assets/css/settings/view.css View File


+ 4
- 0
templates/cards/profile/view.html.twig View File

@@ -34,6 +34,10 @@
{{ '(No tags)' | trans }}
{% endif %}
</nav>

{% for block in handle_event('AppendCardProfile') %}
{{ block | raw }}
{% endfor %}
</section>

<hr>


templates/sidepanel/left/left.html.twig → templates/left/view.html.twig View File

@@ -1,3 +1,8 @@
{% block stylesheets %}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/left/view.css') }}">
{% endblock stylesheets %}

{% block leftpanel %}
<div class="panel panel-left">
<input type="checkbox" id="panel-left-toggle" aria-hidden="true" tabindex="-1">
<label id="panel-left-icon" for="panel-left-toggle" aria-hidden="true" tabindex="-1">{{ icon('menu', 'icon icon-left') | raw }}</label>
@@ -17,4 +22,5 @@

{{ block("footer", "cards/navigation/view.html.twig") }}
</aside>
</div>
</div>
{% endblock leftpanel %}

+ 0
- 40
templates/poll/respondpoll.html.twig View File

@@ -1,40 +0,0 @@
{% extends 'stdgrid.html.twig' %}

{% block meta %}
{{ parent() }}
{% endblock %}

{% block title %}Poll{% endblock %}

{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/network/public.css') }}"
media="screen and (min-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/network/public_mid.css') }}"
media="screen and (max-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/network/public_small.css') }}"
media="screen and (max-width: 750px)">
{% endblock %}

{% block header %}
{{ parent() }}
{% endblock %}

{% block left %}
{{ parent() }}
{% endblock %}

{% block body %}
<div class="content">
<div class="poll">
<p class="poll-question">Q. {{ question }}</p>
{% block form %}
<div class='form-single'>
{{ form(form) }}
</div>
{% endblock form %}
</div>
</div>
{% endblock body %}

{% block javascripts %}{% endblock %}

+ 0
- 5
templates/profilecolor/view.html.twig View File

@@ -1,5 +0,0 @@
<a class="pcolor">
{% if vars is not empty %}
<div class="profile-color" style="border-color: {{ vars.color }}"></div>
{% endif %}
</a>

templates/sidepanel/right/right.html.twig → templates/right/view.html.twig View File

@@ -1,3 +1,8 @@
{% block stylesheets %}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/right/view.css') }}">
{% endblock stylesheets %}

{% block rightpanel %}
<div class="panel panel-right">
<input type="checkbox" id="panel-right-toggle" aria-hidden="true" tabindex="-1">
<label id="panel-right-icon" for="panel-right-toggle" aria-hidden="true" tabindex="-1">{{ icon('notes', 'icon icon-right') | raw }}</label>
@@ -51,3 +56,4 @@

</aside>
</div>
{% endblock rightpanel %}

+ 1
- 1
templates/settings/base.html.twig View File

@@ -9,7 +9,7 @@

{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings.css') }}">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/view.css') }}">
{% endblock %}

{% block header %}


+ 0
- 1
templates/sidepanel/left/left_stylesheets.html.twig View File

@@ -1 +0,0 @@
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/left/left.css') }}">

+ 0
- 1
templates/sidepanel/right/right_stylesheets.html.twig View File

@@ -1 +0,0 @@
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/right/right.css') }}">

+ 7
- 4
templates/stdgrid.html.twig View File

@@ -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 %}

Loading…
Cancel
Save