Merge Request #2
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
- Shows a warning message if a article or their parent is archived
So, if you have new actions that were not described here, please give me a feedback and I will implement this :)
-
Added 1 new commit:
- 10bdc8bf - Avoid count hits and add comments in archived articles. Added to new unit tests and translated msg
-
You should use
self.parent_id_changed?
to verify if the parent_id was changed. -
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 likeActiveModel::Dirty
, where you can usechanged_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!!
-
mentioned in commit a86306b1acc9b945fb1c5c33015724a1487b9fac
-
this line may be removed.
-
Added 1 new commit:
- 4b6d6192 - Avoid count hits and add comments in archived articles. Added to new unit tests and translated msg
-
mentioned in commit 8b44517e5922dda1d762d6d5d4850c290523fec6
-
mentioned in commit 1e0c50469ab9416fd9fdde7b4f71477233a5a95e
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 |
|
99 | 99 | @article.image.save! |
100 | 100 | end |
101 | 101 | @article.last_changed_by = user |
102 | + @article.old_parent_id = @article.parent_id | |
1 |
|
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 |
|