From 1cfc51b0848cb66840e5d947054793c937d99357 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Thu, 12 Jan 2017 23:37:37 +0700 Subject: [PATCH] Fixed delete confirms (for build, project, user, group) + UI fixes --- public/assets/css/main.css | 4 +++ public/assets/js/app.js | 2 +- public/assets/js/init.js | 30 ------------------- src/PHPCensor/Controller/BuildController.php | 2 +- src/PHPCensor/Controller/GroupController.php | 1 + src/PHPCensor/View/Build/view.phtml | 6 ++-- src/PHPCensor/View/BuildsTable.phtml | 13 ++++++-- src/PHPCensor/View/Group/index.phtml | 31 +++++++++++++------- src/PHPCensor/View/Project/view.phtml | 19 ++++++++---- src/PHPCensor/View/User/index.phtml | 21 +++++++++---- 10 files changed, 69 insertions(+), 60 deletions(-) delete mode 100644 public/assets/js/init.js diff --git a/public/assets/css/main.css b/public/assets/css/main.css index 48029bdf..bdd8b757 100644 --- a/public/assets/css/main.css +++ b/public/assets/css/main.css @@ -567,3 +567,7 @@ h6, .visible-line-breaks { white-space: pre-wrap; } + +.btn-group-right { + float: right; +} diff --git a/public/assets/js/app.js b/public/assets/js/app.js index d5dad8ad..d28ac628 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -188,7 +188,7 @@ function confirmDelete(url, subject, reloadAfter) { }; } - dialog.showStatusMessage('Successfully deleted!', 1000); + dialog.showStatusMessage('Successfully deleted!', 500); }, error: function (data) { dialog.showStatusMessage('Deletion failed! Server says "' + data.statusText + '"'); diff --git a/public/assets/js/init.js b/public/assets/js/init.js deleted file mode 100644 index 92b309fa..00000000 --- a/public/assets/js/init.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Initialization of frontend of the application goes here - * - * @author Pavel Pavlov - */ - -$(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; - }); -} diff --git a/src/PHPCensor/Controller/BuildController.php b/src/PHPCensor/Controller/BuildController.php index 6bc2d353..a84276d1 100644 --- a/src/PHPCensor/Controller/BuildController.php +++ b/src/PHPCensor/Controller/BuildController.php @@ -97,7 +97,7 @@ class BuildController extends Controller $actions = "{$rebuild} "; if ($this->currentUserIsAdmin()) { - $actions .= " {$delete}"; + $actions .= " {$delete}"; } $this->layout->actions = $actions; diff --git a/src/PHPCensor/Controller/GroupController.php b/src/PHPCensor/Controller/GroupController.php index e436aed0..6229c6d8 100644 --- a/src/PHPCensor/Controller/GroupController.php +++ b/src/PHPCensor/Controller/GroupController.php @@ -96,6 +96,7 @@ class GroupController extends Controller $title->setValue($group->getTitle()); $submit = new Form\Element\Submit(); + $submit->setClass('btn btn-success'); $submit->setValue(Lang::get('group_save')); $form->addField($title); diff --git a/src/PHPCensor/View/Build/view.phtml b/src/PHPCensor/View/Build/view.phtml index 3543afd1..3deb188a 100644 --- a/src/PHPCensor/View/Build/view.phtml +++ b/src/PHPCensor/View/Build/view.phtml @@ -181,10 +181,8 @@ foreach ($plugins as $plugin) { $('#delete-build').on('click', function (e) { e.preventDefault(); confirmDelete( - "build/delete/getId(); ?>", "Build" - ).onCloseConfirmed = function () {window.location = '/'}; + "build/delete/getId(); ?>", "Build" + ).onCloseConfirmed = function () {window.location = 'project/view/getProjectId(); ?>'}; }); }); - - diff --git a/src/PHPCensor/View/BuildsTable.phtml b/src/PHPCensor/View/BuildsTable.phtml index 3f094e60..d99f083c 100644 --- a/src/PHPCensor/View/BuildsTable.phtml +++ b/src/PHPCensor/View/BuildsTable.phtml @@ -71,17 +71,26 @@ switch($build->getStatus()) -
+
User()->getIsAdmin()): ?>
+ + diff --git a/src/PHPCensor/View/Group/index.phtml b/src/PHPCensor/View/Group/index.phtml index 9b6c6b16..780cb921 100644 --- a/src/PHPCensor/View/Group/index.phtml +++ b/src/PHPCensor/View/Group/index.phtml @@ -24,18 +24,29 @@ - - - - - - - - - +
+ + User()->getIsAdmin() && (!count($group['projects']))): ?> + + + +
-
\ No newline at end of file + + + \ No newline at end of file diff --git a/src/PHPCensor/View/Project/view.phtml b/src/PHPCensor/View/Project/view.phtml index a2149600..e27a571d 100644 --- a/src/PHPCensor/View/Project/view.phtml +++ b/src/PHPCensor/View/Project/view.phtml @@ -10,7 +10,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -152,14 +152,21 @@ if ($pages > 1) { } } - - if ($page < $pages - 1) { print '
  • '.Lang::get('next_link').'
  • '; } - - print ''; ?> + + diff --git a/src/PHPCensor/View/User/index.phtml b/src/PHPCensor/View/User/index.phtml index c1e2af79..20494a1f 100644 --- a/src/PHPCensor/View/User/index.phtml +++ b/src/PHPCensor/View/User/index.phtml @@ -1,7 +1,7 @@
    - +
    @@ -15,7 +15,7 @@ - + @@ -40,13 +40,13 @@ User()->getIsAdmin()): ?> -
    - -
    @@ -58,3 +58,12 @@ + +