Class: Decidim::Conference
- Inherits:
 - 
      ApplicationRecord
      
        
- Object
 - ApplicationRecord
 - Decidim::Conference
 
 
- Includes:
 - FilterableResource, Followable, HasAttachmentCollections, HasAttachments, HasReference, HasUploadValidations, Loggable, Participable, ParticipatorySpaceResourceable, Publicable, ScopableParticipatorySpace, Searchable, Traceable, TranslatableResource
 
- Defined in:
 - app/models/decidim/conference.rb
 
Overview
Interaction between a user and an organization can be done via a Conference. It is a unit of action from the Organization point of view that groups several components (proposals, debates…) that can be enabled or disabled.
Class Method Summary collapse
- .log_presenter_class_for(_log) ⇒ Object
 - 
  
    
      .promoted  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Scope to return only the promoted conferences.
 
Instance Method Summary collapse
- #attachment_context ⇒ Object
 - #closed? ⇒ Boolean
 - #diploma_sent? ⇒ Boolean
 - #has_available_slots? ⇒ Boolean
 - #has_published_registration_types? ⇒ Boolean
 - #has_registration_for?(user) ⇒ Boolean
 - #has_registration_for_user_and_registration_type?(user, registration_type) ⇒ Boolean
 - #hashtag ⇒ Object
 - #remaining_slots ⇒ Object
 - #to_param ⇒ Object
 - #user_roles(role_name = nil) ⇒ Object
 
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
      90 91 92  | 
    
      # File 'app/models/decidim/conference.rb', line 90 def self.log_presenter_class_for(_log) Decidim::Conferences::AdminLog::ConferencePresenter end  | 
  
.promoted ⇒ Object
Scope to return only the promoted conferences.
Returns an ActiveRecord::Relation.
      86 87 88  | 
    
      # File 'app/models/decidim/conference.rb', line 86 def self.promoted where(promoted: true) end  | 
  
Instance Method Details
#attachment_context ⇒ Object
      145 146 147  | 
    
      # File 'app/models/decidim/conference.rb', line 145 def :admin end  | 
  
#closed? ⇒ Boolean
      132 133 134 135 136  | 
    
      # File 'app/models/decidim/conference.rb', line 132 def closed? return false if end_date.blank? end_date < Date.current end  | 
  
#diploma_sent? ⇒ Boolean
      126 127 128 129 130  | 
    
      # File 'app/models/decidim/conference.rb', line 126 def diploma_sent? return false if diploma_sent_at.nil? true end  | 
  
#has_available_slots? ⇒ Boolean
      110 111 112 113 114  | 
    
      # File 'app/models/decidim/conference.rb', line 110 def has_available_slots? return true if available_slots.zero? available_slots > conference_registrations.count end  | 
  
#has_published_registration_types? ⇒ Boolean
      116 117 118 119 120  | 
    
      # File 'app/models/decidim/conference.rb', line 116 def has_published_registration_types? return false if registration_types.empty? registration_types.any?(&:published_at?) end  | 
  
#has_registration_for?(user) ⇒ Boolean
      102 103 104  | 
    
      # File 'app/models/decidim/conference.rb', line 102 def has_registration_for?(user) conference_registrations.where(user:).any? end  | 
  
#has_registration_for_user_and_registration_type?(user, registration_type) ⇒ Boolean
      106 107 108  | 
    
      # File 'app/models/decidim/conference.rb', line 106 def has_registration_for_user_and_registration_type?(user, registration_type) conference_registrations.where(user:, registration_type:).any? end  | 
  
#hashtag ⇒ Object
      94 95 96  | 
    
      # File 'app/models/decidim/conference.rb', line 94 def hashtag attributes["hashtag"].to_s.delete("#") end  | 
  
#remaining_slots ⇒ Object
      122 123 124  | 
    
      # File 'app/models/decidim/conference.rb', line 122 def remaining_slots available_slots - conference_registrations.count end  | 
  
#to_param ⇒ Object
      98 99 100  | 
    
      # File 'app/models/decidim/conference.rb', line 98 def to_param slug end  | 
  
#user_roles(role_name = nil) ⇒ Object
      138 139 140 141 142 143  | 
    
      # File 'app/models/decidim/conference.rb', line 138 def user_roles(role_name = nil) roles = Decidim::ConferenceUserRole.where(conference: self) return roles if role_name.blank? roles.where(role: role_name) end  |