Module: BugHunter::UiHelper

Included in:
App
Defined in:
lib/bug_hunter/ui_helper.rb

Instance Method Summary collapse

Instance Method Details

#content(key) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/bug_hunter/ui_helper.rb', line 11

def content(key)
  if section = sections[key]
    section.respond_to?(:join) ? section.join : section
  else
    ""
  end
end

#content_for(key, &block) ⇒ Object



7
8
9
# File 'lib/bug_hunter/ui_helper.rb', line 7

def content_for(key, &block)
  sections[key] = capture_haml(&block)
end

#content_tag(name, options = {}, &block) ⇒ Object



19
20
21
# File 'lib/bug_hunter/ui_helper.rb', line 19

def (name, options={}, &block)
  "<#{name} #{options.map{|k,v| "#{k}=#{v}" }.join(" ")}>#{block.call}</#{name}>"
end

#list_view(list = [], options = {}, &_block) ⇒ Object

list_view(my_collection) {|e| [e.url, e.name, “some extra content”]}



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bug_hunter/ui_helper.rb', line 24

def list_view(list = [], options = {}, &_block)
  (:ul, :"data-role"=>"listview", :"data-filter"=>options[:filter]||false) do
    list.map do |e|
       :li do
        url, content, extra = _block.call(e)

        (:a, :href => url) do
          content
        end
      end
    end.join
  end
end

#title(v) ⇒ Object



3
4
5
# File 'lib/bug_hunter/ui_helper.rb', line 3

def title(v)
  @title = v
end