40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/generators/erb/leosca/leosca_generator.rb', line 40
def update_layout_html
file = "app/views/layouts/_#{CONFIG[:default_style]}.html.erb"
if nested?
inject_into_file file, :before => " <!-- Insert above here other #{last_parent} elements -->" do
" \#{\"<% if can?(:read, \#{class_name}) && controller.controller_path == '\#{controller_name}' -%>\" if authorization?}\n <li class=\"active\"><%= t('models.\#{plural_table_name}') %></li>\n <!-- Insert above here other \#{singular_table_name} elements -->\n \#{\"<% end -%>\" if authorization?}\n FILE\n end if File.exists?(file)\n #elsif leospaced?\n # inject_into_file file, :before => \" <!-- Insert above other elements -->\" do\n # <<-FILE.gsub(/^ /, '')\n # \#{\"<% if \#{options.auth_class}_signed_in? && current_\#{options.auth_class}.role?(\#{last_namespace.inspect}) -%>\" if authorization?}\n # <li class=\"<%= controller.controller_path == '\#{last_namespace}' ? 'active' : '' %>\"><a href=\"<%= \#{last_namespace}_index_path %>\">\#{last_namespace.capitalize}</a></li>\n # <!-- Insert above here other \#{last_namespace} elements -->\n # \#{\"<% end -%>\" if authorization?}\n # FILE\n # end if File.exists?(file)\n # inject_into_file file, :before => \" <!-- Insert above other elements -->\" do\n # <<-FILE.gsub(/^ /, '')\n # \#{\"<% if can?(:read, \#{class_name}) -%>\" if authorization?}\n # <li class=\"<%= controller.controller_path == '\#{formatted_namespace_path}\#{controller_name}' ? 'active' : '' %>\"><a href=\"<%= \#{list_resources_path} %>\"><%= t('models.\#{plural_table_name}') %></a></li>\n # <!-- Insert above here other \#{singular_table_name} elements -->\n # \#{\"<% end -%>\" if authorization?}\n # FILE\n # end if File.exists?(file)\n else\n inject_into_file file, :before => \" <!-- Insert above other elements -->\" do\n <<-FILE.gsub(/^ /, '')\n \#{\"<% if can?(:read, \#{class_name}) -%>\" if authorization?}\n <li class=\"<%= controller.controller_path == '\#{formatted_namespace_path}\#{controller_name}' ? 'active' : '' %>\"><a href=\"<%= \#{list_resources_path} %>\"><%= t('models.\#{plural_table_name}') %></a></li>\n <!-- Insert above here other \#{singular_table_name} elements -->\n \#{\"<% end -%>\" if authorization?}\n FILE\n end if File.exists?(file)\n end\nend\n".gsub(/^ /, '')
|