Sha256: 6871113f5b5564d9442897bde609ce609fe71cd483d60efaffaacac303a83fc2

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

# encoding: utf-8
#--
#   Copyright (C) 2012 Gitorious AS
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#++

module Dolt
  module View
    module Object
      def object_url(repository, ref, path, object)
        return object[:url] if object[:type] == :submodule
        url = "/#{object[:type]}/#{ref}:#{object_path(path, object)}"
        repo_url(repository, url)
      end

      def object_path(root, object)
        File.join(root, object[:name]).sub(/^\//, "")
      end

      def object_icon_class(entry)
        case entry[:type]
        when :blob
          "icon-file"
        when :tree
          "icon-folder-close"
        when :submodule
          "icon-hdd"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
libdolt-0.6.0 lib/libdolt/view/object.rb
dolt-0.5.1 ./lib/dolt/view/object.rb
dolt-0.5.0 ./lib/dolt/view/object.rb
dolt-0.4.3 ./lib/dolt/view/object.rb