24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/generators/admin_theme/resource/resource_generator.rb', line 24
def generate_views
template "#{options.engine}/view_form.html.#{options.engine}", "app/views/admin/#{plural_resource_name}/_form.html.#{options.engine}"
template "#{options.engine}/view_edit.html.#{options.engine}", "app/views/admin/#{plural_resource_name}/edit.html.#{options.engine}"
template "#{options.engine}/view_index.html.#{options.engine}", "app/views/admin/#{plural_resource_name}/index.html.#{options.engine}"
template "#{options.engine}/view_new.html.#{options.engine}", "app/views/admin/#{plural_resource_name}/new.html.#{options.engine}"
template "#{options.engine}/view_show.html.#{options.engine}", "app/views/admin/#{plural_resource_name}/show.html.#{options.engine}"
gsub_file("app/views/layouts/admin.html.erb", /\<div\s+id=\"main-navigation\">.*\<\/ul\>/mi) do |match|
match.gsub!(/\<\/ul\>/, "")
%|#{match} <li class="<%= controller_name == '#{plural_resource_name}' ? 'active' : '' %>">
<%= link_to "#{plural_model_name}", #{controller_routing_path}_path %>
</li>
</ul>|
end
end
|