Sha256: 759f68270d99d0b5a94a6d470eb9caf53b1e60ef188b2e0002e6db891993dd5b

Contents?: true

Size: 1.26 KB

Versions: 34

Compression:

Stored size: 1.26 KB

Contents

require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/view_models/index_items"
require "haml"

# TODO handle 404 gracefully

module PactBroker
  module UI
    module Controllers
      class Groups < Base
        include PactBroker::Services

        get ":name" do
          erb :'groups/show.html', {
              locals: locals(tab: "details")
            }, {
              layout: "layouts/main",
            }
        end

        get ":name/network" do
          erb :'groups/show.html', {
              locals: locals(tab: "network")
            }, {
              layout: "layouts/main",
            }
        end

        def locals(overrides)
          pacticipant = pacticipant_service.find_pacticipant_by_name(params[:name])
          {
            csv_path: "#{base_url}/groups/#{ERB::Util.url_encode(params[:name])}.csv",
            pacticipant_name: params[:name],
            repository_url: pacticipant&.repository_url,
            base_url: base_url,
            pacticipant: pacticipant,
            details_url: "#{base_url}/pacticipants/#{ERB::Util.url_encode(params[:name])}",
            network_url: "#{base_url}/pacticipants/#{ERB::Util.url_encode(params[:name])}/network"
          }.merge(overrides)
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
pact_broker-2.107.1 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.107.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.106.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.105.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.104.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.103.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.102.2 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.102.1 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.102.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.101.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.100.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.99.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.98.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.97.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.96.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.95.1 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.95.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.94.0 lib/pact_broker/ui/controllers/groups.rb
pact_broker-2.93.4 lib/pact_broker/ui/controllers/groups.rb