Merge pull request #1696 from buddha87/v1.1-dev

Enh: Added loader button to space/user settings + fixed user onIntegrity check
This commit is contained in:
buddha87 2016-05-07 19:08:54 +02:00
commit e1bd0662a8
10 changed files with 15 additions and 16 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

@ -80,7 +80,7 @@ class Space extends ContentContainerActiveRecord implements \humhub\modules\sear
{
$rules = [
[['join_policy', 'visibility', 'status', 'created_by', 'updated_by', 'auto_add_new_members', 'default_content_visibility'], 'integer'],
[['indexUrl'], 'string'],
[['name'], 'required'],
[['description', 'tags', 'color'], 'string'],
[['created_at', 'updated_at'], 'safe'],
@ -103,7 +103,7 @@ class Space extends ContentContainerActiveRecord implements \humhub\modules\sear
{
$scenarios = parent::scenarios();
$scenarios['edit'] = ['name', 'color', 'description', 'tags','indexUrl', 'join_policy', 'visibility', 'default_content_visibility'];
$scenarios['edit'] = ['name', 'color', 'description', 'tags', 'indexUrl', 'join_policy', 'visibility', 'default_content_visibility'];
$scenarios['create'] = ['name', 'color', 'description', 'join_policy', 'visibility'];
return $scenarios;

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

@ -6,6 +6,7 @@ use Yii;
use humhub\modules\user\models\User;
use humhub\modules\user\models\Password;
use humhub\modules\user\models\Profile;
use humhub\modules\user\models\GroupUser;
use humhub\modules\user\models\Mentioning;
use humhub\modules\user\models\Follow;
@ -50,13 +51,10 @@ class Events extends \yii\base\Object
$integrityController = $event->sender;
$integrityController->showTestHeadline("User Module - Users (" . User::find()->count() . " entries)");
foreach (User::find()->joinWith(['profile', 'group'])->all() as $user) {
foreach (User::find()->joinWith(['profile'])->all() as $user) {
if ($user->profile == null) {
$integrityController->showWarning("User with id " . $user->id . " has no profile record!");
}
if (!$user->hasGroup()) {
$integrityController->showWarning("User with id " . $user->id . " has no group assignment!");
}
}
foreach (GroupUser::find()->joinWith(['user'])->all() as $groupUser) {

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(); ?>