mirror of
https://github.com/myvesta/vesta
synced 2025-07-30 11:39:44 -07:00
Initial parameters handling (total users / total blocked). Frontend part. TODO: backend part
This commit is contained in:
parent
d1cf8bdd97
commit
d9c7dba5f1
7 changed files with 46 additions and 31 deletions
|
@ -70,13 +70,21 @@ App.Helpers.getFirstKey = function(obj)
|
|||
App.Helpers.updateInitial = function()
|
||||
{
|
||||
// TODO: need api method
|
||||
$.each(App.Env.initialParams, function(key) {
|
||||
var item = App.Env.initialParams[key];
|
||||
$.each(item, function (i, o) {
|
||||
if (i.indexOf('total_') != -1) {
|
||||
App.View.updateInitialInfo(i, o);
|
||||
$.each(App.Env.initialParams.totals, function(key) {
|
||||
var item = App.Env.initialParams.totals[key];
|
||||
var expr_id = '#'+key;
|
||||
if ('undefined' != typeof item.total) {
|
||||
var ref = $(expr_id).find('.num-total');
|
||||
if (ref.length > 0) {
|
||||
$(ref).html(item.total);
|
||||
}
|
||||
});
|
||||
}
|
||||
if ('undefined' != typeof item.blocked) {
|
||||
var ref = $(expr_id).find('.num-blocked');
|
||||
if (ref.length > 0) {
|
||||
$(ref).html(item.blocked);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -366,7 +366,7 @@ App.HTML.Build.cron_form = function(options, id)
|
|||
}
|
||||
var tpl = App.Templates.get('FORM', 'cron');
|
||||
tpl.set(':source', options);
|
||||
|
||||
tpl.set(':id', id || '');
|
||||
options = App.Helpers.evalJSON(options) || {};
|
||||
if (App.Helpers.isEmpty(options)) {
|
||||
tpl.set(':title', 'New cron entry');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
App.Pages.init = function(){
|
||||
App.Ajax.request('MAIN.getInitial', {}, function(reply){
|
||||
App.Env.initialParams = reply.data;
|
||||
//App.Helpers.updateInitial();
|
||||
App.Helpers.updateInitial();
|
||||
});
|
||||
|
||||
App.Pages.prepareHTML();
|
||||
|
|
|
@ -763,7 +763,7 @@ App.Templates.html = {
|
|||
</div>']
|
||||
},
|
||||
cron: {
|
||||
FORM: ['<div class="b-new-entry b-new-entry_cron">\
|
||||
FORM: ['<div class="b-new-entry b-new-entry_cron" id="~!:id~!" >\
|
||||
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
||||
<input type="hidden" name="target" class="target" value=\'\'>\
|
||||
<div class="entry-header">~!:title~!</div>\
|
||||
|
@ -810,10 +810,10 @@ App.Templates.html = {
|
|||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">report to: <span class="remark">(devide by comma ",")</span></label>\
|
||||
<textarea class="textarea"></textarea>\
|
||||
<textarea class="textarea" name="REPORT_TO"></textarea>\
|
||||
</div>\
|
||||
<div class="form-row buttons-row cc">\
|
||||
<input type="submit" value="~!:save_button~!" class="add-entry-btn">\
|
||||
<input type="submit" value="~!:save_button~!" class="add-entry-btn do_action_save_form">\
|
||||
<span class="cancel-btn do_action_cancel_form">Cancel</span>\
|
||||
<a target="_blank" href="http://vestacp.com/docs/cron/" class="help-btn">Help</a>\
|
||||
</div>\
|
||||
|
|
|
@ -26,7 +26,7 @@ App.Validate.form = function(world, elm)
|
|||
}
|
||||
else {
|
||||
|
||||
if ($(field).val().trim() == '') {
|
||||
if ($(field).val().trim() == '' || $(field).val().trim() == '-') {
|
||||
App.Env.FormError.push($(field).attr('name') + ' is required');
|
||||
form_valid = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue