Added presenter placeholders
This commit is contained in:
parent
9a7082c269
commit
2ed9f969f2
17 changed files with 291 additions and 9 deletions
|
@ -23,6 +23,13 @@ changeAllNames = moderator, administrator
|
|||
changeAllPasswords = moderator, administrator
|
||||
changeAccessRank = administrator
|
||||
|
||||
listSafePosts = anonymous, regularUser, powerUser, moderator, administrator
|
||||
listSketchyPosts = anonymous, regularUser, powerUser, moderator, administrator
|
||||
listUnsafePosts = anonymous, regularUser, powerUser, moderator, administrator
|
||||
uploadPosts = regularUser, powerUser, moderator, administrator
|
||||
|
||||
listTags = anonymous, regularUser, powerUser, moderator, administrator
|
||||
|
||||
[users]
|
||||
minUserNameLength = 1
|
||||
maxUserNameLength = 32
|
||||
|
|
|
@ -47,6 +47,14 @@
|
|||
<script type="text/javascript" src="/js/Presenters/UserAccountSettingsPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/UserAccountRemovalPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/UserPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/PostListPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/PostUploadPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/CommentListPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/TagListPresenter.js"></script>
|
||||
<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/PasswordResetPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Presenters/UserActivationPresenter.js"></script>
|
||||
<script type="text/javascript" src="/js/Router.js"></script>
|
||||
<script type="text/javascript" src="/js/Bootstrap.js"></script>
|
||||
</body>
|
||||
|
|
|
@ -17,6 +17,13 @@ App.Auth = function(jQuery, util, api, appState, promise) {
|
|||
changeAllPasswords: 'changeAllPasswords',
|
||||
deleteOwnAccount: 'deleteOwnAccount',
|
||||
deleteAllAccounts: 'deleteAllAccounts',
|
||||
|
||||
listSafePosts: 'listSafePosts',
|
||||
listSketchyPosts: 'listSketchyPosts',
|
||||
listUnsafePosts: 'listUnsafePosts',
|
||||
uploadPosts: 'uploadPosts',
|
||||
|
||||
listTags: 'listTags',
|
||||
};
|
||||
|
||||
function loginFromCredentials(userName, password, remember) {
|
||||
|
|
26
public_html/js/Presenters/CommentListPresenter.js
Normal file
26
public_html/js/Presenters/CommentListPresenter.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.CommentListPresenter = function(
|
||||
jQuery,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('comments');
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html('Comment list placeholder');
|
||||
};
|
||||
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('commentListPresenter', App.Presenters.CommentListPresenter);
|
26
public_html/js/Presenters/HelpPresenter.js
Normal file
26
public_html/js/Presenters/HelpPresenter.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.HelpPresenter = function(
|
||||
jQuery,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('help');
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html('Help placeholder');
|
||||
};
|
||||
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('helpPresenter', App.Presenters.HelpPresenter);
|
26
public_html/js/Presenters/HomePresenter.js
Normal file
26
public_html/js/Presenters/HomePresenter.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.HomePresenter = function(
|
||||
jQuery,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('home');
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html('Home placeholder');
|
||||
};
|
||||
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('homePresenter', App.Presenters.HomePresenter);
|
32
public_html/js/Presenters/PasswordResetPresenter.js
Normal file
32
public_html/js/Presenters/PasswordResetPresenter.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.PasswordResetPresenter = function(
|
||||
jQuery,
|
||||
topNavigationPresenter,
|
||||
messagePresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
var $messages = $el;
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('login');
|
||||
if (args.token) {
|
||||
alert('Got token');
|
||||
} else {
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html('Password reset placeholder');
|
||||
};
|
||||
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('passwordResetPresenter', App.Presenters.PasswordResetPresenter);
|
26
public_html/js/Presenters/PostListPresenter.js
Normal file
26
public_html/js/Presenters/PostListPresenter.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.PostListPresenter = function(
|
||||
jQuery,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('posts');
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html('Post list placeholder');
|
||||
};
|
||||
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('postListPresenter', App.Presenters.PostListPresenter);
|
26
public_html/js/Presenters/PostUploadPresenter.js
Normal file
26
public_html/js/Presenters/PostUploadPresenter.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.PostUploadPresenter = function(
|
||||
jQuery,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('upload');
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html('Post upload placeholder');
|
||||
};
|
||||
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('postUploadPresenter', App.Presenters.PostUploadPresenter);
|
26
public_html/js/Presenters/TagListPresenter.js
Normal file
26
public_html/js/Presenters/TagListPresenter.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.TagListPresenter = function(
|
||||
jQuery,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('tags');
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html('Tag list placeholder');
|
||||
};
|
||||
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('tagListPresenter', App.Presenters.TagListPresenter);
|
|
@ -33,7 +33,12 @@ App.Presenters.TopNavigationPresenter = function(
|
|||
$el.html(template({
|
||||
loggedIn: auth.isLoggedIn(),
|
||||
user: auth.getCurrentUser(),
|
||||
canListUsers: auth.hasPrivilege(auth.privileges.listUsers)
|
||||
canListUsers: auth.hasPrivilege(auth.privileges.listUsers),
|
||||
canListPosts: auth.hasPrivilege(auth.privileges.listSafePosts) ||
|
||||
auth.hasPrivilege(auth.privileges.listSketchyPosts) ||
|
||||
auth.hasPrivilege(auth.privileges.listUnsafePosts),
|
||||
canListTags: auth.hasPrivilege(auth.privileges.listTags),
|
||||
canUploadPosts: auth.hasPrivilege(auth.privileges.uploadPosts),
|
||||
}));
|
||||
$el.find('li.' + selectedElement).addClass('active');
|
||||
};
|
||||
|
|
26
public_html/js/Presenters/UserActivationPresenter.js
Normal file
26
public_html/js/Presenters/UserActivationPresenter.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var App = App || {};
|
||||
App.Presenters = App.Presenters || {};
|
||||
|
||||
App.Presenters.UserActivationPresenter = function(
|
||||
jQuery,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el = jQuery('#content');
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('login');
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html('Account activation placeholder');
|
||||
};
|
||||
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('userActivationPresenter', App.Presenters.UserActivationPresenter);
|
|
@ -19,14 +19,20 @@ App.Router = function(jQuery, util, appState) {
|
|||
};
|
||||
|
||||
function injectRoutes() {
|
||||
inject('#/home', 'homePresenter');
|
||||
inject('#/login', 'loginPresenter');
|
||||
inject('#/logout', 'logoutPresenter');
|
||||
inject('#/register', 'registrationPresenter');
|
||||
inject('#/users', 'userListPresenter');
|
||||
inject('#/users/:searchArgs', 'userListPresenter');
|
||||
inject('#/user/:userName', 'userPresenter');
|
||||
inject('#/user/:userName/:tab', 'userPresenter');
|
||||
setRoot('#/users');
|
||||
inject('#/upload', 'postUploadPresenter');
|
||||
inject('#/password-reset(/:token)', 'passwordResetPresenter');
|
||||
inject('#/activate(/:token)', 'userActivationPresenter');
|
||||
inject('#/users(/:searchArgs)', 'userListPresenter');
|
||||
inject('#/user/:userName(/:tab)', 'userPresenter');
|
||||
inject('#/posts(/:searchArgs)', 'postListPresenter');
|
||||
inject('#/comments(/:searchArgs)', 'commentListPresenter');
|
||||
inject('#/tags(/:searchArgs)', 'tagListPresenter');
|
||||
inject('#/help', 'helpPresenter');
|
||||
setRoot('#/home');
|
||||
};
|
||||
|
||||
function setRoot(newRoot) {
|
||||
|
|
|
@ -41,7 +41,7 @@ App.Util = (function(jQuery, promise) {
|
|||
var initResult = presenter.init.call(presenter, args);
|
||||
lastContentPresenterName = presenterName;
|
||||
lastContentPresenter = presenter;
|
||||
} else {
|
||||
} else if (lastContentPresenter.reinit) {
|
||||
lastContentPresenter.reinit.call(presenter, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<p>Problems logging in?</p>
|
||||
<ul>
|
||||
<li><a href="#/password-reset">I don't remember my password</a></li>
|
||||
<li><a href="#/activate-account">I haven't received activation e-mail</a></li>
|
||||
<li><a href="#/activate">I haven't received activation e-mail</a></li>
|
||||
<li><a href="#/register">I don't have an account</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,10 +1,34 @@
|
|||
<ul>
|
||||
<!-- todo: check privileges -->
|
||||
<li class="home">
|
||||
<a href="#/home">Home</a>
|
||||
</li>
|
||||
|
||||
<% if (canListPosts) { %>
|
||||
<li class="posts">
|
||||
<a href="#/posts">Posts</a>
|
||||
</li>
|
||||
<% if (canUploadPosts) { %>
|
||||
<li class="upload">
|
||||
<a href="#/upload">Upload</a>
|
||||
</li>
|
||||
<% } %>
|
||||
<li class="comments">
|
||||
<a href="#/comments">Comments</a>
|
||||
</li>
|
||||
<% } %>
|
||||
|
||||
<% if (canListTags) { %>
|
||||
<li class="tags">
|
||||
<a href="#/tags">Tags</a>
|
||||
</li>
|
||||
<% } %>
|
||||
|
||||
<% if (canListUsers) { %>
|
||||
<li class="users">
|
||||
<a href="#/users">Users</a>
|
||||
</li>
|
||||
<% } %>
|
||||
|
||||
<% if (!loggedIn) { %>
|
||||
<li class="login">
|
||||
<a href="#/login">Login</a>
|
||||
|
@ -20,4 +44,8 @@
|
|||
<a href="#/logout">Logout</a>
|
||||
</li>
|
||||
<% } %>
|
||||
|
||||
<li class="help">
|
||||
<a href="#/help">Help</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -17,4 +17,11 @@ class Privilege
|
|||
const CHANGE_ALL_PASSWORDS = 'changeAllPasswords';
|
||||
const DELETE_OWN_ACCOUNT = 'deleteOwnAccount';
|
||||
const DELETE_ALL_ACCOUNTS = 'deleteAllAccounts';
|
||||
|
||||
const LIST_SAFE_POSTS = 'listSafePosts';
|
||||
const LIST_SKETCHY_POSTS = 'listSketchyPosts';
|
||||
const LIST_UNSAFE_POSTS = 'listUnsafePosts';
|
||||
const UPLOAD_POSTS = 'uploadPosts';
|
||||
|
||||
const LIST_TAGS = 'listTags';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue