Merge pull request #361 from warpc/340-titles

[Refs #340] Add title to all page in ABF
This commit is contained in:
Vladimir Sharshov 2012-03-30 11:44:09 -07:00
commit c75f857014
71 changed files with 136 additions and 30 deletions

View File

@ -1,15 +1,5 @@
# -*- encoding : utf-8 -*-
module ApplicationHelper
def choose_title
title = if ['personal_repositories', 'downloads'].include?(controller.controller_name)
APP_CONFIG['repo_project_name']
else
APP_CONFIG['project_name']
end
return title
end
def layout_class
case
when params[:controller] == 'issues' && params[:action] == 'new'
@ -26,4 +16,18 @@ module ApplicationHelper
content_for?(:sidebar) ? 'right' : 'all'
end
end
def title_object object
name = object.class == Group ? object.uname : object.name
object_name = t "activerecord.models.#{object.class.name.downcase}"
case object.class.name
when 'Project', 'Platform'
"#{object_name} #{object.owner.uname}/#{object.name}"
when 'Repository', 'Product'
"#{object_name} #{object.name} - #{title_object object.platform}"
when 'Group'
"#{object_name} #{object.uname}"
else object.class.name
end
end
end

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => nil
%h3.fix= t("layout.activity_feed.header")
=render 'list'

View File

@ -1,4 +1,4 @@
%h3.fix= t("layout.users.list_header")
%h3.fix= title t("layout.users.list_header")
- columns = [{:type => 'html'}, {:type => 'html'}, {:type => 'html'}, {:type => 'html', :sortable => false, :searchable => false}, {:type => nil, :sortable => false, :searchable => false, :class => 'buttons'}]
= raw datatable(columns, {:sort_by => "[0, 'asc']", :processing => t("layout.processing"), :search_label => t("layout.search.header"),

View File

@ -1,6 +1,6 @@
.block
.content
%h2.title= t("layout.users.new_header")
%h2.title= title t("layout.users.new_header")
.inner
= form_for @user, :url => create_user_path, :html => { :class => :form } do |f|
= render :partial => "users/form", :locals => {:f => f}

View File

@ -1,4 +1,4 @@
%h3.fix.bpadding10= @user.uname
%h3.fix.bpadding10= title @user.uname
= form_for @user, :url => update_user_path(@user), :html => { :class => :form } do |f|
= render :partial => "users/form", :locals => {:f => f}

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => t('.title')
/ #myTable
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('layout.build_lists.new_header')]
= form_for [@project, @build_list], :html => { :class => :form, :method => :post } do |f|
%section.left
%h3= t("activerecord.attributes.build_list.project_version")

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@build_list.project), t('activerecord.models.build_list')]
.notify.blue
%div{:class => build_list_status_color(@build_list.status)}
%p= @build_list.human_status

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('layout.projects.members')]
= render :partial => 'projects/sidebar'
= render :partial => 'projects/submenu'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@comment.project), t('layout.comments.edit_header')]
.block
.secondary-navigation
%ul.wat-cf

View File

@ -1,7 +1,7 @@
.block
.content
%h2.title
= t("layout.downloads.title")
= title t("layout.downloads.title")
.inner
%h3= t("layout.downloads.message")
.inner

View File

@ -4,7 +4,7 @@
%li.first.active= link_to t("layout.event_logs.list"), event_logs_path
.content
%h2.title
= t("layout.event_logs.list_header")
= title t("layout.event_logs.list_header")
.inner
%table.table
%tr

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}"
= render :partial => 'projects/submenu'
= render :partial => 'projects/repo_block', :locals => {:project => @project}

View File

@ -1 +1,2 @@
-set_meta_tags :title => [title_object(@project), "#{t :title_editing} #{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"]
= render :partial => "git/blobs/editor", :layout => 'projects/show'

View File

@ -1 +1,2 @@
-set_meta_tags :title => [title_object(@project), "#{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"]
= render :partial => "git/blobs/show", :layout => 'projects/show'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"]
= render :partial => 'projects/submenu'
= render :partial => 'projects/repo_block', :locals => {:project => @project}

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), shortest_hash_id(@commit.id), @commit.message]
= render :partial => 'projects/submenu'
.description

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => title_object(@project)
= render :partial => 'projects/submenu'
= render :partial => 'projects/repo_block', :locals => {:project => @project}

View File

@ -1 +1,2 @@
-set_meta_tags :title => "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}"
= render :partial => "git/trees/show", :layout => 'projects/show'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@group), t('layout.groups.edit')]
= form_for @group, :html => { :class => :form, :multipart => true } do |f|
= render :partial => "form", :locals => {:f => f}

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => t('layout.groups.list_header')
= link_to t("layout.groups.new"), new_group_path, :class => "button"
%table#myTable.tablesorter.group-list{:cellpadding => "0", :cellspacing => "0"}
%thead

View File

@ -1,4 +1,4 @@
%h3.bpadding10= t("layout.groups.new_header")
%h3.bpadding10= title t("layout.groups.new_header")
= form_for @group, :url => groups_path do |f|
= render :partial => "form", :locals => {:f => f}

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => title_object(@group)
.all.verybigpadding
%h3= @group.name
%h4= t("activerecord.attributes.group.description") + ":"

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('.title')]
-render :partial => 'projects/submenu'
-render :partial => 'issues/index_sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('layout.issues.create_header')]
-render :partial => 'projects/submenu'
-render :partial => 'issues/manage_sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), @issue.title]
-render :partial => 'projects/submenu'
-render :partial => 'issues/manage_sidebar'
-content_for :right_nopadding do

View File

@ -2,13 +2,13 @@
%html
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
%title= choose_title
= stylesheet_link_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css', :media => 'screen, projection'
= stylesheet_link_tag "application"
/[if lt IE 9]
= javascript_include_tag 'http://html5shiv.googlecode.com/svn/trunk/html5.js'
= javascript_include_tag "application"
= csrf_meta_tag
= display_meta_tags :site => APP_CONFIG['project_name'], :reverse => true, :separator => '-'
%body
.wrap{:class => content_for?(:sidebar) ? 'columns' : ''}

View File

@ -2,7 +2,6 @@
%html
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "content-type"}
= display_meta_tags :site => APP_CONFIG['project_name']
- if controller_name == 'sessions' && action_name == 'new'
= stylesheet_link_tag "login"
- elsif ['registrations', 'passwords'].include?(controller_name) && ['new', 'create', 'edit', 'update'].include?(action_name)
@ -11,6 +10,7 @@
= javascript_include_tag 'http://html5shiv.googlecode.com/svn/trunk/html5.js'
= javascript_include_tag "login"
= csrf_meta_tag
= display_meta_tags :site => APP_CONFIG['project_name'], :reverse => true, :separator => '-'
%body
-# render :partial => "layouts/flashes"

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@group), t('layout.groups.members')]
= form_tag group_members_path(@group), :id => 'members_form', :delete_url => remove_group_members_path(@group) do
= hidden_field_tag "_method", "post"
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@repository), t('layout.personal_repositories.settings')]
.block
.secondary-navigation
%ul.wat-cf

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@repository), t('activerecord.models.repository')]
.block
.secondary-navigation
%ul.wat-cf

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@platform), t('layout.platforms.clone_header')]
= render :partial => 'submenu'
= render :partial => 'sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@platform), t('layout.platforms.edit')]
= render :partial => 'submenu'
= render :partial => 'sidebar'

View File

@ -0,0 +1 @@
-set_meta_tags :title => t('flash.exception_message')

View File

@ -1,3 +1,3 @@
= link_to t("layout.platforms.new"), new_platform_path, :class => 'button' if can? :create, Platform
= link_to title(t "layout.platforms.new"), new_platform_path, :class => 'button' if can? :create, Platform
= render :partial => 'platforms/list', :object => @platforms
= will_paginate @platforms

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@platform), t('layout.platforms.members')]
= render :partial => 'submenu'
= render :partial => 'sidebar'

View File

@ -1,4 +1,4 @@
%h3= t("layout.platforms.new_header")
%h3= title t("layout.platforms.new_header")
= form_for :platform, :url => platforms_path, :html => { :class => :form } do |f|
= render :partial => "form", :locals => {:f => f}

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => title_object(@platform)
= render :partial => 'submenu'
= render :partial => 'sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(current_user.repository), t('layout.personal_repositories.private_users')]
.block
.secondary-navigation
%ul.wat-cf

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => t('.title')
/ #myTable
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@product), t('title_editing')]
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@platform), t('layout.products.list_header')]
= render :partial => 'platforms/submenu' if params[:platform_id]
= render :partial => 'platforms/sidebar' if params[:platform_id]
= link_to t("layout.products.new"), new_platform_product_path(@platform), :class => 'button' if can? :create, @platform.products.build

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@platform), t('layout.products.new')]
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => title_object(@product)
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('layout.projects.edit')]
= render :partial => 'projects/submenu'
= render :partial => 'projects/sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => t('layout.projects.list_header')
.toolbar
= link_to t('layout.projects.new'), new_project_path, :class => 'button' if can?(:create, Project)
@ -7,7 +8,6 @@
%span.user= t("layout.relations.user")
%span.group= t("layout.relations.group")
.both
- columns = [{:type => 'html'},
{:type => 'html', :sortable => false, :searchable => false},
{:type => nil, :sortable => false, :searchable => false, :class => 'rights'},

View File

@ -1,4 +1,4 @@
%h3.bpadding10= t("layout.projects.new")
%h3.bpadding10= title t("layout.projects.new")
= form_for @project, :html => { :class => :form, :multipart => true } do |f|
= render :partial => "form", :locals => {:f => f}

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('layout.projects.sections')]
= render :partial => 'projects/submenu'
= render :partial => 'projects/sidebar'

View File

@ -10,7 +10,7 @@
\|
= link_to t("layout.register_request.rejected"), register_requests_path(:scope => :rejected)
%h2.title
= t("layout.register_request.list_header")
= title t("layout.register_request.list_header")
.inner
= form_tag register_requests_path, :method => :put, :class => 'update_form' do
= hidden_field_tag 'update_type'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@platform), t('layout.repositories.list_header')]
= render :partial => 'platforms/submenu' if params[:platform_id]
= render :partial => 'platforms/sidebar' if params[:platform_id]
= link_to t("layout.repositories.new"), new_platform_repository_path(@platform), :class => 'button' if can? :create, @platform.repositories.build

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@platform), t('layout.repositories.new')]
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => title_object(@repository)
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'

View File

@ -1,4 +1,4 @@
%h3= t 'layout.search.advanced'
%h3= title t('layout.search.advanced')
= render 'form_advanced'
- if params[:type] == 'all'
#all

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => t('layout.users.settings_notifier')
%p
= t("layout.settings.notifiers.notice_header", :email => @user.email)
%br

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => t('layout.users.settings')
%h3.fix.bpadding10= t('layout.users.private_settings_header')
= form_for(@user, :url => user_private_settings_path(@user), :html => { :method => :put, :class => "form" }) do |f|

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => t('.title')
%h3.fix.bpadding10= @user.uname
= form_for @user, :url => user_path(@user), :html => { :class => :form } do |f|

View File

@ -3,7 +3,7 @@
%br
= link_to t("layout.users.settings"), current_user == @user ? edit_profile_path : edit_user_path(@user), :class => 'button width81' if can? :edit, @user
.left
%h3= @user.uname
%h3= title @user.uname
= @user.name
%br
= link_to @user.email, "mailto:#{ @user.email }"

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('.title')]
= render 'gollum_includes'
/ = render 'project_short'
= render 'projects/submenu'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), "#{t('wiki.editing_page')} #{@page.name}"]
= render 'gollum_includes'
/ = render 'project_short'
= render 'projects/submenu'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('wiki.git_access')]
/ = render 'gollum_includes'
/ = render 'project_short'
= render 'projects/submenu'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('wiki.wiki_history')]
/ = render 'gollum_includes'
/ = render 'project_short'
= render 'projects/submenu'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), t('wiki.pages')]
/ = render 'gollum_includes'
/ = render 'project_short'
= render 'projects/submenu'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), @query, t('wiki.searching.title')]
/ = render 'gollum_includes'
/ = render 'project_short'
= render 'projects/submenu'

View File

@ -1,3 +1,4 @@
-set_meta_tags :title => [title_object(@project), @page.name]
/ = render 'gollum_includes'
/ = render 'project_short'
= render 'projects/submenu'

View File

@ -33,7 +33,7 @@ Rosa::Application.configure do
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
config.assets.debug = false
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict

View File

@ -5,10 +5,10 @@ en:
build_all: Build all
list: List
new: Create
edit: Edit
edit: Settings
about: About platform
new_header: New platform
edit_header: Edit
edit_header: Settings
list_header: Platforms
list_header_main: General
list_header_personal: Personal

View File

@ -5,10 +5,10 @@ ru:
build_all: Собрать все
list: Список
new: Создать
edit: Редактировать
edit: Настройки
about: О платформе
new_header: Новая платформа
edit_header: Редактировать
edit_header: Настройки
list_header: Платформы
list_header_main: Основные
list_header_personal: Персональные

View File

@ -0,0 +1,25 @@
en:
title_editing:
'Editing'
at: at
users:
profile:
title: 'Your Profile'
build_lists:
index:
title: 'Projects Monitoring'
product_build_lists:
index:
title: 'Products Monitoring'
git:
commits:
index:
title: 'Commit History'
issues:
index:
title: 'Tracker'
wiki:
compare:
title: 'Compare Revisions'
searching:
title: 'Search in Wiki'

View File

@ -0,0 +1,25 @@
ru:
title_editing:
'Редактирование'
at: at
users:
profile:
title: 'Ваш профиль'
build_lists:
index:
title: 'Мониторинг проектов'
product_build_lists:
index:
title: 'Мониторинг продуктов'
git:
commits:
index:
title: 'История коммитов'
issues:
index:
title: 'Трекер'
wiki:
compare:
title: 'Сравнение версий'
searching:
title: 'Поиск в вики'

View File

@ -30,6 +30,8 @@ en:
admin: Admins
real: Real
banned: Banned
register_request:
list_header: Register requests
activerecord:
attributes:

View File

@ -30,6 +30,8 @@ ru:
admin: Админы
real: Обычные
banned: Забаненные
register_request:
list_header: Заявки на регистрацию
activerecord:
attributes: