Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

631 B
Raw Blame
module OpenProject
  module Plugins
    module FrontendLinking
      class ErbContext
        def initialize(plugins)
          @plugins = plugins.keys.map { |name, _| [name, importable_name(name)] }
        end

        def frontend_plugins
          @plugins
        end

        def get_binding
          binding
        end

        ##
        # Convert a dash and underscore plugin name
        # to an importable module name.
        # e.g., openproject-costs => OpenprojectCosts
        def importable_name(name)
          name
            .tr("-", "_")
            .camelize(:upper)
        end
      end
    end
  end
end