Table list now have clickable rows
This commit is contained in:
parent
7793de5e34
commit
164e0781f4
@ -1 +1,26 @@
|
|||||||
$(document).on 'turbolinks:load', ->
|
$(document).on 'turbolinks:load', ->
|
||||||
|
$('table.list td.view a').each -> visit $(this)
|
||||||
|
|
||||||
|
# Automatic ajax pagination
|
||||||
|
$('.pagination .next a').attr('data-remote', true).each ->
|
||||||
|
# Go to the next page when page is scrolled
|
||||||
|
$(document).scroll =>
|
||||||
|
if $(this).visible true, true
|
||||||
|
# "Next" link is also hidden while pagination is done
|
||||||
|
$(this).click().parents('.pagination').hide()
|
||||||
|
|
||||||
|
$(document).on 'ajax:success', '.pagination .next a', (event, data) ->
|
||||||
|
$(this).parents('tfoot')
|
||||||
|
.prev()
|
||||||
|
.append($('tbody tr', data))
|
||||||
|
.find('td.view a').each ->
|
||||||
|
visit $(this)
|
||||||
|
|
||||||
|
next = $('.pagination .next a', data).attr 'href'
|
||||||
|
if next?
|
||||||
|
$(this).attr('href', next).parents('.pagination').show()
|
||||||
|
|
||||||
|
# Clicking on a table.list row
|
||||||
|
visit = (elt) =>
|
||||||
|
elt.closest('tr').click -> Turbolinks.visit elt.attr 'href'
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
# Automatic ajax pagination
|
|
||||||
$(document).on 'turbolinks:load', ->
|
|
||||||
$('.pagination .next a').attr('data-remote', true).each ->
|
|
||||||
# Go to the next page when page is scrolled
|
|
||||||
$(document).scroll =>
|
|
||||||
if $(this).visible true, true
|
|
||||||
# "Next" link is also hidden while pagination is done
|
|
||||||
$(this).click().parents('.pagination').hide()
|
|
||||||
|
|
||||||
$(document).on 'ajax:success', '.pagination .next a', (event, data) ->
|
|
||||||
$(this).parents('tfoot').prev().append $('tbody tr', data)
|
|
||||||
|
|
||||||
next = $('.pagination .next a', data).attr 'href'
|
|
||||||
if next?
|
|
||||||
$(this).attr('href', next).parents('.pagination').show()
|
|
@ -23,6 +23,11 @@ table
|
|||||||
&.kind, &.updated_at
|
&.kind, &.updated_at
|
||||||
text-align: center
|
text-align: center
|
||||||
|
|
||||||
|
html.js table.list tbody tr
|
||||||
|
cursor: pointer
|
||||||
|
&:hover
|
||||||
|
background-color: lightgrey
|
||||||
|
|
||||||
dl
|
dl
|
||||||
dt
|
dt
|
||||||
clear: left
|
clear: left
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
%em.fa.fa-tags
|
%em.fa.fa-tags
|
||||||
- elsif orga.tags.count.positive?
|
- elsif orga.tags.count.positive?
|
||||||
%em.fa.fa-tag
|
%em.fa.fa-tag
|
||||||
%td.view{ title: t('.view') }
|
%td.view
|
||||||
= link_to orga_path orga, q: params[:q].permit, page: params[:page] do
|
= link_to orga_path orga, q: params[:q].permit, page: params[:page] do
|
||||||
%em.fa.fa-arrow-circle-right
|
%em.fa.fa-arrow-circle-right
|
||||||
|
|
||||||
|
@ -47,11 +47,11 @@
|
|||||||
%td= object
|
%td= object
|
||||||
%td.changes= changes
|
%td.changes= changes
|
||||||
%td= l version.created_at, format: :short
|
%td= l version.created_at, format: :short
|
||||||
%td
|
%td.view
|
||||||
- unless version.event == 'destroy'
|
- unless version.event == 'destroy'
|
||||||
%a{ href: polymorphic_path(version.item_type.tableize.singularize,
|
%a{ href: polymorphic_path(version.item_type.tableize.singularize,
|
||||||
id: version.item_id) }
|
id: version.item_id) }
|
||||||
%em.fa.fa-eye
|
%em.fa.fa-arrow-circle-right
|
||||||
|
|
||||||
%tfoot
|
%tfoot
|
||||||
%tr
|
%tr
|
||||||
|
Loading…
Reference in New Issue
Block a user