Class: BcmsContentRotator::Slide

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/bcms_content_rotator/slide.rb

Instance Method Summary collapse

Instance Method Details

#has_link?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/models/bcms_content_rotator/slide.rb', line 28

def has_link?
  !link_url.blank?
end

#image_urlObject



19
20
21
# File 'app/models/bcms_content_rotator/slide.rb', line 19

def image_url
  file.url
end

The title of the link users click on the change slides.



24
25
26
# File 'app/models/bcms_content_rotator/slide.rb', line 24

def nav_title_or_name
  navigation_title.blank? ? name : navigation_title
end

#set_attachment_file_pathObject



7
8
9
10
11
# File 'app/models/bcms_content_rotator/slide.rb', line 7

def set_attachment_file_path
  if !attachment_file.blank?
    attachment.file_path = "/slides/attachment/#{Time.now.to_s(:year_month_day)}/#{name.to_slug}.#{attachment_file.original_filename.split('.').last.to_s.downcase}"
  end
end

#set_attachment_sectionObject



13
14
15
16
17
# File 'app/models/bcms_content_rotator/slide.rb', line 13

def set_attachment_section
  if !attachment_file.blank?
    attachment.section = Section.first(:conditions => {:name => 'Slide'})
  end
end