Sha256: 71c2eb728f2db1af3080c372af0c6f6b106ff78bb52993f0ecaf4fe068df56d8

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

module ClassifiedAdvertisement
  class TasksController < ApplicationController
    def calendar
      @story = Story.find params[:story_id]  
    end
    
    def events
      @story = Story.find params[:story_id]
      tasks = @story.tasks.where(:from.gte => params[:start])
      
      tasks = tasks.map do |task|
        { title: task.name, url: task_path(task), start: task.from.to_s, end: task.to.to_s }
      end
     
      render json: tasks, root: false
    end
    
    def sign_up_form
      @task = Task.find(params[:id])
      @amount = @task.vacancy.candidatures.where(user_id: current_user.id).first.try(:amount)
      
      render layout: false
    end
    
    def sign_up
      task = Task.find(params[:id])
      params[:candidature] ||= {}
      @error = task.sign_up(current_user.id, params[:candidature][:amount])
      
      render layout: false
    end
    
    def sign_out
      task = Task.find(params[:id])
      @error = task.sign_out(current_user.id)
      
      render layout: false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voluntary_classified_advertisement-0.3.1 app/controllers/classified_advertisement/tasks_controller.rb