Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use datatables on collection notes list for #3776 #3777

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/controllers/deed_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ def list
end

@deeds = @deed.order('deeds.created_at DESC').paginate :page => params[:page], :per_page => PAGES_PER_SCREEN
@paginate = true
end

def notes
if @collection
@deeds = @collection.deeds.where(deed_type: DeedType::NOTE_ADDED).order('deeds.created_at DESC').includes(:note, :page, :user, :work, :collection).paginate :page => params[:page], :per_page => PAGES_PER_SCREEN
@deeds = @collection.deeds.where(deed_type: DeedType::NOTE_ADDED).order('deeds.created_at DESC').includes(:note, :page, :user, :work, :collection)
@paginate = false
else
@deeds = Deed.where(deed_type: DeedType::NOTE_ADDED).order('deeds.created_at DESC').joins(:collection).includes(:note, :page, :user, :work).where("collections.restricted = 0").paginate :page => params[:page], :per_page => PAGES_PER_SCREEN
@paginate = true
end
render :list
end
Expand Down
41 changes: 23 additions & 18 deletions app/views/deed/list.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,29 @@ table.datagrid.striped#deeds-list
td.nowrap (data-order="#{d.created_at.to_i}")
=time_tag(d.created_at, class: 'small fglight')
=t('.time_ago_in_words', time: time_ago_in_words(d.created_at))
-if @paginate
br
small.legend
=will_paginate @deeds, { :class => 'deed-pager', :page_links => false, :previous_label => t('.newer_activity'), :next_label => t('.older_activity') }
br

-content_for :javascript
javascript:
$(document).ready( function () {
console.log("Hey");
// initialize the works list datatable
$('#deeds-list').DataTable( {
// don't allow sorting on the user icon column
'columnDefs': [ {
'targets': [0],
'orderable': false,
} ],
// Initially sort by recency
"order": [[3, 'desc']]
} );
-else
-content_for :javascript
javascript:
$(document).ready( function () {
// initialize the works list datatable
$('#deeds-list').DataTable( {
// don't allow sorting on the user icon column
'columnDefs': [ {
'targets': [0],
'orderable': false,
} ],
// Initially sort by recency
"order": [[3, 'desc']]
} );

// fix the layout of the pagination controls
$('select[name="deeds-list_length"]').parent().before('Show ');
$('select[name="deeds-list_length"]').parent().after(' entries');
// fix the layout of the pagination controls
$('select[name="deeds-list_length"]').parent().before('Show ');
$('select[name="deeds-list_length"]').parent().after(' entries');

} );
} );
2 changes: 2 additions & 0 deletions config/locales/deed/deed-de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ de:
activity_stream: Aktivitätenüberblick
collection_title: 'Sammlung: %{title}'
deed: Tat
newer_activity: Neuere Aktivität
older_activity: Ältere Aktivität
owner_title: 'Projektinhaber:in: %{title}'
time: Zeit
time_ago_in_words: Vor %{time}
Expand Down
2 changes: 2 additions & 0 deletions config/locales/deed/deed-en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ en:
activity_stream: Activity Stream
collection_title: 'Collection: %{title}'
deed: Deed
newer_activity: Newer Activity
older_activity: Older Activity
owner_title: 'Owner: %{title}'
time: Time
time_ago_in_words: "%{time} ago"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/deed/deed-es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ es:
activity_stream: Flujo de Actividad
collection_title: 'Colección: %{title}'
deed: Escritura
newer_activity: Actividad más reciente
older_activity: Actividad anterior
owner_title: 'Propietario: %{title}'
time: Tiempo
time_ago_in_words: Hace %{time}
Expand Down
2 changes: 2 additions & 0 deletions config/locales/deed/deed-fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ fr:
activity_stream: Flux d'activité
collection_title: 'Collection : %{title}'
deed: Acte
newer_activity: Activité plus récente
older_activity: Activité plus ancienne
owner_title: 'Propriétaire : %{title}'
time: Temps
time_ago_in_words: Il y a %{time}
Expand Down
2 changes: 2 additions & 0 deletions config/locales/deed/deed-pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pt:
activity_stream: Fluxo de Atividade
collection_title: 'Coleção: %{title}'
deed: Obra
newer_activity: Atividade mais recente
older_activity: Atividade mais antiga
owner_title: 'Proprietário: %{title}'
time: Tempo
time_ago_in_words: Há %{time}
Expand Down