Sha256: b41148198baf01e02682f8a472e249b07d453c920c288bdf59cb96de52484078

Contents?: true

Size: 1.8 KB

Versions: 2

Compression:

Stored size: 1.8 KB

Contents

# frozen_string_literal: true
# Copyright 2016 Liqwyd Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Cyclid
  module UI
    module Controllers
      # Controller for Organization related endpoints (including Jobs)
      class Organization < Base
        get '/:name' do
          authenticate!

          # Build breadcrumbs
          name = params[:name]

          @crumbs = []
          @crumbs << { 'name' => name.capitalize }

          @organization = name
          @linkback_url = "/#{name}"

          api_server = Cyclid.config.client_api
          @organization_url = "#{api_server}/organizations/#{params[:name]}"
          @current_user = current_user

          mustache :organization
        end

        get '/:name/job/:id' do
          authenticate!

          # Build breadcrumbs
          name = params[:name]
          id = params[:id]

          @crumbs = []
          @crumbs << { 'url' => "/#{name}", 'name' => name.capitalize }
          @crumbs << { 'name' => "Job ##{id}" }

          @organization = name
          @linkback_url = "/#{name}"

          api_server = Cyclid.config.client_api
          @job_url = "#{api_server}/organizations/#{params[:name]}/jobs/#{params[:id]}"
          @job_id = id
          @current_user = current_user

          mustache :job
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cyclid-ui-0.1.1 app/cyclid_ui/controllers/organization.rb
cyclid-ui-0.1.0 app/cyclid_ui/controllers/organization.rb