markdown bbcode and new ranks page
This commit is contained in:
parent
76d9502d57
commit
0a7ef4f87a
8 changed files with 165 additions and 52 deletions
|
@ -48,6 +48,7 @@ class Parser
|
|||
Tags\Code::class,
|
||||
Tags\ListTag::class,
|
||||
Tags\User::class,
|
||||
Tags\Markdown::class,
|
||||
|
||||
// Newline must always be last
|
||||
Tags\Newline::class,
|
||||
|
|
49
app/BBCode/Tags/Markdown.php
Normal file
49
app/BBCode/Tags/Markdown.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* Markdown.
|
||||
* @package Sakura
|
||||
*/
|
||||
|
||||
namespace Sakura\BBCode\Tags;
|
||||
|
||||
use Parsedown;
|
||||
use Sakura\BBCode\TagBase;
|
||||
|
||||
/**
|
||||
* Markdown!
|
||||
* @package Sakura
|
||||
* @author Julian van de Groep <me@flash.moe>
|
||||
*/
|
||||
class Markdown extends TagBase
|
||||
{
|
||||
/**
|
||||
* Contains the parser.
|
||||
* @var Parsedown
|
||||
*/
|
||||
private static $parser = null;
|
||||
|
||||
/**
|
||||
* Parses the bbcode.
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
public static function parse($text)
|
||||
{
|
||||
return preg_replace_callback(
|
||||
'/\[md\](.*?)\[\/md\]/s',
|
||||
function ($matches) {
|
||||
if (self::$parser === null) {
|
||||
self::$parser = new Parsedown;
|
||||
}
|
||||
|
||||
$parsed = self::$parser
|
||||
->setBreaksEnabled(false)
|
||||
->setMarkupEscaped(true)
|
||||
->text($matches[1]);
|
||||
|
||||
return "<div class='markdown'>{$parsed}</div>";
|
||||
},
|
||||
$text
|
||||
);
|
||||
}
|
||||
}
|
|
@ -54,9 +54,6 @@ class Controller extends BaseController
|
|||
$nav["Friends"]["Requests"] = route('settings.friends.requests');
|
||||
}
|
||||
|
||||
// Notifications
|
||||
$nav["Notifications"]["History"] = route('settings.notifications.history');
|
||||
|
||||
// Appearance
|
||||
if (CurrentSession::$user->permission(Site::CHANGE_AVATAR)) {
|
||||
$nav["Appearance"]["Avatar"] = route('settings.appearance.avatar');
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
"nesbot/carbon": "^1.21",
|
||||
"swiftmailer/swiftmailer": "^5.4",
|
||||
"corneltek/cliframework": "^3.0",
|
||||
"illuminate/filesystem": "^5.2"
|
||||
"illuminate/filesystem": "^5.2",
|
||||
"erusev/parsedown": "^1.6"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
|
43
composer.lock
generated
43
composer.lock
generated
|
@ -4,8 +4,8 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "54f46a3b04683e9c4a3a7e8ecda23612",
|
||||
"content-hash": "82a4dc685e1ed81d5b76869d9946899f",
|
||||
"hash": "b52ed9a48bc73bde0940da07200c9f92",
|
||||
"content-hash": "ee30eebf11e0d54fe7b19abbd4f134ea",
|
||||
"packages": [
|
||||
{
|
||||
"name": "corneltek/class-template",
|
||||
|
@ -725,6 +725,45 @@
|
|||
],
|
||||
"time": "2014-09-09 13:34:57"
|
||||
},
|
||||
{
|
||||
"name": "erusev/parsedown",
|
||||
"version": "1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/erusev/parsedown.git",
|
||||
"reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
|
||||
"reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Parsedown": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Emanuil Rusev",
|
||||
"email": "hello@erusev.com",
|
||||
"homepage": "http://erusev.com"
|
||||
}
|
||||
],
|
||||
"description": "Parser for Markdown.",
|
||||
"homepage": "http://parsedown.org",
|
||||
"keywords": [
|
||||
"markdown",
|
||||
"parser"
|
||||
],
|
||||
"time": "2015-10-04 16:44:32"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/container",
|
||||
"version": "v5.2.37",
|
||||
|
|
|
@ -1689,7 +1689,17 @@ a.default:active {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.settings .friends-list > div:not(:last-child) {
|
||||
.settings .friends-list button {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.settings .friends-list > div:not(:last-child),
|
||||
.settings .friends-list > form {
|
||||
display: inline-block;
|
||||
border: 1px solid #9475B2;
|
||||
text-align: center;
|
||||
|
@ -1701,28 +1711,42 @@ a.default:active {
|
|||
transition: background .2s, box-shadow .2s;
|
||||
}
|
||||
|
||||
.settings .friends-list > div:not(:last-child):hover {
|
||||
.settings .friends-list > div:not(:last-child):hover,
|
||||
.settings .friends-list > form:hover {
|
||||
margin-bottom: 6px;
|
||||
background: #C2AFFE;
|
||||
box-shadow: inset 0 0 2px #9475B2;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-data {
|
||||
.settings .friends-list > form:hover {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.settings .friends-list > .active {
|
||||
background: #C2AFFE;
|
||||
box-shadow: inset 0 0 2px #9475B2;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-data,
|
||||
.settings .friends-list > form > .friends-list-data {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-data > .friends-list-name {
|
||||
.settings .friends-list > div > .friends-list-data > .friends-list-name,
|
||||
.settings .friends-list > form > .friends-list-data > .friends-list-name {
|
||||
font-size: 1.2em;
|
||||
line-height: 1.5em;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions {
|
||||
.settings .friends-list > div > .friends-list-actions,
|
||||
.settings .friends-list > form > .friends-list-actions {
|
||||
display: none;
|
||||
background: linear-gradient(0deg, #9475B2, transparent) transparent;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions > a {
|
||||
.settings .friends-list > div > .friends-list-actions > a,
|
||||
.settings .friends-list > form > .friends-list-actions > button {
|
||||
color: #222;
|
||||
font-size: 2em;
|
||||
line-height: 1em;
|
||||
|
@ -1732,31 +1756,38 @@ a.default:active {
|
|||
float: left;
|
||||
}
|
||||
|
||||
.settings .friends-list > div:hover > .friends-list-actions {
|
||||
.settings .friends-list > div:hover > .friends-list-actions,
|
||||
.settings .friends-list > form:hover > .friends-list-actions {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions > .remove:hover {
|
||||
.settings .friends-list > div > .friends-list-actions > .remove:hover,
|
||||
.settings .friends-list > form > .friends-list-actions > .remove:hover {
|
||||
color: #D00;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions > .remove:active {
|
||||
.settings .friends-list > div > .friends-list-actions > .remove:active,
|
||||
.settings .friends-list > form > .friends-list-actions > .remove:active {
|
||||
color: #A00;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions > .add:hover {
|
||||
.settings .friends-list > div > .friends-list-actions > .add:hover,
|
||||
.settings .friends-list > form > .friends-list-actions > .add:hover {
|
||||
color: #0D0;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions > .add:active {
|
||||
.settings .friends-list > div > .friends-list-actions > .add:active,
|
||||
.settings .friends-list > form > .friends-list-actions > .add:active {
|
||||
color: #0A0;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions > a {
|
||||
.settings .friends-list > div > .friends-list-actions > a,
|
||||
.settings .friends-list > form > .friends-list-actions > button {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions > .fill {
|
||||
.settings .friends-list > div > .friends-list-actions > .fill,
|
||||
.settings .friends-list > form > .friends-list-actions > .fill {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
@ -1766,7 +1797,12 @@ a.default:active {
|
|||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions {
|
||||
.settings .friends-list > form {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.settings .friends-list > div > .friends-list-actions,
|
||||
.settings .friends-list > form > .friends-list-actions {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,23 +7,19 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block settingsContent %}
|
||||
<table class="settings-table">
|
||||
<tbody>
|
||||
<div class="friends-list">
|
||||
{% for rank in user.ranks %}
|
||||
<tr {% if rank.id == user.mainRankId %} class="current-session" {% endif %}>
|
||||
<td style="font-weight: bold; color: {{ rank.colour }}; text-shadow: 0 0 7px {{ rank.colour }}; text-align: left;">
|
||||
<a href="{{ route('members.rank', rank.id) }}" class="clean">{{ rank.name }}</a>
|
||||
</td>
|
||||
<td style="width: 90px;">
|
||||
<form method="post" action="{{ route('settings.account.ranks') }}">
|
||||
<form method="post" action="{{ route('settings.account.ranks') }}" class="friend-container {% if rank.id == user.mainRankId %}active{% endif %}">
|
||||
<input type="hidden" name="session" value="{{ session_id() }}">
|
||||
<input type="hidden" name="rank" value="{{ rank.id }}">
|
||||
<button class="inputStyling small" name="mode" value="main">Set as main</button>
|
||||
<button class="inputStyling small" name="mode" value="remove" {% if rank.id in locked %}disabled="disabled"{% endif %}>Remove</button>
|
||||
<button class="friends-list-data clean" name="mode" value="main">
|
||||
<div class="friends-list-name" style="color: {{ rank.colour }};">{{ rank.name }}</div>
|
||||
</button>
|
||||
<div class="friends-list-actions">
|
||||
<button title="{% if rank.id in locked %}You can't leave this rank{% else %}Leave rank{% endif %}" class="remove fill fa fa-{% if rank.id in locked %}shield{% else %}remove{% endif %}" name="mode" value="remove" {% if rank.id in locked %}disabled{% endif %}></button>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
20
routes.php
20
routes.php
|
@ -9,22 +9,18 @@ namespace Sakura;
|
|||
// Check if logged out
|
||||
Router::filter('logoutCheck', function () {
|
||||
if (CurrentSession::$user->isActive()) {
|
||||
$message = "You must be logged out to do that!";
|
||||
|
||||
Template::vars(compact('message'));
|
||||
|
||||
return Template::render('global/information');
|
||||
return view('global/information', [
|
||||
'message' => "You must be logged out to do that!",
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
// Check if logged in
|
||||
Router::filter('loginCheck', function () {
|
||||
if (!CurrentSession::$user->isActive()) {
|
||||
$message = "You must be logged in to do that!";
|
||||
|
||||
Template::vars(compact('message'));
|
||||
|
||||
return Template::render('global/information');
|
||||
return view('global/information', [
|
||||
'message' => "You must be logged in to do that!",
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -32,10 +28,8 @@ Router::filter('loginCheck', function () {
|
|||
Router::filter('maintenance', function () {
|
||||
if (config('general.maintenance')) {
|
||||
CurrentSession::stop();
|
||||
|
||||
http_response_code(503);
|
||||
|
||||
return Template::render('global/maintenance');
|
||||
return view('global/maintenance');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Reference in a new issue