From 8d454b8e899f39bc3fca7c00317792fcbb1e9008 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Fri, 28 Jul 2017 17:08:09 +0100 Subject: [PATCH] move new repo to shared view and only load it and repo bundle with new_repo is true --- app/views/projects/blob/show.html.haml | 1 - app/views/projects/show.html.haml | 7 ++++--- app/views/projects/tree/_tree_content.html.haml | 3 ++- app/views/projects/tree/show.html.haml | 7 ++++--- app/views/shared/_repo.html.haml | 1 + 5 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 app/views/shared/_repo.html.haml diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml index 7428bb5d3ac..ae3fbc93633 100644 --- a/app/views/projects/blob/show.html.haml +++ b/app/views/projects/blob/show.html.haml @@ -7,7 +7,6 @@ - content_for :page_specific_javascripts do = webpack_bundle_tag 'blob' = webpack_bundle_tag 'common_vue' - = webpack_bundle_tag 'repo' = render 'projects/last_push' diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 18ef1c93c3c..370516ca55e 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -5,9 +5,10 @@ = content_for :meta_tags do = auto_discovery_link_tag(:atom, project_path(@project, rss_url_options), title: "#{@project.name} activity") -- content_for :page_specific_javascripts do - = webpack_bundle_tag 'common_vue' - = webpack_bundle_tag 'repo' +- if show_new_repo? + - content_for :page_specific_javascripts do + = webpack_bundle_tag 'common_vue' + = webpack_bundle_tag 'repo' = render partial: 'flash_messages', locals: { project: @project } diff --git a/app/views/projects/tree/_tree_content.html.haml b/app/views/projects/tree/_tree_content.html.haml index 005696470fc..29e96002640 100644 --- a/app/views/projects/tree/_tree_content.html.haml +++ b/app/views/projects/tree/_tree_content.html.haml @@ -1,4 +1,5 @@ -#repo{ data: { url: repo_url(@project), 'project-name' => @project.name, refs_url: refs_namespace_project_path(@project.namespace, @project, format: "json"), project_url: namespace_project_path(@project.namespace, @project), project_id: @project.id } } +- if show_new_repo? + = render 'shared/repo', project: @project :javascript // Load last commit log for each file in tree diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index 7b173a869a5..c5a73e4c53e 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -6,9 +6,10 @@ = content_for :meta_tags do = auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, rss_url_options), title: "#{@project.name}:#{@ref} commits") -- content_for :page_specific_javascripts do - = webpack_bundle_tag 'common_vue' - = webpack_bundle_tag 'repo' +- if show_new_repo? + - content_for :page_specific_javascripts do + = webpack_bundle_tag 'common_vue' + = webpack_bundle_tag 'repo' = render "projects/commits/head" diff --git a/app/views/shared/_repo.html.haml b/app/views/shared/_repo.html.haml new file mode 100644 index 00000000000..919904a81a7 --- /dev/null +++ b/app/views/shared/_repo.html.haml @@ -0,0 +1 @@ +#repo{ data: { url: repo_url(project), project_name: project.name, refs_url: refs_project_path(project, format: :json), project_url: project_path(project), project_id: project.id } }