Enh: Included select2-humhub theme into the new theming

Enh: Added select2 dropdown for language selection in account and admin settings
Enh: Added data-ui-select2 addition for simple select2 dropdowns
Fix: Don't apply js additions if there was no matching element
This commit is contained in:
buddh4 2017-03-15 13:23:55 +01:00
parent 1fd21c1e02
commit cd64d15cae
9 changed files with 50 additions and 32 deletions

View File

@ -29,7 +29,9 @@ class Select2BootstrapAsset extends AssetBundle
public $baseUrl = '@web-static';
/**
* @inheritdoc
* This is only included for backward compatibility for former 1.2 beta themes.
* After removing this, all themes have to be rebuilt.
* @deprecated since version 1.2.0-beta.3
*/
public $css = ['resources/css/select2Theme/select2-humhub.css'];
@ -40,5 +42,4 @@ class Select2BootstrapAsset extends AssetBundle
public $depends = [
'humhub\assets\Select2Asset'
];
}

View File

@ -3,6 +3,10 @@ HumHub Change Log
1.2.0-beta.3 under developement
--------------------------------
- Enh: Included select2-humhub theme into the new theming
- Enh: Added select2 dropdown for language selection in account and admin settings
- Enh: Added data-ui-select2 addition for simple select2 dropdowns
- Fix: Don't apply js additions if there was no matching element
- Fix: #2336 use of invalid message key in comment notification (dutch)
- Enh: Disable user and space follow by means of module settings
- Fix: Setting of submitName and upload input name in file upload JsWidget

View File

@ -21,7 +21,7 @@ use yii\widgets\ActiveForm;
<?php $allowedLanguages = Yii::$app->i18n->getAllowedLanguages(); ?>
<?php if (count($allowedLanguages) > 1) : ?>
<?php echo $languageDropDown = $form->field($model, 'defaultLanguage')->dropDownList($allowedLanguages); ?>
<?php echo $languageDropDown = $form->field($model, 'defaultLanguage')->dropDownList($allowedLanguages, ['data-ui-select2' => '']); ?>
<?php endif; ?>
<?php echo $form->field($model, 'timeZone')->dropDownList(\humhub\libs\TimezoneHelper::generateList()); ?>

View File

@ -6,33 +6,33 @@ use \humhub\compat\CHtml;
<?php $this->beginContent('@user/views/account/_userSettingsLayout.php') ?>
<?php $form = ActiveForm::begin(['id' => 'basic-settings-form']); ?>
<?php $form = ActiveForm::begin(['id' => 'basic-settings-form']); ?>
<?php echo $form->field($model, 'tags'); ?>
<?php echo $form->field($model, 'tags'); ?>
<?php if(count($languages) > 1) : ?>
<?php echo $form->field($model, 'language')->dropDownList($languages); ?>
<?php endif; ?>
<?php if (count($languages) > 1) : ?>
<?php echo $form->field($model, 'language')->dropDownList($languages, ['data-ui-select2' => '']); ?>
<?php endif; ?>
<?php echo $form->field($model, 'timeZone')->dropDownList(\humhub\libs\TimezoneHelper::generateList()); ?>
<?php echo $form->field($model, 'timeZone')->dropDownList(\humhub\libs\TimezoneHelper::generateList()); ?>
<?php if (Yii::$app->getModule('user')->settings->get('auth.allowGuestAccess')): ?>
<?php if (Yii::$app->getModule('user')->settings->get('auth.allowGuestAccess')): ?>
<?php
echo $form->field($model, 'visibility')->dropDownList([
1 => Yii::t('UserModule.views_account_editSettings', 'Registered users only'),
2 => Yii::t('UserModule.views_account_editSettings', 'Visible for all (also unregistered users)'),
]);
?>
<?php
echo $form->field($model, 'visibility')->dropDownList([
1 => Yii::t('UserModule.views_account_editSettings', 'Registered users only'),
2 => Yii::t('UserModule.views_account_editSettings', 'Visible for all (also unregistered users)'),
]);
?>
<?php endif; ?>
<?php endif; ?>
<?php if (Yii::$app->getModule('tour')->settings->get('enable') == 1) : ?>
<?php echo $form->field($model, 'show_introduction_tour')->checkbox(); ?>
<?php endif; ?>
<?php if (Yii::$app->getModule('tour')->settings->get('enable') == 1) : ?>
<?php echo $form->field($model, 'show_introduction_tour')->checkbox(); ?>
<?php endif; ?>
<button class="btn btn-primary" type="submit" data-ui-loader><?= Yii::t('UserModule.views_account_editSettings', 'Save') ?></button>
<button class="btn btn-primary" type="submit" data-ui-loader><?= Yii::t('UserModule.views_account_editSettings', 'Save') ?></button>
<?php ActiveForm::end(); ?>
<?php ActiveForm::end(); ?>
<?php $this->endContent(); ?>

View File

@ -52,9 +52,11 @@ humhub.module('ui.additions', function (module, require, $) {
var $element = (element instanceof $) ? element : $(element);
$.each(_additions, function (id) {
// Only apply certain filter if filter option is set
if (options.filter && !options.filter.indexOf(id)) {
return;
}
try {
module.apply($element, id);
} catch (e) {
@ -78,6 +80,12 @@ humhub.module('ui.additions', function (module, require, $) {
}
var $match = $element.find(addition.selector).addBack(addition.selector);
// only apply addition if we actually find a match
if(!$match.length) {
return;
}
addition.handler.apply($match, [$match, $element]);
};
@ -95,6 +103,10 @@ humhub.module('ui.additions', function (module, require, $) {
module.register('autosize', '.autosize', function ($match) {
$match.autosize();
});
module.register('select2', '[data-ui-select2]', function ($match) {
$match.select2({theme:"humhub"});
});
// Show tooltips on elements
module.register('tooltip', '.tt', function ($match) {

View File

@ -179,6 +179,8 @@
@import "tags.less";
}
@import "../resources/css/select2Theme/build.less";
// LEGACY/DEPRECATED User- & Space picker
ul.tag_input {
list-style: none;

View File

@ -1,4 +1,3 @@
@import "../../../protected/vendor/bower/bootstrap/less/variables";
@import "../../../themes/HumHub/css/less/variables";
@import "../../../protected/vendor/bower/bootstrap/less/mixins";
@import "../../../../protected/vendor/bower/bootstrap/less/variables";
@import "../../../../protected/vendor/bower/bootstrap/less/mixins";
@import "select2-humhub.less";

View File

@ -34,7 +34,7 @@
// @see https://github.com/twbs/humhub-sass/blob/master/assets/stylesheets/humhub/_forms.scss#L115
.humhub-input-defaults() {
background-color: @input-bg;
border: 2px solid @background2;
border: 2px solid @background-color-page;
border-radius: @input-border-radius;
color: @input-color;
font-family: @font-family-base;
@ -185,9 +185,9 @@
*/
&--highlighted[aria-selected] {
background-color: @background1;
background-color: @background-color-secondary;
border-left:3px solid @info;
color: @font3;
color: @text-color-highlight;
}
.select2-results__option {
@ -707,15 +707,15 @@
*/
.has-warning {
.validation-state-focus(@state-warning-text);
.validation-state-focus(@warning);
}
.has-error {
.validation-state-focus(@state-danger-text);
.validation-state-focus(@danger);
}
.has-success {
.validation-state-focus(@state-success-text);
.validation-state-focus(@success);
}
/**

File diff suppressed because one or more lines are too long