[UI][TWIG] Fixing note actions placement and size, more descriptive rules
This commit is contained in:
parent
26f01c4c92
commit
a9d5f8ac5b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -167,14 +167,14 @@
|
||||
filter: invert(91%) sepia(3%) saturate(350%) hue-rotate(162deg) brightness(106%) contrast(92%);
|
||||
stroke: none;
|
||||
}
|
||||
#form > div {
|
||||
#repeat div,
|
||||
#favourite div {
|
||||
width: var(--main-size);
|
||||
height: var(--main-size);
|
||||
display: flex;
|
||||
margin-left: var(--unit-size);
|
||||
|
||||
}
|
||||
#form_repeat {
|
||||
#repeat_repeat {
|
||||
cursor: pointer;
|
||||
border: none !important;
|
||||
background-color: transparent;
|
||||
@ -184,7 +184,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#form_favourite {
|
||||
#favourite_favourite {
|
||||
cursor: pointer;
|
||||
border: none !important;
|
||||
background-color: transparent;
|
||||
|
32
src/Core/NoteScope.php
Normal file
32
src/Core/NoteScope.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
use App\Util\Bitmap;
|
||||
|
||||
abstract class NoteScope extends Bitmap
|
||||
{
|
||||
public const PUBLIC = 1;
|
||||
public const SITE = 2;
|
||||
public const ADDRESSEE = 4;
|
||||
public const GROUP = 8;
|
||||
public const FOLLOWER = 16;
|
||||
public const MESSAGE = 32;
|
||||
}
|
@ -17,8 +17,6 @@
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
/**
|
||||
* User role enum
|
||||
*
|
||||
@ -29,33 +27,17 @@ namespace App\Core;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
abstract class UserRoles
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
use App\Util\Bitmap;
|
||||
|
||||
abstract class UserRoles extends Bitmap
|
||||
{
|
||||
public const ADMIN = 1;
|
||||
public const MODERATOR = 2;
|
||||
public const USER = 4;
|
||||
public const BOT = 8;
|
||||
|
||||
public static $consts = null;
|
||||
|
||||
public static function bitmapToStrings(int $r): array
|
||||
{
|
||||
$roles = [];
|
||||
if (self::$consts == null) {
|
||||
self::$consts = (new \ReflectionClass(__CLASS__))->getConstants();
|
||||
}
|
||||
|
||||
foreach (self::$consts as $c => $v) {
|
||||
if (($r & $v) !== 0) {
|
||||
$r -= $v;
|
||||
$roles[] = "ROLE_{$c}";
|
||||
}
|
||||
}
|
||||
|
||||
if ($r != 0) {
|
||||
Log::error('User roles bitmap to array failed');
|
||||
}
|
||||
|
||||
return $roles;
|
||||
}
|
||||
public const PREFIX = 'ROLE_';
|
||||
}
|
||||
|
52
src/Util/Bitmap.php
Normal file
52
src/Util/Bitmap.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Util;
|
||||
|
||||
use App\Util\Exception\ServerException;
|
||||
|
||||
abstract class Bitmap
|
||||
{
|
||||
public static $consts = null;
|
||||
|
||||
public static function bitmapToStrings(int $r): array
|
||||
{
|
||||
$init = $r;
|
||||
$class = get_called_class();
|
||||
$vals = [];
|
||||
if (self::$consts == null) {
|
||||
self::$consts = (new \ReflectionClass($class))->getConstants();
|
||||
unset(self::$consts['PREFIX']);
|
||||
}
|
||||
|
||||
foreach (self::$consts as $c => $v) {
|
||||
if (($r & $v) !== 0) {
|
||||
$r -= $v;
|
||||
$vals[] = $class::PREFIX . $c;
|
||||
}
|
||||
}
|
||||
|
||||
if ($r != 0) {
|
||||
Log::error('Bitmap to array conversion failed');
|
||||
throw new ServerException("Bug in bitmap conversion for class {$class} from value {$init}");
|
||||
}
|
||||
|
||||
return $vals;
|
||||
}
|
||||
}
|
@ -15,11 +15,7 @@
|
||||
</div>
|
||||
<div class="note-actions">
|
||||
{% for act in get_note_actions(note) %}
|
||||
{{ form_start(act) }}
|
||||
<div>
|
||||
{{ form_widget(act) }}
|
||||
</div>
|
||||
{{ form_end(act) }}
|
||||
{{ form(act) }}
|
||||
{% endfor %}
|
||||
<a href="{{ path('note_reply', {'reply_to': note.getId()}) }}">
|
||||
<svg class="icon icon-reply">
|
||||
|
Loading…
Reference in New Issue
Block a user