Fix bug of json request url
This commit is contained in:
parent
d8cc8d7adc
commit
95a78fb53b
2 changed files with 11 additions and 4 deletions
|
@ -5,16 +5,16 @@ class Projects::NetworkController < Projects::ApplicationController
|
|||
before_action :require_non_empty_project
|
||||
before_action :assign_ref_vars
|
||||
before_action :authorize_download_code!
|
||||
before_action :assign_extended_sha1
|
||||
|
||||
def show
|
||||
@url = namespace_project_network_path(@project.namespace, @project, @ref, @options.merge(format: :json))
|
||||
@commit_url = namespace_project_commit_path(@project.namespace, @project, 'ae45ca32').gsub("ae45ca32", "%s")
|
||||
@commit = @repo.commit(params[:extended_sha1]) if params[:extended_sha1].present?
|
||||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
if params[:extended_sha1].present? && !@commit
|
||||
flash.now[:alert] = "Git revision '#{params[:extended_sha1]}' does not exist."
|
||||
if @options[:extended_sha1] && !@commit
|
||||
flash.now[:alert] = "Git revision '#{@options[:extended_sha1]}' does not exist."
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -23,4 +23,11 @@ class Projects::NetworkController < Projects::ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def assign_extended_sha1
|
||||
return if params[:extended_sha1].blank?
|
||||
|
||||
@options[:extended_sha1] = params[:extended_sha1]
|
||||
@commit = @repo.commit(@options[:extended_sha1])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
.project-network
|
||||
.controls
|
||||
= form_tag namespace_project_network_path(@project.namespace, @project, @id), method: :get, class: 'form-inline network-form' do |f|
|
||||
= text_field_tag :extended_sha1, params[:extended_sha1], placeholder: "Git revision", class: 'search-input form-control input-mx-250 search-sha'
|
||||
= text_field_tag :extended_sha1, @options[:extended_sha1], placeholder: "Git revision", class: 'search-input form-control input-mx-250 search-sha'
|
||||
= button_tag class: 'btn btn-success' do
|
||||
= icon('search')
|
||||
.inline.prepend-left-20
|
||||
|
|
Loading…
Reference in a new issue