Module: Merb::MerbPhotos::ApplicationHelper

Defined in:
app/helpers/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#merb_photos_button(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'app/helpers/application_helper.rb', line 3

def merb_photos_button(options = {})
  attributes = {}
  attributes[:class] = 'mui_button mui_button_tone_neutral mui_click_window_open'
  farm = options[:farm]
  photo = options[:photo]
  attributes[:id] = slice_url(:photo, :photo_id => photo.id, :photoset_id => @photoset.id)
  image = mui_image(:url => "http://farm#{@photoset.farm}.static.flickr.com/#{photo.server}/#{photo.id}_#{photo.secret}_s.jpg", :height => 75, :width => 75)
  attributes[:style] = 'float:left;margin:1em 0 0 1em;'
  tag(:button, image, attributes)
end

#merb_photos_javascriptObject



14
15
16
# File 'app/helpers/application_helper.rb', line 14

def merb_photos_javascript
  tag(:script, :src => slice_url(:javascript), :type => 'text/javascript')
end

#merb_photos_navigationObject



18
19
20
21
22
23
# File 'app/helpers/application_helper.rb', line 18

def merb_photos_navigation
  navigation = ''
  navigation << mui_button(:name => 'previous', :title => '&larr;', :url => slice_url(:photo, :photo_id => @previous_id, :photoset_id => @photoset_id), :window => 'redirect') if @previous_id
  navigation << mui_button(:name => 'next', :title => '&rarr;', :url => slice_url(:photo, :photo_id => @next_id, :photoset_id => @photoset_id), :window => 'redirect') if @next_id
  navigation
end

#merb_photos_photoObject



25
26
27
# File 'app/helpers/application_helper.rb', line 25

def merb_photos_photo
  mui_image(:height => @photo.height, :url => merb_photos_source(@photo.source), :width => @photo.width)
end

#merb_photos_source(string) ⇒ Object



29
30
31
# File 'app/helpers/application_helper.rb', line 29

def merb_photos_source(string)
  string.gsub(/ |\\/, '')
end

#merb_photos_tab(options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'app/helpers/application_helper.rb', line 33

def merb_photos_tab(options = {})
  photoset = options[:photoset]
  image = mui_image(:url => "http://farm#{photoset.farm}.static.flickr.com/#{photoset.server}/#{photoset.primary}_#{photoset.secret}_s.jpg", :height => 75, :width => 75)
  attributes = {}
  attributes[:class] = 'mui_button mui_button_tone_neutral mui_click'
  attributes[:class] << ' mui_selected' if photoset.id == @photoset.id
  attributes[:id] = slice_url(:index, :photoset_id => photoset.id)
  attributes[:style] = 'width:100%'
  content = tag(:table, tag(:tr, tag(:td, image) + tag(:td, photoset.title)))
  tag(:button, content, attributes)
end