forked from cybrespace/mastodon
		
	Fix various things in the directory (#9449)
* Fix missing variable in directory page title * Order hashtags by number of people instead of alphabetically * Add icon to OpenGraph preview of directory page * Prevent line breaks in hashtags and ensure lowercase in the table
This commit is contained in:
		
							parent
							
								
									c1c0f7c516
								
							
						
					
					
						commit
						ecd303c097
					
				
					 3 changed files with 10 additions and 5 deletions
				
			
		| 
						 | 
					@ -300,6 +300,9 @@
 | 
				
			||||||
      font-size: 18px;
 | 
					      font-size: 18px;
 | 
				
			||||||
      font-weight: 700;
 | 
					      font-weight: 700;
 | 
				
			||||||
      color: $primary-text-color;
 | 
					      color: $primary-text-color;
 | 
				
			||||||
 | 
					      white-space: nowrap;
 | 
				
			||||||
 | 
					      overflow: hidden;
 | 
				
			||||||
 | 
					      text-overflow: ellipsis;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      .fa {
 | 
					      .fa {
 | 
				
			||||||
        color: $darker-text-color;
 | 
					        color: $darker-text-color;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ class Tag < ApplicationRecord
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  validates :name, presence: true, uniqueness: true, format: { with: /\A#{HASHTAG_NAME_RE}\z/i }
 | 
					  validates :name, presence: true, uniqueness: true, format: { with: /\A#{HASHTAG_NAME_RE}\z/i }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  scope :discoverable, -> { joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).where(account_tag_stats: { hidden: false }).order(name: :asc) }
 | 
					  scope :discoverable, -> { joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).where(account_tag_stats: { hidden: false }).order('account_tag_stats.accounts_count desc') }
 | 
				
			||||||
  scope :hidden, -> { where(account_tag_stats: { hidden: true }) }
 | 
					  scope :hidden, -> { where(account_tag_stats: { hidden: true }) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  delegate :accounts_count,
 | 
					  delegate :accounts_count,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,12 +1,14 @@
 | 
				
			||||||
- content_for :page_title do
 | 
					- content_for :page_title do
 | 
				
			||||||
  = t('directories.explore_mastodon')
 | 
					  = t('directories.explore_mastodon', title: site_title)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- content_for :header_tags do
 | 
					- content_for :header_tags do
 | 
				
			||||||
  %meta{ name: 'description', content: t('directories.explanation') }
 | 
					  %meta{ name: 'description', content: t('directories.explanation') }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  = opengraph 'og:site_name', site_title
 | 
					  = opengraph 'og:site_name', t('about.hosted_on', domain: site_hostname)
 | 
				
			||||||
 | 
					  = opengraph 'og:type', 'website'
 | 
				
			||||||
  = opengraph 'og:title', t('directories.explore_mastodon', title: site_title)
 | 
					  = opengraph 'og:title', t('directories.explore_mastodon', title: site_title)
 | 
				
			||||||
  = opengraph 'og:description', t('directories.explanation')
 | 
					  = opengraph 'og:description', t('directories.explanation')
 | 
				
			||||||
 | 
					  = opengraph 'og:image', File.join(root_url, 'android-chrome-192x192.png')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.page-header
 | 
					.page-header
 | 
				
			||||||
  %h1= t('directories.explore_mastodon', title: site_title)
 | 
					  %h1= t('directories.explore_mastodon', title: site_title)
 | 
				
			||||||
| 
						 | 
					@ -29,10 +31,10 @@
 | 
				
			||||||
                %td= account_link_to account
 | 
					                %td= account_link_to account
 | 
				
			||||||
                %td.accounts-table__count
 | 
					                %td.accounts-table__count
 | 
				
			||||||
                  = number_to_human account.statuses_count, strip_insignificant_zeros: true
 | 
					                  = number_to_human account.statuses_count, strip_insignificant_zeros: true
 | 
				
			||||||
                  %small= t('accounts.posts', count: account.statuses_count)
 | 
					                  %small= t('accounts.posts', count: account.statuses_count).downcase
 | 
				
			||||||
                %td.accounts-table__count
 | 
					                %td.accounts-table__count
 | 
				
			||||||
                  = number_to_human account.followers_count, strip_insignificant_zeros: true
 | 
					                  = number_to_human account.followers_count, strip_insignificant_zeros: true
 | 
				
			||||||
                  %small= t('accounts.followers', count: account.followers_count)
 | 
					                  %small= t('accounts.followers', count: account.followers_count).downcase
 | 
				
			||||||
                %td.accounts-table__count
 | 
					                %td.accounts-table__count
 | 
				
			||||||
                  - if account.last_status_at.present?
 | 
					                  - if account.last_status_at.present?
 | 
				
			||||||
                    %time.time-ago{ datetime: account.last_status_at.iso8601, title: l(account.last_status_at) }= l account.last_status_at
 | 
					                    %time.time-ago{ datetime: account.last_status_at.iso8601, title: l(account.last_status_at) }= l account.last_status_at
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue