Permalink
Browse files

Applying nick color to user names, adding flags.

  • Loading branch information...
1 parent 79bdd79 commit 00e1b5d4f4eae401fdbe380d5b5e9895d3070310 @davidpersson davidpersson committed Feb 8, 2011
Showing with 27 additions and 3 deletions.
  1. +9 −1 views/pastes/index.html.php
  2. +15 −2 views/pastes/view.html.php
  3. +3 −0 webroot/css/lithium_bin.css
@@ -17,6 +17,14 @@
return implode("\n", $preview);
};
+$nickRgb = function($nick) {
+ $hash = abs(crc32($nick));
+
+ $rgb = array($hash % 255, $hash % 255, $hash % 255);
+ $rgb[$hash % 2] = 0;
+
+ return $rgb;
+};
?>
<h2><?=$this->title('Latest Pastes'); ?></h2>
<?php if ($latest->count()): ?>
@@ -36,7 +44,7 @@
?>
</td>
<td class="preview"><?= $preview($row->content); ?></td>
- <td><?=$row->author; ?></td>
+ <td style="color: rgb(<?=implode(',' , $nickRgb($row->author))?>);"><?=$row->author; ?></td>
<td><time datetime="<?=date('c', strtotime($row->created)); ?>"><?=$row->created; ?></time></td>
</tr>
<?php endforeach;?>
View
@@ -1,8 +1,21 @@
+<?php
+$nickRgb = function($nick) {
+ $hash = abs(crc32($nick));
+
+ $rgb = array($hash % 255, $hash % 255, $hash % 255);
+ $rgb[$hash % 2] = 0;
+
+ return $rgb;
+};
+?>
<h2><?=$this->title('View Paste'); ?></h2>
<div class="paste">
<div class="meta">
- This <span class="language"><?=$paste->language;?></span> paste was created by
- <span class="author user"><?=$paste->author;?></span> at
+ This
+ <?php if ($paste->private): ?><span class="flag">private</span><?php endif; ?>
+ <?php if ($paste->immutable): ?><span class="flag">immutable</span><?php endif; ?>
+ <span class="language"><?=$paste->language;?></span> paste was created by
+ <span class="author user" style="color: rgb(<?=implode(',' , $nickRgb($paste->author))?>);"><?=$paste->author;?></span> at
<time datetime="<?=date('c', strtotime($paste->created)); ?>" class="created"><?=$paste->created;?></time>.
</div>
<div class="nav">
@@ -70,6 +70,9 @@ input[type="checkbox"] {
}
/*--- View ---*/
+.paste .meta .flag {
+ color: #454545;
+}
.author {
margin-bottom: 2em;
clear: both;

0 comments on commit 00e1b5d

Please sign in to comment.