Move user templates to a subfolder

This commit is contained in:
Frédéric Guillot
2014-12-04 21:04:33 -05:00
parent 66e0028b4a
commit 6739dba792
18 changed files with 62 additions and 53 deletions

View File

@@ -34,7 +34,7 @@ class User extends Base
$this->response->redirect('?controller=app');
}
$this->response->html($this->template->layout('user_login', array(
$this->response->html($this->template->layout('user/login', array(
'errors' => array(),
'values' => array(),
'no_layout' => true,
@@ -63,7 +63,7 @@ class User extends Base
}
}
$this->response->html($this->template->layout('user_login', array(
$this->response->html($this->template->layout('user/login', array(
'errors' => $errors,
'values' => $values,
'no_layout' => true,
@@ -90,7 +90,7 @@ class User extends Base
$params['title'] = ($params['user']['name'] ?: $params['user']['username']).' (#'.$params['user']['id'].')';
}
return $this->template->layout('user_layout', $params);
return $this->template->layout('user/layout', $params);
}
/**
@@ -130,7 +130,7 @@ class User extends Base
$nb_users = $this->user->count();
$this->response->html(
$this->template->layout('user_index', array(
$this->template->layout('user/index', array(
'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()),
'projects' => $this->project->getList(),
'nb_users' => $nb_users,
@@ -156,7 +156,7 @@ class User extends Base
*/
public function create()
{
$this->response->html($this->template->layout('user_new', array(
$this->response->html($this->template->layout('user/new', array(
'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()),
'projects' => $this->project->getList(),
'errors' => array(),
@@ -186,7 +186,7 @@ class User extends Base
}
}
$this->response->html($this->template->layout('user_new', array(
$this->response->html($this->template->layout('user/new', array(
'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()),
'projects' => $this->project->getList(),
'errors' => $errors,
@@ -203,7 +203,7 @@ class User extends Base
public function show()
{
$user = $this->getUser();
$this->response->html($this->layout('user_show', array(
$this->response->html($this->layout('user/show', array(
'projects' => $this->projectPermission->getAllowedProjects($user['id']),
'user' => $user,
)));
@@ -217,7 +217,7 @@ class User extends Base
public function last()
{
$user = $this->getUser();
$this->response->html($this->layout('user_last', array(
$this->response->html($this->layout('user/last', array(
'last_logins' => $this->lastLogin->getAll($user['id']),
'user' => $user,
)));
@@ -231,7 +231,7 @@ class User extends Base
public function sessions()
{
$user = $this->getUser();
$this->response->html($this->layout('user_sessions', array(
$this->response->html($this->layout('user/sessions', array(
'sessions' => $this->authentication->backend('rememberMe')->getAll($user['id']),
'user' => $user,
)));
@@ -266,7 +266,7 @@ class User extends Base
$this->response->redirect('?controller=user&action=notifications&user_id='.$user['id']);
}
$this->response->html($this->layout('user_notifications', array(
$this->response->html($this->layout('user/notifications', array(
'projects' => $this->projectPermission->getAllowedProjects($user['id']),
'notifications' => $this->notification->readSettings($user['id']),
'user' => $user,
@@ -281,7 +281,7 @@ class User extends Base
public function external()
{
$user = $this->getUser();
$this->response->html($this->layout('user_external', array(
$this->response->html($this->layout('user/external', array(
'last_logins' => $this->lastLogin->getAll($user['id']),
'user' => $user,
)));
@@ -316,7 +316,7 @@ class User extends Base
}
}
$this->response->html($this->layout('user_password', array(
$this->response->html($this->layout('user/password', array(
'values' => $values,
'errors' => $errors,
'user' => $user,
@@ -365,7 +365,7 @@ class User extends Base
}
}
$this->response->html($this->layout('user_edit', array(
$this->response->html($this->layout('user/edit', array(
'values' => $values,
'errors' => $errors,
'projects' => $this->projectPermission->filterProjects($this->project->getList(), $user['id']),
@@ -395,7 +395,7 @@ class User extends Base
$this->response->redirect('?controller=user');
}
$this->response->html($this->layout('user_remove', array(
$this->response->html($this->layout('user/remove', array(
'user' => $user,
)));
}
@@ -431,7 +431,7 @@ class User extends Base
$this->response->redirect('?controller=app');
}
else {
$this->response->html($this->template->layout('user_login', array(
$this->response->html($this->template->layout('user/login', array(
'errors' => array('login' => t('Google authentication failed')),
'values' => array(),
'no_layout' => true,
@@ -493,7 +493,7 @@ class User extends Base
$this->response->redirect('?controller=app');
}
else {
$this->response->html($this->template->layout('user_login', array(
$this->response->html($this->template->layout('user/login', array(
'errors' => array('login' => t('GitHub authentication failed')),
'values' => array(),
'no_layout' => true,

View File

@@ -457,7 +457,7 @@ return array(
'Edit profile' => 'Modifier le profil',
'Change password' => 'Changer le mot de passe',
'Password modification' => 'Changement de mot de passe',
'External authentications' => 'Authentifications externe',
'External authentications' => 'Authentifications externes',
'Google Account' => 'Compte Google',
'Github Account' => 'Compte Github',
'Never connected.' => 'Jamais connecté.',

View File

@@ -176,7 +176,7 @@ class ProjectPermission extends Base
*/
public function isUserAllowed($project_id, $user_id)
{
return $this->user->isAdmin($user_id) || $this->isMember($project_id, $user_id);
return $project_id === 0 || $this->user->isAdmin($user_id) || $this->isMember($project_id, $user_id);
}
/**

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<h2><?= t('Edit user') ?></h2>
</div>
<form method="post" action="?controller=user&amp;action=edit&amp;user_id=<?= $user['id'] ?>" autocomplete="off">
<form method="post" action="<?= Helper\u('user', 'edit', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= Helper\form_csrf() ?>
@@ -25,6 +25,8 @@
<?php endif ?>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?>
<?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
</div>
</form>

View File

@@ -8,9 +8,9 @@
<p class="listing">
<?php if (Helper\is_current_user($user['id'])): ?>
<?php if (empty($user['google_id'])): ?>
<a href="?controller=user&amp;action=google<?= Helper\param_csrf() ?>"><?= t('Link my Google Account') ?></a>
<?= Helper\a(t('Link my Google Account'), 'user', 'google', array(), true) ?>
<?php else: ?>
<a href="?controller=user&amp;action=unlinkGoogle<?= Helper\param_csrf() ?>"><?= t('Unlink my Google Account') ?></a>
<?= Helper\a(t('Unlink my Google Account'), 'user', 'unlinkGoogle', array(), true) ?>
<?php endif ?>
<?php else: ?>
<?= empty($user['google_id']) ? t('No account linked.') : t('Account linked.') ?>
@@ -24,9 +24,9 @@
<p class="listing">
<?php if (Helper\is_current_user($user['id'])): ?>
<?php if (empty($user['github_id'])): ?>
<a href="?controller=user&amp;action=gitHub<?= Helper\param_csrf() ?>"><?= t('Link my GitHub Account') ?></a>
<?= Helper\a(t('Link my GitHub Account'), 'user', 'github', array(), true) ?>
<?php else: ?>
<a href="?controller=user&amp;action=unlinkGitHub<?= Helper\param_csrf() ?>"><?= t('Unlink my GitHub Account') ?></a>
<?= Helper\a(t('Unlink my GitHub Account'), 'user', 'unlinkGitHub', array(), true) ?>
<?php endif ?>
<?php else: ?>
<?= empty($user['github_id']) ? t('No account linked.') : t('Account linked.') ?>

View File

@@ -9,7 +9,7 @@
</div>
<section class="sidebar-container" id="user-section">
<?= Helper\template('user_sidebar', array('user' => $user)) ?>
<?= Helper\template('user/sidebar', array('user' => $user)) ?>
<div class="sidebar-content">
<?= $user_content_for_layout ?>

View File

@@ -4,7 +4,7 @@
<p class="alert alert-error"><?= Helper\escape($errors['login']) ?></p>
<?php endif ?>
<form method="post" action="?controller=user&amp;action=check&amp;redirect_query=<?= urlencode($redirect_query) ?>">
<form method="post" action="<?= Helper\u('user', 'check', array('redirect_query' => urlencode($redirect_query))) ?>">
<?= Helper\form_csrf() ?>
@@ -17,11 +17,11 @@
<?= Helper\form_checkbox('remember_me', t('Remember Me'), 1) ?><br/>
<?php if (GOOGLE_AUTH): ?>
<a href="?controller=user&amp;action=google"><?= t('Login with my Google Account') ?></a>
<?= Helper\a(t('Login with my Google Account'), 'user', 'google') ?>
<?php endif ?>
<?php if (GITHUB_AUTH): ?>
<a href="?controller=user&amp;action=gitHub"><?= t('Login with my GitHub Account') ?></a>
<?= Helper\a(t('Login with my GitHub Account'), 'user', 'gitHub') ?>
<?php endif ?>
<div class="form-actions">

View File

@@ -31,7 +31,8 @@
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?> <?= Helper\a(t('cancel'), 'user', 'index') ?>
<?= t('or') ?>
<?= Helper\a(t('cancel'), 'user', 'index') ?>
</div>
</form>
</section>

View File

@@ -2,7 +2,7 @@
<h2><?= t('Email notifications') ?></h2>
</div>
<form method="post" action="?controller=user&amp;action=notifications&amp;user_id=<?= $user['id'] ?>" autocomplete="off">
<form method="post" action="<?= Helper\u('user', 'notifications', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= Helper\form_csrf() ?>
@@ -13,13 +13,14 @@
<div class="form-checkbox-group">
<?php foreach ($projects as $project_id => $project_name): ?>
<?= Helper\form_checkbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?>
<?= Helper\form_checkbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?><br/>
<?php endforeach ?>
</div>
<?php endif ?>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
<?= t('or') ?>
<?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
</div>
</form>

View File

@@ -2,13 +2,15 @@
<h2><?= t('Password modification') ?></h2>
</div>
<form method="post" action="?controller=user&amp;action=password&amp;user_id=<?= $user['id'] ?>" autocomplete="off">
<form method="post" action="<?= Helper\u('user', 'password', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= Helper\form_hidden('id', $values) ?>
<?= Helper\form_csrf() ?>
<?= Helper\form_label(t('Current password for the user "%s"', Helper\get_username()), 'current_password') ?>
<?= Helper\form_password('current_password', $values, $errors) ?><br/>
<div class="alert alert-error">
<?= Helper\form_label(t('Current password for the user "%s"', Helper\get_username()), 'current_password') ?>
<?= Helper\form_password('current_password', $values, $errors) ?><br/>
</div>
<?= Helper\form_label(t('New password for the user "%s"', Helper\get_username($user)), 'password') ?>
<?= Helper\form_password('password', $values, $errors) ?><br/>
@@ -17,7 +19,8 @@
<?= Helper\form_password('confirmation', $values, $errors) ?><br/>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?>
<?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
</div>
</form>
</form>

View File

@@ -0,0 +1,13 @@
<div class="page-header">
<h2><?= t('Remove user') ?></h2>
</div>
<div class="confirm">
<p class="alert alert-info"><?= t('Do you really want to remove this user: "%s"?', $user['name'] ?: $user['username']) ?></p>
<div class="form-actions">
<?= Helper\a(t('Yes'), 'user', 'remove', array('user_id' => $user['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?>
<?= t('or') ?>
<?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
</div>
</div>

View File

@@ -19,7 +19,7 @@
<td><?= dt('%B %e, %Y at %k:%M %p', $session['expiration']) ?></td>
<td><?= Helper\escape($session['ip']) ?></td>
<td><?= Helper\escape(Helper\summary($session['user_agent'])) ?></td>
<td><a href="?controller=user&amp;action=removeSession&amp;user_id=<?= $user['id'] ?>&amp;id=<?= $session['id'].Helper\param_csrf() ?>"><?= t('Remove') ?></a></td>
<td><?= Helper\a(t('Remove'), 'user', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true) ?></td>
</tr>
<?php endforeach ?>
</table>

View File

@@ -30,7 +30,7 @@
</li>
<?php endif ?>
<?php if (Helper\is_admin()): ?>
<?php if (Helper\is_admin() && ! Helper\is_current_user($user['id'])): ?>
<li>
<?= Helper\a(t('Remove'), 'user', 'remove', array('user_id' => $user['id'])) ?>
</li>

View File

@@ -1,12 +0,0 @@
<div class="page-header">
<h2><?= t('Remove user') ?></h2>
</div>
<div class="confirm">
<p class="alert alert-info"><?= t('Do you really want to remove this user: "%s"?', $user['name'] ?: $user['username']) ?></p>
<div class="form-actions">
<a href="?controller=user&amp;action=remove&amp;confirmation=yes&amp;user_id=<?= $user['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a>
<?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
</div>
</div>

View File

@@ -410,7 +410,8 @@ Kanboard.Board = (function() {
}
};
})();// Task related functions
})();
// Task related functions
Kanboard.Task = (function() {
return {