- <%= t("views.tags.published", count: tag.taggings_count) %>
-
+ <% @tags.includes([:badge]).each do |tag| %>
+
+
+
+
+ <%= render_tag_link(tag.accessible_name) %>
+
+
<%= t("views.tags.published", count: number_with_delimiter(tag.taggings_count, delimiter: ",")) %>
+
+ <% if tag.short_summary.present? %>
+
<%= sanitize tag.short_summary %>
+ <% end %>
+
<% if tag %>
-
+
+ <% if tag.badge_id && tag.badge %>
+
 %>)
+ <% end %>
<% end %>
-
- <% if tag.badge_id && tag.badge %>
-
 %>)
- <% end %>
<% end %>
diff --git a/config/environments/development.rb b/config/environments/development.rb
index a1532e039..faa7ed4f4 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -151,6 +151,7 @@ Rails.application.configure do
Bullet.add_safelist(type: :unused_eager_loading, class_name: "FeedbackMessage", association: :reporter)
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :reactions)
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Reaction", association: :user)
+ Bullet.add_safelist(type: :unused_eager_loading, class_name: "Tag", association: :badge)
# Check if there are any data update scripts to run during startup
if %w[Console Server DBConsole].any? { |const| Rails.const_defined?(const) } && DataUpdateScript.scripts_to_run?
diff --git a/config/locales/views/tags/en.yml b/config/locales/views/tags/en.yml
index 19f331645..419625359 100644
--- a/config/locales/views/tags/en.yml
+++ b/config/locales/views/tags/en.yml
@@ -8,7 +8,7 @@ en:
og:
description: "%{community} is great!"
heading:
- default: Top tags
+ default: Tags
search_results: Search results for %{q}
search:
aria_labels:
@@ -44,8 +44,8 @@ en:
code: 123
placeholder: "comma separated, space is optional. Example: 1,2,3"
published:
- one: 1 post published
- other: "%{count} posts published"
+ one: 1 post
+ other: "%{count} posts"
sidebar:
about: 'about #%{tag}'
admin: Admin
diff --git a/config/locales/views/tags/fr.yml b/config/locales/views/tags/fr.yml
index 9db0dd21c..c12f5030a 100644
--- a/config/locales/views/tags/fr.yml
+++ b/config/locales/views/tags/fr.yml
@@ -8,7 +8,7 @@ fr:
og:
description: "%{community} est super"
heading:
- default: Sujets les plus utilisées
+ default: Tags
search_results: Search results for %{q}
search:
aria_labels:
@@ -45,8 +45,8 @@ fr:
code: 123
placeholder: "comma separated, space is optional. Example: 1,2,3"
published:
- one: 1 post published
- other: "%{count} posts published"
+ one: 1 post
+ other: "%{count} posts"
sidebar:
about: 'about #%{tag}'
admin: Admin
diff --git a/cypress/e2e/seededFlows/loggedOutFlows/showLoginModal.spec.js b/cypress/e2e/seededFlows/loggedOutFlows/showLoginModal.spec.js
index 1d44c7e01..e4b83c5a9 100644
--- a/cypress/e2e/seededFlows/loggedOutFlows/showLoginModal.spec.js
+++ b/cypress/e2e/seededFlows/loggedOutFlows/showLoginModal.spec.js
@@ -79,7 +79,7 @@ describe('Show log in modal', () => {
it('should show login modal for tag follow button click', () => {
cy.visit('/tags');
- cy.findByRole('heading', { name: 'Top tags' });
+ cy.findByRole('heading', { name: 'Tags' });
cy.get('[data-follow-clicks-initialized]');
verifyLoginModalBehavior(() =>
diff --git a/cypress/e2e/seededFlows/tagsFlows/followTag.spec.js b/cypress/e2e/seededFlows/tagsFlows/followTag.spec.js
index 05855d648..b136cacd0 100644
--- a/cypress/e2e/seededFlows/tagsFlows/followTag.spec.js
+++ b/cypress/e2e/seededFlows/tagsFlows/followTag.spec.js
@@ -6,7 +6,7 @@ describe('Follow tag', () => {
cy.get('@user').then((user) => {
cy.loginAndVisit(user, '/tags').then(() => {
- cy.findByRole('heading', { name: 'Top tags' });
+ cy.findByRole('heading', { name: 'Tags' });
cy.get('[data-follow-clicks-initialized]');
});
});
diff --git a/db/seeds.rb b/db/seeds.rb
index ad67527c7..c02426f1a 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -212,6 +212,24 @@ Users::CreateMascotAccount.call unless Settings::General.mascot_user_id
##############################################################################
+seeder.create_if_none(Badge) do
+ 5.times do
+ Badge.create!(
+ title: "#{Faker::Lorem.word} #{rand(100)}",
+ description: Faker::Lorem.sentence,
+ badge_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open,
+ )
+ end
+
+ users_in_random_order.limit(10).each do |user|
+ user.badge_achievements.create!(
+ badge: Badge.order(Arel.sql("RANDOM()")).limit(1).take,
+ rewarding_context_message_markdown: Faker::Markdown.random,
+ )
+ end
+end
+##############################################################################
+
seeder.create_if_none(Tag) do
tags = %w[beginners career computerscience git go
java javascript linux productivity python security webdev]
@@ -219,9 +237,11 @@ seeder.create_if_none(Tag) do
tags.each do |tag_name|
Tag.create!(
name: tag_name,
+ short_summary: Faker::Lorem.sentence,
bg_color_hex: Faker::Color.hex_color,
text_color_hex: Faker::Color.hex_color,
supported: true,
+ badge: Badge.order(Arel.sql("RANDOM()")).limit(1).take,
)
end
end
@@ -420,25 +440,6 @@ end
##############################################################################
-seeder.create_if_none(Badge) do
- 5.times do
- Badge.create!(
- title: "#{Faker::Lorem.word} #{rand(100)}",
- description: Faker::Lorem.sentence,
- badge_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open,
- )
- end
-
- users_in_random_order.limit(10).each do |user|
- user.badge_achievements.create!(
- badge: Badge.order(Arel.sql("RANDOM()")).limit(1).take,
- rewarding_context_message_markdown: Faker::Markdown.random,
- )
- end
-end
-
-##############################################################################
-
seeder.create_if_none(FeedbackMessage) do
mod = User.with_role(:trusted).take
diff --git a/spec/requests/tags_spec.rb b/spec/requests/tags_spec.rb
index 7bbc7d4ec..9f6ce5845 100644
--- a/spec/requests/tags_spec.rb
+++ b/spec/requests/tags_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe "Tags", proper_status: true do
create(:tag, name: "javascript", alias_for: "")
get tags_path
- expect(response.body).to include("Top tags", "ruby", "javascript")
+ expect(response.body).to include("Tags", "ruby", "javascript")
end
it "does not include tags with alias" do