Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a generator for the AdminController
- Loading branch information
1 parent
ff8cd23
commit f3fd695
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
lib/generators/curation_concerns/admin_dashboard_generator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'rails/generators' | ||
|
||
module CurationConcerns | ||
class AdminDashboardGenerator < Rails::Generators::Base | ||
source_root File.expand_path('../templates', __FILE__) | ||
|
||
desc 'This generator makes the following changes to your application: | ||
1. Creates an admin dashboard controller. | ||
' | ||
|
||
def create_controller | ||
copy_file 'app/controllers/curation_concerns/admin_controller.rb', 'app/controllers/curation_concerns/admin_controller.rb' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...erators/curation_concerns/templates/app/controllers/curation_concerns/admin_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
module CurationConcerns | ||
# Controller for displaying the Administration console. | ||
# | ||
# This controller provides a framework for reading in a configuration | ||
# and displaying administrative widgets on an admistrative dashboard. | ||
# | ||
# This configuration is included in config/initializers/curation_concerns.rb | ||
# | ||
# The administrative dashbord is divided into two columns, a left side menu | ||
# and the right action display. | ||
# | ||
# The menu is configured by listing actions in display order. | ||
# | ||
# The actions are then defined in the configuration and | ||
# automatically display the partials listed. You can override | ||
# this default behavior by implementing your action in the controller. | ||
# | ||
# The configuration also includes named data sources that can be used in | ||
# any view to access system level data. | ||
# | ||
# Example Configuration: | ||
# @dashboard_configuration ||= { | ||
# menu: { | ||
# index: {}, | ||
# other_action: {}, | ||
# complex_action: {} | ||
# }, | ||
# actions: { | ||
# index: { | ||
# partials: [ | ||
# "total_objects" | ||
# ] | ||
# }, | ||
# other_action: { | ||
# partials: [ | ||
# "other_objects_view" | ||
# ] | ||
# }, | ||
# complex_action: { | ||
# # rendered in the action | ||
# } | ||
# }, | ||
# data_sources: { | ||
# resource_stats: CurationConcerns::ResourceStatisticsSource | ||
# } | ||
# } | ||
# | ||
# Example AdminController | ||
# class AdminController < ApplicationController | ||
# include CurationConcerns::AdminControllerBehavior | ||
# | ||
# def complex_action | ||
# # do complex stuff and render how I want | ||
# ... | ||
# end | ||
# end | ||
# | ||
class AdminController < ApplicationController | ||
include CurationConcerns::AdminControllerBehavior | ||
end | ||
end |