noosfero | Adds option to reorder portal news (!1430)

Rodrigo Souto gitlab at mg.gitlab.com
Tue Apr 17 18:13:44 BRT 2018


Rodrigo Souto started a new discussion on app/controllers/public/home_controller.rb:

> +    end
> +  end
> +
> +  def switch_orders(first_article, second_article)
> +    first_order = first_article.metadata['order']
> +    second_order = second_article.metadata['order']
> +
> +    first_article.metadata['order'] = second_order
> +    second_article.metadata['order'] = first_order
> +
> +    first_article.save
> +    second_article.save
> +  end
> +
> +  def require_admin
> +    head :forbidden unless current_person.try(:in?, environment.admins)

With `environment.admins.include?(current_person)` you don't have to use `try`.

---
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1430#note_68907756
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/20180417/9150895d/attachment-0001.html>


More information about the Noosfero-dev mailing list