Commit c4667f87 authored by Matija Čupić's avatar Matija Čupić

Implement Callouts controller

parent 0dab0837
class CalloutsController < ApplicationController
before_action :callout, only: [:dismiss]
def dismiss
respond_to do |format|
format.json do
if @callout
@callout.update(dismissed_state: true)
else
Callout.create(feature_name: callout_param, dismissed_state: true, user: current_user)
end
head :ok
end
end
end
private
def callout
@callout = Callout.find_by(user: current_user, feature_name: callout_param)
end
def callout_param
params.require(:feature_name)
end
end
......@@ -90,6 +90,11 @@ Rails.application.routes.draw do
# Notification settings
resources :notification_settings, only: [:create, :update]
# Callouts
namespace :callouts do
post :dismiss
end
draw :google_api
draw :import
draw :uploads
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment