29 lines
818 B
CoffeeScript
29 lines
818 B
CoffeeScript
import Ember from 'ember'
|
|
import layout from '../templates/components/collapsible-content'
|
|
|
|
Component = Ember.Component.extend
|
|
layout: layout
|
|
collapsed: true
|
|
classNames: ['collapsible-content-container']
|
|
|
|
title: Ember.computed 'titleSpec', ->
|
|
title = "#{@get('titleSpec')}"
|
|
options = {}
|
|
|
|
# allow modelPath as argument, useful for page-title 'action.new_model' modelPath='models.projects.site' etc
|
|
if modelPath = @get('modelPath')
|
|
options.model = t(modelPath)
|
|
|
|
# interpret the given argument as a translation string if it matches the characteristics
|
|
title = tspan(title, options) if is_translation_path(title)
|
|
|
|
title.htmlSafe()
|
|
|
|
actions:
|
|
toggleCollapsed: -> @toggleProperty('collapsed')
|
|
|
|
Component.reopenClass
|
|
positionalParams: ['titleSpec']
|
|
|
|
export default Component
|