mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 17:50:13 +01:00
refactor sidebar and finish migration of notes
This commit is contained in:
parent
94b5aa2346
commit
ea1ca130f1
18 changed files with 138 additions and 97 deletions
|
|
@ -26,24 +26,18 @@ class NotesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
note = current_user.notes.build
|
||||
note.attributes = params["note"]
|
||||
@note = current_user.notes.build
|
||||
@note.attributes = params["note"]
|
||||
|
||||
saved = note.save
|
||||
@saved = @note.save
|
||||
|
||||
respond_to do |format|
|
||||
format.js do
|
||||
if note.save
|
||||
render :partial => 'notes_summary', :object => note
|
||||
else
|
||||
render :text => ''
|
||||
end
|
||||
end
|
||||
format.js
|
||||
format.xml do
|
||||
if saved
|
||||
head :created, :location => note_url(note), :text => "new note with id #{note.id}"
|
||||
if @saved
|
||||
head :created, :location => note_url(@note), :text => "new note with id #{@note.id}"
|
||||
else
|
||||
render_failure note.errors.full_messages.join(', ')
|
||||
render_failure @note.errors.full_messages.join(', ')
|
||||
end
|
||||
end
|
||||
format.html do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue