Skip to content

Commit

Permalink
Merge pull request #229 from m1x0n/replace-modals
Browse files Browse the repository at this point in the history
replace-modals: Replaced alerts by custom. Disabled a confirmation of…
  • Loading branch information
m1x0n committed Oct 20, 2015
2 parents f5e42b9 + d106988 commit 37256f8
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 6 deletions.
8 changes: 6 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ var concatSettings = {
jsPathMinFull + 'views/tag/select.js',
jsPathMinFull + 'views/tag/view.js',
jsPathMinFull + 'views/vote/single.js',
jsPathMinFull + 'views/popup/alert.js',
jsPathMinFull + 'views/popup/confirm.js',
jsPathMinFull + 'views/role/select.js',
jsPathMinFull + 'views/templates/menu/menu.tpl.js',
Expand All @@ -118,9 +119,11 @@ var concatSettings = {
jsPathMinFull + 'views/templates/folder/select.tpl.js',
jsPathMinFull + 'views/templates/folder/select-row.tpl.js',
jsPathMinFull + 'views/templates/question/form.tpl.js',
jsPathMinFull + 'views/templates/popup/alert.tpl.js',
jsPathMinFull + 'views/templates/popup/confirm.tpl.js',
jsPathMinFull + 'views/templates/vote/votes.tpl.js',
jsPathMinFull + 'views/templates/role/select-row.tpl.js'
jsPathMinFull + 'views/templates/role/select-row.tpl.js',
jsPathMinFull + 'tools/alert-overriding.js',
]
};

Expand Down Expand Up @@ -184,7 +187,7 @@ gulp.task('js-prepare-static', function () {
jsPathFull + 'vendor/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js',
jsPathFull + 'vendor/ckeditor/adapters/jquery.js',
jsPathFull + 'app.js',
jsPathFull + 'validation-model.js'
jsPathFull + 'tools/validation-model.js',
])
.pipe(loadStaticExclude());
});
Expand All @@ -201,6 +204,7 @@ gulp.task('js-prepare', function () {
jsPathFull + 'views/folder/select.js',
jsPathFull + 'views/tag/select.js',
jsPathFull + 'views/tag/view.js',
jsPathFull + 'views/popup/alert.js',
jsPathFull + 'views/popup/confirm.js',
jsPathFull + 'views/vote/single.js',
jsPathFull + 'views/role/select.js'
Expand Down
5 changes: 4 additions & 1 deletion public/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ body.modal-open {
.modal-backdrop.in {
width: 100%;
height: 100%;
z-index: 3;
z-index: 10100;
position: fixed;
}

Expand All @@ -772,20 +772,23 @@ body.modal-open {
padding: 0 !important;
position: fixed;
overflow: hidden;
z-index: 10110;
}

/*
|------------------------------------------------------------------------------
| Confirmation form
|------------------------------------------------------------------------------
*/
.alert-form,
.confirm-form {
width: 25%;
margin: auto;
top: 10%;
bottom: auto;
}

.alert-form .form-group.controls,
.confirm-form .form-group.controls {
margin-bottom: 0;
text-align: center;
Expand Down
4 changes: 2 additions & 2 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ define([
'bootstrap',
'underscore',
'tpl',
'validation-model',
'tools/validation-model',
'jquery.scroll',
'paginator'
'paginator',
], function (Marionette, Backbone) {
var App = new Marionette.Application();
App.queryFlag = [];
Expand Down
1 change: 1 addition & 0 deletions public/js/locales/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"delete": "Delete",
"cancel": "Cancel",

"alert-title": "Attention!",
"confirm-title": "Confirmation",
"confirm-body": "Do you really want to perform this action?",

Expand Down
1 change: 1 addition & 0 deletions public/js/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"delete": "Delete",
"cancel": "Cancel",

"alert-title": "Attention!",
"confirm-title": "Confirmation",
"confirm-body": "Do you really want to perform this action?",

Expand Down
1 change: 1 addition & 0 deletions public/js/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"delete": "Удалить",
"cancel": "Отмена",

"alert-title": "Внимание!",
"confirm-title": "Подтверждение",
"confirm-body": "Вы действительно хотите выполнить это действие?",

Expand Down
1 change: 1 addition & 0 deletions public/js/locales/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"delete": "Видалити",
"cancel": "Скасувати",

"alert-title": "Увага!",
"confirm-title": "Підтверждення",
"confirm-body": "Ви дійсно бажаєте виконати цю операцію?",

Expand Down
30 changes: 30 additions & 0 deletions public/js/tools/alert-overriding.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
define([
'app',
'marionette',
'backbone',
'../views/popup/alert',
], function (App, Marionette, Backbone, AlertView) {
window.alert = function(message, title) {
var title = title || i18n.t("ui.alert-title");

var alertView = new AlertView({
message: message
});

App.trigger('popup:show', {
header: {
title: title
},
class: 'alert-form',
contentView: alertView
});

App.listenTo(
alertView,
'form:submit',
function () {
App.trigger('popup:close');
}
);
};
});
File renamed without changes.
4 changes: 4 additions & 0 deletions public/js/vendor/ckeditor/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,8 @@

// Color of the toolbar (changes '-' placeholders color)
config.uiColor = '#f5f5f5';

// User should not be asked to confirm close, if any dialog field was
// modified.
config.dialog_noConfirmCancel = true;
};
3 changes: 2 additions & 1 deletion public/js/views/main-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ define([
'views/menu/mock',
'tpl!views/templates/main-layout.tpl',
'moment',
'syphon'
'syphon',
'tools/alert-overriding',
], function (
App,
Marionette,
Expand Down
40 changes: 40 additions & 0 deletions public/js/views/popup/alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
define([
'app',
'marionette',
'backbone',
'tpl!views/templates/popup/alert.tpl'
], function (
App,
Marionette,
Backbone,
AlertTpl
) {
App.Folder.Views.AlertView = Marionette.ItemView.extend({
tagName: 'div',
id: 'alert',
template: AlertTpl,

events: {
'submit form': 'submit'
},

submit: function (event) {
event.preventDefault();
this.trigger('form:submit');
},

render: function () {
this.$el.html(this.template({
message: this.message,
_t: i18n.t
}));
},

initialize: function (options) {
this.message = options.message;
}
});

return App.Folder.Views.AlertView;
});

14 changes: 14 additions & 0 deletions public/js/views/templates/popup/alert.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<form action="">
<div class="form-horizontal">
<div class="form-group">
<div class="col-md-12 col-lg-12 col-sm-12 col-xs-12">
<p>
<%= message %>
</p>
</div>
</div>
</div>
<div class="form-group controls">
<button type="submit" class="btn btn-sm btn-info">Ok</button>
</div>
</form>

0 comments on commit 37256f8

Please sign in to comment.