class ArcrudGenerator

Public Instance Methods

copy_entity_base() click to toggle source
# File lib/generators/arcrud/arcrud_generator.rb, line 9
def copy_entity_base
  angular_app_location = 'app/assets/javascripts/app'
  #copy_file "entity/entity-ctrl.js", angular_app_location + "/#{file_name}/#{file_name}-ctrl.js"

  # Copy the entity templates to app codebase
  directory 'entity', angular_app_location + '/%file_name%'

  # Add routes to state provider
  inject_into_file angular_app_location + '/app.js', :after => "\t$stateProvider" do
    "\n\t\t\t.state('" + file_name + "', {
      url: '/" + file_name + "',
      controller: '" + file_name.capitalize + "Ctrl',
      templateUrl: 'app/" + file_name + "/" + file_name + ".html',
      resolve: {
        " + file_name.capitalize + "List: ['" + file_name.capitalize + "Service', function(" + file_name.capitalize + "Service) {
          return " + file_name.capitalize + "Service.query();
        }]
      }
    })\n"
  end

end

Private Instance Methods

file_name1() click to toggle source
# File lib/generators/arcrud/arcrud_generator.rb, line 34
def file_name1
  entity_name.underscore
end