Sha256: 41863fd690655e416dffa7763f98d7519b112342188b1c977a5cdc832d287d63
Contents?: true
Size: 852 Bytes
Versions: 2
Compression:
Stored size: 852 Bytes
Contents
module Scrivito module Generators class WidgetGenerator < ::Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) argument :name, type: :string argument :attrs, type: :array, default: [], banner: 'attribute:type attribute:type' def create_model template 'model.erb', "app/models/#{file_name}.rb" end def create_views template 'show.html.erb', "app/views/#{file_name}/show.html.erb" template 'details.html.erb', "app/views/#{file_name}/details.html.erb" template 'thumbnail.html.erb', "app/views/#{file_name}/thumbnail.html.erb" end def file_name super.ends_with?('_widget') ? super : "#{super}_widget" end def class_name super.ends_with?('Widget') ? super : "#{super}Widget" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scrivito_sdk-1.18.0 | lib/generators/scrivito/widget/widget_generator.rb |
scrivito_sdk-1.18.0.rc1 | lib/generators/scrivito/widget/widget_generator.rb |