Small cleanup.

This commit is contained in:
buddh4 2017-07-20 18:07:05 +02:00
parent 7556625914
commit 41d5ad4408
12 changed files with 76 additions and 85 deletions

View File

@ -36,6 +36,16 @@ class CoreApiAsset extends AssetBundle
*/
public $jsOptions = ['position' => \yii\web\View::POS_HEAD];
/**
* @inheritdoc
*/
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
'humhub\assets\BluebirdAsset',
];
/**
* @inheritdoc
*/
@ -60,19 +70,10 @@ class CoreApiAsset extends AssetBundle
'js/humhub/humhub.ui.gallery.js',
'js/humhub/humhub.ui.picker.js',
'js/humhub/humhub.ui.richtext.js',
'js/humhub/humhub.ui.markdown.js',
'js/humhub/humhub.media.Jplayer.js',
// Note this should stay at last for other click event listeners beeing able to prevent pjax handling (e.g gallery)
'js/humhub/humhub.client.pjax.js',
];
/**
* @inheritdoc
*/
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
'humhub\assets\BluebirdAsset',
];
}

View File

@ -41,6 +41,15 @@ class Formatter extends \yii\i18n\Formatter
}
}
/**
* Returns the date pattern for the given $locale and $dateType, $timeType.
*
* @since 1.2.2
* @param int $dateType
* @param int $timeType
* @param null $locale
* @return null|string
*/
public function getDateTimePattern($dateType = IntlDateFormatter::SHORT, $timeType = IntlDateFormatter::SHORT, $locale = null) {
if(extension_loaded('intl')) {
$locale = empty($locale) ? $this->locale : $locale;
@ -55,6 +64,7 @@ class Formatter extends \yii\i18n\Formatter
* Checks if the time pattern of a given $locale contains a meridiem (AM/PM).
* If no $locale is provided the Formatter locale will be used.
*
* @since 1.2.2
* @param null $locale
* @return bool if the locale uses a 12 hour (AM/PM) otherwise a 24 hour time format is used.
*/

View File

@ -29,6 +29,7 @@ HumHub Change Log
- Enh: Added `humhub/widgts/Button::userPickerSelfSelect()` for creating self select button for userpickers.
- Enh: Added `humhub/widgts/Link::withAction()` for creating action based links
- Enh: Added `SelectTimeZoneDropdown` widget
- Enh: Added `Modal::closable` in order to respect `backdrop` and `keyboard` data setting of `Modal` and `ModalDialog` widget
1.2.1 (June 17, 2017)
- Fix: Invite error in french language

View File

@ -13,13 +13,13 @@ return [
'id' => 'notification',
'class' => Module::className(),
'isCoreModule' => true,
'events' => array(
array('class' => User::className(), 'event' => User::EVENT_BEFORE_DELETE, 'callback' => array(Events::className(), 'onUserDelete')),
array('class' => Space::className(), 'event' => Space::EVENT_BEFORE_DELETE, 'callback' => array(Events::className(), 'onSpaceDelete')),
array('class' => IntegrityController::className(), 'event' => IntegrityController::EVENT_ON_RUN, 'callback' => array(Events::className(), 'onIntegrityCheck')),
array('class' => CronController::className(), 'event' => CronController::EVENT_ON_DAILY_RUN, 'callback' => array(Events::className(), 'onCronDailyRun')),
array('class' => ActiveRecord::className(), 'event' => ActiveRecord::EVENT_BEFORE_DELETE, 'callback' => [Events::className(), 'onActiveRecordDelete']),
array('class' => LayoutAddons::className(), 'event' => LayoutAddons::EVENT_BEFORE_RUN, 'callback' => [Events::className(), 'onLayoutAddons'])
),
'events' => [
['class' => User::className(), 'event' => User::EVENT_BEFORE_DELETE, 'callback' => [Events::className(), 'onUserDelete']],
['class' => Space::className(), 'event' => Space::EVENT_BEFORE_DELETE, 'callback' => [Events::className(), 'onSpaceDelete']],
['class' => IntegrityController::className(), 'event' => IntegrityController::EVENT_ON_RUN, 'callback' => [Events::className(), 'onIntegrityCheck']],
['class' => CronController::className(), 'event' => CronController::EVENT_ON_DAILY_RUN, 'callback' => [Events::className(), 'onCronDailyRun']],
['class' => ActiveRecord::className(), 'event' => ActiveRecord::EVENT_BEFORE_DELETE, 'callback' => [Events::className(), 'onActiveRecordDelete']],
['class' => LayoutAddons::className(), 'event' => LayoutAddons::EVENT_BEFORE_RUN, 'callback' => [Events::className(), 'onLayoutAddons']]
],
];
?>

View File

@ -3,14 +3,14 @@
use yii\helpers\Html;
?><div class="panel panel-default">
<div class="panel-heading">
<?php echo Yii::t('SpaceModule.views_admin_modules', '<strong>Space</strong> Modules'); ?>
<?= Yii::t('SpaceModule.views_admin_modules', '<strong>Space</strong> Modules'); ?>
</div>
<div class="panel-body">
<?php if (count($availableModules) == 0): ?>
<p><?php echo Yii::t('SpaceModule.views_admin_modules', 'Currently there are no modules available for this space!'); ?></p>
<p><?= Yii::t('SpaceModule.views_admin_modules', 'Currently there are no modules available for this space!'); ?></p>
<?php else: ?>
<?php echo Yii::t('SpaceModule.views_admin_modules', 'Enhance this space with modules.'); ?><br>
<?= Yii::t('SpaceModule.views_admin_modules', 'Enhance this space with modules.'); ?><br>
<?php endif; ?>
@ -19,36 +19,36 @@ use yii\helpers\Html;
<div class="media">
<img class="media-object img-rounded pull-left" data-src="holder.js/64x64" alt="64x64"
style="width: 64px; height: 64px;"
src="<?php echo $module->getContentContainerImage($space); ?>">
src="<?= $module->getContentContainerImage($space); ?>">
<div class="media-body">
<h4 class="media-heading"><?php echo $module->getContentContainerName($space); ?>
<h4 class="media-heading"><?= $module->getContentContainerName($space); ?>
<?php if ($space->isModuleEnabled($moduleId)) : ?>
<small><span class="label label-success"><?php echo Yii::t('SpaceModule.views_admin_modules', 'Activated'); ?></span></small>
<small><span class="label label-success"><?= Yii::t('SpaceModule.views_admin_modules', 'Activated'); ?></span></small>
<?php endif; ?>
</h4>
<p><?php echo $module->getContentContainerDescription($space); ?></p>
<p><?= $module->getContentContainerDescription($space); ?></p>
<?php if ($space->canDisableModule($moduleId)): ?>
<a href="#" style="<?= $space->isModuleEnabled($moduleId) ? '' : 'display:none' ?>"
data-action-click="content.container.disableModule"
data-action-url="<?= $space->createUrl('/space/manage/module/disable', ['moduleId' => $moduleId]) ?>" data-reload="1"
data-action-confirm="<?= Yii::t('SpaceModule.views_admin_modules', 'Are you sure? *ALL* module data for this space will be deleted!') ?>"
class="btn btn-sm btn-primary disable" data-ui-loader>
class="btn btn-sm btn-primary disable disable-module-<?= $moduleId ?>" data-ui-loader>
<?= Yii::t('SpaceModule.views_admin_modules', 'Disable') ?>
</a>
<?php endif; ?>
<?php if ($module->getContentContainerConfigUrl($space) && $space->isModuleEnabled($moduleId)) : ?>
<a href="<?= $module->getContentContainerConfigUrl($space) ?>" class="btn btn-sm btn-default">
<a href="<?= $module->getContentContainerConfigUrl($space) ?>" class="btn btn-sm btn-default configure-module-<?= $moduleId ?>">
<?= Yii::t('SpaceModule.views_admin_modules', 'Configure') ?>
</a>
<?php endif; ?>
<a href="#" style="<?= $space->isModuleEnabled($moduleId) ? 'display:none' : '' ?>"
<a href="#" style="<?= $space->isModuleEnabled($moduleId) ? 'display:none' : '' ?>"
data-action-click="content.container.enableModule" data-action-url="<?= $space->createUrl('/space/manage/module/enable', ['moduleId' => $moduleId]) ?>" data-reload="1"
class="btn btn-sm btn-primary enable" data-ui-loader>
class="btn btn-sm btn-primary enable enable-module-<?= $moduleId ?>" data-ui-loader>
<?= Yii::t('SpaceModule.views_admin_modules', 'Enable') ?>
</a>
</div>

View File

@ -27,7 +27,7 @@ if ($canInviteExternal && $model->hasErrors('inviteExternal')) {
<div class="text-center">
<ul id="tabs" class="nav nav-tabs tabs-center" data-tabs="tabs">
<li class="<?= $isInviteTabActiveClass ?> tab-internal">
<a href="#internal"data-toggle="tab"><?= Yii::t('SpaceModule.views_space_invite', 'Pick users'); ?></a>
<a href="#internal" data-toggle="tab"><?= Yii::t('SpaceModule.views_space_invite', 'Pick users'); ?></a>
</li>
<li class="<?= $isInviteExternalTabActiveClass ?> tab-external">
<a href="#external" data-toggle="tab"><?= Yii::t('SpaceModule.views_space_invite', 'Invite by email'); ?></a>

View File

@ -1,7 +1,6 @@
<?php
return [
'modules' => ['task'],
'fixtures' => [
'default'
]

View File

@ -125,6 +125,11 @@ abstract class BasePickerField extends InputWidget
*/
public $form;
/**
* @deprecated since 1.2.2 use $name instead
*/
public $formName;
/**
* Model instance.
*
@ -140,13 +145,6 @@ abstract class BasePickerField extends InputWidget
*/
public $attribute;
/**
* Input form name.
* This can be set if no form and model is provided for custom input field setting.
*
* @var type
*/
public $formName;
/**
* Can be used to overwrite the default placeholder.
@ -163,7 +161,7 @@ abstract class BasePickerField extends InputWidget
/**
* If set to true the picker will be focused automatically.
*
* @var type
* @var boolean
*/
public $focus = false;
@ -196,6 +194,11 @@ abstract class BasePickerField extends InputWidget
{
\humhub\assets\Select2BootstrapAsset::register($this->view);
//Only for compatibility
if(empty($this->name)) {
$this->name = $this->formName;
}
if ($this->selection != null && !is_array($this->selection)) {
$this->selection = [$this->selection];
}
@ -215,8 +218,8 @@ abstract class BasePickerField extends InputWidget
} else if ($this->model != null) {
return Html::activeDropDownList($this->model, $this->attribute, $selection, $options);
} else {
$name = (!$this->formName) ? 'pickerField' : $this->formName;
return Html::dropDownList($name, $selection, [], $options);
$name = (!$this->name) ? 'pickerField' : $this->name;
return Html::dropDownList($name, $this->value, $selection, $options);
}
}

View File

@ -12,6 +12,7 @@ namespace humhub\widgets;
* MarkdownEditorWidget replaces a textarea element with bootstrap-markdown editor
*
* @todo Allow multiple MarkdownEditorWidget instances on a page
* @deprecated since 1.2.2 use MarkdownField instead
* @author luke
* @since 0.11
*/

View File

@ -12,7 +12,7 @@ use humhub\widgets\RichText;
* @since 1.2
* @author buddha
*/
class RichtextField extends JsWidget
class RichtextField extends InputWidget
{
/**
@ -29,37 +29,6 @@ class RichtextField extends JsWidget
*/
public $minInput = 3;
/**
* If the ActiveForm is set, it will be used to create the picker field,
* otherwise it's created by Html::activeDropDownList
*
* @var \yii\widgets\ActiveForm
*/
public $form;
/**
* Model instance. Requires the setting of an model $attribute.
*
* @var \yii\db\ActiveRecord
*/
public $model;
/**
* Model attribute which holds the picker value. The referenced model attribute has to be an
* array.
*
* @var string
*/
public $attribute;
/**
* Input form name.
* This can be provided if no form and model is provided for custom input field setting.
*
* @var type
*/
public $name;
/**
* Can be used to overwrite the default placeholder.
*
@ -98,14 +67,6 @@ class RichtextField extends JsWidget
*/
public $excludes = [];
/**
* Can be used to set the value in case no $model and $attribute is provided.
* $model and $attribute is provided.
*
* @var string
*/
public $value;
/**
* If set to true the picker will be focused automatically.
*

View File

@ -1,5 +1,9 @@
<?php
use humhub\libs\Html;
?>
<!-- Dialog -->
<div class="<?= $dialogClass ?>">
<?= Html::beginTag('div', $options) ?>
<!-- Content -->
<div class="modal-content">
<!-- Header -->
@ -34,5 +38,4 @@
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?= Html::endTag('div') ?>

View File

@ -92,11 +92,23 @@ humhub.module('ui.form.elements', function (module, require, $) {
}
};
var toggleTimeZoneInput = function(evt) {
evt.$trigger.siblings('.timeZoneInputContainer:first').fadeToggle('fast');
};
var timeZoneSelected = function(evt) {
$toggleButton = evt.$trigger.parent().siblings('.timeZoneToggle:first');
$toggleButton.text(evt.$trigger.find('option:selected').text());
evt.$trigger.parent().hide();
};
module.export({
init: init,
initCheckbox: initCheckbox,
initRadio: initRadio
initRadio: initRadio,
toggleTimeZoneInput: toggleTimeZoneInput,
timeZoneSelected: timeZoneSelected
});
});