Class: UserPreferencesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/user_preferences_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#is_data_controller, #is_task_controller, #meta_data, #meta_description, #meta_keywords, #meta_title, #page_title, #site_name

Instance Method Summary (collapse)

Methods inherited from ApplicationController

#clear_project_and_user_variables, #digest_cookie, #digested_cookie_exists?, #disable_turbolinks, #intercept_api, #invalid_object, #is_data_controller?, #is_task_controller?, #log_user_recent_route, #notice_user, #project_matches, #record_not_found, #set_project_and_user_variables, #set_project_from_params, #token_authenticate

Methods included from ProjectsHelper

#project_link, #project_tag, #projects_list, #projects_search_form

Instance Method Details

- (Object) favorite_page



4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/user_preferences_controller.rb', line 4

def favorite_page
  sessions_current_user.add_page_to_favorites(valid_params)
  respond_to do |format|
    format.html {
      redirect_back(fallback_location: (request.referer || root_path), notice: 'Added page to favorites.')
    }
    format.js {
       }
  end
end

- (Object) unfavorite_page



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/user_preferences_controller.rb', line 15

def unfavorite_page
  sessions_current_user.remove_page_from_favorites(valid_params)
  respond_to do |format|
    format.html {
      redirect_back(fallback_location: (request.referer || root_path), notice: 'Removed page from favorites.')
    }
    format.js { 
        }
  end
end

- (Object) valid_params (protected)



28
29
30
# File 'app/controllers/user_preferences_controller.rb', line 28

def valid_params
  params.permit(:name, :kind).merge(project_id: sessions_current_project_id)
end