holderdeord/hdo-site

View on GitHub
app/controllers/parties_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class PartiesController < ApplicationController
  hdo_caches_page :index, :show

  def index
    @parties = Party.order(:name).all
  end

  def show
    @party           = Party.find(params[:id])
    @representatives = @party.current_representatives
    @representatives = @representatives.sort_by { |e| e.has_image? ? 0 : 1 }

    @propositions_feed = Hdo::Utils::PropositionsFeed.for_model(
      @party,
      see_all: true,
      title: "Siste forslag fra #{@party.name}",
      show_parties: AppConfig.parties_in_proposition_feed
    )
  end
end