-
Notifications
You must be signed in to change notification settings - Fork 13
General Use
In your initialization set HydraEditor.models
config/initializers/hydra_editor.rb HydraEditor.models = ["RecordedAudio", "PdfModel"]
You can customize the names of your fields/models by adding to your translation file:
config/locales/en.yml
hydra_editor:
form:
model_label:
PdfModel: "PDF"
RecordedAudio: "audio"
simple_form:
labels:
image:
dateCreated: "Date Created"
sub_location: "Holding Sub-location"
Create a form object for each of your models.
app/forms/recorded_audio_form.rb
class RecordedAudioForm
include HydraEditor::Form
self.model_class = RecordedAudio
self.terms = [] # Terms to be edited
self.required_fields = [] # Required fields
end
Add the javascript by adding this line to your app/assets/javascript/application.js:
//= require hydra-editor/hydra-editor
Add the stylesheets by adding this line to your app/assets/stylesheets/application.css:
*= require hydra-editor/hydra-editor
(Note: The Javascript includes require Blacklight and must be put after that.) Other customizations
By default hydra-editor provides a RecordsController with :new, :create, :edit, and :update actions implemented in the included RecordsControllerBehavior module, and a RecordsHelper module with methods implemented in RecordsHelperBehavior. If you are mounting the engine and using its routes, you can override the controller behaviors by creating your own RecordsController:
class RecordsController < ApplicationController include RecordsControllerBehavior
Your custom code
end
If you are not mounting the engine or using its default routes, you can include RecordsControllerBehavior in your own controller and add the appropriate routes to your app's config/routes.rb.