From 1d3efeb7a50c20c67933a6633dfaf9b3ee1cf476 Mon Sep 17 00:00:00 2001 From: Alex Kalderimis <alex.kalderimis@gmail.com> Date: Thu, 27 Feb 2020 15:20:54 +1300 Subject: [PATCH] Support display of wiki events This updates templates and views to support wiki events --- app/helpers/events_helper.rb | 15 +++++++++++++++ app/views/events/_event.html.haml | 4 +++- app/views/events/event/_wiki.html.haml | 10 ++++++++++ app/views/shared/_event_filter.html.haml | 2 ++ ...526-be-wiki-activity-on-project-group-user.yml | 5 +++++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 app/views/events/event/_wiki.html.haml create mode 100644 changelogs/unreleased/30526-be-wiki-activity-on-project-group-user.yml diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 09866ca75ff4..f0fd042408d6 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -70,6 +70,8 @@ def comments_visible? def event_preposition(event) if event.push_action? || event.commented_action? || event.target "at" + elsif event.wiki_page? + _("Events|in the wiki for") elsif event.milestone? "in" end @@ -172,6 +174,19 @@ def event_note_target_url(event) end end + def event_wiki_title_html(event) + capture do + concat content_tag(:span, _('wiki page'), class: "event-target-type append-right-4") + concat link_to(event.wiki_page_title, event_wiki_page_target_url(event), + title: event.target_title, + class: 'has-tooltip event-target-link append-right-4') + end + end + + def event_wiki_page_target_url(event) + project_wiki_url(event.project, event.wiki_page_title) + end + def event_note_title_html(event) if event.note_target capture do diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index 647f0597adb1..c042cd2c3e3e 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -5,7 +5,9 @@ .event-item-timestamp #{time_ago_with_tooltip(event.created_at)} - - if event.created_project_action? + - if event.wiki_page? + = render "events/event/wiki", event: event + - elsif event.created_project_action? = render "events/event/created_project", event: event - elsif event.push_action? = render "events/event/push", event: event diff --git a/app/views/events/event/_wiki.html.haml b/app/views/events/event/_wiki.html.haml new file mode 100644 index 000000000000..7ca982945218 --- /dev/null +++ b/app/views/events/event/_wiki.html.haml @@ -0,0 +1,10 @@ += icon_for_profile_event(event) + += event_user_info(event) + +.event-title.d-flex.flex-wrap + = inline_event_icon(event) + %span.event-type.d-inline-block.append-right-4{ class: event.action_name } + = event.action_name + = event_wiki_title_html(event) + = render "events/event_scope", event: event diff --git a/app/views/shared/_event_filter.html.haml b/app/views/shared/_event_filter.html.haml index ad9eb325ff0f..e88c6e0c1f74 100644 --- a/app/views/shared/_event_filter.html.haml +++ b/app/views/shared/_event_filter.html.haml @@ -15,4 +15,6 @@ = render_if_exists 'events/epics_filter' - if comments_visible? = event_filter_link EventFilter::COMMENTS, _('Comments'), s_('EventFilterBy|Filter by comments') + - if @project.nil? || @project.has_wiki? + = event_filter_link EventFilter::WIKI, _('Wiki'), s_('EventFilterBy|Filter by wiki') = event_filter_link EventFilter::TEAM, _('Team'), s_('EventFilterBy|Filter by team') diff --git a/changelogs/unreleased/30526-be-wiki-activity-on-project-group-user.yml b/changelogs/unreleased/30526-be-wiki-activity-on-project-group-user.yml new file mode 100644 index 000000000000..022fd8efb77c --- /dev/null +++ b/changelogs/unreleased/30526-be-wiki-activity-on-project-group-user.yml @@ -0,0 +1,5 @@ +--- +title: Support wiki events in activity streams +merge_request: 23869 +author: +type: changed -- GitLab