Remove some more deprecations
This commit is contained in:
parent
fcff3f549d
commit
2e5c3c8a2d
|
@ -3,19 +3,6 @@
|
|||
`import loadInitializers from 'ember/load-initializers'`
|
||||
`import config from './config/environment'`
|
||||
|
||||
`import mb from 'travis/helpers/mb'`
|
||||
`import label from 'travis/helpers/label'`
|
||||
`import travisField from 'travis/helpers/travis-field'`
|
||||
`import travisErrors from 'travis/helpers/travis-errors'`
|
||||
#`import input from 'travis/helpers/input'`
|
||||
`import filterInput from 'travis/helpers/filter-input'`
|
||||
Ember.HTMLBars._registerHelper('label', label)
|
||||
Ember.HTMLBars._registerHelper('travis-field', travisField)
|
||||
Ember.HTMLBars._registerHelper('travis-errors', travisErrors)
|
||||
#Ember.Handlebars.registerHelper('input', input)
|
||||
Ember.HTMLBars._registerHelper('filter-input', filterInput)
|
||||
Ember.Handlebars.registerBoundHelper('mb', mb)
|
||||
|
||||
Ember.MODEL_FACTORY_INJECTIONS = true
|
||||
|
||||
App = Ember.Application.extend(Ember.Evented,
|
||||
|
|
|
@ -36,7 +36,7 @@ Controller = Ember.ArrayController.extend
|
|||
|
||||
loadFlashes: (msgs) ->
|
||||
for msg in msgs
|
||||
type = Ember.keys(msg)[0]
|
||||
type = Object.keys(msg)[0]
|
||||
msg = { type: type, message: msg[type] }
|
||||
@get('flashes').unshiftObject(msg)
|
||||
Ember.run.later(this, (-> @get('flashes.content').removeObject(msg)), 15000)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
`import { safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (value, options) ->
|
||||
if value?
|
||||
safe $.capitalize(value)
|
||||
else
|
||||
''
|
||||
|
||||
`export default helper`
|
|
@ -1,6 +1,7 @@
|
|||
`import { safe, formatCommit as formatCommitHelper } from 'travis/utils/helpers'`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (commit) ->
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
commit = params[0]
|
||||
safe formatCommitHelper(commit.get('sha'), commit.get('branch')) if commit
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { timeInWords, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (duration, options) ->
|
||||
safe timeInWords(duration)
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
safe timeInWords(params[0])
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { formatSha as _formatSha, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (sha) ->
|
||||
safe _formatSha(sha)
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
safe _formatSha(params[0])
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { timeAgoInWords, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (value, options) ->
|
||||
safe timeAgoInWords(value) || '-'
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
safe timeAgoInWords(params[0]) || '-'
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
`import { formatCommit, safe } from 'travis/utils/helpers'`
|
||||
`import { githubCommit as githubCommitUrl } from 'travis/utils/urls'`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (slug, commitSha) ->
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
slug = params[0]
|
||||
commitSha = params[1]
|
||||
return '' unless commitSha
|
||||
sha = Ember.Handlebars.Utils.escapeExpression formatCommit(commitSha)
|
||||
return sha unless slug
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
`import { safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (state) ->
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
state = params[0]
|
||||
if state == 'received'
|
||||
'booting'
|
||||
else
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
`import Ember from 'ember'`
|
||||
|
||||
originalInputHelper = Ember.Handlebars.helpers.input
|
||||
|
||||
input = (options) ->
|
||||
# for now I can match label only with the property name
|
||||
# passed here matches the label
|
||||
name = (options.hash.value || options.hash.checked)
|
||||
id = options.hash.id
|
||||
|
||||
# generate id only if it's not given
|
||||
if name && !name.match(/\./) && !id
|
||||
labels = @get('_labels')
|
||||
unless labels
|
||||
labels = Ember.Object.create()
|
||||
@set('_labels', labels)
|
||||
|
||||
# for now I support only label + input in their own context
|
||||
id = labels.get(name)
|
||||
unless id
|
||||
id = "#{name}-#{Math.round(Math.random() * 1000000)}"
|
||||
labels.set(name, id)
|
||||
|
||||
options.hash.id = id
|
||||
options.hashTypes.id = 'STRING'
|
||||
options.hashContexts.id = this
|
||||
|
||||
originalInputHelper.call(this, options)
|
||||
|
||||
`export default input`
|
|
@ -1,7 +1,7 @@
|
|||
`import { timeAgoInWords, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (value, options) ->
|
||||
safe timeAgoInWords(value) || 'currently running'
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
safe timeAgoInWords(params[0]) || 'currently running'
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import { timeAgoInWords, safe } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (value, options) ->
|
||||
safe moment(value).format('MMMM D, YYYY H:mm:ss') || '-'
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
safe moment(params[0]).format('MMMM D, YYYY H:mm:ss') || '-'
|
||||
|
||||
`export default helper`
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
`import { pathFrom } from 'travis/utils/helpers'`
|
||||
`import Ember from "ember"`
|
||||
|
||||
helper = Ember.Handlebars.makeBoundHelper (url, options) ->
|
||||
helper = Ember.HTMLBars.makeBoundHelper (params) ->
|
||||
url = params[0]
|
||||
path = pathFrom(url)
|
||||
if path.indexOf('...') >= 0
|
||||
shas = path.split('...')
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
`import Ember from 'ember'`
|
||||
|
||||
ErrorsView = Ember.View.extend
|
||||
tagName: 'span'
|
||||
templateName: 'helpers/travis-errors'
|
||||
classNames: ['error']
|
||||
classNameBindings: ['codes', 'show']
|
||||
codes: (->
|
||||
@get('errors').mapBy('code')
|
||||
).property('@errors', 'errors.length')
|
||||
show: Ember.computed.notEmpty('errors.[]')
|
||||
|
||||
fn = (params, hash, options, env) ->
|
||||
name = params[0]
|
||||
controller = env.data.view.get('controller')
|
||||
errors = controller.get('errors').for(name)
|
||||
view = ErrorsView.create(
|
||||
controller: controller
|
||||
errors: errors
|
||||
)
|
||||
|
||||
env.helpers.view.helperFunction.call(this, [view], hash, options, env)
|
||||
|
||||
`export default fn`
|
|
@ -1,25 +0,0 @@
|
|||
`import Ember from 'ember'`
|
||||
|
||||
FormFieldRowView = Ember.View.extend
|
||||
invalid: Ember.computed.notEmpty('errors.[]')
|
||||
classNameBindings: ['invalid']
|
||||
classNames: 'field'
|
||||
|
||||
fn = (params, hash, options, env) ->
|
||||
name = params[0]
|
||||
controller = env.data.view.get('controller')
|
||||
errors = controller.get('errors').for(name)
|
||||
template = options.template
|
||||
delete options.template
|
||||
|
||||
view = FormFieldRowView.create(
|
||||
controller: controller
|
||||
template: template
|
||||
errors: errors
|
||||
name: name
|
||||
classNameBindings: ['name']
|
||||
)
|
||||
|
||||
env.helpers.view.helperFunction.call(this, [view], hash, options, env)
|
||||
|
||||
`export default fn`
|
|
@ -4,4 +4,4 @@ fn = (size) ->
|
|||
if size
|
||||
(size / 1024 / 1024).toFixed(2)
|
||||
|
||||
`export default fn`
|
||||
`export default Ember.HTMLBars.makeBoundHelper(fn)`
|
|
@ -9,7 +9,7 @@ initialize = (container, app) ->
|
|||
app.inject('application', 'auth', 'auth:main')
|
||||
app.inject('component', 'auth', 'auth:main')
|
||||
|
||||
app.inject('auth', 'store', 'store:main')
|
||||
app.inject('auth', 'store', 'service:store')
|
||||
|
||||
AuthInitializer =
|
||||
name: 'auth'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
`import config from 'travis/config/environment'`
|
||||
`import TravisPusher from 'travis/utils/pusher'`
|
||||
|
||||
initialize = (container, application) ->
|
||||
initialize = (registry, application) ->
|
||||
if config.pusher.key
|
||||
application.pusher = new TravisPusher(config.pusher)
|
||||
|
||||
|
@ -9,9 +9,6 @@ initialize = (container, application) ->
|
|||
|
||||
application.inject('route', 'pusher', 'pusher:main')
|
||||
|
||||
application.pusher.store = container.lookup('store:main')
|
||||
|
||||
|
||||
PusherInitializer =
|
||||
name: 'pusher'
|
||||
after: 'ember-data'
|
||||
|
|
10
app/instance-initializers/pusher.coffee
Normal file
10
app/instance-initializers/pusher.coffee
Normal file
|
@ -0,0 +1,10 @@
|
|||
initialize = (data) ->
|
||||
data.application.pusher.store = data.container.lookup('service:store')
|
||||
|
||||
PusherInitializer =
|
||||
name: 'pusher'
|
||||
after: 'ember-data'
|
||||
initialize: initialize
|
||||
|
||||
`export {initialize}`
|
||||
`export default PusherInitializer`
|
|
@ -87,6 +87,4 @@ Store = DS.Store.extend
|
|||
data = json.repository || json.repo
|
||||
@pushPayload(repos: [data])
|
||||
|
||||
|
||||
|
||||
`export default Store`
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<p class="tile-item caches-date column">{{format-time cache.last_modified}}</p>
|
||||
|
||||
<p class="tile-item caches-size column">{{mb cache.size}}MB</p>
|
||||
<p class="tile-item caches-size column">{{travis-mb cache.size}}MB</p>
|
||||
|
||||
<p class="tile-item caches-button column">
|
||||
<a href="#" {{action "delete"}} class="{{if isDeleting 'deleting'}} delete-by-slug delete button--delete">
|
||||
|
|
Loading…
Reference in New Issue
Block a user