Enh: Added loader button to space/user settings

This commit is contained in:
buddha87 2016-05-07 19:06:15 +02:00
parent 519a8e768e
commit 694e0f540b
8 changed files with 11 additions and 10 deletions

View File

@ -152,7 +152,6 @@ $(document).ready(function () {
initPlugins();
var x = 0;
$('a[data-ui-loader], button[data-ui-loader]').on('click', function () {
var $this = $(this);
@ -160,17 +159,19 @@ $(document).ready(function () {
return false;
}
//Adopt current color for the loader animation
var color = $this.css('color') || '#ffffff';
var $loader = $('<span class="loader"><span class="sk-spinner sk-spinner-three-bounce"><span class="sk-bounce1"></span><span class="sk-bounce2"></span><span class="sk-bounce3"></span></span></span>');
//Align bouncer animation color and size
$loader.find('.sk-bounce1, .sk-bounce2, .sk-bounce3')
.addClass('disabled')
.css( {'background-color': color, 'width': '10px', 'height': '10px'});
//The loader does have some margin we have to hide
$this.css('overflow', 'hidden');
$this.addClass('disabled');
//Prevent the container from resizing
$this.css('min-width', this.getBoundingClientRect().width);
$this.data('text', $this.text());
@ -182,7 +183,7 @@ $(document).ready(function () {
$('[data-ui-loader]').each(function() {
var $this = $(this);
if($this.find('.loader').length) {
$this.html($(this).data('text'));
$this.html($this.data('text'));
$this.removeClass('disabled');
}
});

View File

@ -162,7 +162,7 @@ class HForm extends \yii\base\Component
$output = "";
foreach ($buttons as $buttonName => $definition) {
if ($definition['type'] == 'submit') {
$output .= \yii\helpers\Html::submitButton($definition['label'], ['name' => $buttonName, 'class' => $definition['class']]);
$output .= \yii\helpers\Html::submitButton($definition['label'], ['name' => $buttonName, 'class' => $definition['class'], 'data-ui-loader' => '']);
$output .= "&nbsp;";
}
}

View File

@ -43,7 +43,7 @@ $this->registerCssFile('@web/resources/space/colorpicker/css/bootstrap-colorpick
</div>
<?php echo Html::submitButton(Yii::t('SpaceModule.views_admin_edit', 'Save'), array('class' => 'btn btn-primary')); ?>
<?php echo Html::submitButton(Yii::t('SpaceModule.views_admin_edit', 'Save'), array('class' => 'btn btn-primary', 'data-ui-loader' => '')); ?>
<?php echo \humhub\widgets\DataSaved::widget(); ?>

View File

@ -37,7 +37,7 @@ use humhub\modules\space\modules\manage\widgets\DefaultMenu;
<?php echo $form->field($model, 'default_content_visibility')->dropdownList($contentVisibilities); ?>
<p class="help-block"><?php echo Yii::t('SpaceModule.views_admin_edit', 'Choose if new content should be public or private by default'); ?></p>
<?php echo Html::submitButton(Yii::t('base', 'Save'), array('class' => 'btn btn-primary')); ?>
<?php echo Html::submitButton(Yii::t('base', 'Save'), array('class' => 'btn btn-primary', 'data-ui-loader' => '')); ?>
<?php echo \humhub\widgets\DataSaved::widget(); ?>

View File

@ -22,7 +22,7 @@ use \humhub\compat\CHtml;
<?php echo $form->field($model, 'newEmail')->textInput(['maxlength' => 45]); ?>
<hr>
<?php echo CHtml::submitButton(Yii::t('UserModule.views_account_changeEmail', 'Save'), array('class' => 'btn btn-primary')); ?>
<?php echo CHtml::submitButton(Yii::t('UserModule.views_account_changeEmail', 'Save'), array('class' => 'btn btn-primary', 'data-ui-loader' => '')); ?>
<!-- show flash message after saving -->
<?php echo \humhub\widgets\DataSaved::widget(); ?>

View File

@ -18,7 +18,7 @@ use humhub\compat\CHtml;
<?php echo $form->field($model, 'newPasswordConfirm')->passwordInput(['maxlength' => 45]); ?>
<hr>
<?php echo CHtml::submitButton(Yii::t('UserModule.views_account_changePassword', 'Save'), array('class' => 'btn btn-primary')); ?>
<?php echo CHtml::submitButton(Yii::t('UserModule.views_account_changePassword', 'Save'), array('class' => 'btn btn-primary', 'data-ui-loader' => '')); ?>
<!-- show flash message after saving -->

View File

@ -43,7 +43,7 @@ use \humhub\models\Setting;
<?php endif; ?>
<hr>
<?php echo CHtml::submitButton(Yii::t('UserModule.views_account_editSettings', 'Save'), array('class' => 'btn btn-primary')); ?>
<?php echo CHtml::submitButton(Yii::t('UserModule.views_account_editSettings', 'Save'), array('class' => 'btn btn-primary', 'data-ui-loader' => '')); ?>
<!-- show flash message after saving -->
<?php echo \humhub\widgets\DataSaved::widget(); ?>

View File

@ -46,7 +46,7 @@ use humhub\modules\user\models\User;
<hr>
<?php echo CHtml::submitButton(Yii::t('UserModule.views_account_emailing', 'Save'), array('class' => 'btn btn-primary')); ?>
<?php echo CHtml::submitButton(Yii::t('UserModule.views_account_emailing', 'Save'), array('class' => 'btn btn-primary', 'data-ui-loader' => '')); ?>
<!-- show flash message after saving -->
<?php echo \humhub\widgets\DataSaved::widget(); ?>