mondo-generators 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +7 -1
- data/VERSION +1 -1
- data/mondo-generators.gemspec +20 -6
- data/rails_generators/mondo_authentication/mondo_authentication_generator.rb +1 -1
- data/rails_generators/mondo_layout/mondo_layout_generator.rb +14 -4
- data/rails_generators/mondo_layout/templates/layout.html.haml +3 -2
- data/rails_generators/mondo_scaffold/mondo_scaffold_generator.rb +164 -0
- data/rails_generators/mondo_scaffold/templates/actions/create.rb +9 -0
- data/rails_generators/mondo_scaffold/templates/actions/destroy.rb +6 -0
- data/rails_generators/mondo_scaffold/templates/actions/edit.rb +3 -0
- data/rails_generators/mondo_scaffold/templates/actions/index.rb +3 -0
- data/rails_generators/mondo_scaffold/templates/actions/new.rb +3 -0
- data/rails_generators/mondo_scaffold/templates/actions/show.rb +3 -0
- data/rails_generators/mondo_scaffold/templates/actions/update.rb +9 -0
- data/rails_generators/mondo_scaffold/templates/controller.rb +3 -0
- data/rails_generators/mondo_scaffold/templates/helper.rb +2 -0
- data/rails_generators/mondo_scaffold/templates/migration.rb +16 -0
- data/rails_generators/mondo_scaffold/templates/model.rb +3 -0
- data/rails_generators/mondo_scaffold/templates/views/haml/_form.html.haml +9 -0
- data/rails_generators/mondo_scaffold/templates/views/haml/edit.html.haml +17 -0
- data/rails_generators/mondo_scaffold/templates/views/haml/index.html.haml +29 -0
- data/rails_generators/mondo_scaffold/templates/views/haml/new.html.haml +12 -0
- data/rails_generators/mondo_scaffold/templates/views/haml/show.html.haml +15 -0
- metadata +19 -5
- data/rails_generators/mondo_layout/templates/images/error.png +0 -0
- data/rails_generators/mondo_layout/templates/images/notice.png +0 -0
- data/rails_generators/mondo_layout/templates/images/success.png +0 -0
    
        data/README.rdoc
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0. | 
| 1 | 
            +
            0.6.0
         | 
    
        data/mondo-generators.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{mondo-generators}
         | 
| 8 | 
            -
              s.version = "0. | 
| 8 | 
            +
              s.version = "0.6.0"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Luca Tironi"]
         | 
| 12 | 
            -
              s.date = %q{ | 
| 12 | 
            +
              s.date = %q{2010-02-03}
         | 
| 13 13 | 
             
              s.description = %q{A collection of useful generator scripts for Rails.}
         | 
| 14 14 | 
             
              s.email = %q{luca.tironi@gmail.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -45,10 +45,7 @@ Gem::Specification.new do |s| | |
| 45 45 | 
             
                 "rails_generators/mondo_layout/templates/_flash_message.html.haml",
         | 
| 46 46 | 
             
                 "rails_generators/mondo_layout/templates/application.js",
         | 
| 47 47 | 
             
                 "rails_generators/mondo_layout/templates/helper.rb",
         | 
| 48 | 
            -
                 "rails_generators/mondo_layout/templates/images/error.png",
         | 
| 49 48 | 
             
                 "rails_generators/mondo_layout/templates/images/navbar_bkg.gif",
         | 
| 50 | 
            -
                 "rails_generators/mondo_layout/templates/images/notice.png",
         | 
| 51 | 
            -
                 "rails_generators/mondo_layout/templates/images/success.png",
         | 
| 52 49 | 
             
                 "rails_generators/mondo_layout/templates/layout.html.haml",
         | 
| 53 50 | 
             
                 "rails_generators/mondo_layout/templates/stylesheets/_colors.sass",
         | 
| 54 51 | 
             
                 "rails_generators/mondo_layout/templates/stylesheets/_constants.sass",
         | 
| @@ -64,7 +61,24 @@ Gem::Specification.new do |s| | |
| 64 61 | 
             
                 "rails_generators/mondo_layout/templates/stylesheets/partials/_tables.sass",
         | 
| 65 62 | 
             
                 "rails_generators/mondo_layout/templates/stylesheets/partials/_typography.sass",
         | 
| 66 63 | 
             
                 "rails_generators/mondo_layout/templates/stylesheets/partials/_users.sass",
         | 
| 67 | 
            -
                 "rails_generators/mondo_layout/templates/stylesheets/screen.sass"
         | 
| 64 | 
            +
                 "rails_generators/mondo_layout/templates/stylesheets/screen.sass",
         | 
| 65 | 
            +
                 "rails_generators/mondo_scaffold/mondo_scaffold_generator.rb",
         | 
| 66 | 
            +
                 "rails_generators/mondo_scaffold/templates/actions/create.rb",
         | 
| 67 | 
            +
                 "rails_generators/mondo_scaffold/templates/actions/destroy.rb",
         | 
| 68 | 
            +
                 "rails_generators/mondo_scaffold/templates/actions/edit.rb",
         | 
| 69 | 
            +
                 "rails_generators/mondo_scaffold/templates/actions/index.rb",
         | 
| 70 | 
            +
                 "rails_generators/mondo_scaffold/templates/actions/new.rb",
         | 
| 71 | 
            +
                 "rails_generators/mondo_scaffold/templates/actions/show.rb",
         | 
| 72 | 
            +
                 "rails_generators/mondo_scaffold/templates/actions/update.rb",
         | 
| 73 | 
            +
                 "rails_generators/mondo_scaffold/templates/controller.rb",
         | 
| 74 | 
            +
                 "rails_generators/mondo_scaffold/templates/helper.rb",
         | 
| 75 | 
            +
                 "rails_generators/mondo_scaffold/templates/migration.rb",
         | 
| 76 | 
            +
                 "rails_generators/mondo_scaffold/templates/model.rb",
         | 
| 77 | 
            +
                 "rails_generators/mondo_scaffold/templates/views/haml/_form.html.haml",
         | 
| 78 | 
            +
                 "rails_generators/mondo_scaffold/templates/views/haml/edit.html.haml",
         | 
| 79 | 
            +
                 "rails_generators/mondo_scaffold/templates/views/haml/index.html.haml",
         | 
| 80 | 
            +
                 "rails_generators/mondo_scaffold/templates/views/haml/new.html.haml",
         | 
| 81 | 
            +
                 "rails_generators/mondo_scaffold/templates/views/haml/show.html.haml"
         | 
| 68 82 | 
             
              ]
         | 
| 69 83 | 
             
              s.homepage = %q{http://gemcutter.org/gems/mondo-generators}
         | 
| 70 84 | 
             
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| @@ -40,8 +40,8 @@ class MondoAuthenticationGenerator < Rails::Generator::Base | |
| 40 40 | 
             
                  m.route_name :signup, 'signup', :controller => user_plural_name, :action => 'new'
         | 
| 41 41 | 
             
                  m.route_name :logout, 'logout', :controller => session_plural_name, :action => 'destroy'
         | 
| 42 42 | 
             
                  m.route_name :login, 'login', :controller => session_plural_name, :action => 'new'
         | 
| 43 | 
            -
                  m.insert_into "config/routes.rb", 'map.resources :users, :collection => { :mass_new => :get, :mass_create => :post }'
         | 
| 44 43 | 
             
                  m.route_resources session_plural_name
         | 
| 44 | 
            +
                  m.insert_into "config/routes.rb", 'map.resources :users, :collection => { :mass_new => :get, :mass_create => :post }'
         | 
| 45 45 |  | 
| 46 46 | 
             
                  m.insert_into "app/controllers/#{application_controller_name}.rb", 'include Authentication'
         | 
| 47 47 |  | 
| @@ -14,7 +14,7 @@ class MondoLayoutGenerator < Rails::Generator::Base | |
| 14 14 | 
             
                  m.directory 'public/images/icons'
         | 
| 15 15 |  | 
| 16 16 | 
             
                  m.template "layout.html.haml", "app/views/layouts/application.html.haml"
         | 
| 17 | 
            -
                  m.template "_flash_message.html.haml", "app/views/ | 
| 17 | 
            +
                  m.template "_flash_message.html.haml", "app/views/shared/_flash_message.html.haml"
         | 
| 18 18 | 
             
                  m.file     "stylesheets/screen.sass",  "app/stylesheets/screen.sass"
         | 
| 19 19 | 
             
                  m.file     "stylesheets/_colors.sass",  "app/stylesheets/_colors.sass"
         | 
| 20 20 | 
             
                  m.file     "stylesheets/_mixins.sass",  "app/stylesheets/_mixins.sass"
         | 
| @@ -37,9 +37,19 @@ class MondoLayoutGenerator < Rails::Generator::Base | |
| 37 37 | 
             
                  m.file "helper.rb", "app/helpers/layout_helper.rb"
         | 
| 38 38 | 
             
                  m.file "application.js", "public/javascripts/application.js"
         | 
| 39 39 | 
             
                  m.file "images/navbar_bkg.gif", "public/images/navbar_bkg.gif"
         | 
| 40 | 
            -
                  m.file "images/error. | 
| 41 | 
            -
                  m.file "images/notice. | 
| 42 | 
            -
                  m.file "images/success. | 
| 40 | 
            +
                  m.file "images/error.gif", "public/images/icons/error.gif"
         | 
| 41 | 
            +
                  m.file "images/notice.gif", "public/images/icons/notice.gif"
         | 
| 42 | 
            +
                  m.file "images/success.gif", "public/images/icons/success.gif"
         | 
| 43 | 
            +
                  
         | 
| 44 | 
            +
                  m.file "images/yes.gif", "public/images/icons/yes.gif"
         | 
| 45 | 
            +
                  m.file "images/no.gif", "public/images/icons/no.gif"
         | 
| 46 | 
            +
                  m.file "images/accept.gif", "public/images/icons/accept.gif"
         | 
| 47 | 
            +
                  m.file "images/cancel.gif", "public/images/icons/cancel.gif"
         | 
| 48 | 
            +
                  m.file "images/back.gif", "public/images/icons/back.gif"
         | 
| 49 | 
            +
                  m.file "images/new.gif", "public/images/icons/new.gif"
         | 
| 50 | 
            +
                  m.file "images/edit.gif", "public/images/icons/edit.gif"
         | 
| 51 | 
            +
                  m.file "images/delete.gif", "public/images/icons/delete.gif"
         | 
| 52 | 
            +
                  m.file "images/bullet_black.gif", "public/images/icons/bullet_black.gif"
         | 
| 43 53 | 
             
                end
         | 
| 44 54 | 
             
              end
         | 
| 45 55 |  | 
| @@ -0,0 +1,164 @@ | |
| 1 | 
            +
            class MondoScaffoldGenerator < Rails::Generator::Base
         | 
| 2 | 
            +
              attr_accessor :name, :attributes, :controller_actions
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              def initialize(runtime_args, runtime_options = {})
         | 
| 5 | 
            +
                super
         | 
| 6 | 
            +
                usage if @args.empty?
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                @name = @args.first
         | 
| 9 | 
            +
                @controller_actions = []
         | 
| 10 | 
            +
                @attributes = []
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                @args[1..-1].each do |arg|
         | 
| 13 | 
            +
                  if arg == '!'
         | 
| 14 | 
            +
                    options[:invert] = true
         | 
| 15 | 
            +
                  elsif arg.include? ':'
         | 
| 16 | 
            +
                    @attributes << Rails::Generator::GeneratedAttribute.new(*arg.split(":"))
         | 
| 17 | 
            +
                  else
         | 
| 18 | 
            +
                    @controller_actions << arg
         | 
| 19 | 
            +
                    @controller_actions << 'create' if arg == 'new'
         | 
| 20 | 
            +
                    @controller_actions << 'update' if arg == 'edit'
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                @controller_actions.uniq!
         | 
| 25 | 
            +
                @attributes.uniq!
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                if options[:invert] || @controller_actions.empty?
         | 
| 28 | 
            +
                  @controller_actions = all_actions - @controller_actions
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                if @attributes.empty?
         | 
| 32 | 
            +
                  options[:skip_model] = true # default to skipping model if no attributes passed
         | 
| 33 | 
            +
                  if model_exists?
         | 
| 34 | 
            +
                    model_columns_for_attributes.each do |column|
         | 
| 35 | 
            +
                      @attributes << Rails::Generator::GeneratedAttribute.new(column.name.to_s, column.type.to_s)
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
                  else
         | 
| 38 | 
            +
                    @attributes << Rails::Generator::GeneratedAttribute.new('name', 'string')
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
              end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
              def manifest
         | 
| 44 | 
            +
                record do |m|
         | 
| 45 | 
            +
                  unless options[:skip_model]
         | 
| 46 | 
            +
                    m.directory "app/models"
         | 
| 47 | 
            +
                    m.template "model.rb", "app/models/#{singular_name}.rb"
         | 
| 48 | 
            +
                    unless options[:skip_migration]
         | 
| 49 | 
            +
                      m.migration_template "migration.rb", "db/migrate", :migration_file_name => "create_#{plural_name}"
         | 
| 50 | 
            +
                    end
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  unless options[:skip_controller]
         | 
| 54 | 
            +
                    m.directory "app/controllers"
         | 
| 55 | 
            +
                    m.template "controller.rb", "app/controllers/#{plural_name}_controller.rb"
         | 
| 56 | 
            +
                    
         | 
| 57 | 
            +
                    m.directory "app/helpers"
         | 
| 58 | 
            +
                    m.template "helper.rb", "app/helpers/#{plural_name}_helper.rb"
         | 
| 59 | 
            +
                    
         | 
| 60 | 
            +
                    m.directory "app/views/#{plural_name}"
         | 
| 61 | 
            +
                    controller_actions.each do |action|
         | 
| 62 | 
            +
                      if File.exist? source_path("views/haml/#{action}.html.haml")
         | 
| 63 | 
            +
                        m.template "views/haml/#{action}.html.haml", "app/views/#{plural_name}/#{action}.html.haml"
         | 
| 64 | 
            +
                      end
         | 
| 65 | 
            +
                    end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                    if form_partial?
         | 
| 68 | 
            +
                      m.template "views/haml/_form.html.haml", "app/views/#{plural_name}/_form.html.haml"
         | 
| 69 | 
            +
                    end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                    m.route_resources plural_name
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
              end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
              def form_partial?
         | 
| 77 | 
            +
                actions? :new, :edit
         | 
| 78 | 
            +
              end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
              def all_actions
         | 
| 81 | 
            +
                %w[index show new create edit update destroy]
         | 
| 82 | 
            +
              end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
              def action?(name)
         | 
| 85 | 
            +
                controller_actions.include? name.to_s
         | 
| 86 | 
            +
              end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
              def actions?(*names)
         | 
| 89 | 
            +
                names.all? { |n| action? n.to_s }
         | 
| 90 | 
            +
              end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
              def singular_name
         | 
| 93 | 
            +
                name.underscore
         | 
| 94 | 
            +
              end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
              def plural_name
         | 
| 97 | 
            +
                name.underscore.pluralize
         | 
| 98 | 
            +
              end
         | 
| 99 | 
            +
             | 
| 100 | 
            +
              def class_name
         | 
| 101 | 
            +
                name.camelize
         | 
| 102 | 
            +
              end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
              def plural_class_name
         | 
| 105 | 
            +
                plural_name.camelize
         | 
| 106 | 
            +
              end
         | 
| 107 | 
            +
             | 
| 108 | 
            +
              def controller_methods(dir_name)
         | 
| 109 | 
            +
                controller_actions.map do |action|
         | 
| 110 | 
            +
                  read_template("#{dir_name}/#{action}.rb")
         | 
| 111 | 
            +
                end.join("  \n").strip
         | 
| 112 | 
            +
              end
         | 
| 113 | 
            +
             | 
| 114 | 
            +
              def items_path(suffix = 'path')
         | 
| 115 | 
            +
                if action? :index
         | 
| 116 | 
            +
                  "#{plural_name}_#{suffix}"
         | 
| 117 | 
            +
                else
         | 
| 118 | 
            +
                  "root_#{suffix}"
         | 
| 119 | 
            +
                end
         | 
| 120 | 
            +
              end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
              def item_path(suffix = 'path')
         | 
| 123 | 
            +
                if action? :show
         | 
| 124 | 
            +
                  "@#{singular_name}"
         | 
| 125 | 
            +
                else
         | 
| 126 | 
            +
                  items_path(suffix)
         | 
| 127 | 
            +
                end
         | 
| 128 | 
            +
              end
         | 
| 129 | 
            +
             | 
| 130 | 
            +
              def model_columns_for_attributes
         | 
| 131 | 
            +
                class_name.constantize.columns.reject do |column|
         | 
| 132 | 
            +
                  column.name.to_s =~ /^(id|created_at|updated_at)$/
         | 
| 133 | 
            +
                end
         | 
| 134 | 
            +
              end
         | 
| 135 | 
            +
             | 
| 136 | 
            +
            protected
         | 
| 137 | 
            +
             | 
| 138 | 
            +
              def add_options!(opt)
         | 
| 139 | 
            +
                opt.separator ''
         | 
| 140 | 
            +
                opt.separator 'Options:'
         | 
| 141 | 
            +
                opt.on("--skip-model", "Don't generate a model or migration file.") { |v| options[:skip_model] = v }
         | 
| 142 | 
            +
                opt.on("--skip-migration", "Don't generate migration file for model.") { |v| options[:skip_migration] = v }
         | 
| 143 | 
            +
                opt.on("--skip-timestamps", "Don't add timestamps to migration file.") { |v| options[:skip_timestamps] = v }
         | 
| 144 | 
            +
                opt.on("--skip-controller", "Don't generate controller, helper, or views.") { |v| options[:skip_controller] = v }
         | 
| 145 | 
            +
                opt.on("--invert", "Generate all controller actions except these mentioned.") { |v| options[:invert] = v }
         | 
| 146 | 
            +
              end
         | 
| 147 | 
            +
             | 
| 148 | 
            +
              # is there a better way to do this? Perhaps with const_defined?
         | 
| 149 | 
            +
              def model_exists?
         | 
| 150 | 
            +
                File.exist? destination_path("app/models/#{singular_name}.rb")
         | 
| 151 | 
            +
              end
         | 
| 152 | 
            +
             | 
| 153 | 
            +
              def read_template(relative_path)
         | 
| 154 | 
            +
                ERB.new(File.read(source_path(relative_path)), nil, '-').result(binding)
         | 
| 155 | 
            +
              end
         | 
| 156 | 
            +
             | 
| 157 | 
            +
              def banner
         | 
| 158 | 
            +
                <<-EOS
         | 
| 159 | 
            +
            Creates a controller and optional model given the name, actions, and attributes.
         | 
| 160 | 
            +
             | 
| 161 | 
            +
            USAGE: #{$0} #{spec.name} ModelName [controller_actions and model:attributes] [options]
         | 
| 162 | 
            +
            EOS
         | 
| 163 | 
            +
              end
         | 
| 164 | 
            +
            end
         | 
| @@ -0,0 +1,9 @@ | |
| 1 | 
            +
              def create
         | 
| 2 | 
            +
                @<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
         | 
| 3 | 
            +
                if @<%= singular_name %>.save
         | 
| 4 | 
            +
                  flash[:success] = "Successfully created <%= name.underscore.humanize.downcase %>."
         | 
| 5 | 
            +
                  redirect_to <%= item_path('url') %>
         | 
| 6 | 
            +
                else
         | 
| 7 | 
            +
                  render :new
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
              end
         | 
| @@ -0,0 +1,9 @@ | |
| 1 | 
            +
              def update
         | 
| 2 | 
            +
                @<%= singular_name %> = <%= class_name %>.find(params[:id])
         | 
| 3 | 
            +
                if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
         | 
| 4 | 
            +
                  flash[:success] = "Successfully updated <%= name.underscore.humanize.downcase %>."
         | 
| 5 | 
            +
                  redirect_to <%= items_path('url') %>
         | 
| 6 | 
            +
                else
         | 
| 7 | 
            +
                  render :edit
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
              end
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            class Create<%= plural_class_name %> < ActiveRecord::Migration
         | 
| 2 | 
            +
              def self.up
         | 
| 3 | 
            +
                create_table :<%= plural_name %> do |t|
         | 
| 4 | 
            +
                <%- for attribute in attributes -%>
         | 
| 5 | 
            +
                  t.<%= attribute.type %> :<%= attribute.name %>
         | 
| 6 | 
            +
                <%- end -%>
         | 
| 7 | 
            +
                <%- unless options[:skip_timestamps] -%>
         | 
| 8 | 
            +
                  t.timestamps
         | 
| 9 | 
            +
                <%- end -%>
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
              
         | 
| 13 | 
            +
              def self.down
         | 
| 14 | 
            +
                drop_table :<%= plural_name %>
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            - title "Edit <%= singular_name.titleize %>"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            <%- if form_partial? -%>
         | 
| 4 | 
            +
            - form_for @<%= singular_name %> do |f|
         | 
| 5 | 
            +
              = render :partial => "form", :locals => { :f => f, :submit_button => t("label.update") }
         | 
| 6 | 
            +
            <%- else -%>
         | 
| 7 | 
            +
            <%= read_template("views/haml/_form.html.haml") -%>
         | 
| 8 | 
            +
            <%- end -%>
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            <%- if actions? :show, :destroy, :index -%>
         | 
| 11 | 
            +
            <%- if action? :destroy -%>
         | 
| 12 | 
            +
            = link_to t("label.destroy"), <%= singular_name %>, :confirm => t("confirm.destroy"), :method => :delete, :class => "button negative"
         | 
| 13 | 
            +
            <%- end -%>
         | 
| 14 | 
            +
            <%- if action? :index -%>
         | 
| 15 | 
            +
            = link_to t("label.back"), <%= plural_name %>_path, :class => "button"
         | 
| 16 | 
            +
            <%- end -%>
         | 
| 17 | 
            +
            <%- end -%>
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            - title "<%= plural_name.titleize %>"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            <%- if actions? :new -%>
         | 
| 4 | 
            +
            %p
         | 
| 5 | 
            +
              = link_to "New <%= singular_name.titleize %>", new_<%= singular_name %>_path
         | 
| 6 | 
            +
            <%- end -%>
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            %table
         | 
| 9 | 
            +
              %tr
         | 
| 10 | 
            +
                <%- for attribute in attributes -%>
         | 
| 11 | 
            +
                %th <%= attribute.column.human_name %>
         | 
| 12 | 
            +
                <%- end -%>
         | 
| 13 | 
            +
                %th Actions
         | 
| 14 | 
            +
              - for <%= singular_name %> in @<%= plural_name %>
         | 
| 15 | 
            +
                - tr_class = cycle 'even', 'odd'
         | 
| 16 | 
            +
                %tr{:class => tr_class}
         | 
| 17 | 
            +
                  <%- for attribute in attributes -%>
         | 
| 18 | 
            +
                  %td= h <%= singular_name %>.<%= attribute.name %>
         | 
| 19 | 
            +
                  <%- end -%>
         | 
| 20 | 
            +
                  %td
         | 
| 21 | 
            +
                  <%- if action? :show -%>
         | 
| 22 | 
            +
                    = link_to t("label.show"), <%= singular_name %>, :class => "button positive"
         | 
| 23 | 
            +
                  <%- end -%>
         | 
| 24 | 
            +
                  <%- if action? :edit -%>
         | 
| 25 | 
            +
                    = link_to t("label.edit"), edit_<%= singular_name %>_path(<%= singular_name %>), :class => "button"
         | 
| 26 | 
            +
                  <%- end -%>
         | 
| 27 | 
            +
                  <%- if action? :destroy -%>
         | 
| 28 | 
            +
                    = link_to t("label.destroy"), <%= singular_name %>, :confirm => t("confirm.destroy"), :method => :delete, :class => "button negative"
         | 
| 29 | 
            +
                  <%- end -%>
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            - title "New <%= singular_name.titleize %>"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            <%- if form_partial? -%>
         | 
| 4 | 
            +
            - form_for @<%= singular_name %> do |f|
         | 
| 5 | 
            +
              = render :partial => "form", :locals => { :f => f, :submit_button => t("label.create") }
         | 
| 6 | 
            +
            <%- else -%>
         | 
| 7 | 
            +
            <%= read_template("views/haml/_form.html.haml") -%>
         | 
| 8 | 
            +
            <%- end -%>
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            <%- if action? :index -%>
         | 
| 11 | 
            +
            = link_to "Back to List", <%= plural_name %>_path, :class => "button"
         | 
| 12 | 
            +
            <%- end -%>
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            - title "<%= singular_name.titleize %>"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            <%- for attribute in attributes -%>
         | 
| 4 | 
            +
            %p
         | 
| 5 | 
            +
              %strong <%= attribute.column.human_name.titleize %>:
         | 
| 6 | 
            +
              =h @<%= singular_name %>.<%= attribute.name %>
         | 
| 7 | 
            +
            <%- end -%>
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            %p.buttons
         | 
| 10 | 
            +
              <%- if action? :edit -%>
         | 
| 11 | 
            +
              = link_to t("label.edit"), edit_<%= singular_name %>_path(<%= singular_name %>), :class => "button positive"
         | 
| 12 | 
            +
              <%- end -%>
         | 
| 13 | 
            +
              <%- if action? :index -%>
         | 
| 14 | 
            +
              = link_to t("label.back"), <%= plural_name %>_path, :class => "button"
         | 
| 15 | 
            +
              <%- end -%>
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: mondo-generators
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.6.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Luca Tironi
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2010-02-03 00:00:00 +01:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: []
         | 
| 15 15 |  | 
| @@ -51,10 +51,7 @@ files: | |
| 51 51 | 
             
            - rails_generators/mondo_layout/templates/_flash_message.html.haml
         | 
| 52 52 | 
             
            - rails_generators/mondo_layout/templates/application.js
         | 
| 53 53 | 
             
            - rails_generators/mondo_layout/templates/helper.rb
         | 
| 54 | 
            -
            - rails_generators/mondo_layout/templates/images/error.png
         | 
| 55 54 | 
             
            - rails_generators/mondo_layout/templates/images/navbar_bkg.gif
         | 
| 56 | 
            -
            - rails_generators/mondo_layout/templates/images/notice.png
         | 
| 57 | 
            -
            - rails_generators/mondo_layout/templates/images/success.png
         | 
| 58 55 | 
             
            - rails_generators/mondo_layout/templates/layout.html.haml
         | 
| 59 56 | 
             
            - rails_generators/mondo_layout/templates/stylesheets/_colors.sass
         | 
| 60 57 | 
             
            - rails_generators/mondo_layout/templates/stylesheets/_constants.sass
         | 
| @@ -71,6 +68,23 @@ files: | |
| 71 68 | 
             
            - rails_generators/mondo_layout/templates/stylesheets/partials/_typography.sass
         | 
| 72 69 | 
             
            - rails_generators/mondo_layout/templates/stylesheets/partials/_users.sass
         | 
| 73 70 | 
             
            - rails_generators/mondo_layout/templates/stylesheets/screen.sass
         | 
| 71 | 
            +
            - rails_generators/mondo_scaffold/mondo_scaffold_generator.rb
         | 
| 72 | 
            +
            - rails_generators/mondo_scaffold/templates/actions/create.rb
         | 
| 73 | 
            +
            - rails_generators/mondo_scaffold/templates/actions/destroy.rb
         | 
| 74 | 
            +
            - rails_generators/mondo_scaffold/templates/actions/edit.rb
         | 
| 75 | 
            +
            - rails_generators/mondo_scaffold/templates/actions/index.rb
         | 
| 76 | 
            +
            - rails_generators/mondo_scaffold/templates/actions/new.rb
         | 
| 77 | 
            +
            - rails_generators/mondo_scaffold/templates/actions/show.rb
         | 
| 78 | 
            +
            - rails_generators/mondo_scaffold/templates/actions/update.rb
         | 
| 79 | 
            +
            - rails_generators/mondo_scaffold/templates/controller.rb
         | 
| 80 | 
            +
            - rails_generators/mondo_scaffold/templates/helper.rb
         | 
| 81 | 
            +
            - rails_generators/mondo_scaffold/templates/migration.rb
         | 
| 82 | 
            +
            - rails_generators/mondo_scaffold/templates/model.rb
         | 
| 83 | 
            +
            - rails_generators/mondo_scaffold/templates/views/haml/_form.html.haml
         | 
| 84 | 
            +
            - rails_generators/mondo_scaffold/templates/views/haml/edit.html.haml
         | 
| 85 | 
            +
            - rails_generators/mondo_scaffold/templates/views/haml/index.html.haml
         | 
| 86 | 
            +
            - rails_generators/mondo_scaffold/templates/views/haml/new.html.haml
         | 
| 87 | 
            +
            - rails_generators/mondo_scaffold/templates/views/haml/show.html.haml
         | 
| 74 88 | 
             
            has_rdoc: true
         | 
| 75 89 | 
             
            homepage: http://gemcutter.org/gems/mondo-generators
         | 
| 76 90 | 
             
            licenses: []
         | 
| Binary file | 
| Binary file | 
| Binary file |