Over the past few months, I’ve developed an administrative console for
databases in the process of solving other problems.
At the moment, the state of development is:
-
Going to /admin_panel/model will bring you to a list of items in the
model:- Supports acts_as_list via drag/drop sorting
- Supports “activated” via an activated/deactivated button
- Supports basic CRUD operations
-
/admin_panel/model/edit will create a new instance of the model
-
/admin_panel/model/edit/id will bring up an edit form
-
the panel is customizable:
- by def page_options; { option_hash }; end
- by def list_options; { option_hash }; end
- /admin_pane/model will provide a two-panel categorized list if
:has_many
or :belongs_to options are set as a list_option - Clicking a category (on the left list) will bring up items (from
the right
list) in that category. This works with working has_many or
belongs_to
relationships set in Rails.
-
the edit form automatically created widgets for database columns of
type:- :text with optional support for tinyMCE
- :string with a text_field
- :date with date_select
- :time with am/pm via a time_select plugin I heavily modified
- :boolean with a checkbox
- :file with file_column
- :image with file_column and an image display
- automatic select boxes for belongs_to
-
the edit form can be customized (via page_options):
- fields can be ignored
- the default widget can be changed
- pretty field names can be created that are used in both labels and
error messages (via pretty_error_messages_for) - the header can be changed from the default (“New Model Name” or
"Editing
Model Name(Title of Specific Items) - The order of fields can be specified
- Subsection titles can be specified
- Lines can be removed under specific items
- Additional options can be specified for the widget (e.g. you can
pass
options for the text_field, date, etc. widgets that are merged with
the
default options) - The back button can be added or removed
-
Required conventions at the moment
- the main name field in a model is called ‘title’
- this will probably change to become customizable
You can see a screenshot of the list view and the edit form at
http://www.yehudakatz.com/admin-console.gif
The point of this rather long explanation is to elicit feedback about
where I should go with this. I would like to release it as a plugin
(probably an Engine), and would like to make it more sanely put together
before I do so:
- GUI, database-held configuration via a AdminPanel model and
:serialize - A central navbar for the tables
- Add and remove models from the admin panel via the GUI
- All of the above would replace the current hack of putting the config
in a
model method and make it easier for newbies to configure their
database
front-end
This tool, as it currently stands, does not assist in the creation of
tables. Because migrations are so easy (and important to know), I
figured that people could continue to create their models as they do
currently, and have an automated (but configurable) data-entry backend
without further work.
That’s what I needed anyway (for me, the configuration was needed so
that I could make the various forms look good, and not like some generic
throw-in; I’m using it as the back-end to a CMS I’m building for a large
non-profit).
I’m looking forward to some feedback. Again, take a look at the
screenshot at
http://www.yehudakatz.com/admin-console.gif to get a better sense of
what all
of this means. Note that nothing in the screenshot was generated by
anything
but a group of universal helpers.
Thanks!
Yehuda K.