Add effective date to terms of service (#33993)

This commit is contained in:
Eugen Rochko 2025-03-05 10:01:33 +01:00 committed by GitHub
parent 84164270c6
commit cadda2f957
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
67 changed files with 201 additions and 126 deletions

View file

@ -14,6 +14,9 @@
.fields-group
= form.input :changelog, wrapper: :with_block_label, input_html: { rows: 8 }
.fields-group
= form.input :effective_date, wrapper: :with_block_label, as: :date, start_year: Time.zone.today.year
.actions
= form.button :button, t('admin.terms_of_service.save_draft'), type: :submit, name: :action_type, value: :save_draft, class: 'button button-secondary'
= form.button :button, t('admin.terms_of_service.publish'), type: :submit, name: :action_type, value: :publish

View file

@ -12,5 +12,9 @@
- @terms_of_service.each do |terms_of_service|
%li
.admin__terms-of-service__history__item
%h5= l(terms_of_service.published_at)
%h5
- if terms_of_service.effective_date.present?
= link_to l(terms_of_service.published_at), terms_of_service_version_path(date: terms_of_service.effective_date)
- else
= l(terms_of_service.published_at)
.prose= markdown(terms_of_service.changelog)

View file

@ -10,7 +10,11 @@
.admin__terms-of-service__container__header
.dot-indicator.success
.dot-indicator__indicator
%span= t('admin.terms_of_service.live')
%span
- if @terms_of_service.effective?
= t('admin.terms_of_service.live')
- else
= t('admin.terms_of_service.going_live_on_html', date: tag.time(l(@terms_of_service.effective_date), class: 'formatted', date: @terms_of_service.effective_date.iso8601))
·
%span
= t('admin.terms_of_service.published_on_html', date: tag.time(l(@terms_of_service.published_at.to_date), class: 'formatted', date: @terms_of_service.published_at.to_date.iso8601))