summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/application_controller.rb2
-rw-r--r--app/controllers/projects/graphs_controller.rb22
-rw-r--r--app/controllers/projects/merge_requests_controller.rb2
3 files changed, 24 insertions, 2 deletions
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb
index d3f926b62bc..c2aaf094e68 100644
--- a/app/controllers/projects/application_controller.rb
+++ b/app/controllers/projects/application_controller.rb
@@ -28,7 +28,7 @@ class Projects::ApplicationController < ApplicationController
private
- def ci_enabled
+ def builds_enabled
return render_404 unless @project.builds_enabled?
end
diff --git a/app/controllers/projects/graphs_controller.rb b/app/controllers/projects/graphs_controller.rb
index 418b92040bc..a8f47069bb4 100644
--- a/app/controllers/projects/graphs_controller.rb
+++ b/app/controllers/projects/graphs_controller.rb
@@ -5,7 +5,7 @@ class Projects::GraphsController < Projects::ApplicationController
before_action :require_non_empty_project
before_action :assign_ref_vars
before_action :authorize_download_code!
- before_action :ci_enabled, only: :ci
+ before_action :builds_enabled, only: :ci
def show
respond_to do |format|
@@ -34,6 +34,26 @@ class Projects::GraphsController < Projects::ApplicationController
@charts[:build_times] = Ci::Charts::BuildTime.new(ci_project)
end
+ def languages
+ @languages = Linguist::Repository.new(@repository.rugged, @repository.rugged.head.target_id).languages
+ total = @languages.map(&:last).sum
+
+ @languages = @languages.map do |language|
+ name, share = language
+ color = Digest::SHA256.hexdigest(name)[0...6]
+ {
+ value: (share.to_f * 100 / total).round(2),
+ label: name,
+ color: "##{color}",
+ highlight: "##{color}"
+ }
+ end
+
+ @languages.sort! do |x, y|
+ y[:value] <=> x[:value]
+ end
+ end
+
private
def fetch_graph
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 3f47f2ddb2c..c5fb49de46a 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -264,6 +264,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request_diff = @merge_request.merge_request_diff
+ @ci_commit = @merge_request.ci_commit
+
if @merge_request.locked_long_ago?
@merge_request.unlock_mr
@merge_request.close