2011-11-25 14:10:56 +00:00
|
|
|
#= require ../shared/form_view
|
2011-11-27 16:22:54 +00:00
|
|
|
#= require ../sites/domains_view
|
2011-11-25 14:10:56 +00:00
|
|
|
|
|
|
|
Locomotive.Views.CurrentSite ||= {}
|
|
|
|
|
2011-11-27 16:22:54 +00:00
|
|
|
class Locomotive.Views.CurrentSite.EditView extends Locomotive.Views.Shared.FormView
|
|
|
|
|
|
|
|
el: '#content'
|
|
|
|
|
|
|
|
initialize: ->
|
|
|
|
@model = new Locomotive.Models.CurrentSite(@options.site)
|
|
|
|
|
|
|
|
window.foo = @model
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
super()
|
|
|
|
|
|
|
|
@render_domain_entries()
|
|
|
|
|
|
|
|
@enable_liquid_editing()
|
|
|
|
|
|
|
|
render_domain_entries: ->
|
|
|
|
@domains_view = new Locomotive.Views.Site.DomainsView model: @model, errors: @options.errors
|
|
|
|
|
|
|
|
@$('#site_domains_input label').after(@domains_view.render().el)
|
|
|
|
|
|
|
|
enable_liquid_editing: ->
|
|
|
|
input = @$('#site_robots_txt')
|
|
|
|
@editor = CodeMirror.fromTextArea input.get()[0],
|
|
|
|
mode: 'liquid'
|
|
|
|
autoMatchParens: false
|
|
|
|
lineNumbers: false
|
|
|
|
passDelay: 50
|
|
|
|
tabMode: 'shift'
|
|
|
|
theme: 'default'
|
|
|
|
onChange: (editor) => @model.set(robots_txt: editor.getValue())
|
|
|
|
|
|
|
|
|
|
|
|
|