- Enh: Added Pin/Archived/Public wallentry icons

- Enh: Smaller stream style fixes
- Enh: Added movable behavior to content type post
- Fix: Invalid use of global permission for new force invite
This commit is contained in:
buddh4 2018-07-01 14:51:28 +02:00
parent 5d9fbb1c43
commit ffc1fb9011
12 changed files with 43 additions and 19 deletions

View File

@ -232,15 +232,15 @@ class ContentActiveRecord extends ActiveRecord implements ContentOwner, Movable
public function getLabels($labels = [], $includeContentName = true)
{
if ($this->content->isPinned()) {
$labels[] = Label::danger(Yii::t('ContentModule.widgets_views_label', 'Pinned'))->sortOrder(100);
$labels[] = Label::danger(Yii::t('ContentModule.widgets_views_label', 'Pinned'))->icon('fa-map-pin')->sortOrder(100);
}
if($this->content->isArchived()) {
$labels[] = Label::warning(Yii::t('ContentModule.widgets_views_label', 'Archived'))->sortOrder(200);
$labels[] = Label::warning(Yii::t('ContentModule.widgets_views_label', 'Archived'))->icon('fa-archive')->sortOrder(200);
}
if ($this->content->isPublic()) {
$labels[] = Label::info(Yii::t('ContentModule.widgets_views_label', 'Public'))->sortOrder(300);
$labels[] = Label::info(Yii::t('ContentModule.widgets_views_label', 'Public'))->icon('fa-globe')->sortOrder(300);
}
if ($includeContentName) {

View File

@ -389,8 +389,10 @@ class Content extends ContentDeprecated implements Movable
if($move === true) {
static::getDb()->transaction(function($db) use ($container) {
$this->setContainer($container);
$this->save();
$this->getModel()->afterMove();
if($this->save()) {
ContentTag::deleteContentRelations($this, false);
$this->getModel()->afterMove();
}
});
}

View File

@ -20,6 +20,7 @@ use Yii;
use yii\db\ActiveQuery;
use humhub\components\ActiveRecord;
use humhub\modules\content\components\ContentContainerActiveRecord;
use yii\db\Expression;
/**
* ContentTags are a concept to categorize content on module and ContentContainer level.
@ -472,7 +473,7 @@ class ContentTag extends ActiveRecord
* @param Content $content
* @return ContentTagRelation[]
*/
public static function getTagContentRelations(Content $content)
public static function getTagContentRelations(Content $content, $includeGlobal = true)
{
$query = $content->getTagRelations()->innerJoin('content_tag', 'content_tag_relation.tag_id = content_tag.id');
@ -481,6 +482,10 @@ class ContentTag extends ActiveRecord
$query->andWhere(['content_tag.module_id' => $instance->moduleId]);
}
if(!$includeGlobal) {
$query->andWhere(['IS NOT', 'content_tag.contentcontainer_id', new Expression('NULL')]);
}
if (static::class != ContentTag::class) {
$query->andWhere(['content_tag.type' => static::class]);
}
@ -493,9 +498,9 @@ class ContentTag extends ActiveRecord
*
* @param Content $content
*/
public static function deleteContentRelations(Content $content)
public static function deleteContentRelations(Content $content, $includeGlobal = true)
{
$relations = self::getTagContentRelations($content);
$relations = self::getTagContentRelations($content, $includeGlobal);
foreach ($relations as $relation) {
$relation->delete();
}

View File

@ -51,6 +51,13 @@ class MoveContentForm extends Model
];
}
public function attributeLabels()
{
return[
'target' => Yii::t('ContentModule.base', 'Target Space')
];
}
public function validateTarget($attribute, $params, $validator)
{
$targetContainer = $this->getTargetContainer();

View File

@ -12,10 +12,10 @@ use humhub\widgets\Button;
<?php ModalDialog::begin(['header' => Yii::t('ContentModule.base', '<strong>Move</strong> content')]) ?>
<?php $form = ActiveForm::begin() ?>
<div class="modal-body">
<?= $form->field($model, 'target')->widget(SpacePickerField::class, ['maxSelection' => 1])?>
<?= $form->field($model, 'target')->widget(SpacePickerField::class, ['maxSelection' => 1, 'focus' => true])?>
</div>
<div class="modal-footer">
<?= Button::primary(Yii::t('base', 'Save'))->action('content.submitMove') ?>
<?= Button::primary(Yii::t('base', 'Save'))->action('content.submitMove')->loader(true) ?>
<?= ModalButton::cancel() ?>
</div>
<?php ActiveForm::end() ?>

View File

@ -12,12 +12,12 @@ use humhub\modules\content\permissions\ManageContent;
use Yii;
/**
* MoveLink used to move a wallentry to another space.
* MoveContentLink used to move a wallentry to another space.
*
* @package humhub.modules_core.wall.widgets
* @since 1.3
*/
class MoveLink extends WallEntryControlLink
class MoveContentLink extends WallEntryControlLink
{
/**

View File

@ -194,7 +194,7 @@ class WallEntry extends Widget
$this->addControl($result, [NotificationSwitchLink::class, ['content' => $this->contentObject], ['sortOrder' => 300]]);
$this->addControl($result, [PermaLink::class, ['content' => $this->contentObject], ['sortOrder' => 400]]);
$this->addControl($result, [PinLink::class, ['content' => $this->contentObject], ['sortOrder' => 500]]);
$this->addControl($result, [MoveLink::class, ['model' => $this->contentObject], ['sortOrder' => 550]]);
$this->addControl($result, [MoveContentLink::class, ['model' => $this->contentObject], ['sortOrder' => 550]]);
$this->addControl($result, [ArchiveLink::class, ['content' => $this->contentObject], ['sortOrder' => 600]]);
if(isset($this->controlsOptions['add'])) {

View File

@ -37,7 +37,7 @@ class InviteModal extends Widget
'model' => $this->model,
'attribute' => $this->attribute,
'searchUrl' => $this->searchUrl,
'canManageMembers' => $this->model->space->getPermissionManager()->can(new ManageUsers()),
'canManageMembers' => Yii::$app->user->can(ManageUsers::class),
]);
}
}

View File

@ -176,7 +176,7 @@ class WallStreamFilterNavigation extends FilterNavigation
$this->addFilter([
'id' => DefaultStreamFilter::FILTER_FILES,
'title' => Yii::t('ContentModule.widgets_views_stream', 'Content with attached files'),
'title' => Yii::t('ContentModule.widgets_views_stream', 'With file attachments'),
'sortOrder' => 300
],static::FILTER_BLOCK_BASIC);
}

View File

@ -20,7 +20,7 @@ class Events extends BaseObject
$record = $event->sender->object;
if($record->content->canWrite()) {
$event->sender->addWidget(ContentTopicButton::class, ['record' => $record], ['sortOrder' => 200]);
$event->sender->addWidget(ContentTopicButton::class, ['record' => $record], ['sortOrder' => 240]);
}
}

View File

@ -110,7 +110,6 @@
.wall-stream-filter-root {
margin:0;
white-space: nowrap;
border:0 !important;
}
@ -124,7 +123,7 @@
}
.wall-stream-filter-body {
overflow:auto;
overflow:hidden;
background-color: @background-color-secondary;
border: 1px solid #ddd;
border-top: 0;
@ -183,6 +182,17 @@
}
}
@media (max-width: 767px) {
#wall-stream-filter-nav {
.wall-stream-filter-root {
white-space: nowrap;
}
.wall-stream-filter-body {
overflow: auto;
}
}
}
.filter-root {
margin:15px;

File diff suppressed because one or more lines are too long