diff options
author | Rydkin Maxim <maks.rydkin@gmail.com> | 2017-03-28 23:27:16 +0300 |
---|---|---|
committer | Rydkin Maxim <maks.rydkin@gmail.com> | 2017-04-04 21:11:25 +0300 |
commit | 2575661865be0cd230993950b78e0b4550694f78 (patch) | |
tree | ebc564a62dcfcd95a0674071370511bc52334159 | |
parent | b9f7d4b45e0456c35d8e95977bb2f9281cde69b4 (diff) | |
download | gitlab-ce-2575661865be0cd230993950b78e0b4550694f78.tar.gz |
replace helper with decorator
-rw-r--r-- | app/helpers/ci_status_helper.rb | 4 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 1 | ||||
-rw-r--r-- | app/serializers/pipeline_entity.rb | 2 | ||||
-rw-r--r-- | app/views/projects/builds/_header.html.haml | 12 |
4 files changed, 9 insertions, 10 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 2db95729dd9..2de9e0de310 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -121,8 +121,4 @@ module CiStatusHelper status.respond_to?(:label) && status.respond_to?(:icon) end - - def status_title(pipeline) - Ci::PipelinePresenter.new(pipeline).status_title - end end diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 5e88ba0c170..9ef35ebdd50 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -4,6 +4,7 @@ module Ci include HasStatus include Importable include AfterCommitQueue + include Presentable belongs_to :project belongs_to :user diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb index c6b80dc0952..78af8b51709 100644 --- a/app/serializers/pipeline_entity.rb +++ b/app/serializers/pipeline_entity.rb @@ -84,6 +84,6 @@ class PipelineEntity < Grape::Entity end def status_tooltip - Ci::PipelinePresenter.new(pipeline).status_title + pipeline.present(current_user: request.user).status_title end end diff --git a/app/views/projects/builds/_header.html.haml b/app/views/projects/builds/_header.html.haml index aeb1dba4b3f..67da50646c7 100644 --- a/app/views/projects/builds/_header.html.haml +++ b/app/views/projects/builds/_header.html.haml @@ -1,14 +1,16 @@ +- pipeline = @build.pipeline.present(current_user: current_user) + .content-block.build-header.top-area .header-content - = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false, title: status_title(@build.pipeline) + = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false, title: pipeline.status_title Job %strong.js-build-id ##{@build.id} in pipeline - = link_to pipeline_path(@build.pipeline) do - %strong ##{@build.pipeline.id} + = link_to pipeline_path(pipeline) do + %strong ##{pipeline.id} for commit - = link_to namespace_project_commit_path(@project.namespace, @project, @build.pipeline.sha) do - %strong= @build.pipeline.short_sha + = link_to namespace_project_commit_path(@project.namespace, @project, pipeline.sha) do + %strong= pipeline.short_sha from = link_to namespace_project_commits_path(@project.namespace, @project, @build.ref) do %code |