fixed changelog (mainly)

This commit is contained in:
flash 2016-04-09 03:59:54 +02:00
parent f9c08bf405
commit 73dd366e69
5 changed files with 134 additions and 62 deletions

View file

@ -33,7 +33,7 @@ class AppearanceController extends Controller
return Template::render('global/information');
}
return $this->go('appearance.avatar');
return Template::render('settings/appearance/avatar');
}
public function background()
@ -48,7 +48,7 @@ class AppearanceController extends Controller
return Template::render('global/information');
}
return $this->go('appearance.background');
return Template::render('settings/appearance/background');
}
public function header()

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', 20160402);
define('SAKURA_VERSION', 20160408);
// Define Sakura Path
define('ROOT', __DIR__ . '/');

View file

@ -261,7 +261,6 @@
}
</script>
{% if config('dev.show_changelog', true) and stats %}
<script type="text/javascript" src="https://sakura.flash.moe/?get=all&amp;limit=5&amp;variable=true"></script>
<script type="text/javascript">
// Column colours for actions
var changelogColours = [
@ -274,9 +273,7 @@
'#C44' // Revert
];
window.addEventListener("load", function () {
// Check if the changelog variable is an object
if(typeof changelog === 'object') {
function yuunoCreateChangelog() {
// Grab the index panel
var _panel = document.getElementById('indexPanel');
@ -300,15 +297,21 @@
var _cltable = document.createElement('table');
_cltable.className = 'panelTable';
_cltable.style.borderSpacing = '0 1px';
_cltable.id = 'yuunoChangelogTable';
// Append it to indexPanel
indexPanel.appendChild(_cltable);
}
function yuunoAddToChangelog(object) {
_cltable = document.getElementById('yuunoChangelogTable');
// Create and append all changelog entries
for (var _s in changelog) {
// Create header
var _hr = document.createElement('tr');
var _hri = document.createElement('td');
// Set data
_hri.appendChild(document.createTextNode(_s));
_hri.appendChild(document.createTextNode(object.date));
_hri.style.background = '#9475b2';
_hri.style.color = '#306';
_hri.style.fontWeight = '700';
@ -319,9 +322,9 @@
_hr.appendChild(_hri);
_cltable.appendChild(_hr);
for (var _e in changelog[_s]) {
for (var _e in object.changes) {
// Reassign _e
_e = changelog[_s][_e];
_e = object.changes[_e];
// Create elements
var _clr = document.createElement('tr');
@ -329,11 +332,11 @@
var _clcm = document.createElement('td');
// Set data
_clca.appendChild(document.createTextNode(_e['change_action']['action_name']));
_clca.style.background = changelogColours[_e['change_action']['action_id']];
_clca.style.borderBottom = '1px solid ' + changelogColours[_e['change_action']['action_id']];
_clcm.style.borderBottom = '1px solid ' + changelogColours[_e['change_action']['action_id']];
_clcm.appendChild(document.createTextNode(_e['change_message']));
_clca.appendChild(document.createTextNode(_e.action.name));
_clca.style.background = changelogColours[_e.action.id];
_clca.style.borderBottom = '1px solid ' + changelogColours[_e.action.id];
_clcm.style.borderBottom = '1px solid ' + changelogColours[_e.action.id];
_clcm.appendChild(document.createTextNode(_e.message));
// Append
_clr.appendChild(_clca);
@ -342,10 +345,25 @@
}
}
// Append it to indexPanel
indexPanel.appendChild(_cltable);
window.addEventListener("load", function () {
yuunoCreateChangelog();
var changelog = {},
fetch = 0,
clg = new AJAX();
clg.addCallback(200, function () {
yuunoAddToChangelog(JSON.parse(clg.response()));
if (fetch < 2) {
fetch++;
clg.setUrl('https://sakura.flash.moe/api.php/' + fetch);
clg.start(HTTPMethods.GET);
}
});
clg.setUrl('https://sakura.flash.moe/api.php/' + fetch);
clg.start(HTTPMethods.GET);
});
</script>
{% endif %}
</body>

View file

@ -0,0 +1,27 @@
{% extends 'settings/appearance/master.twig' %}
{% set mode = 'Avatar' %}
{% block description %}
<p>Maximum image size is {{ config('avatar_max_width') }}x{{ config('avatar_max_height') }}, minimum image size is {{ config('avatar_min_width') }}x{{ config('avatar_min_height') }}, maximum file size is {{ config('avatar_max_fsize')|byte_symbol }}.</p>
{% endblock %}
{% block settingsContent %}
<form enctype="multipart/form-data" method="post" action="{{ route('settings.appearance.avatar') }}">
<input type="hidden" name="MAX_FILE_SIZE" value="{{ config('avatar_max_fsize') }}" />
<div style="text-align: center;">
<div>
<img src="{{ route('file.avatar', user.id) }}" alt="Your Avatar" class="default-avatar-setting" />
</div>
<div>
<input type="file" name="avatar" />
<div style="font-size: .8em;">
(Leave upload box empty to remove avatar)
</div>
</div>
<div>
<button value="{{ session_id() }}" name="session" class="inputStyling">Upload</button>
</div>
</div>
</form>
{% endblock %}

View file

@ -0,0 +1,27 @@
{% extends 'settings/appearance/master.twig' %}
{% set mode = 'Background' %}
{% block description %}
<p>Maximum image size is {{ config('background_max_width') }}x{{ config('background_max_height') }}, minimum image size is {{ config('background_min_width') }}x{{ config('background_min_height') }}, maximum file size is {{ config('background_max_fsize')|byte_symbol }}.</p>
{% endblock %}
{% block settingsContent %}
<form enctype="multipart/form-data" method="post" action="{{ route('settings.appearance.background') }}">
<input type="hidden" name="MAX_FILE_SIZE" value="{{ config('background_max_fsize') }}" />
<div style="text-align: center;">
<div>
<img src="{{ route('file.background', user.id) }}" alt="Your Background" class="default-avatar-setting" style="max-width: 90%; max-height: 90%;" />
</div>
<div>
<input type="file" name="background" />
<div style="font-size: .8em;">
(Leave upload box empty to remove background)
</div>
</div>
<div>
<button value="{{ session_id() }}" name="session" class="inputStyling">Upload</button>
</div>
</div>
</form>
{% endblock %}