Fixed delete confirms (for build, project, user, group) + UI fixes
This commit is contained in:
parent
1237bf450c
commit
1cfc51b084
|
@ -567,3 +567,7 @@ h6,
|
||||||
.visible-line-breaks {
|
.visible-line-breaks {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-group-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ function confirmDelete(url, subject, reloadAfter) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.showStatusMessage('Successfully deleted!', 1000);
|
dialog.showStatusMessage('Successfully deleted!', 500);
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
dialog.showStatusMessage('Deletion failed! Server says "' + data.statusText + '"');
|
dialog.showStatusMessage('Deletion failed! Server says "' + data.statusText + '"');
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/**
|
|
||||||
* Initialization of frontend of the application goes here
|
|
||||||
*
|
|
||||||
* @author Pavel Pavlov <Pavel.Pavlov@alera.ru>
|
|
||||||
*/
|
|
||||||
|
|
||||||
$(function () {
|
|
||||||
$('#latest-builds').on('latest-builds:reload', bindAppDeleteEvents);
|
|
||||||
$('#latest-builds').trigger('latest-builds:reload');
|
|
||||||
});
|
|
||||||
|
|
||||||
function bindAppDeleteEvents () {
|
|
||||||
$('.app-delete-build').on('click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
confirmDelete(e.target.href, 'Build').onClose = function () {
|
|
||||||
window.location.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.app-delete-user').on('click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
confirmDelete(e.target.href, 'User', true);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -97,7 +97,7 @@ class BuildController extends Controller
|
||||||
$actions = "<a class=\"btn btn-default\" href=\"{$rebuildLink}\">{$rebuild}</a> ";
|
$actions = "<a class=\"btn btn-default\" href=\"{$rebuildLink}\">{$rebuild}</a> ";
|
||||||
|
|
||||||
if ($this->currentUserIsAdmin()) {
|
if ($this->currentUserIsAdmin()) {
|
||||||
$actions .= " <a class=\"btn btn-danger\" href=\"{$deleteLink}\">{$delete}</a>";
|
$actions .= " <a class=\"btn btn-danger\" id=\"delete-build\" href=\"{$deleteLink}\">{$delete}</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->layout->actions = $actions;
|
$this->layout->actions = $actions;
|
||||||
|
|
|
@ -96,6 +96,7 @@ class GroupController extends Controller
|
||||||
$title->setValue($group->getTitle());
|
$title->setValue($group->getTitle());
|
||||||
|
|
||||||
$submit = new Form\Element\Submit();
|
$submit = new Form\Element\Submit();
|
||||||
|
$submit->setClass('btn btn-success');
|
||||||
$submit->setValue(Lang::get('group_save'));
|
$submit->setValue(Lang::get('group_save'));
|
||||||
|
|
||||||
$form->addField($title);
|
$form->addField($title);
|
||||||
|
|
|
@ -181,10 +181,8 @@ foreach ($plugins as $plugin) {
|
||||||
$('#delete-build').on('click', function (e) {
|
$('#delete-build').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
confirmDelete(
|
confirmDelete(
|
||||||
"<?php echo APP_URL ?>build/delete/<?php print $build->getId(); ?>", "Build"
|
"<?= APP_URL; ?>build/delete/<?= $build->getId(); ?>", "Build"
|
||||||
).onCloseConfirmed = function () {window.location = '/'};
|
).onCloseConfirmed = function () {window.location = '<?= APP_URL; ?>project/view/<?= $build->getProjectId(); ?>'};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -71,17 +71,26 @@ switch($build->getStatus())
|
||||||
<span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span>
|
<span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group">
|
<div class="btn-group btn-group-right">
|
||||||
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>"><?php Lang::out('view'); ?></a>
|
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>"><?php Lang::out('view'); ?></a>
|
||||||
<?php if($this->User()->getIsAdmin()): ?>
|
<?php if($this->User()->getIsAdmin()): ?>
|
||||||
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
|
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="<?php echo APP_URL ?>build/delete/<?php print $build->getId(); ?>" class="app-delete-build"><?php Lang::out('delete_build'); ?></a></li>
|
<li><a href="<?php echo APP_URL ?>build/delete/<?php print $build->getId(); ?>" class="delete-build"><?php Lang::out('delete_build'); ?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.delete-build').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
confirmDelete(e.target.href, "Build").onCloseConfirmed = function () {window.location = window.location.href};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -24,18 +24,29 @@
|
||||||
<td><?php print $group['title']; ?></td>
|
<td><?php print $group['title']; ?></td>
|
||||||
<td><?php print count($group['projects']); ?></td>
|
<td><?php print count($group['projects']); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-sm btn-default" href="<?php print APP_URL . 'group/edit/' . $group['id']; ?>">
|
<div class="btn-group btn-group-right">
|
||||||
<?php Lang::out('group_edit'); ?>
|
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>group/edit/<?php print $group['id']; ?>"><?php Lang::out('group_edit'); ?></a>
|
||||||
</a>
|
<?php if($this->User()->getIsAdmin() && (!count($group['projects']))): ?>
|
||||||
|
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
|
||||||
<?php if (!count($group['projects'])): ?>
|
<span class="caret"></span>
|
||||||
<a class="btn btn-sm btn-danger delete-group" href="<?php print APP_URL . 'group/delete/' . $group['id']; ?>">
|
</button>
|
||||||
<?php Lang::out('group_delete'); ?>
|
<ul class="dropdown-menu">
|
||||||
</a>
|
<li><a href="<?php echo APP_URL ?>group/delete/<?php print $group['id']; ?>" class="delete-group"><?php Lang::out('group_delete'); ?></a></li>
|
||||||
<?php endif; ?>
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.delete-group').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
confirmDelete(e.target.href, "Group").onCloseConfirmed = function () {window.location = window.location.href};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -10,7 +10,7 @@
|
||||||
<?php Lang::out('edit_project'); ?>
|
<?php Lang::out('edit_project'); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="btn btn-danger" href="javascript:confirmDelete('<?php print APP_URL . 'project/delete/' . $project->getId(); ?>', '<?php print Lang::out('project'); ?>', true)">
|
<a class="btn btn-danger" id="delete-project">
|
||||||
<?php Lang::out('delete_project'); ?>
|
<?php Lang::out('delete_project'); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
|
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
|
||||||
<th><?php Lang::out('branch'); ?></th>
|
<th><?php Lang::out('branch'); ?></th>
|
||||||
<th><?php Lang::out('status'); ?></th>
|
<th><?php Lang::out('status'); ?></th>
|
||||||
<th style="width: 100px"></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="latest-builds">
|
<tbody id="latest-builds">
|
||||||
|
@ -152,14 +152,21 @@ if ($pages > 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($page < $pages - 1) {
|
if ($page < $pages - 1) {
|
||||||
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">'.Lang::get('next_link').'</a></li>';
|
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">'.Lang::get('next_link').'</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '</ul></div>';
|
print '</ul></div>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$('#delete-project').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
confirmDelete(
|
||||||
|
"<?= APP_URL; ?>project/delete/<?= $project->getId(); ?>", "Project"
|
||||||
|
).onCloseConfirmed = function () {window.location = '/'};
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php use PHPCensor\Helper\Lang; ?>
|
<?php use PHPCensor\Helper\Lang; ?>
|
||||||
<div class="clearfix" style="margin-bottom: 20px;">
|
<div class="clearfix" style="margin-bottom: 20px;">
|
||||||
<div class="pull-right btn-group">
|
<div class="pull-right btn-group">
|
||||||
<a class="btn btn-primary" href="<?php print APP_URL; ?>user/add"><?php Lang::out('add_user'); ?></a>
|
<a class="btn btn-success" href="<?php print APP_URL; ?>user/add"><?php Lang::out('add_user'); ?></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<th><?php Lang::out('email_address'); ?></th>
|
<th><?php Lang::out('email_address'); ?></th>
|
||||||
<th><?php Lang::out('name'); ?></th>
|
<th><?php Lang::out('name'); ?></th>
|
||||||
<th><?php Lang::out('is_admin'); ?></th>
|
<th><?php Lang::out('is_admin'); ?></th>
|
||||||
<th style="width: 100px"></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="users">
|
<tbody id="users">
|
||||||
|
@ -40,13 +40,13 @@
|
||||||
<td><?php print $status; ?></td>
|
<td><?php print $status; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if($this->User()->getIsAdmin()): ?>
|
<?php if($this->User()->getIsAdmin()): ?>
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group btn-group-right">
|
||||||
<a class="btn btn-default btn-small" href="<?php echo APP_URL ?>user/edit/<?php print $user->getId(); ?>"><?php Lang::out('edit'); ?></a>
|
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>user/edit/<?php print $user->getId(); ?>"><?php Lang::out('edit'); ?></a>
|
||||||
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
|
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="<?php echo APP_URL ?>user/delete/<?php print $user->getId(); ?>" class="app-delete-user"><?php Lang::out('delete_user'); ?></a></li>
|
<li><a href="<?php echo APP_URL ?>user/delete/<?php print $user->getId(); ?>" class="delete-user"><?php Lang::out('delete_user'); ?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -58,3 +58,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.delete-user').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
confirmDelete(e.target.href, "User").onCloseConfirmed = function () {window.location = window.location.href};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue