mysociety/alaveteli

View on GitHub
app/controllers/projects/projects_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
# View and manage Projects
class Projects::ProjectsController < Projects::BaseController
  before_action :authenticate

  def show
    authorize! :read, @project
    @leaderboard = Project::Leaderboard.new(@project)
  end

  private

  def find_project
    @project = Project.find(params[:id])
  end

  def authenticate
    authenticated? || ask_to_login(
      web: _('To join this project'),
      email: _('Then you can join this project'),
      email_subject: _('Confirm your account on {{site_name}}',
                       site_name: site_name)
    )
  end
end