Sha256: 1218fcb7f5f8d176e058c2e6c802f9bde88aff649bd2a75d0566da143bd594f3

Contents?: true

Size: 1.35 KB

Versions: 11

Compression:

Stored size: 1.35 KB

Contents

class @TypeStation.AdminBarEditor
  constructor: (@ts, @$el, @data) ->
    template = @$el.html()
    $('body').append(template)
    vex.defaultOptions.className = 'vex-theme-os'

    $('#ts-admin-bar-edit').on 'click', =>
      @ts.enable()
      false

    $('#ts-admin-bar-cancel').on 'click', =>
      @ts.disable()
      if @ts.isChanged()
        vex.dialog.confirm
          message: 'You have unsaved changes, Do you want to discard them?'
          callback: (value) ->
            if value
              window.location.reload()
      false

    $('#ts-admin-bar-save').on 'click', =>
      vex.dialog.confirm
        message: 'Are you sure you want to save changes?'
        callback: (value) =>
          if value
            @ts.save()
      false


    $titleEditor = $('#ts-admin-bar-title')
    editor = new TypeStation.TextHtmlEditor(@ts, $titleEditor, $titleEditor.data('ts'))
    @ts.editors.set $titleEditor.attr('id'), editor

    $editEditor = $('#ts-admin-bar-settings')
    editor = new TypeStation.EntityEditor(@ts, $editEditor, $editEditor.data('ts'))
    @ts.editors.set $editEditor.attr('id'), editor

  enable: ->
    $('#ts-admin-bar').removeClass('ts-hidden')
    $('#ts-admin-bar-edit').addClass('ts-hidden')

  disable: ->
    $('#ts-admin-bar').addClass('ts-hidden').removeClass 'insert-open'
    $('#ts-admin-bar-edit').removeClass('ts-hidden')

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
type_station-0.4.1 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.4.0 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.3.4 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.3.3 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.3.2 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.3.1 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.3.0 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.2.3 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.2.2 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.2.1 app/assets/javascripts/type_station/editables/admin_bar.js.coffee
type_station-0.2.0 app/assets/javascripts/type_station/editables/admin_bar.js.coffee