-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rangement des données statiques (#2344)
* Rangement * raw date * meta -> core * clean * clean * clean * forced_title * clean * fix * fix --------- Co-authored-by: Sébastien Gaya <sebastien.gaya@gmail.com>
- Loading branch information
1 parent
335580e
commit 16659fc
Showing
30 changed files
with
151 additions
and
213 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
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,69 @@ | ||
<% | ||
# Partial arguments | ||
forced_title ||= nil | ||
forced_slug ||= nil | ||
skip_date ||= false | ||
# Preparing variables | ||
title = forced_title || about.to_s | ||
show_subtitle = about.respond_to?(:subtitle) | ||
show_date = about.respond_to?(:published_at) && !skip_date | ||
show_published_at = about.respond_to?(:published_at) | ||
if about.respond_to?(:slug) && about.slug.present? | ||
slug = forced_slug || about.slug | ||
end | ||
if @website | ||
previous_permalinks = about.previous_permalinks_in_website(@website) | ||
hugo = about.hugo(@website) if about.respond_to?(:hugo) | ||
end | ||
%> | ||
<% | ||
############# | ||
# Title and subtitle | ||
############# | ||
%> | ||
title: >- | ||
<%= prepare_text_for_static title %> | ||
<% if show_subtitle %> | ||
subtitle: >- | ||
<%= prepare_text_for_static about.subtitle %> | ||
<% end %> | ||
<% | ||
############# | ||
# Permalinks | ||
############# | ||
%> | ||
<% if @website %> | ||
url: "<%= about.current_permalink_in_website(@website)&.path %>" | ||
<% if slug %> | ||
slug: "<%= slug %>" | ||
<% end %> | ||
<% if previous_permalinks.any? %> | ||
aliases: | ||
<% previous_permalinks.each do |permalink| %> | ||
- <%= permalink.path %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% | ||
############# | ||
# Dates & meta | ||
############# | ||
%> | ||
<% if show_date %> | ||
date: <%= about.published_at&.iso8601 %> | ||
<% end %> | ||
lastmod: <%= about.updated_at&.iso8601 %> | ||
meta: | ||
<% if hugo %> | ||
hugo: | ||
permalink: "<%= hugo.permalink %>" | ||
file: "<%= hugo.file %>" | ||
path: "<%= hugo.path %>" | ||
slug: "<%= hugo.slug %>" | ||
<% end %> | ||
dates: | ||
created_at: <%= about.created_at&.iso8601 %> | ||
updated_at: <%= about.updated_at&.iso8601 %> | ||
<% if show_published_at %> | ||
published_at: <%= about.published_at&.iso8601 %> | ||
<% end %> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
app/views/admin/application/static/_permalink.json.jbuilder
This file was deleted.
Oops, something went wrong.
4 changes: 1 addition & 3 deletions
4
app/views/admin/communication/websites/agenda/categories/static.html.erb
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
63 changes: 35 additions & 28 deletions
63
app/views/admin/communication/websites/agenda/events/static/_dates.html.erb
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 |
---|---|---|
@@ -1,33 +1,40 @@ | ||
<% | ||
depth ||= 0 | ||
indentation = ' ' * depth | ||
%> | ||
<%= indentation %>dates: | ||
<%= indentation %> status: "<%= event.status %>" | ||
<%= indentation %> archive: <%= event.archive? %> | ||
<%= indentation %> computed: | ||
<%= indentation %> short: >- | ||
<%= indentation %> <%= date_range_i18n(event.from_day, event.to_day, format: :short, locale: locale) %> | ||
<%= indentation %> long: >- | ||
<%= indentation %> <%= date_range_i18n(event.from_day, event.to_day, format: :long, locale: locale) %> | ||
<%= indentation %> two_lines: | ||
<%= indentation %> short: >- | ||
<%= indentation %> <%= date_range_i18n(event.from_day, event.to_day, format: :short, layout: :two_lines, locale: locale) %> | ||
<%= indentation %> long: >- | ||
<%= indentation %> <%= date_range_i18n(event.from_day, event.to_day, format: :long, layout: :two_lines, locale: locale) %> | ||
<%= indentation %> from: | ||
<%= indentation %> day: <%= event.from_day %> | ||
# Dates override default dates in core, so it comes after | ||
# https://github.com/osunyorg/admin/issues/1880 | ||
if event.archive? %> | ||
date: "<%= event.from_day&.iso8601 %>" | ||
<% elsif event.current? %> | ||
weight: -1 | ||
date: "<%= event.from_day&.iso8601 %>" | ||
<% else %> | ||
weight: <%= event.distance_in_days %> | ||
<% end %> | ||
dates: | ||
status: "<%= event.status %>" | ||
archive: <%= event.archive? %> | ||
computed: | ||
short: >- | ||
<%= date_range_i18n(event.from_day, event.to_day, format: :short, locale: locale) %> | ||
long: >- | ||
<%= date_range_i18n(event.from_day, event.to_day, format: :long, locale: locale) %> | ||
two_lines: | ||
short: >- | ||
<%= date_range_i18n(event.from_day, event.to_day, format: :short, layout: :two_lines, locale: locale) %> | ||
long: >- | ||
<%= date_range_i18n(event.from_day, event.to_day, format: :long, layout: :two_lines, locale: locale) %> | ||
from: | ||
day: <%= event.from_day %> | ||
<% if event.from_hour %> | ||
<%= indentation %> hour: <%= event.from_hour.strftime "%H:%M" %> | ||
hour: <%= event.from_hour.strftime "%H:%M" %> | ||
<% end %> | ||
<%= indentation %> to: | ||
<%= indentation %> day: <%= event.to_day || event.from_day %> | ||
to: | ||
day: <%= event.to_day || event.from_day %> | ||
<% if event.to_hour %> | ||
<%= indentation %> hour: <%= event.to_hour.strftime "%H:%M" %> | ||
hour: <%= event.to_hour.strftime "%H:%M" %> | ||
<% end %> | ||
<%= indentation %> add_to_calendar: | ||
<%= indentation %> google: "<%= l10n.cal_google_url.html_safe %>" | ||
<%= indentation %> yahoo: "<%= l10n.cal_yahoo_url.html_safe %>" | ||
<%= indentation %> office: "<%= l10n.cal_office_url.html_safe %>" | ||
<%= indentation %> outlook: "<%= l10n.cal_outlook_url.html_safe %>" | ||
<%= indentation %> ical: "<%= l10n.cal_ical_url.html_safe %>" | ||
add_to_calendar: | ||
google: "<%= l10n.cal_google_url.html_safe %>" | ||
yahoo: "<%= l10n.cal_yahoo_url.html_safe %>" | ||
office: "<%= l10n.cal_office_url.html_safe %>" | ||
outlook: "<%= l10n.cal_outlook_url.html_safe %>" | ||
ical: "<%= l10n.cal_ical_url.html_safe %>" |
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
30 changes: 0 additions & 30 deletions
30
app/views/admin/communication/websites/pages/static.json.jbuilder
This file was deleted.
Oops, something went wrong.
4 changes: 1 addition & 3 deletions
4
app/views/admin/communication/websites/portfolio/categories/static.html.erb
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
5 changes: 1 addition & 4 deletions
5
app/views/admin/communication/websites/posts/categories/static.html.erb
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
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
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
Oops, something went wrong.