Sha256: 9733ffcbbea2c47270a25a6ae6c052d347e2b550800bb66743339cb681be6791

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

Volontariat.BrainstormingRoute = Ember.Route.extend
  model: (params) ->
    $('#reload_alert').slideUp()
    
    #@controllerFor('brainstorming').set 'reloading', false
    
    MessageBus.subscribe "/brainstormings/#{params.slug}", (data) =>
      #if @controllerFor('brainstorming').get('reloading')
      #  alert 'reloading still active'
      #else if (
      return if @controllerFor('brainstorming').get('dirty')
      
      if ( 
        @controllerFor('brainstorming').get('newIdeaMode') || @controllerFor('brainstorming').get('ideaId') || 
        @controllerFor('brainstorming').get('newArgumentIdeaId') || @controllerFor('brainstorming').get('argumentId')
      )
        Volontariat.reload_alert data.message
      else
        #@controllerFor('brainstorming').set 'reloading', true
        @transitionTo 'no_data'
        @transitionTo 'brainstorming', params.user_slug, params.slug 
  
    @controllerFor('brainstorming').set 'slug', params.slug
    @controllerFor('brainstorming').set 'userSlug', params.user_slug
    @controllerFor('brainstorming').set 'ideaId', null
    
    Ember.$.getJSON(
      "/api/v1/brainstorming_ideas.json?user_slug=#{params.user_slug}&brainstorming_slug=#{params.slug}"
    ).then (json) =>
      @controllerFor('brainstorming').set 'ideas', json.brainstorming_ideas
    
    Ember.$.getJSON("/api/v1/brainstormings/#{params.slug}?user_slug=#{params.user_slug}").then (json) =>
      json.brainstorming
      
  closeReloadAlert: (->
    $('#reload_alert').slideUp()
  ).on('deactivate')

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voluntary_brainstorming-0.0.2 app/assets/javascripts/voluntary_brainstorming/routes/brainstorming_route.js.coffee