Commit 93ecef8dc4cebcfb9254124a6dfd2e1f11c5d1bb
1 parent
845ae13e
Exists in
master
and in
28 other branches
article-versions: use versioned author_url too instead of only name
Showing
2 changed files
with
8 additions
and
6 deletions
Show diff stats
app/models/article.rb
@@ -631,16 +631,18 @@ class Article < ActiveRecord::Base | @@ -631,16 +631,18 @@ class Article < ActiveRecord::Base | ||
631 | end | 631 | end |
632 | 632 | ||
633 | def author_name(version_number = nil) | 633 | def author_name(version_number = nil) |
634 | - person = version_number ? author(version_number) : author | 634 | + person = author(version_number) |
635 | person ? person.name : (setting[:author_name] || _('Unknown')) | 635 | person ? person.name : (setting[:author_name] || _('Unknown')) |
636 | end | 636 | end |
637 | 637 | ||
638 | - def author_url | ||
639 | - author ? author.url : nil | 638 | + def author_url(version_number = nil) |
639 | + person = author(version_number) | ||
640 | + person ? person.url : nil | ||
640 | end | 641 | end |
641 | 642 | ||
642 | - def author_id | ||
643 | - author ? author.id : nil | 643 | + def author_id(version_number = nil) |
644 | + person = author(version_number) | ||
645 | + person ? person.id : nil | ||
644 | end | 646 | end |
645 | 647 | ||
646 | def version_license(version_number = nil) | 648 | def version_license(version_number = nil) |
app/views/content_viewer/article_versions.rhtml
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | <%= radio_button_tag 'v2', v.version, false, :onclick => 'versionInputClicked(this)' %> | 14 | <%= radio_button_tag 'v2', v.version, false, :onclick => 'versionInputClicked(this)' %> |
15 | <%= link_to(_("Version #{v.version}"), @page.url.merge(:version => v.version)) %> | 15 | <%= link_to(_("Version #{v.version}"), @page.url.merge(:version => v.version)) %> |
16 | <%= @page.version == v.version ? _('(current)') : '' %> | 16 | <%= @page.version == v.version ? _('(current)') : '' %> |
17 | - <span class='updated-by'><%= _('by %{author}') % {:author => link_to(@page.author_name(v.version), @page.author_url)} %></span> | 17 | + <span class='updated-by'><%= _('by %{author}') % {:author => link_to(@page.author_name(v.version), @page.author_url(v.version))} %></span> |
18 | <span class='updated-on'><%= show_time(v.updated_at) %></span> | 18 | <span class='updated-on'><%= show_time(v.updated_at) %></span> |
19 | </li> | 19 | </li> |
20 | <% end %> | 20 | <% end %> |