admin add in skoolfiance project
link ----- https://activeadmin.info/documentation.html
Comand to create the file at the admin side--
$> rails generate active_admin:resource [MyModelName]
url --
http://localhost:3001/admin/invoice_templates/2
1. generate tables -
rails g model EmailTemplate name:string created:datetime subject:text description:text
rails g model InvoiceTemplate template_name:string date_created:datetime from:string cc:string bcc:string subject:text email_content:text
2. give command – generate this file for admin side
$> rails generate active_admin:resource [MyModelName]
3. add codes in admin files
4. add models
5. done
invoice_templates.rb ::
ActiveAdmin.register BxBlockInvoiceTemplate::InvoiceTemplate, as: "InvoiceTemplate" do
permit_params :name, :created, :sender_email, :cc_email,
:bcc_email, :subject, :description
actions :all
index do
selectable_column
id_column
column :name
column :created
column :sender_email
column :cc_email
column :bcc_email
column :subject
column :description
actions
end
show do
attributes_table do
row :name
row :created
row :sender_email
row :cc_email
row :bcc_email
row :subject
row :description
end
end
form do |f|
f.inputs do
f.input :name
f.input :created
f.input :sender_email
f.input :cc_email
f.input :bcc_email
f.input :subject
f.input :description
end
f.actions
end
end
email_template::
ActiveAdmin.register BxBlockEmailTemplate::EmailTemplate, as: "EmailTemplate" do
permit_params :name, :created, :subject,
:description
actions :all
index do
selectable_column
id_column
column :name
column :created
column :subject
column :description
actions
end
show do
attributes_table do
row :name
row :created
row :subject
row :description
end
end
form do |f|
f.inputs do
f.input :name
f.input :created
f.input :subject
f.input :description
end
f.actions
end
end
Comments
Post a Comment