mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-02 22:11:48 +01:00
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@575 a4c988fc-2ded-0310-b66e-134b36920a42
49 lines
1.1 KiB
Ruby
49 lines
1.1 KiB
Ruby
class NotesController < ApplicationController
|
|
|
|
def index
|
|
@all_notes = current_user.notes
|
|
@page_title = "TRACKS::All notes"
|
|
respond_to do |format|
|
|
format.html
|
|
format.xml { render :xml => @all_notes.to_xml( :except => :user_id ) }
|
|
end
|
|
end
|
|
|
|
def show
|
|
@note = current_user.notes.find(params['id'])
|
|
@page_title = "TRACKS::Note " + @note.id.to_s
|
|
end
|
|
|
|
def create
|
|
note = current_user.notes.build
|
|
note.attributes = params["new_note"]
|
|
|
|
if note.save
|
|
render :partial => 'notes_summary', :object => note
|
|
else
|
|
render :text => ''
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
note = current_user.notes.find(params['id'])
|
|
if note.destroy
|
|
render :text => ''
|
|
else
|
|
notify :warning, "Couldn't delete note \"#{note.id}\""
|
|
render :text => ''
|
|
end
|
|
end
|
|
|
|
def update
|
|
note = current_user.notes.find(params['id'])
|
|
note.attributes = params["note"]
|
|
if note.save
|
|
render :partial => 'notes', :object => note
|
|
else
|
|
notify :warning, "Couldn't update note \"#{note.id}\""
|
|
render :text => ''
|
|
end
|
|
end
|
|
|
|
end
|