commit
4a11ac280a
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -59,8 +59,14 @@ module ApplicationHelper
|
|||
name = object.class == Group ? object.uname : object.name
|
||||
object_name = t "activerecord.models.#{object.class.name.downcase}"
|
||||
case object.class.name
|
||||
when 'Project', 'Platform'
|
||||
when 'Project'
|
||||
"#{object_name} #{object.owner.uname}/#{object.name}"
|
||||
when 'Platform'
|
||||
if object.main?
|
||||
"#{object_name} #{object.name}"
|
||||
else
|
||||
"#{object_name} #{object.owner.uname}/#{object.name}"
|
||||
end
|
||||
when 'Repository', 'Product'
|
||||
"#{object_name} #{object.name} - #{title_object object.platform}"
|
||||
when 'Group'
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
module FacebookHelper
|
||||
|
||||
# Returns a facebook-specific image for the current page.
|
||||
def facebook_meta_image
|
||||
resource = get_resource
|
||||
@fb_meta_image ||= avatar_url(resource, :big) if resource.respond_to?(:avatar)
|
||||
@fb_meta_image ||= asset_url('fb-image.png')
|
||||
|
||||
@fb_meta_image
|
||||
end
|
||||
|
||||
# Returns a facebook-specific URL for the current page.
|
||||
def facebook_meta_url
|
||||
@fb_meta_url ||= fb_like_url(get_resource)
|
||||
end
|
||||
|
||||
# Returns the facebook application id.
|
||||
def facebook_meta_app_id
|
||||
APP_CONFIG['keys']['facebook']['id']
|
||||
end
|
||||
|
||||
# Returns the facebook site name - used for the site:og_name meta tag.
|
||||
def facebook_site_name
|
||||
APP_CONFIG['project_name']
|
||||
end
|
||||
|
||||
# Creates a 'like' URL for the given object instance.
|
||||
def fb_like_url(object=nil)
|
||||
# All likes for resources go to referrers#like, which redirects them
|
||||
# to the appropriate target.
|
||||
begin
|
||||
# Make sure we're using the correct domain. This should happen automatically,
|
||||
# but is a bit flaky in cucumber so set it explicitly to be safe.
|
||||
#domain = current_site.present? ? current_site.domain : request.host
|
||||
url = object.respond_to?(:fb_like_url) ?
|
||||
object.fb_like_url : polymorphic_url(object)#, host: domain)
|
||||
rescue
|
||||
end if object
|
||||
url ||= request.url
|
||||
# Clean up unnecessary params
|
||||
url.gsub!(/\?.*/, '')
|
||||
url << "?page=#{params[:page]}" if params[:page].to_i > 1
|
||||
url
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# Gets the current resource.
|
||||
def get_resource
|
||||
case controller
|
||||
when Groups::BaseController
|
||||
@group
|
||||
when Users::BaseController
|
||||
@user
|
||||
when Projects::Git::BaseController
|
||||
@project
|
||||
else
|
||||
instance_variable_get "@#{controller_name.singularize}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,4 +1,6 @@
|
|||
- set_meta_tags title: t('layout.advisories.list_header')
|
||||
- set_meta_tags og: { title: t('layout.advisories.list_header') }
|
||||
|
||||
- render partial: 'submenu'
|
||||
.col-xs-12.col-md-10.col-md-offset-1
|
||||
.row
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
- set_meta_tags title: [title_object(@advisory), t('activerecord.models.advisory')]
|
||||
- title = [title_object(@advisory), t('activerecord.models.advisory')]
|
||||
- set_meta_tags title: title
|
||||
- set_meta_tags og: { title: title.reverse * ' - ',
|
||||
description: truncate(@advisory.description, length: 255) }
|
||||
|
||||
- render partial: 'submenu'
|
||||
|
||||
.container.col-md-offset-2.col-md-8
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- set_meta_tags title: t('layout.contact.page_header')
|
||||
- set_meta_tags og: { title: t('layout.contact.page_header') }
|
||||
|
||||
.row
|
||||
.col-md-10.col-md-offset-1
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
- set_meta_tags title: title_object(@group)
|
||||
- set_meta_tags og: { title: title_object(@group),
|
||||
description: truncate(@group.description, length: 255) }
|
||||
|
||||
|
||||
= render 'groups/base/submenu'
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ html
|
|||
head
|
||||
meta name="viewport" content="width=device-width, initial-scale=1.0"
|
||||
meta content="text/html; charset=utf-8" http-equiv="Content-Type"
|
||||
== render 'shared/header'
|
||||
== csrf_meta_tag
|
||||
= display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-'
|
||||
- if user_signed_in?
|
||||
|
|
|
@ -3,6 +3,7 @@ html
|
|||
head
|
||||
meta name="viewport" content="width=device-width, initial-scale=1.0"
|
||||
meta content="text/html; charset=utf-8" http-equiv="Content-Type"
|
||||
== render 'shared/header'
|
||||
== csrf_meta_tag
|
||||
= display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-'
|
||||
== stylesheet_link_tag 'new_application', cache: 'application'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
- set_meta_tags og: { description: 'Terms of Service' }
|
||||
|
||||
- render 'tos_sidebar'
|
||||
|
||||
.tos
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
- set_meta_tags og: { description: t('tour.meta_description') }
|
||||
|
||||
.row
|
||||
.col-md-8.col-md-offset-2
|
||||
.row
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
- set_meta_tags og: { description: t('tour.meta_description') }
|
||||
|
||||
.row
|
||||
.col-md-8.col-md-offset-2
|
||||
.row
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
-set_meta_tags title: title_object(@mass_build)
|
||||
- set_meta_tags title: title_object(@mass_build)
|
||||
- set_meta_tags og: { title: title_object(@mass_build),
|
||||
description: truncate(@mass_build.description, length: 255) }
|
||||
|
||||
= render 'submenu'
|
||||
|
||||
.col-xs-12.col-md-10.col-md-offset-1
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- set_meta_tags title: [title_object(@platform), t('layout.advisories.list_header')]
|
||||
- set_meta_tags og: { title: t('layout.advisories.list_header') + ' - ' + title_object(@platform) }
|
||||
== render 'submenu'
|
||||
|
||||
.col-xs-12.col-md-10.col-md-offset-1
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
-set_meta_tags title: title_object(@platform)
|
||||
- set_meta_tags title: title_object(@platform)
|
||||
- set_meta_tags og: { title: title_object(@platform),
|
||||
description: truncate(@platform.description, length: 255) }
|
||||
|
||||
= render 'submenu'
|
||||
|
||||
.col-xs-12.col-md-10.col-md-offset-1
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- set_meta_tags title: t('.title')
|
||||
- set_meta_tags og: { title: t('.title') }
|
||||
|
||||
= render 'projects/build_lists/submenu'
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
- set_meta_tags title: [title_object(@product_build_list.product), t('layout.product_build_lists.show')]
|
||||
- description = @product_build_list.results.map{ |r| r['file_name'] }.select{ |n| n =~ /.iso$/ }
|
||||
- set_meta_tags og: { title: title_object(@product_build_list.product),
|
||||
description: description * ', ' }
|
||||
|
||||
= render 'submenu'
|
||||
|
||||
- pbl = @product_build_list
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
-set_meta_tags title: title_object(@product)
|
||||
- set_meta_tags og: { title: title_object(@product),
|
||||
description: truncate(@product.description, length: 255) }
|
||||
|
||||
= render 'submenu'
|
||||
|
||||
.container.col-md-offset-2.col-md-8
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
- set_meta_tags title: [title_object(@platform), t('layout.repositories.list_header')]
|
||||
- set_meta_tags og: { title: t('layout.repositories.list_header') + ' - ' + title_object(@platform) }
|
||||
|
||||
= render 'submenu' if params[:platform_id]
|
||||
|
||||
.container.col-md-offset-2.col-md-8
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
-set_meta_tags title: title_object(@repository)
|
||||
- set_meta_tags title: title_object(@repository)
|
||||
- set_meta_tags og: { title: title_object(@repository),
|
||||
description: truncate(@repository.description, length: 255) }
|
||||
= render 'submenu'
|
||||
|
||||
.container.col-md-offset-2.col-md-8
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
- set_meta_tags title: [title_object(@build_list.project), t('activerecord.models.build_list')]
|
||||
- description = @build_list.packages.map(&:fullname) * ', '
|
||||
- set_meta_tags og: { title: t('activerecord.models.build_list') + ' - ' + title_object(@build_list.project),
|
||||
description: truncate(description, length: 255) }
|
||||
|
||||
|
||||
= render 'submenu'
|
||||
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
-set_meta_tags title: "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}"
|
||||
- title = "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}"
|
||||
- set_meta_tags title: title
|
||||
- set_meta_tags og: { title: title,
|
||||
description: truncate(@project.description, length: 255) }
|
||||
|
||||
== render partial: "blame", layout: 'layout'
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
-set_meta_tags title: [title_object(@project), "#{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"]
|
||||
- title = [title_object(@project), "#{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"]
|
||||
- set_meta_tags title: title
|
||||
- set_meta_tags og: { title: title * ' - ',
|
||||
description: truncate(@project.description, length: 255) }
|
||||
|
||||
== render partial: "show", layout: 'layout'
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
-title = "#{t('diff')} #{shortest_hash_id @commit1.id}...#{shortest_hash_id @commit.id}"
|
||||
-set_meta_tags title: [title_object(@project), title]
|
||||
- title = "#{t('diff')} #{shortest_hash_id @commit1.id}...#{shortest_hash_id @commit.id}"
|
||||
- title = [title_object(@project), title]
|
||||
- set_meta_tags title: title
|
||||
- set_meta_tags og: { title: title * ' - ',
|
||||
description: truncate(@project.description, length: 255) }
|
||||
== render 'submenu'
|
||||
|
||||
.col-xs-12.col-md-10.col-md-offset-1
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
-set_meta_tags title: [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"]
|
||||
- title = [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"]
|
||||
- set_meta_tags title: title
|
||||
- set_meta_tags og: { title: title * ' - ',
|
||||
description: truncate(@project.description, length: 255) }
|
||||
|
||||
== render 'submenu'
|
||||
.col-xs-12.col-md-10.col-md-offset-1
|
||||
.row
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
-set_meta_tags title: [title_object(@project), shortest_hash_id(@commit.id), @commit.message]
|
||||
- title = [title_object(@project), shortest_hash_id(@commit.id)]
|
||||
- set_meta_tags title: [title, @commit.message].flatten
|
||||
- set_meta_tags og: { title: title * ' - ',
|
||||
description: truncate(@commit.message, length: 255) }
|
||||
== render 'submenu'
|
||||
|
||||
.col-xs-12.col-md-10.col-md-offset-1
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
-set_meta_tags title: "#{title_object @project}"
|
||||
- title = title_object(@project)
|
||||
- set_meta_tags title: title
|
||||
- set_meta_tags og: { title: title,
|
||||
description: truncate(@project.description, length: 255) }
|
||||
|
||||
== render partial: "branches", layout: 'layout'
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
-set_meta_tags title: title_object(@project)
|
||||
- title = title_object(@project)
|
||||
- set_meta_tags title: title
|
||||
- set_meta_tags og: { title: title,
|
||||
description: truncate(@project.description, length: 255) }
|
||||
|
||||
= render 'submenu'
|
||||
= render 'repo_block', project: @project
|
||||
= render 'about_block', project: @project
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
-set_meta_tags title: "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}"
|
||||
- set_meta_tags title: "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}"
|
||||
- set_meta_tags og: { title: title_object(@project),
|
||||
description: truncate(@project.description, length: 255) }
|
||||
|
||||
== render partial: "show", layout: 'layout'
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
-set_meta_tags title: "#{title_object @project}"
|
||||
- title = title_object(@project)
|
||||
- set_meta_tags title: title
|
||||
- set_meta_tags og: { title: title,
|
||||
description: truncate(@project.description, length: 255) }
|
||||
|
||||
== render partial: "tags", layout: 'layout'
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
-set_meta_tags title: [title_object(@project), @issue.title]
|
||||
- set_meta_tags title: [title_object(@project), @issue.title]
|
||||
- set_meta_tags og: { title: @issue.title,
|
||||
description: truncate(@issue.body, length: 255) }
|
||||
|
||||
== render 'submenu'
|
||||
== render 'projects/comments/markdown_help' if current_user
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
link rel='canonical' href=facebook_meta_url
|
||||
/ meta property='og:title' content=facebook_meta_title
|
||||
meta property='og:type' content='website'
|
||||
meta property='og:url' content=facebook_meta_url
|
||||
meta property='og:image' content=facebook_meta_image
|
||||
meta property='og:site_name' content=facebook_site_name
|
||||
meta property='fb:app_id' content=facebook_meta_app_id
|
||||
/ meta property='og:description' content=facebook_meta_description
|
||||
/ meta name='Description' content=facebook_meta_description
|
|
@ -1,5 +1,6 @@
|
|||
en:
|
||||
tour:
|
||||
meta_description: "A distributed environment to build distributions, supporting all steps from managing source code to create ISO images."
|
||||
read_more: more...
|
||||
projects: Project Management
|
||||
sources: Source Code
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ru:
|
||||
tour:
|
||||
meta_description: "Платформа разработки и управления жизненным циклом дистрибутивов: от исходного кода до ISO-образов."
|
||||
read_more: Читать далее...
|
||||
projects: Управление проектами
|
||||
sources: Исходный код
|
||||
|
|
Loading…
Reference in New Issue