Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-04-13 08:39:18 +0300
committerStan Hu <stanhu@gmail.com>2016-04-14 17:24:58 +0300
commitc7e384aab23301ad0ee3559252324fa957d15db3 (patch)
treed78a59ec9a9da680dcc93508c92a09885069dd7c /lib/gitlab/gon_helper.rb
parent0c082d5e3a34d787f8b2fea0c22fa4256cf82be3 (diff)
Add spec for deletion of authorized OAuth2 application
Closes #14370 Move gon function into its own helper
Diffstat (limited to 'lib/gitlab/gon_helper.rb')
-rw-r--r--lib/gitlab/gon_helper.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb
new file mode 100644
index 00000000000..5ebaad6ca6e
--- /dev/null
+++ b/lib/gitlab/gon_helper.rb
@@ -0,0 +1,17 @@
+module Gitlab
+ module GonHelper
+ def add_gon_variables
+ gon.api_version = API::API.version
+ gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
+ gon.default_issues_tracker = Project.new.default_issue_tracker.to_param
+ gon.max_file_size = current_application_settings.max_attachment_size
+ gon.relative_url_root = Gitlab.config.gitlab.relative_url_root
+ gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class
+
+ if current_user
+ gon.current_user_id = current_user.id
+ gon.api_token = current_user.private_token
+ end
+ end
+ end
+end