Rename tags to topics

- Rename CSS class
- Fix broken test
- Update project settings docs
- Update general project settings image
- Rename helper methods
This commit is contained in:
Martin Wortschack 2019-01-10 21:08:41 +01:00
parent 4aaea7b3c7
commit f5cde3a781
8 changed files with 26 additions and 20 deletions

View File

@ -219,7 +219,7 @@
color: $gl-text-color-secondary;
}
.project-tag-list {
.project-topic-list {
font-size: $gl-font-size;
font-weight: $gl-font-weight-normal;
@ -251,7 +251,7 @@
line-height: $gl-font-size-large;
}
.project-tag-list,
.project-topic-list,
.project-metadata {
font-size: $gl-font-size-small;
}
@ -273,7 +273,7 @@
}
.access-request-link,
.project-tag-list {
.project-topic-list {
padding-left: $gl-padding-8;
border-left: 1px solid $gl-text-color-secondary;
}

View File

@ -13,7 +13,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
presents :project
AnchorData = Struct.new(:is_link, :label, :link, :class_modifier, :icon)
MAX_TAGS_TO_SHOW = 3
MAX_TOPICS_TO_SHOW = 3
def statistic_icon(icon_name = 'plus-square-o')
sprite_icon(icon_name, size: 16, css_class: 'icon append-right-4')
@ -310,20 +310,20 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
end
end
def tags_to_show
project.tag_list.take(MAX_TAGS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord
def topics_to_show
project.tag_list.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord
end
def count_of_extra_tags_not_shown
if project.tag_list.count > MAX_TAGS_TO_SHOW
project.tag_list.count - MAX_TAGS_TO_SHOW
def count_of_extra_topics_not_shown
if project.tag_list.count > MAX_TOPICS_TO_SHOW
project.tag_list.count - MAX_TOPICS_TO_SHOW
else
0
end
end
def has_extra_tags?
count_of_extra_tags_not_shown > 0
def has_extra_topics?
count_of_extra_topics_not_shown > 0
end
private

View File

@ -19,12 +19,13 @@
%span.access-request-links.prepend-left-8
= render 'shared/members/access_request_links', source: @project
- if @project.tag_list.present?
%span.project-tag-list.d-inline-flex.prepend-left-8.has-tooltip{ data: { container: 'body' }, title: @project.has_extra_tags? ? @project.tag_list.join(', ') : nil }
%span.project-topic-list.d-inline-flex.prepend-left-8.has-tooltip{ data: { container: 'body' }, title: @project.has_extra_topics? ? @project.tag_list.join(', ') : nil }
= sprite_icon('tag', size: 16, css_class: 'icon append-right-4')
= @project.tags_to_show
- if @project.has_extra_tags?
= @project.topics_to_show
- if @project.has_extra_topics?
= _("+ %{count} more") % { count: @project.count_of_extra_tags_not_shown }
.project-repo-buttons.col-md-12.col-lg-6.d-inline-flex.flex-wrap.justify-content-lg-end
- if current_user
.d-inline-flex

View File

@ -39,9 +39,9 @@
= render_if_exists 'shared/repository_size_limit_setting', form: f, type: :project
.form-group
= f.label :tag_list, "Tags", class: 'label-bold'
= f.label :tag_list, "Topics", class: 'label-bold'
= f.text_field :tag_list, value: @project.tag_list.join(', '), maxlength: 2000, class: "form-control"
%p.form-text.text-muted Separate tags with commas.
%p.form-text.text-muted Separate topics with commas.
%fieldset.features
%h5.prepend-top-0= _("Project avatar")
.form-group

View File

@ -0,0 +1,5 @@
---
title: Rename project tags to project topics
merge_request: 24219
author:
type: other

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

@ -14,7 +14,7 @@ functionality of a project.
### General project settings
Adjust your project's name, description, avatar, [default branch](../repository/branches/index.md#default-branch), and tags:
Adjust your project's name, description, avatar, [default branch](../repository/branches/index.md#default-branch), and topics:
![general project settings](img/general_settings.png)

View File

@ -9,13 +9,13 @@ describe 'Projects > Settings > User tags a project' do
visit edit_project_path(project)
end
it 'sets project tags' do
fill_in 'Tags', with: 'tag1, tag2'
it 'sets project topics' do
fill_in 'Topics', with: 'topic1, topic2'
page.within '.general-settings' do
click_button 'Save changes'
end
expect(find_field('Tags').value).to eq 'tag1, tag2'
expect(find_field('Topics').value).to eq 'topic1, topic2'
end
end