Set page titles relevant to page is loaded
I used ember-cli-document-title addon.
This commit is contained in:
parent
780edf69c8
commit
dfc22014a8
|
@ -1,6 +1,9 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: (model) ->
|
||||
@get('contentType').replace('_', ' ').capitalize()
|
||||
|
||||
renderTemplate: ->
|
||||
@render 'builds'
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: (model) ->
|
||||
model.get('name') || model.get('login')
|
||||
|
||||
setupController: (controller, account) ->
|
||||
@_super.apply this, arguments
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
`import config from 'travis/config/environment'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
needsAuth: false
|
||||
|
@ -12,6 +13,14 @@ Route = TravisRoute.extend
|
|||
activate: ->
|
||||
@get('stylesheetsManager').disable('dashboard')
|
||||
|
||||
title: (titleParts) ->
|
||||
if titleParts.length
|
||||
titleParts = titleParts.reverse()
|
||||
titleParts.push('Travis CI')
|
||||
titleParts.join(' - ')
|
||||
else
|
||||
config.defaultTitle
|
||||
|
||||
actions:
|
||||
redirectToGettingStarted: ->
|
||||
# do nothing, we handle it only in index path
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: (model) ->
|
||||
"Build ##{model.get('number')}"
|
||||
|
||||
serialize: (model, params) ->
|
||||
id = if model.get then model.get('id') else model
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
`import AbstractBuildsRoute from 'travis/routes/abstract-builds'`
|
||||
|
||||
Route = AbstractBuildsRoute.extend(contentType: 'builds')
|
||||
Route = AbstractBuildsRoute.extend(
|
||||
contentType: 'builds'
|
||||
)
|
||||
|
||||
`export default Route`
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: 'Environment variables'
|
||||
|
||||
model: (params) ->
|
||||
repo = @modelFor('repo')
|
||||
repo.get('envVars.promise')
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: (model) ->
|
||||
"Job ##{model.get('number')}"
|
||||
|
||||
serialize: (model, params) ->
|
||||
id = if model.get then model.get('id') else model
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: 'Profile'
|
||||
|
||||
needsAuth: true
|
||||
|
||||
setupController: (controller, model) ->
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
`import Repo from 'travis/models/repo'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: (model) ->
|
||||
model.get('slug')
|
||||
|
||||
renderTemplate: ->
|
||||
@render 'repo', into: 'main'
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: 'Settings'
|
||||
|
||||
model: ->
|
||||
repo = @modelFor('repo')
|
||||
repo.fetchSettings().then (settings) ->
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
`import TravisRoute from 'travis/routes/basic'`
|
||||
|
||||
Route = TravisRoute.extend
|
||||
titleToken: 'Ssh Keys'
|
||||
|
||||
model: (params) ->
|
||||
repo = @modelFor('repo')
|
||||
self = this
|
||||
|
|
|
@ -6,6 +6,7 @@ module.exports = function(environment) {
|
|||
environment: environment,
|
||||
baseURL: '/',
|
||||
locationType: 'auto',
|
||||
defaultTitle: 'Travis CI',
|
||||
EmberENV: {
|
||||
FEATURES: {
|
||||
// Here you can enable experimental features on an ember canary build
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
"ember-cli-coffeescript": "0.7.0",
|
||||
"ember-cli-content-security-policy": "0.3.0",
|
||||
"ember-cli-dependency-checker": "0.0.7",
|
||||
"ember-cli-document-title": "0.0.1",
|
||||
"ember-cli-htmlbars": "^0.6.0",
|
||||
"ember-cli-ic-ajax": "0.1.1",
|
||||
"ember-cli-inject-live-reload": "^1.3.0",
|
||||
|
|
|
@ -162,8 +162,12 @@ class Travis::Web::App
|
|||
end
|
||||
|
||||
def set_title(content)
|
||||
content.gsub!(/\{\{title\}\}/, title)
|
||||
end
|
||||
|
||||
def title
|
||||
default_title = "Travis CI - Free Hosted Continuous Integration Platform for the Open Source Community"
|
||||
content.gsub!(/\{\{title\}\}/, ENV['SITE_TITLE'] || default_title)
|
||||
ENV['SITE_TITLE'] || default_title
|
||||
end
|
||||
|
||||
def set_assets_host(content)
|
||||
|
@ -173,6 +177,7 @@ class Travis::Web::App
|
|||
def set_config(string, opts = {})
|
||||
# TODO: clean up
|
||||
config = {}
|
||||
config['defaultTitle'] = title
|
||||
config['apiEndpoint'] = options[:api_endpoint] if options[:api_endpoint]
|
||||
config['pagesEndpoint'] = options[:pages_endpoint] if options[:pages_endpoint]
|
||||
config['billingEndpoint'] = options[:billing_endpoint] if options[:billing_endpoint]
|
||||
|
|
Loading…
Reference in New Issue
Block a user