forked from GNUsocial/gnu-social
[PLUGINS][ProfileColor] Re-organized plugins templates and assets. ProfileColor plugin fixed.
This commit is contained in:
parent
765cf66ff2
commit
57b94af9f6
@ -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()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,6 @@ class NewPoll
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['_template' => 'Poll/newpoll.html.twig', 'form' => $form->createView()];
|
return ['_template' => 'poll/newpoll.html.twig', 'form' => $form->createView()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
plugins/Poll/templates/poll/respondpoll.html.twig
Normal file
18
plugins/Poll/templates/poll/respondpoll.html.twig
Normal 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 %}
|
@ -60,7 +60,7 @@ class ProfileColor
|
|||||||
$pcolor = DB::find('profile_color', ['actor_id' => $actor_id]);
|
$pcolor = DB::find('profile_color', ['actor_id' => $actor_id]);
|
||||||
$color = '#000000';
|
$color = '#000000';
|
||||||
if ($pcolor != null) {
|
if ($pcolor != null) {
|
||||||
$color = $pcolor->getColor();
|
$color = $pcolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = Form::create([
|
$form = Form::create([
|
||||||
@ -73,17 +73,17 @@ class ProfileColor
|
|||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
|
|
||||||
if ($pcolor != null) {
|
if ($pcolor !== null) {
|
||||||
DB::remove($pcolor);
|
DB::remove($pcolor);
|
||||||
DB::flush();
|
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::persist($pcolor);
|
||||||
DB::flush();
|
DB::flush();
|
||||||
throw new RedirectException();
|
throw new RedirectException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['_template' => 'profilecolor/profilecolor.html.twig', 'form' => $form->createView()];
|
return ['_template' => 'profileColor/profileColorSettings.html.twig', 'form' => $form->createView()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ use App\Core\Event;
|
|||||||
use App\Core\Modules\Plugin;
|
use App\Core\Modules\Plugin;
|
||||||
use App\Core\Router\RouteLoader;
|
use App\Core\Router\RouteLoader;
|
||||||
use App\Util\Common;
|
use App\Util\Common;
|
||||||
|
use App\Util\Formatting;
|
||||||
use Plugin\ProfileColor\Controller as C;
|
use Plugin\ProfileColor\Controller as C;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
@ -65,39 +66,26 @@ class ProfileColor extends Plugin
|
|||||||
return Event::next;
|
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
|
* @param $vars
|
||||||
*
|
* @param $res
|
||||||
* @return bool hook value; true means continue processing, false means stop.
|
* @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;
|
return Event::next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
{% block stylesheets %}
|
||||||
|
<style>
|
||||||
|
.profile {
|
||||||
|
background: {{ profile.color }} !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock stylesheets %}
|
@ -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;
|
|
||||||
}
|
|
@ -34,6 +34,10 @@
|
|||||||
{{ '(No tags)' | trans }}
|
{{ '(No tags)' | trans }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
{% for block in handle_event('AppendCardProfile') %}
|
||||||
|
{{ block | raw }}
|
||||||
|
{% endfor %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -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">
|
<div class="panel panel-left">
|
||||||
<input type="checkbox" id="panel-left-toggle" aria-hidden="true" tabindex="-1">
|
<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>
|
<label id="panel-left-icon" for="panel-left-toggle" aria-hidden="true" tabindex="-1">{{ icon('menu', 'icon icon-left') | raw }}</label>
|
||||||
@ -18,3 +23,4 @@
|
|||||||
{{ block("footer", "cards/navigation/view.html.twig") }}
|
{{ block("footer", "cards/navigation/view.html.twig") }}
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock leftpanel %}
|
@ -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 %}
|
|
@ -1,5 +0,0 @@
|
|||||||
<a class="pcolor">
|
|
||||||
{% if vars is not empty %}
|
|
||||||
<div class="profile-color" style="border-color: {{ vars.color }}"></div>
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
|
@ -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">
|
<div class="panel panel-right">
|
||||||
<input type="checkbox" id="panel-right-toggle" aria-hidden="true" tabindex="-1">
|
<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>
|
<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>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock rightpanel %}
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
{{ parent() }}
|
{{ 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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/left/left.css') }}">
|
|
@ -1 +0,0 @@
|
|||||||
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/right/right.css') }}">
|
|
@ -1,12 +1,15 @@
|
|||||||
{% extends '/base.html.twig' %}
|
{% extends '/base.html.twig' %}
|
||||||
|
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{% include '/sidepanel/left/left_stylesheets.html.twig' %}
|
{{ block("stylesheets", "/left/view.html.twig") }}
|
||||||
{% include '/sidepanel/right/right_stylesheets.html.twig' %}
|
{{ block("stylesheets", "/right/view.html.twig") }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block leftpanel %}
|
{% block leftpanel %}
|
||||||
{% include '/sidepanel/left/left.html.twig' %}
|
{% include '/left/view.html.twig' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block rightpanel %}
|
{% block rightpanel %}
|
||||||
{% include '/sidepanel/right/right.html.twig' %}
|
{% include '/right/view.html.twig' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user