Skip to content

Commit

Permalink
✅ Manage creation_date for Questions
Browse files Browse the repository at this point in the history
  • Loading branch information
moustachu committed Jan 10, 2019
1 parent d1b3d14 commit e0fb9c2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/initializers/extends.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'extends/decidim-core/commands/decidim/amendable/create_extend.rb'
require 'extends/decidim-core/commands/decidim/amendable/promote_extend.rb'
require 'extends/decidim-core/helpers/decidim/cells_helper_extend.rb'
require 'extends/decidim-core/cells/decidim/author_cell_extend.rb'
19 changes: 19 additions & 0 deletions lib/extends/decidim-core/cells/decidim/author_cell_extend.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Decidim
module Questions
module AuthorCellExtend

def creation_date?
return true if posts_controller?
return unless from_context
return unless proposals_controller? || collaborative_drafts_controller? || questions_controller?
return unless show_action?
true
end

end
end
end

Decidim::AuthorCell.class_eval do
prepend(Decidim::Questions::AuthorCellExtend)
end
2 changes: 1 addition & 1 deletion spec/system/questions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
expect(page).to have_content(question.body)
expect(page).to have_author(question.creator_author.name)
expect(page).to have_content(question.reference)
expect(page).to have_creation_date(I18n.l(question.published_at, format: :decidim_short))
expect(page).to have_creation_date(I18n.l(question.published_at.to_date, format: :decidim_short))
end

context "when process is not related to any scope" do
Expand Down

0 comments on commit e0fb9c2

Please sign in to comment.