codecombat/app/views/i18n/I18NEditPollView.coffee

22 lines
736 B
CoffeeScript
Raw Normal View History

2015-03-07 19:30:25 -05:00
I18NEditModelView = require './I18NEditModelView'
Poll = require 'models/Poll'
module.exports = class I18NEditPollView extends I18NEditModelView
id: "i18n-edit-poll-view"
modelClass: Poll
buildTranslationList: ->
lang = @selectedLanguage
# name, description
if i18n = @model.get('i18n')
if name = @model.get('name')
@wrapRow "Poll name", ['name'], name, i18n[lang]?.name, []
if description = @model.get('description')
@wrapRow "Poll description", ['description'], description, i18n[lang]?.description, []
# answers
for answer, index in @model.get('answers') ? []
if i18n = answer.i18n
@wrapRow 'Answer', ['text'], answer.text, i18n[lang]?.text, ['answers', index]