Add admin interface for the links

This commit is contained in:
Patrick Gansterer 2019-11-04 03:52:07 +01:00
parent 7657b05787
commit 1053b3883d
11 changed files with 142 additions and 0 deletions

View file

@ -0,0 +1,15 @@
= simple_form_for [:admin, @link], validate: true, remote: true do |f|
.modal-header
= close_button :modal
%h3= @link.new_record? ? t('.title_new') : t('.title_edit')
.modal-body
= f.input :name
= f.input :url
= f.association :workgroup
= f.input :indirect, input_html: { 'data-toggle' => 'collapse', 'data-target' => '#authorization' }
#authorization{class: @link.indirect? ? '' : 'collapse'}
= f.input :authorization
%small= t '.description'
.modal-footer
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
= f.submit class: 'btn btn-primary'

View file

@ -0,0 +1,15 @@
%table.table.table-striped
%thead
%tr
%th= Link.human_attribute_name :name
%th= Link.human_attribute_name :url
%th= t 'ui.actions'
%tbody
- for link in @links
%tr
%td= link.name
%td= link.url
%td
= link_to t('ui.edit'), edit_admin_link_path(link), remote: true, class: 'btn btn-mini'
= link_to t('ui.delete'), admin_link_path(link), :data => {:confirm => t('admin.confirm', name: link.name)},
:method => :delete, class: 'btn btn-mini btn-danger'

View file

@ -0,0 +1,2 @@
$('#modalContainer').html('#{j(render("form"))}');
$('#modalContainer').modal();

View file

@ -0,0 +1,7 @@
- title t '.title'
- content_for :actionbar do
= link_to t('.new_link'), new_admin_link_path, remote: true, class: 'btn btn-primary'
#links
= render "links"

View file

@ -0,0 +1,2 @@
$('#links').html('#{escape_javascript(render("links"))}');
$('#modalContainer').modal('hide');