Make trophy description optional
authorJoshua Rüsweg <josh@bastelstu.be>
Sun, 6 Aug 2017 09:53:41 +0000 (11:53 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Sun, 6 Aug 2017 09:54:04 +0000 (11:54 +0200)
See #2315

com.woltlab.wcf/templates/boxUserTrophyList.tpl
com.woltlab.wcf/templates/groupedUserTrophyList.tpl
com.woltlab.wcf/templates/trophy.tpl
com.woltlab.wcf/templates/trophyList.tpl
wcfsetup/install/files/lib/acp/form/TrophyAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserTrophyAddForm.class.php

index b01116a7895867de6612755d4846df88673d4bf9..74c0acf5e88c996d0b3a1f78be27bba272c36a82 100644 (file)
@@ -24,7 +24,7 @@
 
                                <div class="sidebarItemTitle">
                                        <h3><a href="{$boxUserTrophy->getTrophy()->getLink()}">{$boxUserTrophy->getTrophy()->getTitle()}</a></h3>
-                                       <small><p>{@$boxUserTrophy->getDescription()}</p><p>{@$boxUserTrophy->getUserProfile()->getAnchorTag()} - {@$boxUserTrophy->time|time}</p></small>
+                                       <small>{if !$boxUserTrophy->getDescription()|empty}<p>{$boxUserTrophy->getDescription()}</p>{/if}<p>{@$boxUserTrophy->getUserProfile()->getAnchorTag()} - {@$boxUserTrophy->time|time}</p></small>
                                </div>
                        </li>
                {/foreach}
index 48cb1fe66894a18d37cae099d7ff0c5ff449dac5..d652f72b66b600da7b7be8e1e6933ea617387771 100644 (file)
@@ -7,7 +7,7 @@
 
                                        <div class="containerHeadline">
                                                <h3><a href="{link controller='Trophy' object=$userTrophy->getTrophy()}{/link}">{@$userTrophy->getTrophy()->getTitle()}</a></h3>
-                                               <small>{$userTrophy->getDescription()} - {@$userTrophy->time|time}</small>
+                                               <small>{if !$userTrophy->getDescription()|empty}{$userTrophy->getDescription()} – {/if}{@$userTrophy->time|time}</small>
                                        </div>
                                </div>
                        </li>
index f238c92bf7f0004ad815c20f545413f299765b0d..33c3a52059ad4374d24d37c51e5e4dd9e3349925 100644 (file)
@@ -18,7 +18,7 @@
                <div class="contentHeaderTitle">
                        <h1 class="contentTitle">{$trophy->getTitle()}</h1>
                        <ul class="inlineList contentHeaderMetaData">
-                               <li>{$trophy->getDescription()}</li>
+                               {if !$trophy->getDescription()|empty}<li>{$trophy->getDescription()}</li>{/if}
                                <li><span class="icon icon16 fa-users"></span> {@$items}</li>
                        </ul>
                </div>
@@ -43,7 +43,7 @@
 
                                <div class="sidebarItemTitle">
                                        <h3>{@$userTrophy->getUserProfile()->getAnchorTag()}</h3>
-                                       <small>{$userTrophy->getDescription()} – {@$userTrophy->time|time}</small>
+                                       <small>{if !$userTrophy->getDescription()|empty}{$userTrophy->getDescription()} – {/if}{@$userTrophy->time|time}</small>
                                </div>
                        </li>
                {/foreach}
index 4ab470b81981853200b5f996a413b143f1ff4292..3c1b122861fc05d27d5378432489287ea9b1b137 100644 (file)
@@ -52,7 +52,7 @@
 
                                                <div class="sidebarItemTitle">
                                                        <h3><a href="{$trophy->getLink()}">{@$trophy->getTitle()}</a></h3>
-                                                       <small>{$trophy->getDescription()}</small>
+                                                       {if !$trophy->getDescription()|empty}<small>{$trophy->getDescription()}</small>{/if}
                                                </div>
                                        </li>
                                {/foreach}
index 490b7013693f8da430d7da532d1f1289d5b1deac..67b15bc31476f829bb41840adf009eea19defdcf 100644 (file)
@@ -145,6 +145,7 @@ class TrophyAddForm extends AbstractAcpForm {
                
                $descriptionI18n = new I18nValue('description');
                $descriptionI18n->setLanguageItem('wcf.user.trophy.description', 'wcf.user.trophy', 'com.woltlab.wcf');
+               $descriptionI18n->setFlags(I18nValue::ALLOW_EMPTY);
                $this->registerI18nValue($descriptionI18n);
                
                if (isset($_POST['tmpHash'])) {
index 0b2b984349c9de9ab02c2a68274bf6432b473175..08906ff84b8420d2ce46edc0dab7f83dd7f58223 100644 (file)
@@ -171,7 +171,7 @@ class UserTrophyAddForm extends AbstractAcpForm {
                                ])
                        ]))->executeAction();
                        
-                       $this->saveI18n($databaseObject, UserTrophyEditor::class);
+                       $this->saveI18n($databaseObject['returnValues'], UserTrophyEditor::class);
                }
                
                $this->reset();