Module: Commontator::Controllers
- Defined in:
- lib/commontator/controllers.rb
Class Method Summary collapse
Instance Method Summary collapse
- #commontator_set_new_comment ⇒ Object
- #commontator_set_thread_variables ⇒ Object
- #commontator_thread_show(commontable) ⇒ Object
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/commontator/controllers.rb', line 4 def self.included(base) base.helper Commontator::SharedHelper end |
Instance Method Details
#commontator_set_new_comment ⇒ Object
16 17 18 19 20 21 |
# File 'lib/commontator/controllers.rb', line 16 def commontator_set_new_comment return unless @commontator_thread.config.new_comment_style == :t new_comment = Commontator::Comment.new(creator: @commontator_user, thread: @commontator_thread) @commontator_new_comment = new_comment if new_comment.can_be_created_by?(@commontator_user) end |
#commontator_set_thread_variables ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/commontator/controllers.rb', line 8 def commontator_set_thread_variables return if @commontator_thread.nil? || !@commontator_thread.can_be_read_by?(@commontator_user) @commontator_page = [params[:page].to_i, 1].max @commontator_show_all = !params[:show_all].blank? && @commontator_thread.can_be_edited_by?(@commontator_user) end |
#commontator_thread_show(commontable) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/commontator/controllers.rb', line 23 def commontator_thread_show(commontable) commontator_set_user commontator_set_thread(commontable) commontator_set_thread_variables commontator_set_new_comment @commontator_thread_show = true @commontator_thread.mark_as_read_for(@commontator_user) end |