From 50c329abaab7aca0969552b7cfd15225ba0a1728 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 25 Jul 2014 21:13:52 +0400 Subject: [PATCH] Hide 'Create Build Lists of dependent projects' button if no projects --- app/views/projects/build_lists/show.html.haml | 3 ++- app/views/projects/build_lists/show.json.jbuilder | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/projects/build_lists/show.html.haml b/app/views/projects/build_lists/show.html.haml index e5cf8fe33..b7949aff1 100644 --- a/app/views/projects/build_lists/show.html.haml +++ b/app/views/projects/build_lists/show.html.haml @@ -225,7 +225,8 @@ - if can_run_dependent_build_lists?(@build_list) = link_to t('projects.build_lists.dependent_projects.title'), dependent_projects_build_list_path(@build_list), - class: 'button' + class: 'button', + 'ng-show' => 'build_list.dependent_projects_exists' %div{'ng-show' => "build_list.status == #{BuildList::BUILD_STARTED}"} = render 'shared/log', { build_started: true, get_log_path: log_build_list_path(@build_list) } diff --git a/app/views/projects/build_lists/show.json.jbuilder b/app/views/projects/build_lists/show.json.jbuilder index 26bec88eb..007a7d7d1 100644 --- a/app/views/projects/build_lists/show.json.jbuilder +++ b/app/views/projects/build_lists/show.json.jbuilder @@ -51,6 +51,7 @@ json.build_list do json.url file_store_results_url(result['sha1'], result['file_name']) end if @build_list.new_core? && @build_list.results.present? + dependent_projects_exists = false json.packages @build_list.packages do |package| json.(package, :id, :name, :fullname, :release, :version, :sha1, :epoch) json.url "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}" if package.sha1 @@ -60,10 +61,13 @@ json.build_list do json.name project.name_with_owner json.dependent_packages packages json.new_url new_project_build_list_path(project) + + dependent_projects_exists = true end if @build_list.save_to_platform.main? end if @build_list.packages.present? + json.dependent_projects_exists dependent_projects_exists json.item_groups do |group| @item_groups.each_with_index do |group, level|