UX: Add og metadata for groups.

https://meta.discourse.org/t/onebox-for-groups/79155
This commit is contained in:
Maja Komel
2018-01-31 21:04:09 +01:00
committed by Guo Xiang Tan
parent 9d0807224b
commit 76a2fc3d07
3 changed files with 36 additions and 2 deletions

View File

@ -12,6 +12,7 @@ class GroupsController < ApplicationController
]
skip_before_action :preload_json, :check_xhr, only: [:posts_feed, :mentions_feed]
skip_before_action :check_xhr, only: [:show]
def index
unless SiteSetting.enable_group_directory?
@ -48,7 +49,19 @@ class GroupsController < ApplicationController
end
def show
render_serialized(find_group(:id), GroupShowSerializer, root: 'basic_group')
respond_to do |format|
group = find_group(:id)
format.html do
@title = group.full_name.present? ? group.full_name.capitalize : group.name
@description_meta = group.bio_cooked.present? ? PrettyText.excerpt(group.bio_cooked, 300) : @title
render :show
end
format.json do
render_serialized(group, GroupShowSerializer, root: 'basic_group')
end
end
end
def edit