Merge Request #2

Merged
noosferogov/noosfero!2
Created by Michel Felipe

Article archived/readonly

This is a new feature to freeze/archive on specific article to avoid that a user perform some actions:

  • Deny associate children articles to archived folders
  • Not allow vote to a archived article and your comments
  • Not allow create new comments
  • Not count hits (visualizations) to a archived article

  • Refactory visual aspects into Visibility and Options sections on create/edit articles

visibilit-options

  • Shows a warning message if a article or their parent is archived

archived-article

So, if you have new actions that were not described here, please give me a feedback and I will implement this :)

Assignee: None
Milestone: None

Merged by Victor Costa

Source branch has been removed
2 participants
  • Me
    Michel Felipe @mfdeveloper

    Added 1 new commit:

    • 10bdc8bf - Avoid count hits and add comments in archived articles. Added to new unit tests and translated msg
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa started a discussion on commit a86306b1
    last updated by Michel Felipe
    app/models/article.rb
    842 850 sanitizer.sanitize(text)
    843 851 end
    844 852  
      853 + def parent_archived?
      854 + if (self.old_parent_id != self.parent_id) && self.parent && self.parent.archived?
    2
    • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
      Victor Costa @vfcosta

      You should use self.parent_id_changed? to verify if the parent_id was changed.

      Choose File ...   File name...
      Cancel
    • Me
      Michel Felipe @mfdeveloper (Edited )

      This Rails feature attribute_changed? is pretty awesome @vfcosta !! Many thanks to share this with me :) I had no idea about this behavior. After your response, I made a research about this and I found it like ActiveModel::Dirty, where you can use changed_attributes to check more than one model attribute!

      I made this changes in the same last commit and forced update. Please, verify now if everything it's ok!!

      Choose File ...   File name...
      Cancel
    4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa started a discussion on commit a86306b1
    last updated by Victor Costa
    app/controllers/my_profile/cms_controller.rb
    99 99 @article.image.save!
    100 100 end
    101 101 @article.last_changed_by = user
      102 + @article.old_parent_id = @article.parent_id
    1
    4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa started a discussion on commit a86306b1
    last updated by Victor Costa
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa started a discussion on commit a86306b1
    last updated by Victor Costa
    app/models/article.rb
    9 9 :highlighted, :notify_comments, :display_hits, :slug,
    10 10 :external_feed_builder, :display_versions, :external_link,
    11 11 :image_builder, :show_to_followers,
    12   - :author, :display_preview
      12 + :author, :display_preview, :archived
      13 +
      14 + attr_accessor :old_parent_id
    1
  • Me
    Michel Felipe @mfdeveloper

    Added 1 new commit:

    • 4b6d6192 - Avoid count hits and add comments in archived articles. Added to new unit tests and translated msg
    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe @mfdeveloper

    Added 1 new commit:

    • 5b923237 - Avoid count hits and add comments in archived articles. Added to new unit tests and translated msg
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta
    Choose File ...   File name...
    Cancel