Commit 8759770c authored by Kamil Trzcinski's avatar Kamil Trzcinski

Re-use as much of views as possible

parent 1ef8be76
- is_playable = subject.playable? && can?(current_user, :update_build, @project)
%li.build{class: ("playable" if is_playable)}
.curve
.build-content
- if is_playable
= link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do
= render_status_with_link('build', 'play')
.ci-status-text= subject.name
- elsif can?(current_user, :read_build, @project)
= link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do
= render_status_with_link('build', subject.status)
.ci-status-text= subject.name
- else
= render_status_with_link('build', subject.status)
= ci_icon_for_status(subject.status)
- if is_playable
= link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do
= render_status_with_link('build', 'play')
.ci-status-text= subject.name
- elsif can?(current_user, :read_build, @project)
= link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do
= render_status_with_link('build', subject.status)
.ci-status-text= subject.name
- else
= render_status_with_link('build', subject.status)
= ci_icon_for_status(subject.status)
......@@ -39,13 +39,7 @@
= stage.titleize
.builds-container
%ul
- status_groups = statuses.group_by(&:group_name)
- status_groups.each do |group_name, grouped_statuses|
- if grouped_statuses.one?
- status = grouped_statuses.first
= render "projects/#{status.to_partial_path}_pipeline", subject: status
- else
= render "projects/commit/pipeline_grouped_status", name: group_name, subject: grouped_statuses
= render "projects/commit/pipeline_stage", statuses: statuses
- if pipeline.yaml_errors.present?
......
%li.build
.curve
.build-content
- group_status = CommitStatus.where(id: subject).status
= render_status_with_link('build', group_status)
.dropdown.inline
%button.dropdown-menu-toggle{type: 'button', data: {toggle: 'dropdown'}}
%span.ci-status-text
= name
%span.badge= subject.length
%ul.dropdown-menu.grouped-pipeline-dropdown
.arrow
- subject.each do |status|
-# = render "projects/#{status.to_partial_path}_pipeline", subject: status
- is_playable = status.playable? && can?(current_user, :update_build, @project)
%li
- if is_playable
= link_to play_namespace_project_build_path(status.project.namespace, status.project, status, return_to: request.original_url), method: :post, title: 'Play' do
= render_status_with_link('build', 'play')
.ci-status-text= status.name
- elsif can?(current_user, :read_build, @project)
= link_to namespace_project_build_path(status.project.namespace, status.project, status) do
= render_status_with_link('build', status.status)
.ci-status-text= status.name
- else
= render_status_with_link('build', status.status)
= ci_icon_for_status(status.status)
- status_groups = statuses.group_by(&:group_name)
- status_groups.each do |group_name, grouped_statuses|
- if grouped_statuses.one?
- status = grouped_statuses.first
- is_playable = status.playable? && can?(current_user, :update_build, @project)
%li.build{class: ("playable" if is_playable)}
.curve
.build-content
= render "projects/#{status.to_partial_path}_pipeline", subject: status
- else
%li.build
.curve
.build-content
= render "projects/commit/pipeline_status_group", name: group_name, subject: grouped_statuses
- group_status = CommitStatus.where(id: subject).status
= render_status_with_link('build', group_status)
.dropdown.inline
%button.dropdown-menu-toggle{type: 'button', data: {toggle: 'dropdown'}}
%span.ci-status-text
= name
%span.badge= subject.length
%ul.dropdown-menu.grouped-pipeline-dropdown
.arrow
- subject.each do |status|
= render "projects/#{status.to_partial_path}_pipeline", subject: status
%li.build
.curve
.build-content
- if subject.target_url
- link_to subject.target_url do
= render_status_with_link('commit status', subject.status)
%span.ci-status-text= subject.name
- else
= render_status_with_link('commit status', subject.status)
%span.ci-status-text= subject.name
- if subject.target_url
- link_to subject.target_url do
= render_status_with_link('commit status', subject.status)
%span.ci-status-text= subject.name
- else
= render_status_with_link('commit status', subject.status)
%span.ci-status-text= subject.name
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment