Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .container
- .row
- = link_to "Add new task", "#new_task", class:"fancybox btn btn-primary"
- .hidden
- #new_task
- = form_for @task, remote: true do |f|
- .field
- = f.hidden_field :user_id, :value => current_user.id
- .field
- = f.label :title
- = f.text_field :title, class:"form-control"
- .field
- = f.label :description
- = f.text_area :description, class:"form-control"
- .field
- = f.label "Choose user"
- br/
- = collection_select( :task, :user_ids, User.all, :id, :email, {}, { :multiple => true } )
- .actions = f.submit class:"btn btn-raised btn-primary"
- javascript:
- $(document).ready(function() {
- $("a.fancybox").fancybox();
- });
- def create
- @task = Task.new(task_params)
- @task.author = current_user.email
- respond_to do |format|
- if @task.save
- format.html { redirect_to @task, notice: 'Task was successfully created.' }
- format.json { render :show, status: :created, location: @task }
- format.js
- else
- format.html { render :new }
- format.json { render json: @task.errors, status: :unprocessable_entity }
- format.js
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement