Commit 5c4d0589 authored by Dennis Tang's avatar Dennis Tang Committed by Fatih Acet

Resolve "Empty states for profile page"

parent 591380a3
...@@ -25,4 +25,8 @@ module ProfilesHelper ...@@ -25,4 +25,8 @@ module ProfilesHelper
end end
end end
end end
def user_profile?
params[:controller] == 'users'
end
end end
- illustration_path = 'illustrations/profile-page/activity.svg'
- current_user_empty_message_header = s_('UserProfile|Join or create a group to start contributing by commenting on issues or submitting merge requests!')
- primary_button_label = _('New group')
- primary_button_link = new_group_path
- secondary_button_label = _('Explore groups')
- secondary_button_link = explore_groups_path
- visitor_empty_message = _('No activities found')
- if @events.present? - if @events.present?
= render partial: 'events/event', collection: @events = render partial: 'events/event', collection: @events
- else - else
.nothing-here-block= _("No activities found") = render partial: 'shared/empty_states/profile_tabs', locals: { illustration_path: illustration_path,
current_user_empty_message_header: current_user_empty_message_header,
primary_button_label: primary_button_label,
primary_button_link: primary_button_link,
secondary_button_label: secondary_button_label,
secondary_button_link: secondary_button_link,
visitor_empty_message: visitor_empty_message }
- current_user_empty_message_description = local_assigns.fetch(:current_user_empty_message_description, nil)
- secondary_button_link = local_assigns.fetch(:secondary_button_link, nil)
.nothing-here-block
.svg-content
= image_tag illustration_path, size: '75'
.text-content
- if user_profile? and current_user.present? and current_user.username == params[:username]
%h5= current_user_empty_message_header
- if current_user_empty_message_description.present?
%p= current_user_empty_message_description
- if secondary_button_link.present?
= link_to secondary_button_label, secondary_button_link, class: 'btn btn-create btn-inverted'
= link_to primary_button_label, primary_button_link, class: 'btn btn-success'
- else
%h5= visitor_empty_message
- illustration_path = 'illustrations/profile-page/groups.svg'
- current_user_empty_message_header = s_('UserProfile|You can create a group for several dependent projects.')
- current_user_empty_message_description = s_('UserProfile|Groups are the best way to manage projects and members.')
- primary_button_label = _('New group')
- primary_button_link = new_group_path
- visitor_empty_message = s_('GroupsEmptyState|No groups found')
- if groups.any? - if groups.any?
- user = local_assigns[:user] - user = local_assigns[:user]
...@@ -5,4 +12,9 @@ ...@@ -5,4 +12,9 @@
- groups.each_with_index do |group, i| - groups.each_with_index do |group, i|
= render "shared/groups/group", group: group, user: user = render "shared/groups/group", group: group, user: user
- else - else
.nothing-here-block= s_("GroupsEmptyState|No groups found") = render partial: 'shared/empty_states/profile_tabs', locals: { illustration_path: illustration_path,
current_user_empty_message_header: current_user_empty_message_header,
current_user_empty_message_description: current_user_empty_message_description,
primary_button_label: primary_button_label,
primary_button_link: primary_button_link,
visitor_empty_message: visitor_empty_message }
...@@ -14,6 +14,17 @@ ...@@ -14,6 +14,17 @@
- skip_pagination = false unless local_assigns[:skip_pagination] == true - skip_pagination = false unless local_assigns[:skip_pagination] == true
- compact_mode = false unless local_assigns[:compact_mode] == true - compact_mode = false unless local_assigns[:compact_mode] == true
- css_classes = "#{'compact' if compact_mode} #{'explore' if explore_projects_tab?}" - css_classes = "#{'compact' if compact_mode} #{'explore' if explore_projects_tab?}"
- contributed_projects_illustration_path = 'illustrations/profile-page/contributed-projects.svg'
- contributed_projects_current_user_empty_message_header = s_('UserProfile|Explore public groups to find projects to contribute to.')
- contributed_projects_visitor_empty_message = s_('UserProfile|This user hasn\'t contributed to any projects')
- own_projects_illustration_path = 'illustrations/profile-page/personal-project.svg'
- own_projects_current_user_empty_message_header = s_('UserProfile|You haven\'t created any personal projects.')
- own_projects_current_user_empty_message_description = s_('UserProfile|Your projects can be available publicly, internally, or privately, at your choice.')
- own_projects_visitor_empty_message = s_('UserProfile|This user doesn\'t have any personal projects')
- primary_button_label = _('New project')
- primary_button_link = new_project_path
- secondary_button_label = _('Explore groups')
- secondary_button_link = explore_groups_path
.js-projects-list-holder .js-projects-list-holder
- if any_projects?(projects) - if any_projects?(projects)
...@@ -33,9 +44,18 @@ ...@@ -33,9 +44,18 @@
%span  you have no access to. %span  you have no access to.
= paginate_collection(projects, remote: remote) unless skip_pagination = paginate_collection(projects, remote: remote) unless skip_pagination
- else - else
.nothing-here-block - if @contributed_projects
.svg-content.svg-130 = render partial: 'shared/empty_states/profile_tabs', locals: { illustration_path: contributed_projects_illustration_path,
= image_tag 'illustrations/profile-page/personal-project.svg' current_user_empty_message_header: contributed_projects_current_user_empty_message_header,
%div primary_button_label: primary_button_label,
%span primary_button_link: primary_button_link,
= s_('UserProfile|This user doesn\'t have any personal projects') secondary_button_label: secondary_button_label,
secondary_button_link: secondary_button_link,
visitor_empty_message: contributed_projects_visitor_empty_message }
- else
= render partial: 'shared/empty_states/profile_tabs', locals: { illustration_path: own_projects_illustration_path,
current_user_empty_message_header: own_projects_current_user_empty_message_header,
current_user_empty_message_description: own_projects_current_user_empty_message_description,
primary_button_label: primary_button_label,
primary_button_link: primary_button_link,
visitor_empty_message: own_projects_visitor_empty_message }
- link_project = local_assigns.fetch(:link_project, false) - link_project = local_assigns.fetch(:link_project, false)
- illustration_path = 'illustrations/profile-page/activity.svg'
- current_user_empty_message_header = s_('UserProfile|You haven\'t created any snippets.')
- current_user_empty_message_description = s_('UserProfile|Snippets in GitLab can either be private, internal, or public.')
- primary_button_label = _('New snippet')
- primary_button_link = new_snippet_path
- visitor_empty_message = s_('UserProfile|No snippets found.')
.snippets-list-holder .snippets-list-holder
%ul.content-list %ul.content-list
= render partial: 'shared/snippets/snippet', collection: @snippets, locals: { link_project: link_project } = render partial: 'shared/snippets/snippet', collection: @snippets, locals: { link_project: link_project }
- if @snippets.empty? - if @snippets.empty?
%li %li
.nothing-here-block= _("Nothing here.") = render partial: 'shared/empty_states/profile_tabs', locals: { illustration_path: illustration_path,
current_user_empty_message_header: current_user_empty_message_header,
current_user_empty_message_description: current_user_empty_message_description,
primary_button_label: primary_button_label,
primary_button_link: primary_button_link,
visitor_empty_message: visitor_empty_message }
= paginate @snippets, theme: 'gitlab' = paginate @snippets, theme: 'gitlab'
---
title: Refresh empty states for profile page tabs
merge_request: 24549
author:
type: changed
...@@ -4836,9 +4836,6 @@ msgstr "" ...@@ -4836,9 +4836,6 @@ msgstr ""
msgid "Notes|Show history only" msgid "Notes|Show history only"
msgstr "" msgstr ""
msgid "Nothing here."
msgstr ""
msgid "Notification events" msgid "Notification events"
msgstr "" msgstr ""
...@@ -7833,12 +7830,24 @@ msgstr "" ...@@ -7833,12 +7830,24 @@ msgstr ""
msgid "UserProfile|Edit profile" msgid "UserProfile|Edit profile"
msgstr "" msgstr ""
msgid "UserProfile|Explore public groups to find projects to contribute to."
msgstr ""
msgid "UserProfile|Groups" msgid "UserProfile|Groups"
msgstr "" msgstr ""
msgid "UserProfile|Groups are the best way to manage projects and members."
msgstr ""
msgid "UserProfile|Join or create a group to start contributing by commenting on issues or submitting merge requests!"
msgstr ""
msgid "UserProfile|Most Recent Activity" msgid "UserProfile|Most Recent Activity"
msgstr "" msgstr ""
msgid "UserProfile|No snippets found."
msgstr ""
msgid "UserProfile|Overview" msgid "UserProfile|Overview"
msgstr "" msgstr ""
...@@ -7851,6 +7860,9 @@ msgstr "" ...@@ -7851,6 +7860,9 @@ msgstr ""
msgid "UserProfile|Snippets" msgid "UserProfile|Snippets"
msgstr "" msgstr ""
msgid "UserProfile|Snippets in GitLab can either be private, internal, or public."
msgstr ""
msgid "UserProfile|Subscribe" msgid "UserProfile|Subscribe"
msgstr "" msgstr ""
...@@ -7860,12 +7872,27 @@ msgstr "" ...@@ -7860,12 +7872,27 @@ msgstr ""
msgid "UserProfile|This user has a private profile" msgid "UserProfile|This user has a private profile"
msgstr "" msgstr ""
msgid "UserProfile|This user hasn't contributed to any projects"
msgstr ""
msgid "UserProfile|View all" msgid "UserProfile|View all"
msgstr "" msgstr ""
msgid "UserProfile|View user in admin area" msgid "UserProfile|View user in admin area"
msgstr "" msgstr ""
msgid "UserProfile|You can create a group for several dependent projects."
msgstr ""
msgid "UserProfile|You haven't created any personal projects."
msgstr ""
msgid "UserProfile|You haven't created any snippets."
msgstr ""
msgid "UserProfile|Your projects can be available publicly, internally, or privately, at your choice."
msgstr ""
msgid "Users" msgid "Users"
msgstr "" msgstr ""
......
...@@ -34,7 +34,7 @@ describe 'Overview tab on a user profile', :js do ...@@ -34,7 +34,7 @@ describe 'Overview tab on a user profile', :js do
it 'does not show any entries in the list of activities' do it 'does not show any entries in the list of activities' do
page.within('.activities-block') do page.within('.activities-block') do
expect(page).to have_selector('.loading', visible: false) expect(page).to have_selector('.loading', visible: false)
expect(page).to have_content('No activities found') expect(page).to have_content('Join or create a group to start contributing by commenting on issues or submitting merge requests!')
expect(page).not_to have_selector('.event-item') expect(page).not_to have_selector('.event-item')
end end
end end
...@@ -96,7 +96,7 @@ describe 'Overview tab on a user profile', :js do ...@@ -96,7 +96,7 @@ describe 'Overview tab on a user profile', :js do
it 'it shows an empty project list with an info message' do it 'it shows an empty project list with an info message' do
page.within('.projects-block') do page.within('.projects-block') do
expect(page).to have_selector('.loading', visible: false) expect(page).to have_selector('.loading', visible: false)
expect(page).to have_content('This user doesn\'t have any personal projects') expect(page).to have_content('You haven\'t created any personal projects.')
expect(page).not_to have_selector('.project-row') expect(page).not_to have_selector('.project-row')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment