[dw-free] Show tags in Inbox Entries
[commit: http://hg.dwscoalition.org/dw-free/rev/7f53dabcf436]
http://bugs.dwscoalition.org/show_bug.cgi?id=2843
Display the list of tags on an entry in your inbox.
Patch by
tyggerjai.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2843
Display the list of tags on an entry in your inbox.
Patch by
Files modified:
- bin/upgrading/en.dat
- cgi-bin/LJ/Event/JournalNewEntry.pm
- htdocs/inbox/index.bml
--------------------------------------------------------------------------------
diff -r 0842a46e3e81 -r 7f53dabcf436 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat Fri Oct 08 12:16:54 2010 +0800
+++ b/bin/upgrading/en.dat Fri Oct 08 15:01:17 2010 +0800
@@ -1817,6 +1817,8 @@ esn.supofficialpost.subscribtion.html=[[
esn.tags=The entry is tagged "[[tags]]"
+esn.tags.short=Tags: [[tags]]
+
esn.unscreen_comment=[[openlink]]Unscreen the comment[[closelink]]
esn.view_comments=[[openlink]]View all comments[[closelink]] to this entry
diff -r 0842a46e3e81 -r 7f53dabcf436 cgi-bin/LJ/Event/JournalNewEntry.pm
--- a/cgi-bin/LJ/Event/JournalNewEntry.pm Fri Oct 08 12:16:54 2010 +0800
+++ b/cgi-bin/LJ/Event/JournalNewEntry.pm Fri Oct 08 15:01:17 2010 +0800
@@ -82,10 +82,31 @@ sub content {
return undef unless $self->_can_view_content( $entry, $target );
return $entry->event_html( {
- # double negatives, ouch!
- ljcut_disable => ! $target->cut_inbox,
- cuturl => $entry->url } )
- . $self->as_html_actions;
+ # double negatives, ouch!
+ ljcut_disable => ! $target->cut_inbox,
+ cuturl => $entry->url } )
+
+ . $self->as_html_tags( $target )
+ . $self->as_html_actions;
+}
+
+sub as_html_tags {
+ my ( $self, $u ) = @_;
+ my $tags = '';
+ my $url = $self->entry->journal->journal_base;
+ my $lang = $u->prop( 'browselang' );
+
+ my @taglist = $self->entry->tags;
+
+ # add tag info for entries that have tags
+ if ( @taglist ) {
+ my @htmltags = ();
+ push @htmltags, qq{<a href="$url/tag/$_">$_</a>} foreach @taglist;
+
+ $tags = "<div class='entry-tags'>" . LJ::Lang::get_text( $lang, 'esn.tags.short', undef, { tags => join(', ', @htmltags ) } ). "</div>";
+ }
+ return $tags;
+
}
sub content_summary {
@@ -159,6 +180,7 @@ my @_ml_strings_en = (
'esn.hi', # 'Hi [[username]],',
'esn.journal_new_entry.about', # ' titled "[[title]]"',
'esn.tags', # 'The entry is tagged "[[tags]]"',
+ 'esn.tags.short',
'esn.journal_new_entry.head_comm', # 'There is a new entry by [[poster]][[about]] in [[journal]]![[tags]]',
'esn.journal_new_entry.head_user', # '[[poster]] has posted a new entry[[about]].[[tags]]',
'esn.you_can', # 'You can:',
diff -r 0842a46e3e81 -r 7f53dabcf436 htdocs/inbox/index.bml
--- a/htdocs/inbox/index.bml Fri Oct 08 12:16:54 2010 +0800
+++ b/htdocs/inbox/index.bml Fri Oct 08 15:01:17 2010 +0800
@@ -75,7 +75,10 @@ body<=
$selected_folder = "entrycomment" if $selected_folder eq "singleentry";
$selected_folder = qq(
- <style>.filterlink_$view {display: none;}</style>
+ <style>
+ .filterlink_$view {display: none;}
+ .entry-tags {text-align: right; font-style: italic;}
+ </style>
);
$head = $selected_folder;
--------------------------------------------------------------------------------
