# File app/controllers/settings/projects_controller.rb, line 7 def show respond_to do |format| format.html format.json { render json: settings_json } end end
# File app/controllers/settings/projects_controller.rb, line 14 def update columns = (params[:columns] || {}).keys.map(&:intern) if @settings.update_attributes(columns: columns) respond_to do |format| format.html { redirect_to(projects_path) } format.json { render json: settings_json } end else render(action: :show) # Expect #show to display errors etc end end
# File app/controllers/settings/projects_controller.rb, line 29 def get_settings @settings = current_user.settings(:plan_list) # :name column should always be present (displayed as a disabled checkbox) # so it's not necessary to include it in the list here @all_columns -= [:name] end
# File app/controllers/settings/projects_controller.rb, line 36 def settings_json @settings_json ||= { selected_columns: @settings.columns, all_columns: @all_columns }.to_json end