Advertisement
Guest User

Untitled

a guest
Jul 24th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. .container
  2. .row
  3. = link_to "Add new task", "#new_task", class:"fancybox btn btn-primary"
  4. .hidden
  5. #new_task
  6. = form_for @task, remote: true do |f|
  7. .field
  8. = f.hidden_field :user_id, :value => current_user.id
  9. .field
  10. = f.label :title
  11. = f.text_field :title, class:"form-control"
  12. .field
  13. = f.label :description
  14. = f.text_area :description, class:"form-control"
  15. .field
  16. = f.label "Choose user"
  17. br/
  18. = collection_select( :task, :user_ids, User.all, :id, :email, {}, { :multiple => true } )
  19.  
  20. .actions = f.submit class:"btn btn-raised btn-primary"
  21.  
  22. javascript:
  23. $(document).ready(function() {
  24. $("a.fancybox").fancybox();
  25. });
  26.  
  27. def create
  28. @task = Task.new(task_params)
  29. @task.author = current_user.email
  30. respond_to do |format|
  31. if @task.save
  32. format.html { redirect_to @task, notice: 'Task was successfully created.' }
  33. format.json { render :show, status: :created, location: @task }
  34. format.js
  35. else
  36. format.html { render :new }
  37. format.json { render json: @task.errors, status: :unprocessable_entity }
  38. format.js
  39. end
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement