Skip to content

Commit

Permalink
Merge branch 'typo9'
Browse files Browse the repository at this point in the history
  • Loading branch information
tonypro committed Jun 10, 2020
2 parents c6fe2c1 + c7a6aa9 commit 9bde33f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 19 deletions.
24 changes: 24 additions & 0 deletions Classes/Domain/Model/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ class Message extends AbstractEntity
*/
protected $seenBy = null;

/**
* priority
*
* @var int $priority
*/
protected $priority = 0;

/**
*/
public function __construct()
Expand Down Expand Up @@ -167,4 +174,21 @@ public function removeSeenBy(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $front
{
$this->seenBy->detach($frontendUser);
}

/**
* @return int
*/
public function getPriority(): int
{
return $this->priority;
}

/**
* @param int $priority
*/
public function setPriority(int $priority): void
{
$this->priority = $priority;
}

}
6 changes: 4 additions & 2 deletions Classes/Domain/Repository/MessageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public function findByNotSeen(int $userId): QueryResultInterface
{
$query = $this->createQuery();

$query->matching($query->logicalNot(
$query->getQuerySettings()->setRespectStoragePage(false);

/* $query->matching($query->logicalNot(
$query->contains('seenBy', $userId)
));
));*/

return $query->execute();
}
Expand Down
19 changes: 17 additions & 2 deletions Configuration/TCA/tx_pxamessagebox_domain_model_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
'iconfile' => 'EXT:pxa_message_box/Resources/Public/Icons/message.svg'
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date, author, headline, text, seen_by',
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, priority, date, author, headline, text, seen_by',
],
'types' => [
'1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date, author, headline, text,
'1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, priority, date, author, headline, text,
--div--;LLL:EXT:pxa_message_box/Resources/Private/Language/locallang_db.xlf:tx_pxamessagebox_domain_model_message.seen_by, seen_by,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'
],
Expand Down Expand Up @@ -156,5 +156,20 @@
'MM' => 'tx_pxamessagebox_message_feuser_mm',
]
],
'priority' => [
'exclude' => false,
'label' => 'Availability',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['Viktigt', 0],
['Notera' , 1]
],
'showIconTable' => true,
'size' => 1,
'maxitems' => 1,
]
],
],
];
31 changes: 18 additions & 13 deletions Resources/Private/Templates/Message/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,34 @@
<f:section name="content">
<f:if condition="{messages}">
<f:for each="{messages}" as="message">
<div class="message-box">
<div class="message-box {f:if(condition: '{message.priority} == 0', then: 'message-box__important')} {f:if(condition: '{message.priority} == 1', then: 'message-box__notice')}">
<f:link.action action="close"
pageType="2378954"
data="{close-message: '1'}"
id="message-box-{message.uid}"
arguments="{message: message}">
pageType="2378954"
data="{close-message: '1'}"
id="message-box-{message.uid}"
arguments="{message: message}">
<div class="close-message__btn js__close-message"></div>
</f:link.action>

<div class="message-box__info">
<span class="message-box__info-date">{f:format.date(date: message.date, format: 'Y-m-d')}</span>
<span class="message-box__info-author">{message.author}</span>
</div>
<f:comment>
<div class="message-box__info">
<span class="message-box__info-date">{f:format.date(date: message.date, format: 'Y-m-d')}</span>
<span class="message-box__info-author">{message.author}</span>
</div>
</f:comment>

<f:if condition="{message.headline}">
<f:if condition="{message.headline}">
<h3 class="message-box__header">{message.headline}</h3>
</f:if>

<f:if condition="{message.text}">
<f:format.html>{message.text}</f:format.html>
<f:if condition="{message.text}">
<div class="message-box__text">
<f:format.html>{message.text}</f:format.html>
</div>
</f:if>
</div>
</f:for>
</f:if>
</f:section>
</html>
</html>

3 changes: 2 additions & 1 deletion Resources/Public/Js/messageBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ $(function () {

var ajaxUrl = $(this).attr('href');
var currentElement = $(this);
currentElement.parent().toggleClass('message-box__collapsed');

$.ajax({
url: ajaxUrl,
dataType: 'json',

success: function (data) {
if (data.success) {
currentElement.parent().hide();
console.log('1')
}
},
});
Expand Down
2 changes: 1 addition & 1 deletion ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CREATE TABLE tx_pxamessagebox_domain_model_message (
headline varchar(255) DEFAULT '' NOT NULL,
text text,
seen_by int(11) DEFAULT '0' NOT NULL,

priority tinyint(4) DEFAULT '0' NOT NULL
);

CREATE TABLE tx_pxamessagebox_message_feuser_mm (
Expand Down

0 comments on commit 9bde33f

Please sign in to comment.