BigW Consortium Gitlab

gon_helper.rb 996 Bytes
Newer Older
1 2 3
module Gitlab
  module GonHelper
    def add_gon_variables
4
      gon.api_version            = 'v4'
5
      gon.default_avatar_url     = URI.join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
6
      gon.max_file_size          = current_application_settings.max_attachment_size
7
      gon.asset_host             = ActionController::Base.asset_host
8
      gon.relative_url_root      = Gitlab.config.gitlab.relative_url_root
9
      gon.shortcuts_path         = help_page_path('shortcuts')
10
      gon.user_color_scheme      = Gitlab::ColorSchemes.for_user(current_user).css_class
11 12
      gon.katex_css_url          = ActionController::Base.helpers.asset_path('katex.css')
      gon.katex_js_url           = ActionController::Base.helpers.asset_path('katex.js')
13 14 15

      if current_user
        gon.current_user_id = current_user.id
Clement Ho committed
16
        gon.current_username = current_user.username
17
        gon.current_user_fullname = current_user.name
18 19 20 21
      end
    end
  end
end