fixed changelog (mainly)
This commit is contained in:
parent
f9c08bf405
commit
73dd366e69
5 changed files with 134 additions and 62 deletions
|
@ -33,7 +33,7 @@ class AppearanceController extends Controller
|
||||||
return Template::render('global/information');
|
return Template::render('global/information');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->go('appearance.avatar');
|
return Template::render('settings/appearance/avatar');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function background()
|
public function background()
|
||||||
|
@ -48,7 +48,7 @@ class AppearanceController extends Controller
|
||||||
return Template::render('global/information');
|
return Template::render('global/information');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->go('appearance.background');
|
return Template::render('settings/appearance/background');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function header()
|
public function header()
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', 20160402);
|
define('SAKURA_VERSION', 20160408);
|
||||||
|
|
||||||
// Define Sakura Path
|
// Define Sakura Path
|
||||||
define('ROOT', __DIR__ . '/');
|
define('ROOT', __DIR__ . '/');
|
||||||
|
|
|
@ -261,7 +261,6 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{% if config('dev.show_changelog', true) and stats %}
|
{% if config('dev.show_changelog', true) and stats %}
|
||||||
<script type="text/javascript" src="https://sakura.flash.moe/?get=all&limit=5&variable=true"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// Column colours for actions
|
// Column colours for actions
|
||||||
var changelogColours = [
|
var changelogColours = [
|
||||||
|
@ -274,77 +273,96 @@
|
||||||
'#C44' // Revert
|
'#C44' // Revert
|
||||||
];
|
];
|
||||||
|
|
||||||
window.addEventListener("load", function () {
|
function yuunoCreateChangelog() {
|
||||||
// Check if the changelog variable is an object
|
// Grab the index panel
|
||||||
if(typeof changelog === 'object') {
|
var _panel = document.getElementById('indexPanel');
|
||||||
// Grab the index panel
|
|
||||||
var _panel = document.getElementById('indexPanel');
|
|
||||||
|
|
||||||
// Create the head container
|
// Create the head container
|
||||||
var _cltitle = document.createElement('div');
|
var _cltitle = document.createElement('div');
|
||||||
_cltitle.className = 'head';
|
_cltitle.className = 'head';
|
||||||
_cltitle.style.marginBottom = '1px';
|
_cltitle.style.marginBottom = '1px';
|
||||||
|
|
||||||
// Create a link
|
// Create a link
|
||||||
var _cllink = document.createElement('a');
|
var _cllink = document.createElement('a');
|
||||||
_cllink.className = 'underline';
|
_cllink.className = 'underline';
|
||||||
_cllink.target = '_blank';
|
_cllink.target = '_blank';
|
||||||
_cllink.href = 'https://sakura.flash.moe/#r{{ constant('SAKURA_VERSION') }}';
|
_cllink.href = 'https://sakura.flash.moe/#r{{ constant('SAKURA_VERSION') }}';
|
||||||
|
|
||||||
// Append everything
|
// Append everything
|
||||||
_cllink.appendChild(document.createTextNode('Changelog'));
|
_cllink.appendChild(document.createTextNode('Changelog'));
|
||||||
_cltitle.appendChild(_cllink);
|
_cltitle.appendChild(_cllink);
|
||||||
_panel.appendChild(_cltitle);
|
_panel.appendChild(_cltitle);
|
||||||
|
|
||||||
// Create changelog table
|
// Create changelog table
|
||||||
var _cltable = document.createElement('table');
|
var _cltable = document.createElement('table');
|
||||||
_cltable.className = 'panelTable';
|
_cltable.className = 'panelTable';
|
||||||
_cltable.style.borderSpacing = '0 1px';
|
_cltable.style.borderSpacing = '0 1px';
|
||||||
|
_cltable.id = 'yuunoChangelogTable';
|
||||||
|
|
||||||
// Create and append all changelog entries
|
// Append it to indexPanel
|
||||||
for (var _s in changelog) {
|
indexPanel.appendChild(_cltable);
|
||||||
// Create header
|
}
|
||||||
var _hr = document.createElement('tr');
|
|
||||||
var _hri = document.createElement('td');
|
|
||||||
|
|
||||||
// Set data
|
function yuunoAddToChangelog(object) {
|
||||||
_hri.appendChild(document.createTextNode(_s));
|
_cltable = document.getElementById('yuunoChangelogTable');
|
||||||
_hri.style.background = '#9475b2';
|
|
||||||
_hri.style.color = '#306';
|
|
||||||
_hri.style.fontWeight = '700';
|
|
||||||
_hri.style.fontSize = '1.2em';
|
|
||||||
_hri.setAttribute('colspan', '2');
|
|
||||||
|
|
||||||
// Append
|
// Create header
|
||||||
_hr.appendChild(_hri);
|
var _hr = document.createElement('tr');
|
||||||
_cltable.appendChild(_hr);
|
var _hri = document.createElement('td');
|
||||||
|
|
||||||
for (var _e in changelog[_s]) {
|
// Set data
|
||||||
// Reassign _e
|
_hri.appendChild(document.createTextNode(object.date));
|
||||||
_e = changelog[_s][_e];
|
_hri.style.background = '#9475b2';
|
||||||
|
_hri.style.color = '#306';
|
||||||
|
_hri.style.fontWeight = '700';
|
||||||
|
_hri.style.fontSize = '1.2em';
|
||||||
|
_hri.setAttribute('colspan', '2');
|
||||||
|
|
||||||
// Create elements
|
// Append
|
||||||
var _clr = document.createElement('tr');
|
_hr.appendChild(_hri);
|
||||||
var _clca = document.createElement('td');
|
_cltable.appendChild(_hr);
|
||||||
var _clcm = document.createElement('td');
|
|
||||||
|
|
||||||
// Set data
|
for (var _e in object.changes) {
|
||||||
_clca.appendChild(document.createTextNode(_e['change_action']['action_name']));
|
// Reassign _e
|
||||||
_clca.style.background = changelogColours[_e['change_action']['action_id']];
|
_e = object.changes[_e];
|
||||||
_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']));
|
|
||||||
|
|
||||||
// Append
|
// Create elements
|
||||||
_clr.appendChild(_clca);
|
var _clr = document.createElement('tr');
|
||||||
_clr.appendChild(_clcm);
|
var _clca = document.createElement('td');
|
||||||
_cltable.appendChild(_clr);
|
var _clcm = document.createElement('td');
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append it to indexPanel
|
// Set data
|
||||||
indexPanel.appendChild(_cltable);
|
_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);
|
||||||
|
_clr.appendChild(_clcm);
|
||||||
|
_cltable.appendChild(_clr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
27
templates/yuuno/settings/appearance/avatar.twig
Normal file
27
templates/yuuno/settings/appearance/avatar.twig
Normal 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 %}
|
27
templates/yuuno/settings/appearance/background.twig
Normal file
27
templates/yuuno/settings/appearance/background.twig
Normal 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 %}
|
Reference in a new issue