Files
nairobi/app/controllers/welcome_controller.rb
rgarcia 0e097973cc Add widget feeds to homepage
Note there is some funkiness going on with class loadings
Had to create a `feed` and `widget_feed` table even though in this
first version the Widget::Feed includes only uses ActiveModel instead
of ActiveRecord, otherwise some specs failed

We’ll figure it out and clean up 😌
2018-05-28 18:17:26 +02:00

28 lines
672 B
Ruby

class WelcomeController < ApplicationController
skip_authorization_check
before_action :set_user_recommendations, only: :index, if: :current_user
layout "devise", only: [:welcome, :verification]
def index
@header = Widget::Card.header.first
@feeds = Widget::Feed.active
@cards = Widget::Card.body
end
def welcome
end
def verification
redirect_to verification_path if signed_in?
end
private
def set_user_recommendations
@recommended_debates = Debate.recommendations(current_user).sort_by_recommendations.limit(3)
@recommended_proposals = Proposal.recommendations(current_user).sort_by_recommendations.limit(3)
end
end