Module: Daddy::Formatter::DaddyHtml

Included in:
Html
Defined in:
lib/daddy/formatter/daddy_html.rb

Instance Method Summary collapse

Instance Method Details

#after_menuObject



19
20
21
22
23
24
# File 'lib/daddy/formatter/daddy_html.rb', line 19

def after_menu
  if ENV['PUBLISH']
    @builder << '</div>'
    @builder << '</div>'
  end
end

#before_menuObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/daddy/formatter/daddy_html.rb', line 7

def before_menu
  if ENV['PUBLISH']
    @builder << "<div>"

    @builder.div(:id => 'menu') do
        @builder << make_menu_for_publish
    end

    @builder << "<div class='contents'>"
  end
end

#feature_dir(feature, short = false) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/daddy/formatter/daddy_html.rb', line 32

def feature_dir(feature, short = false)
  ret = ''
  
  split = feature.file.split('/')
  split.reverse[1..-2].each_with_index do |dir, i|
    break if dir == '仕様書' or dir == '開発日記'

    if i == 0
      if short
        ret = dir.split('.').first + '.'
      else
        ret = dir
      end
    else
      ret = dir.split('.').first + '.' + ret
    end
  end

  ret
end

#make_menu_for_publishObject



26
27
28
29
30
# File 'lib/daddy/formatter/daddy_html.rb', line 26

def make_menu_for_publish
  menu = Rails.root + '/tmp/menu.html'
  system("erb -T - #{File.dirname(__FILE__)}/menu.html.erb > #{menu}")
  File.readlines(menu).join
end

#should_expandObject



53
54
55
56
57
# File 'lib/daddy/formatter/daddy_html.rb', line 53

def should_expand
  return false unless ENV['EXPAND']
  return false if ['f', 'false'].include?(ENV['EXPAND'].downcase)
  true
end