Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !96

Add generators for different resource templates

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge view_generator into master Oct 05, 2015
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 15

Created by: gracewashere

Problem

In order for developers to customize views, they need to define templates in specific paths inside the application.

It can be difficult for developers to remember which paths they need to place the template files into, what the templates should be called, and which variables are available inside each of the views.

https://trello.com/c/woiNAsJ8

Solution

Add generators according to the documentation for copying views from administrate's source code into the appropriate location in the developer's code base.

Usage

generate views for all resources

rails generate administrate:views:index
 # Generates app/views/administrate/application/index.html.erb
 # Generates app/views/administrate/application/_table.html.erb

rails generate administrate:views:show
 # Generates app/views/administrate/application/show.html.erb

rails generate administrate:views:edit
 # Generates app/views/administrate/application/edit.html.erb
 # Generates app/views/administrate/application/_form.html.erb

rails generate administrate:views:new
 # Generates app/views/administrate/application/new.html.erb
 # Generates app/views/administrate/application/_form.html.erb

rails generate administrate:views
 # Generates all of the above

Generate views for a specific resource

rails generate administrate:views:index User
 # Generates app/views/administrate/users/index.html.erb
 # Generates app/views/administrate/users/_table.html.erb

rails generate administrate:views:show User
 # Generates app/views/administrate/users/show.html.erb

rails generate administrate:views:edit User
 # Generates app/views/administrate/users/edit.html.erb
 # Generates app/views/administrate/users/_form.html.erb

rails generate administrate:views:new User
 # Generates app/views/administrate/users/new.html.erb
 # Generates app/views/administrate/users/_form.html.erb

rails generate administrate:views User
 # Generates all of the above
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: view_generator