Scaffold file templates
This commit is contained in:
12
app/views/file_templates/_form.html.slim
Normal file
12
app/views/file_templates/_form.html.slim
Normal file
@@ -0,0 +1,12 @@
|
||||
= form_for(@file_template) do |f|
|
||||
= render('shared/form_errors', object: @file_template)
|
||||
.form-group
|
||||
= f.label(:name)
|
||||
= f.text_field(:name, class: 'form-control', required: true)
|
||||
.form-group
|
||||
= f.label(:file_type_id)
|
||||
= f.collection_select(:file_type_id, FileType.all.order(:name), :id, :name, {}, class: 'form-control')
|
||||
.form-group
|
||||
= f.label(:content)
|
||||
= f.text_area(:content, class: 'form-control')
|
||||
.actions = render('shared/submit_button', f: f, object: @file_template)
|
3
app/views/file_templates/edit.html.slim
Normal file
3
app/views/file_templates/edit.html.slim
Normal file
@@ -0,0 +1,3 @@
|
||||
h1 = @file_template
|
||||
|
||||
= render('form')
|
20
app/views/file_templates/index.html.slim
Normal file
20
app/views/file_templates/index.html.slim
Normal file
@@ -0,0 +1,20 @@
|
||||
h1 = FileTemplate.model_name.human(count: 2)
|
||||
|
||||
.table-responsive
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th = t('activerecord.attributes.file_template.name')
|
||||
th = t('activerecord.attributes.file_template.file_type')
|
||||
th colspan=3 = t('shared.actions')
|
||||
tbody
|
||||
- @file_templates.each do |file_template|
|
||||
tr
|
||||
td = file_template.name
|
||||
td = link_to(file_template.file_type, file_type_path(file_template.file_type))
|
||||
td = link_to(t('shared.show'), file_template)
|
||||
td = link_to(t('shared.edit'), edit_file_template_path(file_template))
|
||||
td = link_to(t('shared.destroy'), file_template, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
|
||||
|
||||
= render('shared/pagination', collection: @file_templates)
|
||||
p = render('shared/new_button', model: FileTemplate)
|
3
app/views/file_templates/new.html.slim
Normal file
3
app/views/file_templates/new.html.slim
Normal file
@@ -0,0 +1,3 @@
|
||||
h1 = t('shared.new_model', model: FileTemplate.model_name.human)
|
||||
|
||||
= render('form')
|
7
app/views/file_templates/show.html.slim
Normal file
7
app/views/file_templates/show.html.slim
Normal file
@@ -0,0 +1,7 @@
|
||||
h1
|
||||
= @file_template
|
||||
= render('shared/edit_button', object: @file_template)
|
||||
|
||||
= row(label: 'file_template.name', value: @file_template.name)
|
||||
= row(label: 'file_template.file_type', value: link_to(@file_template.file_type, file_type_path(@file_template.file_type)))
|
||||
= row(label: 'file_template.content', value: @file_template.content)
|
Reference in New Issue
Block a user