-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14259 from opf/fix/meeting-punctutation
Render dots in meeting subheader
- Loading branch information
Showing
6 changed files
with
111 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# frozen_string_literal: true | ||
|
||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2012-2023 the OpenProject GmbH | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License version 3. | ||
# | ||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
# Copyright (C) 2006-2013 Jean-Philippe Lang | ||
# Copyright (C) 2010-2013 the ChiliProject Team | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
# See COPYRIGHT and LICENSE files for more details. | ||
#++ | ||
# | ||
module OpPrimer | ||
class RelativeTimeComponent < Primer::Component | ||
def initialize(datetime:, **system_arguments) | ||
super() | ||
@system_arguments = deny_tag_argument(**system_arguments) | ||
|
||
@system_arguments[:datetime] = datetime | ||
@system_arguments[:lang] ||= I18n.locale | ||
@system_arguments[:prefix] ||= I18n.t(:label_on) | ||
end | ||
|
||
def call | ||
render(Primer::Beta::RelativeTime.new(**@system_arguments)) | ||
end | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
lookbook/previews/op_primer/relative_time_component_preview.rb
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,13 @@ | ||
module OpPrimer | ||
class RelativeTimeComponentPreview < Lookbook::Preview | ||
def default(datetime: (Time.now - 123456.seconds)) | ||
render OpPrimer::RelativeTimeComponent.new(datetime:) | ||
end | ||
|
||
def german_locale(datetime: Time.parse('2023-10-25T09:06:03Z')) | ||
I18n.with_locale(:de) do | ||
render OpPrimer::RelativeTimeComponent.new(datetime:) | ||
end | ||
end | ||
end | ||
end |
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
7 changes: 7 additions & 0 deletions
7
modules/meeting/app/components/meetings/header_infoline_component.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<%= render(Primer::BaseComponent.new(tag: :div, color: :subtle, font_size: :small)) do %> | ||
<%= t("label_meeting_created_by") %> | ||
<%= render(Primer::Beta::Link.new(href: user_path(@meeting.author), underline: false, | ||
target: "_blank")) { @meeting.author.name } %>. | ||
<%= t("label_meeting_last_updated") %> | ||
<%= render(OpPrimer::RelativeTimeComponent.new(font_size: :small, datetime: last_updated_at, prefix: I18n.t(:label_on))) %>. | ||
<% end %> |
43 changes: 43 additions & 0 deletions
43
modules/meeting/app/components/meetings/header_infoline_component.rb
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,43 @@ | ||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2012-2023 the OpenProject GmbH | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License version 3. | ||
# | ||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
# Copyright (C) 2006-2013 Jean-Philippe Lang | ||
# Copyright (C) 2010-2013 the ChiliProject Team | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
# See COPYRIGHT and LICENSE files for more details. | ||
#++ | ||
|
||
module Meetings | ||
class HeaderInfolineComponent < ApplicationComponent | ||
def initialize(meeting) | ||
super | ||
@meeting = meeting | ||
end | ||
|
||
def last_updated_at | ||
latest_agenda_update = @meeting.agenda_items.maximum(:updated_at) || @meeting.updated_at | ||
latest_meeting_update = @meeting.updated_at | ||
|
||
[latest_agenda_update, latest_meeting_update].max | ||
end | ||
end | ||
end |