Sha256: 1b9d43c7a3546d80afbd1be3431f5e5a985472704ed976719e435eee354e0d37

Contents?: true

Size: 973 Bytes

Versions: 3

Compression:

Stored size: 973 Bytes

Contents

module Trinidad
  module Sandbox
    module Helpers
      module View
        def link_to_deploy
          %q{<a href="deploy">deploy</a>}
        end

        def render_parameters(parameters)
          render = ''

          parameters.keys.sort.each_with_index do |key, index|
            column = find_column(parameters, index)

            klass = "column#{column}"
            klass << " reset" if column == 2 && find_column(parameters, index - 1) == 1

            render << %Q{<li class="#{klass}">#{key} => #{parameters[key]}</li>}
          end

          render
        end

        def render_host_name
          $servlet_context.get_attribute('host_name') || 'HOST_NAME'
        end

        def render_deploy_token
          $servlet_context.get_attribute('deploy_token') || 'SECRET_DEPLOY_TOKEN'
        end

        private
        def find_column(parameters, index)
          (parameters.length / 2) > index ? 1 : 2
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trinidad_sandbox_extension-1.0.2 lib/trinidad_sandbox_extension/app/helpers/view.rb
trinidad_sandbox_extension-1.0.1 lib/trinidad_sandbox_extension/app/helpers/view.rb
trinidad_sandbox_extension-1.0.0 lib/trinidad_sandbox_extension/app/helpers/view.rb