mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix: Admin group add members placeholder.
Enh: Easier save feedback by using module.log.success('saved'); Fix: Set jsWidget id when autogenerated Fix: Use of Html::activeLabel instead of $form->label in RichtextField Enh: Added pjax redirect capability to js client Fix: Show default error in status bar if invalid message object was provided
This commit is contained in:
parent
06b3e976d6
commit
433d885eb5
@ -3,6 +3,17 @@ HumHub Change Log
|
||||
1.2.0-beta.2 under developement
|
||||
--------------------------------
|
||||
- Fix #2302: Hide file info for images on wall settings not applied.
|
||||
- Fix: German translation error in Admin -> Users -> Groups -> Members -> Add Member UserPicker.
|
||||
- Fix: German translation "Notify Users" placeholder too long.
|
||||
- Fix: Admin group add members placeholder.
|
||||
- Fix: Stream entry root not removed for content delte (poll,etc)
|
||||
- Enh: Easier save feedback by using 'module.log.success('saved')'
|
||||
- Fix: Admin group add members placeholder.
|
||||
- Enh: Easier save feedback by using module.log.success('saved');
|
||||
- Fix: Set jsWidget id when autogenerated
|
||||
- Fix: Use of Html::activeLabel instead of $form->label in RichtextField
|
||||
- Enh: Added pjax redirect capability to js client
|
||||
- Fix: Show default error in status bar if invalid message object was provided
|
||||
|
||||
1.2.0-beta.2 (February 24, 2017)
|
||||
--------------------------------
|
||||
|
@ -19,7 +19,7 @@ use yii\widgets\ActiveForm;
|
||||
'model' => $addGroupMemberForm,
|
||||
'attribute' => 'userGuids',
|
||||
'url' => Url::to(['/admin/group/new-member-search', 'id' => $group->id]),
|
||||
'options' => ['data-placeholder' => Yii::t('AdminModule.views_group_manageGroupUser', 'Add new members...')],
|
||||
'placeholder' => Yii::t('AdminModule.views_group_manageGroupUser', 'Add new members...'),
|
||||
'focus' => true,
|
||||
])
|
||||
?>
|
||||
|
@ -89,6 +89,7 @@ class CoreJsConfig extends Widget
|
||||
'text' => [
|
||||
'error.default' => Yii::t('base', 'An unexpected error occured. If this keeps happening, please contact a site administrator.'),
|
||||
'success.saved' => Yii::t('base', 'Saved'),
|
||||
'saved' => Yii::t('base', 'Saved'),
|
||||
'success.edit' => Yii::t('base', 'Saved'),
|
||||
0 => Yii::t('base', 'An unexpected error occured. If this keeps happening, please contact a site administrator.'),
|
||||
403 => Yii::t('base', 'You are not allowed to run this action.'),
|
||||
|
@ -110,7 +110,8 @@ class JsWidget extends Widget
|
||||
if($this->id) {
|
||||
return $this->id;
|
||||
}
|
||||
return parent::getId($autoGenerate);
|
||||
|
||||
return $this->id = parent::getId($autoGenerate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ class RichtextField extends JsWidget
|
||||
* @var string
|
||||
*/
|
||||
public $placeholder;
|
||||
|
||||
|
||||
/**
|
||||
* The url used for the default @ metioning.
|
||||
* If there is no $searchUrl is given, the $searchRoute will be used instead.
|
||||
@ -74,7 +74,7 @@ class RichtextField extends JsWidget
|
||||
* @var string
|
||||
*/
|
||||
public $mentioningUrl;
|
||||
|
||||
|
||||
/**
|
||||
* Route used for the default @ mentioning. This will only be used if
|
||||
* not $searchUrl is given.
|
||||
@ -82,7 +82,7 @@ class RichtextField extends JsWidget
|
||||
* @var string
|
||||
*/
|
||||
protected $mentioningRoute = "/search/search/mentioning";
|
||||
|
||||
|
||||
/**
|
||||
* Richtext features supported for within this feature.
|
||||
* By default all features will be included.
|
||||
@ -90,14 +90,14 @@ class RichtextField extends JsWidget
|
||||
* @var array
|
||||
*/
|
||||
public $includes = [];
|
||||
|
||||
|
||||
/**
|
||||
* Richtext features not supported in this richtext feature.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $excludes = [];
|
||||
|
||||
|
||||
/**
|
||||
* Can be used to set the value in case no $model and $attribute is provided.
|
||||
* $model and $attribute is provided.
|
||||
@ -105,20 +105,20 @@ class RichtextField extends JsWidget
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
|
||||
|
||||
/**
|
||||
* If set to true the picker will be focused automatically.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $focus = false;
|
||||
|
||||
|
||||
/**
|
||||
* Disables the input field.
|
||||
* @var boolean
|
||||
*/
|
||||
public $disabled = false;
|
||||
|
||||
|
||||
/**
|
||||
* Will be used as userfeedback, why this richtext is disabled.
|
||||
*
|
||||
@ -130,12 +130,12 @@ class RichtextField extends JsWidget
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $init = true;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $visible = true;
|
||||
|
||||
|
||||
/**
|
||||
* @var boolean defines if the default label should be rendered. This is only available if $form is given.
|
||||
*/
|
||||
@ -147,26 +147,41 @@ class RichtextField extends JsWidget
|
||||
public function run()
|
||||
{
|
||||
$inputOptions = $this->getAttributes();
|
||||
$inputOptions['id'] = $this->getId(true).'_input';
|
||||
$inputOptions['id'] = $this->getId(true) . '_input';
|
||||
$inputOptions['style'] = 'display:none;color';
|
||||
unset($inputOptions['contenteditable']);
|
||||
$modelAttribute = $this->attribute;
|
||||
|
||||
|
||||
if ($this->form != null) {
|
||||
$input = $this->form->field($this->model, $this->attribute)->textarea($inputOptions)->label(false);
|
||||
$richText = Html::tag('div', RichText::widget(['text' => $this->model->$modelAttribute, 'edit' => true]), $this->getOptions());
|
||||
$richText = $this->form->label($this->model, $this->attribute, ['class' => 'control-label']).$richText;
|
||||
$richText = $this->getLabel() . $richText;
|
||||
} else if ($this->model != null) {
|
||||
$input = Html::activeTextarea($this->model, $this->attribute, $inputOptions);
|
||||
$richText = Html::tag('div', RichText::widget(['text' => $this->model->$modelAttribute, 'edit' => true]), $this->getOptions());
|
||||
$richText = $this->getLabel() . $richText;
|
||||
} else {
|
||||
$input = Html::textarea(((!$this->name) ? 'richtext' : $this->name), $this->value, $inputOptions);
|
||||
$richText = Html::tag('div', RichText::widget(['text' => $this->value, 'edit' => true]),$this->getOptions());
|
||||
$richText = Html::tag('div', RichText::widget(['text' => $this->value, 'edit' => true]), $this->getOptions());
|
||||
$richText = $this->getLabel() . $richText;
|
||||
}
|
||||
|
||||
return $input . $richText;
|
||||
}
|
||||
|
||||
public function getLabel()
|
||||
{
|
||||
if(!$this->label) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return $input.$richText;
|
||||
if ($this->label === true && $this->model != null) {
|
||||
return Html::activeLabel($this->model, $this->attribute, ['class' => 'control-label']);
|
||||
} else {
|
||||
return $this->label;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$result = [
|
||||
@ -175,15 +190,15 @@ class RichtextField extends JsWidget
|
||||
'mentioning-url' => $this->getMentioningUrl(),
|
||||
'placeholder' => $this->placeholder,
|
||||
];
|
||||
|
||||
if($this->disabled) {
|
||||
|
||||
if ($this->disabled) {
|
||||
$result['disabled'] = true;
|
||||
$result['disabled-text'] = $this->disabledText;
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function getAttributes()
|
||||
{
|
||||
return [
|
||||
@ -191,9 +206,10 @@ class RichtextField extends JsWidget
|
||||
'contenteditable' => "true",
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getMentioningUrl()
|
||||
{
|
||||
return ($this->mentioningUrl) ? $this->mentioningUrl : Url::to([$this->mentioningRoute]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ humhub.module('client', function (module, require, $) {
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
var reload = function(preventPjax) {
|
||||
if(!preventPjax && module.pjax.config.active) {
|
||||
|
||||
var reload = function (preventPjax) {
|
||||
if (!preventPjax && module.pjax.config.active) {
|
||||
module.pjax.reload();
|
||||
} else {
|
||||
location.reload(true);
|
||||
@ -171,18 +171,7 @@ humhub.module('client', function (module, require, $) {
|
||||
var response = new Response(xhr, url, textStatus, cfg.dataType).setError(errorThrown);
|
||||
|
||||
if (response.status == 302) {
|
||||
|
||||
url = null;
|
||||
if (xhr.getResponseHeader('X-Pjax-Url')) {
|
||||
url = xhr.getResponseHeader('X-Pjax-Url');
|
||||
} else {
|
||||
url = xhr.getResponseHeader('X-Redirect');
|
||||
}
|
||||
|
||||
if (url !== null) {
|
||||
document.location = url;
|
||||
return;
|
||||
}
|
||||
_redirect(xhr);
|
||||
}
|
||||
|
||||
if (errorHandler && object.isFunction(errorHandler)) {
|
||||
@ -256,6 +245,24 @@ humhub.module('client', function (module, require, $) {
|
||||
return promise;
|
||||
};
|
||||
|
||||
var _redirect = function (xhr) {
|
||||
var url = null;
|
||||
if (xhr.getResponseHeader('X-Pjax-Url')) {
|
||||
url = xhr.getResponseHeader('X-Pjax-Url');
|
||||
} else {
|
||||
url = xhr.getResponseHeader('X-Redirect');
|
||||
}
|
||||
|
||||
if (url !== null) {
|
||||
if(module.pjax && module.pjax.config.active) {
|
||||
module.pjax.redirect(url);
|
||||
} else {
|
||||
document.location = url;
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
var finish = function (originalEvent) {
|
||||
if (originalEvent && object.isFunction(originalEvent.finish) && originalEvent.block !== 'manual') {
|
||||
originalEvent.finish();
|
||||
|
@ -11,6 +11,10 @@ humhub.module('client.pjax', function (module, require, $) {
|
||||
}
|
||||
};
|
||||
|
||||
var redirect = function(url) {
|
||||
$.pjax({url: url, container: PJAX_CONTAINER_SELECTOR});
|
||||
};
|
||||
|
||||
var reload = function() {
|
||||
$.pjax.reload({container: PJAX_CONTAINER_SELECTOR});
|
||||
};
|
||||
@ -90,6 +94,7 @@ humhub.module('client.pjax', function (module, require, $) {
|
||||
module.export({
|
||||
init: init,
|
||||
reload: reload,
|
||||
redirect: redirect,
|
||||
isActive: isActive,
|
||||
installLoader: installLoader,
|
||||
});
|
||||
|
@ -104,6 +104,8 @@ humhub.module('log', function (module, require, $) {
|
||||
msg = this.getMessage(msg.status, level, true);
|
||||
} else if(object.isString(msg) || object.isNumber(msg)) {
|
||||
msg = this.getMessage(msg, level, (!object.isDefined(msg) && level >= TRACE_WARN));
|
||||
} else if(level >= TRACE_WARN){
|
||||
msg = this.getMessage(null, level, true);
|
||||
}
|
||||
|
||||
this._consoleLog(msg, level, details);
|
||||
|
Loading…
x
Reference in New Issue
Block a user