Skip to content

Commit

Permalink
Create a 'collective' user
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed May 29, 2013
1 parent 4dc7a5f commit 32c6537
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/user.rb
Expand Up @@ -33,6 +33,10 @@ class User < ActiveRecord::Base

validates_format_of :homesite, :message => "L'URL du site web personnel n'est pas valide", :with => URI::regexp(%w(http https)), :allow_blank => true

def self.collective
where(name: "Collectif").first
end

### SEO ###

extend FriendlyId
Expand Down
4 changes: 4 additions & 0 deletions app/views/redaction/news/_attendees.html.haml
Expand Up @@ -6,3 +6,7 @@
= link_to a.name, a, :title => pluralize(a.nb_editions, "édition")
- if current_account.can_reassign?(@news)
= button_to "Réattribuer", reassign_moderation_news_path(:user_id => a.id), :class => "reassign_news", :title => "Réattribuer la paternité de cette dépêche"
- if current_account.can_reassign?(@news)
%li
Collectif
= button_to "Réattribuer", reassign_moderation_news_path(:user_id => User.collective.id), :class => "reassign_news", :title => "Réattribuer la paternité de cette dépêche"
3 changes: 3 additions & 0 deletions db/seeds.rb
Expand Up @@ -79,6 +79,9 @@
anon.skip_confirmation!
anon.save

# Collective user
User.create :name => "Collectif"

# Wiki
wp = WikiPage.new
wp.title = WikiPage::HomePage
Expand Down

0 comments on commit 32c6537

Please sign in to comment.