Merge pull request #2356 from tchak/fix-admin-procedure-list-links

Make right click work on procedure list links
This commit is contained in:
Pierre de La Morinerie 2018-08-08 12:24:38 +02:00 committed by GitHub
commit 1f7b6ce2c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 16 deletions

View file

@ -1,9 +1,10 @@
$(document).on('turbolinks:load', link_init);
function link_init() {
$('#dossiers-list tr').on('click', function (event) {
if (event.target.className !== 'btn-sm btn-danger') {
$(location).attr('href', $(this).data('dossier_url'));
$('#dossiers-list tr').on('click', function(event) {
var href = $(this).data('href');
if (href && event.target.tagName !== 'A') {
location.href = href;
}
});
}

View file

@ -13,22 +13,20 @@
- @procedures.each do |procedure|
- procedure = procedure.decorate
%tr{ id: "tr_dossier_#{procedure.id}", 'data-dossier_url' => admin_procedure_path(id: procedure.id) }
%td= procedure.id
%td.col-xs-6
= procedure.libelle
- if @active_class
%td.procedure-lien= link_to procedure.lien, procedure.lien, 'data-method' => :get
- if @active_class || @archived_class
%td
= procedure.published_at_fr
- admin_procedure_href = admin_procedure_path(procedure)
%tr{ id: "tr_dossier_#{procedure.id}", data: { href: admin_procedure_href } }
%td= link_to(procedure.id, admin_procedure_href)
%td.col-xs-6= link_to(procedure.libelle, admin_procedure_href)
- if procedure.publiee?
%td.procedure-lien= link_to(procedure.lien, procedure.lien)
- if procedure.publiee_ou_archivee?
%td= link_to(procedure.published_at_fr, admin_procedure_href)
- else
%td
= procedure.created_at_fr
%td= link_to(procedure.created_at_fr, admin_procedure_href)
%td
= link_to('Cloner', admin_procedure_clone_path(procedure.id), 'data-method' => :put, class: 'btn-sm btn-primary clone-btn')
= link_to('Cloner', admin_procedure_clone_path(procedure.id), data: { method: :put }, class: 'btn-sm btn-primary clone-btn')
- if !procedure.publiee_ou_archivee?
= link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), 'data-method' => :delete, class: 'btn-sm btn-danger')
= link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), data: { method: :delete }, class: 'btn-sm btn-danger')
= smart_listing.paginate
= smart_listing.pagination_per_page_links