mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Add Tag#formatted_name for admin views
This commit is contained in:
parent
7fe71e3fde
commit
a6385b7da8
4 changed files with 18 additions and 5 deletions
|
@ -75,6 +75,10 @@ class Tag < ApplicationRecord
|
|||
attributes['display_name'] || name
|
||||
end
|
||||
|
||||
def formatted_name
|
||||
"##{display_name}"
|
||||
end
|
||||
|
||||
def usable
|
||||
boolean_with_default('usable', true)
|
||||
end
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
.batch-table__row__content.batch-table__row__content--padded.pending-account
|
||||
.pending-account__header
|
||||
%strong
|
||||
= link_to admin_tag_path(tag.id) do
|
||||
= t('admin.tags.tag_name', name: tag.display_name)
|
||||
= link_to tag.formatted_name, admin_tag_path(tag.id)
|
||||
|
||||
%br/
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
.batch-table__row__content.pending-account
|
||||
.pending-account__header
|
||||
= link_to admin_tag_path(tag.id) do
|
||||
= material_symbol 'tag'
|
||||
= tag.display_name
|
||||
= link_to tag.formatted_name, admin_tag_path(tag.id)
|
||||
|
||||
%br/
|
||||
|
||||
|
|
|
@ -112,6 +112,18 @@ RSpec.describe Tag do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#formatted_name' do
|
||||
it 'returns name with a proceeding hash symbol' do
|
||||
tag = Fabricate(:tag, name: 'foo')
|
||||
expect(tag.formatted_name).to eq '#foo'
|
||||
end
|
||||
|
||||
it 'returns display_name with a proceeding hash symbol, if display name present' do
|
||||
tag = Fabricate(:tag, name: 'foobar', display_name: 'FooBar')
|
||||
expect(tag.formatted_name).to eq '#FooBar'
|
||||
end
|
||||
end
|
||||
|
||||
describe '.recently_used' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:other_person_status) { Fabricate(:status) }
|
||||
|
|
Loading…
Reference in a new issue