Skip to content

Commit

Permalink
CommentScore bug fix.
Browse files Browse the repository at this point in the history
Allowed absolute paths in Gdn_Controller::AddCssFile()
  • Loading branch information
todd committed Jul 15, 2009
1 parent 8dca70e commit 605053b
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 28 deletions.
10 changes: 5 additions & 5 deletions applications/garden/design/form.screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ table tbody tr.FootNote td {
}
table thead th {
font-size: 13px;
color: #000;
color: #000 /* Body Heading Font Color */;
}
table input.Button {
margin: 0px;
}
}
table.AltRows tr.Alt th,
table.AltRows tr.Alt td {
background: #f8f8f8;
background: #f8f8f8 /* Body Alt Background Color */;
}
table.AltColumns th.Alt,
table.AltColumns td.Alt {
background: #f8f8f8;
background: #f8f8f8 /* Body Alt Background Color */;
}
table.AltColumns tr.Alt {
background: none;
Expand Down Expand Up @@ -209,7 +209,7 @@ table.Sortable tbody td {
}
.CheckBoxGrid th.Alt,
.CheckBoxGrid td.Alt {
background: #f8f8f8;
background: #f8f8f8 /* Body Alt Background Color */;
}

/* CheckColumn */
Expand Down
4 changes: 2 additions & 2 deletions applications/garden/design/layout.screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ ul#Menu {
border: 0;
width: 38px;
height: 26px;
background: #E9F9FF /* Panel Background Color */;
color: #2786C2 /* Panel Font Color */;
background: #E9F9FF;
color: #2786C2;
padding: 3px 0 4px;
margin: 0;
-moz-border-radius: 0;
Expand Down
4 changes: 2 additions & 2 deletions applications/vanilla/design/vanilla.screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ body.Discussion #Content h2 {
font-weight:bold;
margin:0;
padding:6px 0 0 10px;
color: #333;
color: #333 /* Body Heading Font Color */;
padding: 6px 0;
line-height: 100%;
}
Expand Down Expand Up @@ -690,7 +690,7 @@ body.Discussion #Content h2 span {
clear: both;
padding: 1px 8px 2px;
line-height: 170%;
color: #454545;
color: #454545 /* Body Text Font Color */;
}
.Body p {
margin: 8px 0;
Expand Down
38 changes: 22 additions & 16 deletions library/core/class.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -808,23 +808,29 @@ public function RenderMaster() {
// And now search for/add all css files
foreach ($this->_CssFiles as $CssInfo) {
$CssFile = $CssInfo['FileName'];
$CssGlob = preg_replace('/(.*)(\.css)/', '\1*\2', $CssFile);
$AppFolder = $CssInfo['AppFolder'];
if ($AppFolder == '')
$AppFolder = $this->ApplicationFolder;

// CSS comes from one of four places:
$CssPaths = array();
if ($this->Theme) {
// 1. Application-specific css. eg. root/themes/theme_name/app_name/design/
$CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . $AppFolder . DS . 'design' . DS . $CssGlob;
// 2. Garden-wide theme view. eg. root/themes/theme_name/design/
$CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'design' . DS . $CssGlob;

if(strpos($CssFile, '/') !== FALSE) {
// A direct path to the file was given.
$CssPaths = array(PATH_ROOT.str_replace('/', DS, $CssFile));
} else {
$CssGlob = preg_replace('/(.*)(\.css)/', '\1*\2', $CssFile);
$AppFolder = $CssInfo['AppFolder'];
if ($AppFolder == '')
$AppFolder = $this->ApplicationFolder;

// CSS comes from one of four places:
$CssPaths = array();
if ($this->Theme) {
// 1. Application-specific css. eg. root/themes/theme_name/app_name/design/
$CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . $AppFolder . DS . 'design' . DS . $CssGlob;
// 2. Garden-wide theme view. eg. root/themes/theme_name/design/
$CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'design' . DS . $CssGlob;
}
// 3. Application default. eg. root/applications/app_name/design/
$CssPaths[] = PATH_APPLICATIONS . DS . $AppFolder . DS . 'design' . DS . $CssGlob;
// 4. Garden default. eg. root/applications/garden/design/
$CssPaths[] = PATH_APPLICATIONS . DS . 'garden' . DS . 'design' . DS . $CssGlob;
}
// 3. Application default. eg. root/applications/app_name/design/
$CssPaths[] = PATH_APPLICATIONS . DS . $AppFolder . DS . 'design' . DS . $CssGlob;
// 4. Garden default. eg. root/applications/garden/design/
$CssPaths[] = PATH_APPLICATIONS . DS . 'garden' . DS . 'design' . DS . $CssGlob;

// Find the first file that matches the path.
$CssPath = FALSE;
Expand Down
4 changes: 2 additions & 2 deletions plugins/CommentScore/class.commentscore.plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class Gdn_CommentScorePlugin implements Gdn_IPlugin {

public function DiscussionController_Render_Before($Sender) {
$Sender->Head->AddCss('/plugins/CommentScore/commentscore.css');
$Sender->AddCssFile('/plugins/CommentScore/commentscore.css');
$Sender->Head->AddScript('/plugins/CommentScore/commentscore.js');
}

Expand Down Expand Up @@ -57,7 +57,7 @@ public function DiscussionController_CommentOptions_Handler($Sender) {
$Href = '/vanilla/discussion/score/' . $Comment->CommentID . '/' . $Signs[$Key] . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl);

if($IncAmount == 0) {
$Attributes['href2'] = $Href;
$Attributes['href2'] = Url($Href);
$CssClass .= ' Disabled';
$Href = '';
} else {
Expand Down
2 changes: 1 addition & 1 deletion plugins/CommentScore/commentscore.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

.Comment .CommentScore span {
color: #777;
color: #777 /* Meta Label Font Color */;
}

.Comment .CommentScore a.Inc {
Expand Down
4 changes: 4 additions & 0 deletions plugins/CommentScore/commentscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ jQuery(document).ready(function($) {
$('.CommentScore a').click(function() {
var $btn = $(this);

if($btn.attr('href') == "") {
return false;
}

// Create an animated number.
var inc = $btn.attr('title');
var animate = '<div class="Animate">' + inc + '</div>';
Expand Down

0 comments on commit 605053b

Please sign in to comment.