Commit f86a5077 authored by Lin Jen-Shin's avatar Lin Jen-Shin
parent 11f840bf
...@@ -34,7 +34,7 @@ class Projects::ArtifactsController < Projects::ApplicationController ...@@ -34,7 +34,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
redirect_to namespace_project_build_path(project.namespace, project, build) redirect_to namespace_project_build_path(project.namespace, project, build)
end end
def search def latest_succeeded
path = params[:path] path = params[:path]
if %w[download browse file].include?(path) if %w[download browse file].include?(path)
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
%li.dropdown-header Previous Artifacts %li.dropdown-header Previous Artifacts
- artifacts.each do |job| - artifacts.each do |job|
%li %li
= link_to search_namespace_project_artifacts_path(@project.namespace, @project, branch.name, 'download', job: job.name), rel: 'nofollow' do = link_to latest_succeeded_namespace_project_artifacts_path(@project.namespace, @project, branch.name, 'download', job: job.name), rel: 'nofollow' do
%span Download '#{job.name}' %span Download '#{job.name}'
- if can_remove_branch?(@project, branch.name) - if can_remove_branch?(@project, branch.name)
......
...@@ -26,5 +26,5 @@ ...@@ -26,5 +26,5 @@
%li.dropdown-header Previous Artifacts %li.dropdown-header Previous Artifacts
- artifacts.each do |job| - artifacts.each do |job|
%li %li
= link_to search_namespace_project_artifacts_path(@project.namespace, @project, @ref, 'download', job: job.name), rel: 'nofollow' do = link_to latest_succeeded_namespace_project_artifacts_path(@project.namespace, @project, @ref, 'download', job: job.name), rel: 'nofollow' do
%span Download '#{job.name}' %span Download '#{job.name}'
...@@ -24,5 +24,5 @@ ...@@ -24,5 +24,5 @@
%li.dropdown-header Previous Artifacts %li.dropdown-header Previous Artifacts
- artifacts.each do |job| - artifacts.each do |job|
%li %li
= link_to search_namespace_project_artifacts_path(project.namespace, project, ref, 'download', job: job.name), rel: 'nofollow' do = link_to latest_succeeded_namespace_project_artifacts_path(project.namespace, project, ref, 'download', job: job.name), rel: 'nofollow' do
%span Download '#{job.name}' %span Download '#{job.name}'
...@@ -765,9 +765,10 @@ Rails.application.routes.draw do ...@@ -765,9 +765,10 @@ Rails.application.routes.draw do
resources :artifacts, only: [] do resources :artifacts, only: [] do
collection do collection do
get :search, path: ':ref_name/*path', get :latest_succeeded,
format: false, path: ':ref_name/*path',
constraints: { ref_name: /.+/ } # could have / format: false,
constraints: { ref_name: /.+/ } # could have /
end end
end end
end end
......
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