Class: NotesController
Instance Method Summary
collapse
#admin_login_required, #admin_or_self_login_required, #all_done_todos_for, #boolean_param, cas_enabled?, #cas_enabled?, #count_deferred_todos, #count_undone_todos, #count_undone_todos_phrase, #done_todos_for, #enable_mobile_content_negotiation, #for_autocomplete, #format_date, #format_dependencies_as_json_for_auto_complete, #handle_unverified_request, #init_data_for_sidebar, #init_hidden_todo_counts, #init_not_done_counts, #mobile?, #notify, #openid_enabled?, openid_enabled?, #parse_date_per_user_prefs, prefered_auth?, #prefered_auth?, #redirect_back_or_home, #render_failure, #sanitize, #set_group_view_by, #set_locale, #set_session_expiration, #set_time_zone, #set_zindex_counter, #todo_xml_params
Methods included from Common
like_operator, #set_theme
#access_denied, #authorize?, #basic_auth_denied, #current_user, #get_basic_auth_data, #get_current_user, #logged_in?, #login_from_cookie, #login_optional, #login_or_feed_token_required, #login_required, #logout_user, #prefs, #protect?, #redirect_back_or_default, #redirect_to_login, #set_current_user, #store_location
Instance Method Details
#create ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/notes_controller.rb', line 24
def create
@note = current_user.notes.build
@note.attributes = note_params
@saved = @note.save
respond_to do |format|
format.js
format.xml do
if @saved
head :created, :location => note_url(@note), :text => "new note with id #{@note.id}"
else
render_failure @note.errors.full_messages.join(', ')
end
end
format.html do
render :body => 'unexpected request for html rendering'
end
end
end
|
#destroy ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'app/controllers/notes_controller.rb', line 55
def destroy
@note = current_user.notes.find(params['id'])
@note.destroy
set_source_view
respond_to do |format|
format.html
format.js { @down_count = current_user.notes.size }
end
end
|
#index ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'app/controllers/notes_controller.rb', line 4
def index
@all_notes = current_user.notes
@count = @all_notes.size
@page_title = "TRACKS::All notes"
@source_view = 'note_list'
respond_to do |format|
format.html
format.xml { render :xml => @all_notes.to_xml(:root => :notes, :except => :user_id) }
end
end
|
#note_params ⇒ Object
74
75
76
|
# File 'app/controllers/notes_controller.rb', line 74
def note_params
params.require(:note).permit(:project_id, :body)
end
|
#set_source_view ⇒ Object
68
69
70
|
# File 'app/controllers/notes_controller.rb', line 68
def set_source_view
@source_view = params['_source_view'] || 'note'
end
|
#show ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'app/controllers/notes_controller.rb', line 15
def show
@note = current_user.notes.find(params['id'])
@page_title = "TRACKS::Note " + @note.id.to_s
respond_to do |format|
format.html
format.m
end
end
|
#update ⇒ Object
45
46
47
48
49
50
51
52
53
|
# File 'app/controllers/notes_controller.rb', line 45
def update
@note = current_user.notes.find(params['id'])
@note.attributes = note_params
@saved = @note.save
respond_to do |format|
format.html
format.js { render }
end
end
|