Sha256: 1814bbc0eeef44fbea6444c82bf3238a68813912f89ff86ffbf203b847316a94

Contents?: true

Size: 1.75 KB

Versions: 43

Compression:

Stored size: 1.75 KB

Contents

class AceInput
  constructor: (editor)->
    @editor   = ace.edit(editor)
    @editor.$blockScrolling = Infinity
    @session  = @editor.getSession()
    @renderer = @editor.renderer
    @textarea = $("##{$(editor).data('target')}")
    @selectedMode = $(editor).data('mode')
    if @selectedMode == "et"
      @selectedMode = "ruby"
    @setOptions()
    @updateMode()
    @updateTheme()
    @bindTextarea()
    @editor.setFontSize "16px"

  setOptions: =>
    @renderer.setShowPrintMargin false
    @renderer.setHScrollBarAlwaysVisible false
    @session.setUseWorker false
    @session.setTabSize 2
    @session.setUseSoftTabs true
    @session.setFoldStyle "markbeginend"

  updateMode: =>
    mode = require("ace/mode/#{@selectedMode}").Mode
    @session.setMode new mode()

  updateTheme: =>
    @editor.setTheme require("ace/theme/github")

  bindTextarea: =>
    ace = @
    ace.session.setValue ace.textarea.val()
    ace.session.on "change", ->
      ace.textarea.val ace.session.getValue()

$(document).ready ->
  $('.select2').select2()
  # Table Row as links
  $('.table-hover tr[data-url]').on 'click', ->
    window.location.href = $(this).attr('data-url')
    return

  window.startAnimateProgress = (message) ->
    $('.content-body').prepend '<div class=\'alert-box\'></div>'
    $('.content-body .alert-box').Loadingdotdotdot('word': message).addClass 'info'
    return

  window.stopAnimateProgress = ->
    $('.alert-box').Loadingdotdotdot 'Stop'
    return

  # Modal Cancel buttons
  $('a.modal-cancel').click (e) ->
    e.preventDefault()
    $('a.close-reveal-modal').trigger 'click'
    return

  editor = []
  $('.ace-input').each (index)->
    editor.push(new AceInput(this))
    window.editor = editor

String::repeat = (num) ->
  new Array(num + 1).join this

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
express_admin-2.0.0.b app/assets/javascripts/express_admin/admin.js.coffee
express_admin-2.0.0.a app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.8.1 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.8.0 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.32 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.31 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.30 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.29 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.28 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.27 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.26 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.25 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.24 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.23 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.22 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.21 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.20 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.19 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.18 app/assets/javascripts/express_admin/admin.js.coffee
express_admin-1.7.17 app/assets/javascripts/express_admin/admin.js.coffee