Class: ClassifiedAdvertisement::TasksController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/classified_advertisement/tasks_controller.rb

Instance Method Summary collapse

Instance Method Details

#calendarObject



3
4
5
# File 'app/controllers/classified_advertisement/tasks_controller.rb', line 3

def calendar
  @story = Story.find params[:story_id]  
end

#eventsObject



7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/classified_advertisement/tasks_controller.rb', line 7

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

#sign_outObject



33
34
35
36
37
38
# File 'app/controllers/classified_advertisement/tasks_controller.rb', line 33

def sign_out
  task = Task.find(params[:id])
  @error = task.sign_out(current_user.id)
  
  render layout: false
end

#sign_upObject



25
26
27
28
29
30
31
# File 'app/controllers/classified_advertisement/tasks_controller.rb', line 25

def 
  task = Task.find(params[:id])
  params[:candidature] ||= {}
  @error = task.(current_user.id, params[:candidature][:amount])
  
  render layout: false
end

#sign_up_formObject



18
19
20
21
22
23
# File 'app/controllers/classified_advertisement/tasks_controller.rb', line 18

def 
  @task = Task.find(params[:id])
  @amount = @task.vacancy.candidatures.where(user_id: current_user.id).first.try(:amount)
  
  render layout: false
end