-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ne montrer que les 3 plus récentes resources historisées (#3358)
* fold resource history * move resource history to own template * mix format --------- Co-authored-by: Antoine Augusti <[email protected]>
- Loading branch information
1 parent
4a869b4
commit 3814dbb
Showing
5 changed files
with
79 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
apps/transport/lib/transport_web/templates/dataset/_dataset_resources_history.html.heex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<% has_validity_period_col = has_validity_period?(@history_resources) %> | ||
<section class="white pt-48" id="backed-up-resources"> | ||
<h3><%= dgettext("page-dataset-details", "Backed up resources") %></h3> | ||
<div class="panel"> | ||
<div id="backed-up-resources-see-more-wrapper"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th><%= dgettext("page-dataset-details", "File") %></th> | ||
<th><%= dgettext("page-dataset-details", "Publication date") %></th> | ||
<%= if has_validity_period_col do %> | ||
<th> | ||
<%= dgettext("page-dataset-details", "Validity period") %> | ||
</th> | ||
<% end %> | ||
<th><%= dgettext("page-dataset-details", "Format") %></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= for resource_history <- @history_resources do %> | ||
<tr> | ||
<td> | ||
<%= link(resource_history.payload["title"], | ||
to: resource_history.payload["permanent_url"], | ||
rel: "nofollow" | ||
) %> | ||
</td> | ||
<td><%= resource_history.inserted_at |> DateTimeDisplay.format_datetime_to_date(@locale) %></td> | ||
<%= if has_validity_period_col do %> | ||
<%= if has_validity_period?(resource_history) do %> | ||
<td> | ||
<%= dgettext( | ||
"page-dataset-details", | ||
"%{start} to %{end}", | ||
start: | ||
resource_history | ||
|> validity_period() | ||
|> Map.get("start_date") | ||
|> DateTimeDisplay.format_date(@locale), | ||
end: | ||
resource_history | ||
|> validity_period() | ||
|> Map.get("end_date") | ||
|> DateTimeDisplay.format_date(@locale) | ||
) %> | ||
</td> | ||
<% else %> | ||
<td></td> | ||
<% end %> | ||
<% end %> | ||
<td><span class="label"><%= resource_history.payload["format"] %></span></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
<%= if Enum.count(@history_resources) == max_nb_history_resources() do %> | ||
<p class="small"> | ||
<%= dgettext("page-dataset-details", "Displaying the last %{nb} backed up resources.", | ||
nb: max_nb_history_resources() | ||
) %> | ||
</p> | ||
<% end %> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<script> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
addSeeMore("280px", | ||
"#backed-up-resources-see-more-wrapper", | ||
"<%= dgettext("page-dataset-details", "Display more") %>", | ||
"<%= dgettext("page-dataset-details", "Display less") %>" | ||
) | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters