Added /history
This commit is contained in:
parent
cb53572a2d
commit
d313890d8a
7 changed files with 108 additions and 2 deletions
1
TODO
1
TODO
|
@ -6,7 +6,6 @@ first major release.
|
|||
- users: add user-configurable "about me" (should support Markdown)
|
||||
- tags: add tag merging
|
||||
- tags: add tag descriptions
|
||||
- add /history
|
||||
|
||||
refactors:
|
||||
- add enum validation in IValidatables (needs refactors of enums and
|
||||
|
|
|
@ -27,6 +27,7 @@ table.history .user img {
|
|||
|
||||
table.history td {
|
||||
padding: 0.1em 0.25em;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
table.history ul {
|
||||
|
@ -48,3 +49,21 @@ table.history li {
|
|||
table.history li:not(:last-of-type):after {
|
||||
content: ', ';
|
||||
}
|
||||
|
||||
#history-wrapper {
|
||||
text-align: center;
|
||||
}
|
||||
#history-wrapper table {
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
}
|
||||
@media all and (min-width: 77em) {
|
||||
#history-wrapper table {
|
||||
width: 70em;
|
||||
}
|
||||
}
|
||||
@media all and (max-width: 77em) {
|
||||
#history-wrapper table {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@
|
|||
|
||||
<script type="text/javascript" src="/js/Presenters/HelpPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/HomePresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/HistoryPresenter.js"></script>
|
||||
|
||||
<script type="text/javascript" src="/js/Router.js"></script>
|
||||
<script type="text/javascript" src="/js/Bootstrap.js"></script>
|
||||
|
|
78
public_html/js/Presenters/HistoryPresenter.js
Normal file
78
public_html/js/Presenters/HistoryPresenter.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.HistoryPresenter = function(
|
||||
_,
|
||||
jQuery,
|
||||
util,
|
||||
promise,
|
||||
auth,
|
||||
pagerPresenter,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
var templates = {};
|
||||
var params;
|
||||
|
||||
function init(params, loaded) {
|
||||
topNavigationPresenter.changeTitle('History');
|
||||
|
||||
promise.wait(
|
||||
util.promiseTemplate('global-history'),
|
||||
util.promiseTemplate('history'))
|
||||
.then(function(historyWrapperTemplate, historyTemplate) {
|
||||
templates.historyWrapper = historyWrapperTemplate;
|
||||
templates.history = historyTemplate;
|
||||
|
||||
render();
|
||||
loaded();
|
||||
|
||||
pagerPresenter.init({
|
||||
baseUri: '#/history',
|
||||
backendUri: '/history',
|
||||
$target: $el.find('.pagination-target'),
|
||||
updateCallback: function($page, data) {
|
||||
renderHistory($page, data.entities);
|
||||
},
|
||||
},
|
||||
function() {
|
||||
reinit(params, function() {});
|
||||
});
|
||||
}).fail(function() {
|
||||
console.log(arguments);
|
||||
loaded();
|
||||
});
|
||||
}
|
||||
|
||||
function reinit(_params, loaded) {
|
||||
params = _params;
|
||||
params.query = params.query || {};
|
||||
|
||||
pagerPresenter.reinit({query: params.query});
|
||||
loaded();
|
||||
}
|
||||
|
||||
function deinit() {
|
||||
pagerPresenter.deinit();
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html(templates.historyWrapper());
|
||||
}
|
||||
|
||||
function renderHistory($page, historyItems) {
|
||||
$page.append(templates.history({
|
||||
formatRelativeTime: util.formatRelativeTime,
|
||||
history: historyItems}));
|
||||
}
|
||||
|
||||
return {
|
||||
init: init,
|
||||
reinit: reinit,
|
||||
deinit: deinit,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('historyPresenter', ['_', 'jQuery', 'util', 'promise', 'auth', 'pagerPresenter', 'topNavigationPresenter'], App.Presenters.HistoryPresenter);
|
|
@ -27,6 +27,7 @@ App.Router = function(_, jQuery, promise, util, appState, presenterManager) {
|
|||
inject('#/tags(/:!query)', 'tagListPresenter');
|
||||
inject('#/tag/:tagName', 'tagPresenter');
|
||||
inject('#/help(/:tab)', 'helpPresenter');
|
||||
inject('#/history(/:!query)', 'historyPresenter');
|
||||
}
|
||||
|
||||
function navigate(url, useBrowserDispatcher) {
|
||||
|
|
4
public_html/templates/global-history.tpl
Normal file
4
public_html/templates/global-history.tpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div id="history-wrapper">
|
||||
<div class="pagination-target">
|
||||
</div>
|
||||
</div>
|
|
@ -53,6 +53,10 @@
|
|||
<% } %>
|
||||
|
||||
<p>
|
||||
<small class="version">Version: <a href="//github.com/rr-/szurubooru/commits/master"><%= version %></a> (built <%= formatRelativeTime(buildTime) %>)</small>
|
||||
<small class="version">
|
||||
Version: <a href="//github.com/rr-/szurubooru/commits/master"><%= version %></a> (built <%= formatRelativeTime(buildTime) %>)
|
||||
|
|
||||
<a href="#/history">Recent tag and post edits</a>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue