class Effective::Generators::ViewsGenerator

Public Instance Methods

assign_attributes() click to toggle source
# File lib/generators/effective/views_generator.rb, line 23
def assign_attributes
  @attributes = (invoked_attributes.presence || resource_attributes).except(:archived)
  self.class.send(:attr_reader, :attributes)
end
create_views() click to toggle source
# File lib/generators/effective/views_generator.rb, line 32
def create_views
  if invoked_actions.include?('show') || non_crud_actions.present?
    if admin_effective_scaffold?
      template "#{scaffold_path}/views/_resource.html.haml", resource.admin_effective_view_file(resource.name, partial: true)
    else
      template "#{scaffold_path}/views/_resource.html.haml", resource.view_file(resource.name, partial: true)
    end
  end

  if effective_scaffold?
    template "#{scaffold_path}/views/_layout.html.haml", resource.view_file('layout', partial: true)
  end

end
invoke_views() click to toggle source
# File lib/generators/effective/views_generator.rb, line 28
def invoke_views
  say_status :invoke, :views, :white
end
validate_resource() click to toggle source
# File lib/generators/effective/views_generator.rb, line 19
def validate_resource
  exit unless resource_valid?
end