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..143a3ba5 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -164,11 +164,13 @@ if (!Function.prototype.bind) { /** * Used for delete buttons in the system, just to prevent accidental clicks. */ -function confirmDelete(url, subject, reloadAfter) { +function confirmDelete(url, reloadAfter) { var dialog = new PHPCensorConfirmDialog({ - message: subject + ' will be permanently deleted. Are you sure?', - confirmBtnCaption: 'Delete', + title: Lang.get('confirm_title'), + message: Lang.get('confirm_message'), + confirmBtnCaption: Lang.get('confirm_ok'), + cancelBtnCaption: Lang.get('confirm_cancel'), /* confirm-btn click handler */ @@ -188,10 +190,10 @@ function confirmDelete(url, subject, reloadAfter) { }; } - dialog.showStatusMessage('Successfully deleted!', 1000); + dialog.showStatusMessage(Lang.get('confirm_success'), 500); }, error: function (data) { - dialog.showStatusMessage('Deletion failed! Server says "' + data.statusText + '"'); + dialog.showStatusMessage(Lang.get('confirm_failed') + data.statusText); if (data.status == 401) { handleFailedAjax(data); @@ -210,8 +212,8 @@ function confirmDelete(url, subject, reloadAfter) { * @type {{message: string, title: string, confirmBtnCaption: string, cancelBtnCaption: string, confirmed: Function}} */ var PHPCensorConfirmDialogOptions = { - message: 'The action will be performed and cannot be undone. Are you sure?', - title: 'Confirmation Dialog', + message: 'Are you sure?', + title: 'Confirmation', confirmBtnCaption: 'Ok', cancelBtnCaption: 'Cancel', confirmed: function (e) { @@ -239,22 +241,22 @@ var PHPCensorConfirmDialog = Class.extend({ */ $('body').append( '' + + '' + + '' ); } @@ -262,8 +264,8 @@ var PHPCensorConfirmDialog = Class.extend({ Define dialog controls */ this.$dialog = $('#confirm-dialog'); - this.$cancelBtn = this.$dialog.find('div.modal-footer button.btn-default'); - this.$confirmBtn = this.$dialog.find('div.modal-footer button.btn-primary'); + this.$cancelBtn = this.$dialog.find('#confirm-cancel'); + this.$confirmBtn = this.$dialog.find('#confirm-ok'); this.$title = this.$dialog.find('h4.modal-title'); this.$body = this.$dialog.find('div.modal-body'); @@ -350,7 +352,7 @@ var PHPCensorConfirmDialog = Class.extend({ showStatusMessage: function (message, closeTimeout) { this.$confirmBtn.hide(); - this.$cancelBtn.html('Close'); + this.$cancelBtn.hide(); /* Status message @@ -468,8 +470,8 @@ var Lang = { return sprintf.apply(sprintf[0], args); } - return 'MISSING: ' + string; + return string; } }; -moment.locale(LANGUAGE); \ No newline at end of file +moment.locale(LANGUAGE); 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..75e41c87 100644 --- a/src/PHPCensor/Controller/GroupController.php +++ b/src/PHPCensor/Controller/GroupController.php @@ -58,7 +58,8 @@ class GroupController extends Controller $groups[] = $thisGroup; } - $this->view->groups = $groups; + $this->layout->title = Lang::get('group_projects'); + $this->view->groups = $groups; } /** @@ -96,6 +97,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/Languages/lang.en.php b/src/PHPCensor/Languages/lang.en.php index b1786f29..2f4e99b6 100644 --- a/src/PHPCensor/Languages/lang.en.php +++ b/src/PHPCensor/Languages/lang.en.php @@ -159,7 +159,8 @@ PHP Censor', Services section of your Bitbucket repository.', // Project Groups - 'group_projects' => 'Projects', + 'group_projects' => 'Project Groups', + 'group_count' => 'Projects Count', 'group_edit' => 'Edit', 'group_delete' => 'Delete', 'group_add' => 'Add Group', @@ -489,4 +490,11 @@ PHP Censor', 'slack_notify' => 'Slack', 'technical_debt' => 'Technical Debt', 'xmpp' => 'XMPP', + + 'confirm_message' => 'Item will be permanently deleted. Are you sure?', + 'confirm_title' => 'Item delete confirmation', + 'confirm_ok' => 'Delete', + 'confirm_cancel' => 'Cancel', + 'confirm_success' => 'Item successfully deleted.', + 'confirm_failed' => 'Deletion failed! Server says: ', ]; diff --git a/src/PHPCensor/Languages/lang.ru.php b/src/PHPCensor/Languages/lang.ru.php index 65479ae3..f073555f 100644 --- a/src/PHPCensor/Languages/lang.ru.php +++ b/src/PHPCensor/Languages/lang.ru.php @@ -153,7 +153,8 @@ PHP Censor', Services вашего Bitbucket репозитория.', // Project Groups - 'group_projects' => 'Проекты', + 'group_projects' => 'Группы проектов', + 'group_count' => 'Количество проектов', 'group_edit' => 'Редактировать', 'group_delete' => 'Удалить', 'group_add' => 'Добавить группу', @@ -473,4 +474,11 @@ PHP Censor', 'slack_notify' => 'Slack', 'technical_debt' => 'Technical Debt', 'xmpp' => 'XMPP', + + 'confirm_message' => 'Элемент будет удален навсегда. Вы уверены?', + 'confirm_title' => 'Подтвержение удаления', + 'confirm_ok' => 'Удалить', + 'confirm_cancel' => 'Отмена', + 'confirm_success' => 'Элемент успешно удален.', + 'confirm_failed' => 'Удаление провалилось! Ответ сервера: ', ]; diff --git a/src/PHPCensor/View/Build/view.phtml b/src/PHPCensor/View/Build/view.phtml index 3543afd1..ae311f2f 100644 --- a/src/PHPCensor/View/Build/view.phtml +++ b/src/PHPCensor/View/Build/view.phtml @@ -180,11 +180,8 @@ foreach ($plugins as $plugin) { $('#delete-build').on('click', function (e) { e.preventDefault(); - confirmDelete( - "build/delete/getId(); ?>", "Build" - ).onCloseConfirmed = function () {window.location = '/'}; + confirmDelete("build/delete/getId(); ?>") + .onCloseConfirmed = function () {window.location = 'project/view/getProjectId(); ?>'}; }); }); - - diff --git a/src/PHPCensor/View/BuildsTable.phtml b/src/PHPCensor/View/BuildsTable.phtml index 3f094e60..edaf5c7c 100644 --- a/src/PHPCensor/View/BuildsTable.phtml +++ b/src/PHPCensor/View/BuildsTable.phtml @@ -71,17 +71,27 @@ switch($build->getStatus()) -
+
User()->getIsAdmin()): ?>
+ + diff --git a/src/PHPCensor/View/Group/index.phtml b/src/PHPCensor/View/Group/index.phtml index 9b6c6b16..b9041ca4 100644 --- a/src/PHPCensor/View/Group/index.phtml +++ b/src/PHPCensor/View/Group/index.phtml @@ -6,16 +6,12 @@
-
-

-
- - - + + @@ -24,18 +20,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..54d7f697 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,20 @@ 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..c6675455 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,13 @@ + +