noosfero | If article parent is highlighted, the article will be highlighted (!1351)

Rodrigo Souto gitlab at mg.gitlab.com
Mon Nov 27 18:46:09 BRST 2017


Hi @victorcmoura!

The way your code is written the user will be unable to create a "not highlighted" article that has a highlighted parent due to the use uf `before_save` instead of `before_create`. `before_save` is called on every save.

Now, even using the `before_create` it's still a little annoying that I would need to create an article and edit it just to create a "not highlighted" article below a highlighted parent.

I think the best solution is to set the highlighted attribute with a default value equal to the parent's highlighted value on CmsController#new action. This way, the highlighted will be preset when the user go to the article creationg page, but he will be able to change it if he wants. This logic is already used with other attributes like `published` and `show_to_followers`. Take a look at `app/controllers/my_profile/cms_controller.rb` line 146.

---
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1351#note_48883842
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20171127/ab03fe5c/attachment.html>


More information about the Noosfero-dev mailing list