Commit 5feffa49df80cd3b6382ebcb5236ff5627d417b2
1 parent
bb5bb818
Exists in
master
and in
29 other branches
ActionItem21: recording and displaying 'last change by'
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@984 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
11 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/cms/text_html.rb
... | ... | @@ -6,6 +6,7 @@ class CmsController |
6 | 6 | @article.parent = profile.articles.find(params[:parent_id]) |
7 | 7 | end |
8 | 8 | @article.profile = profile |
9 | + @article.last_changed_by = user | |
9 | 10 | if request.post? |
10 | 11 | if @article.save |
11 | 12 | redirect_to :action => 'view', :id => @article.id |
... | ... | @@ -16,6 +17,7 @@ class CmsController |
16 | 17 | def text_html_edit |
17 | 18 | @article = Article.find(params[:id]) |
18 | 19 | if request.post? |
20 | + @article.last_changed_by = user | |
19 | 21 | if @article.update_attributes(params[:article]) |
20 | 22 | redirect_to :action => 'view', :id => @article.id |
21 | 23 | end | ... | ... |
app/views/cms/view.rhtml
... | ... | @@ -51,7 +51,7 @@ |
51 | 51 | |
52 | 52 | <ul> |
53 | 53 | <li> |
54 | - <%= _('"%{article}", last changed by %{author}') % { :article => @article.name, :author => 'bli' } %> | |
54 | + <%= _('"%{article}", last changed by %{author}') % { :article => @article.name, :author => (@article.last_changed_by.name || _('Unknown User')) } %> | |
55 | 55 | </li> |
56 | 56 | <li> |
57 | 57 | <%= _('Public address of this article: %s') % (@article.public_path) %> | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -53,6 +53,14 @@ class CmsControllerTest < Test::Unit::TestCase |
53 | 53 | flunk 'pending' |
54 | 54 | end |
55 | 55 | |
56 | + should 'set last_changed_by when creating article' do | |
57 | + flunk 'pending' | |
58 | + end | |
59 | + | |
60 | + should 'set last_changed_by when updating article' do | |
61 | + flunk 'pending' | |
62 | + end | |
63 | + | |
56 | 64 | should 'list available editors' do |
57 | 65 | editors = [ "#{RAILS_ROOT}/app/controllers/my_profile/cms/bli.rb", "#{RAILS_ROOT}/app/controllers/my_profile/cms/blo.rb" ] |
58 | 66 | Dir.expects(:glob).with("#{RAILS_ROOT}/app/controllers/my_profile/cms/*.rb").returns(editors) | ... | ... |