Sha256: 79e933e5cf5e04aea3c7b01e71ffcb2d75a06c3edcddc57ea95c650d9ea1669a

Contents?: true

Size: 865 Bytes

Versions: 1

Compression:

Stored size: 865 Bytes

Contents

class Perkins.Views.Org extends Backbone.View
  el: "#main-content"

  events:
    "click .add-repo" : "addRepo"

  initialize: (opts={})->
    @model = new Perkins.Models.Org(name: opts.name)

  template: ->
    JST["org"](@model.toJSON())

  render: ()->
    @model.fetch
      success: =>
        $(@el).html(@template())

  addRepo: (ev)->
    target = $(ev.currentTarget)
    target.text("adding...")
    target.addClass("btn-diabled")
    repo_id = target.data('gb-id')
    url = "/repos/add/#{repo_id}.json"

    #add repo & refresh sidebar on success.
    $.ajax
      url: url
      success: ->
        sidebar = Applayout.appLayout.sidebar.currentView
        sidebar.repos.reset()
        sidebar.repos.fetch()
    false

  close: ()->
    $(@el).html("")
    console.log "CLOSED VIEW CALLED"
    @.stopListening()
    @.undelegateEvents()
    @.unbind()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
perkins-0.0.5 lib/perkins/assets/javascripts/perkins/v/orgs.js.coffee