Class: Infold::Views::ShowGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Infold::Views::ShowGenerator
- Defined in:
- lib/generators/infold/views/show_generator.rb
Instance Method Summary collapse
Instance Method Details
#setup ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/generators/infold/views/show_generator.rb', line 12 def setup resource_name = name.camelize.singularize db_schema_file = Rails.root.join('db/schema.rb') db_schema = DbSchema.new(File.exist?(db_schema_file) ? File.read(db_schema_file) : nil) yaml = YAML.load_file(Rails.root.join("config/infold/#{resource_name.underscore}.yml")) resource = YamlReader.generate_resource(resource_name, yaml, db_schema) @writer = ShowWriter.new(resource) end |
#show_content_file ⇒ Object
29 30 31 |
# File 'lib/generators/infold/views/show_generator.rb', line 29 def show_content_file template "views/_show_content.haml", Rails.root.join("app/views/admin/#{name.underscore.pluralize}/_show_content.html.haml"), force: true end |
#show_file ⇒ Object
21 22 23 |
# File 'lib/generators/infold/views/show_generator.rb', line 21 def show_file template "views/show.html+turbo_frame.haml", Rails.root.join("app/views/admin/#{name.underscore.pluralize}/show.html+turbo_frame.haml"), force: true end |
#show_wrapper_file ⇒ Object
25 26 27 |
# File 'lib/generators/infold/views/show_generator.rb', line 25 def show_wrapper_file template "views/_show_wrapper.haml", Rails.root.join("app/views/admin/#{name.underscore.pluralize}/_show_wrapper.html.haml"), force: true end |