Skip to content

Commit 62ef0d7

Browse files
authored
Merge pull request #602 from topcoder-platform/issues-456
Issues-456: Simplified Announcement, Issues-544
2 parents 80964f7 + 142e52e commit 62ef0d7

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

config/vanilla/bootstrap.before.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ function watchIcon($hasWatched = false, $title='') {
339339
if($hasWatched) {
340340
$icon = <<<EOT
341341
<svg width="21px" height="14px" viewBox="0 0 21 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
342-
<title>$title</title>
343342
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
344343
<g id="02-Challenge-Forums" transform="translate(-1261.000000, -328.000000)" fill="#0AB88A" fill-rule="nonzero">
345344
<path d="M1271.08333,328 C1266.5,328 1262.58583,330.850833 1261,334.875 C1262.58583,338.899167 1266.5,341.75 1271.08333,341.75 C1275.66667,341.75 1279.58083,338.899167 1281.16667,334.875 C1279.58083,330.850833 1275.66667,328 1271.08333,328 Z M1271.08333,339.458333 C1268.55333,339.458333 1266.5,337.405 1266.5,334.875 C1266.5,332.345 1268.55333,330.291667 1271.08333,330.291667 C1273.61333,330.291667 1275.66667,332.345 1275.66667,334.875 C1275.66667,337.405 1273.61333,339.458333 1271.08333,339.458333 Z M1271.08333,332.125 C1269.56167,332.125 1268.33333,333.353333 1268.33333,334.875 C1268.33333,336.396667 1269.56167,337.625 1271.08333,337.625 C1272.605,337.625 1273.83333,336.396667 1273.83333,334.875 C1273.83333,333.353333 1272.605,332.125 1271.08333,332.125 Z" id="Shape"></path>
@@ -350,7 +349,6 @@ function watchIcon($hasWatched = false, $title='') {
350349
} else {
351350
$icon = <<<EOT
352351
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
353-
<title>$title</title>
354352
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
355353
<g id="02-Challenge-Forums" transform="translate(-1260.000000, -594.000000)">
356354
<g id="watch-icon" transform="translate(1260.000000, 594.000000)">
@@ -388,18 +386,17 @@ function watchButton($category, $isHijackButton = true) {
388386
$categoryID= val('CategoryID', $category);
389387
$hasWatched = $categoryModel->hasWatched($categoryID, $userID);
390388

391-
$text = $hasWatched ? t('Stop watching the category') : t('Watch the category');
392-
$icon = watchIcon($hasWatched, $text);
393-
$cssClasses = 'watchButton' . ($hasWatched ? ' isWatching': '');
389+
$text = $hasWatched ? t('Stop watching forum') : t('Watch forum');
390+
$icon = '<span class="tooltiptext">'.$text.'</span>'. watchIcon($hasWatched);
391+
$cssClasses = 'watchButton ' . ($hasWatched ? ' isWatching tooltip': 'tooltip');
394392
if($isHijackButton) {
395393
$cssClasses = 'Hijack '.$cssClasses;
396394
}
397395

398-
$output .= anchor(
399-
$icon,
396+
$output .= anchor($icon,
400397
$hasWatched ? "/category/watched/{$categoryID}/" . Gdn::session()->transientKey() : "/category/watch/{$categoryID}/" . Gdn::session()->transientKey(),
401398
$cssClasses,
402-
['title' => $text, 'aria-pressed' => $hasWatched ? 'true' : 'false', 'role' => 'button', 'tabindex' => '0']
399+
[ 'aria-pressed' => $hasWatched ? 'true' : 'false', 'role' => 'button', 'tabindex' => '0']
403400
);
404401
}
405402
return $output;

vanilla/applications/vanilla/views/discussion/helper_functions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ function getDiscussionOptionsDropdown($discussion = null) {
375375
// Permissions
376376
$canEdit = DiscussionModel::canEdit($discussion, $timeLeft);
377377
$canAnnounce = CategoryModel::checkPermission($categoryID, 'Vanilla.Discussions.Announce');
378+
// FIX: https://github.com/topcoder-platform/forums/issues/456
379+
$newAnnounceValue = $discussion->Announce > 0? 0 : 1;
378380
$canSink = CategoryModel::checkPermission($categoryID, 'Vanilla.Discussions.Sink');
379381
$canClose = CategoryModel::checkPermission($categoryID, 'Vanilla.Discussions.Close');
380382
$canDelete = CategoryModel::checkPermission($categoryID, 'Vanilla.Discussions.Delete');
@@ -392,7 +394,7 @@ function getDiscussionOptionsDropdown($discussion = null) {
392394

393395
$dropdown->addLinkIf($canDismiss, t('Dismiss'), "vanilla/discussion/dismissannouncement?discussionid={$discussionID}", 'dismiss', 'DismissAnnouncement Hijack')
394396
->addLinkIf($canEdit, t('Edit').$timeLeft, '/post/editdiscussion/'.$discussionID, 'edit')
395-
->addLinkIf($canAnnounce, t('Announce'), '/discussion/announce?discussionid='.$discussionID, 'announce', 'AnnounceDiscussion Popup')
397+
->addLinkIf($canAnnounce, $discussion->Announce > 0 ? t('Don\'t Announce'):t('Announce'), '/discussion/announce?discussionid='.$discussionID.'&announce='.$newAnnounceValue, 'announce', 'AnnounceDiscussion Hijack')
396398
->addLinkIf($canSink, t($discussion->Sink ? 'Unsink' : 'Sink'), '/discussion/sink?discussionid='.$discussionID.'&sink='.(int)!$discussion->Sink, 'sink', 'SinkDiscussion Hijack')
397399
->addLinkIf($canClose, t($discussion->Closed ? 'Reopen' : 'Close'), '/discussion/close?discussionid='.$discussionID.'&close='.(int)!$discussion->Closed, 'close', 'CloseDiscussion Hijack')
398400
->addLinkIf($canRefetch, t('Refetch Page'), '/discussion/refetchpageinfo.json?discussionid='.$discussionID, 'refetch', 'RefetchPage Hijack')

vanilla/applications/vanilla/views/discussions/helper_functions.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ function bookmarkButton($discussion) {
8181
// New value should be opposite
8282
$hasWatched = $discussion->Bookmarked == 1;
8383
$newValue = $hasWatched ? 0 : 1;
84-
$title = t($hasWatched ? 'Stop watching the discussion' : 'Watch the discussion');
85-
$icon = watchIcon($hasWatched, $title);
84+
$title = t($hasWatched ? 'Stop watching forum' : 'Watch forum');
85+
$icon = '<span class="tooltiptext">'.$title.'</span>'.watchIcon($hasWatched);
8686
return anchor(
8787
$icon,
8888
'/discussion/bookmark/' . $discussion->DiscussionID . '/?tkey=' . Gdn::session()->transientKey() . '&bookmarked=' . $newValue,
89-
'Hijack watchButton ' . ($hasWatched ? ' isWatching' : ''),
90-
['title' => $title]
89+
'Hijack watchButton ' . ($hasWatched ? ' isWatching tooltip' : 'tooltip'),
90+
[]
9191
);
9292
} else {
9393
$notificationPreferences = $categoryModel->getCategoryNotificationPreferences($discussion->CategoryID, Gdn::session()->UserID);
@@ -122,13 +122,13 @@ function bookmarkButton($discussion) {
122122
}
123123
}
124124

125-
$title = t($hasWatched ? 'Stop watching the discussion' : 'Watch the discussion');
126-
$icon = watchIcon($hasWatched, $title);
125+
$title = t($hasWatched ? 'Stop watching forum' : 'Watch forum');
126+
$icon = '<span class="tooltiptext">'.$title.'</span>'.watchIcon($hasWatched, '');
127127
return anchor(
128128
$icon,
129129
'/discussion/bookmark/' . $discussion->DiscussionID . '/?tkey=' . Gdn::session()->transientKey() . '&bookmarked=' . $newValue,
130-
'Hijack watchButton ' . ($hasWatched ? ' isWatching' : ''),
131-
['title' => $title]
130+
'Hijack watchButton ' . ($hasWatched ? ' isWatching tooltip' : 'tooltip'),
131+
[]
132132
);
133133
}
134134
}

0 commit comments

Comments
 (0)