Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-10-13 12:08:10 +0300
committerPhil Hughes <me@iamphill.com>2017-10-16 13:29:30 +0300
commitb1b91aa0658d81107327884ca56f579cf6146078 (patch)
tree999ed5273e0b42aa6848b76bbfefc6acb39c85f5 /app/controllers/projects/tree_controller.rb
parent3a7623fc010832c337e0ba0eb8650d7f6fca3562 (diff)
Refactored multi-file data structure
This moves away from storing in a single array just to render the table. It now stores in a multi-dimensional array/object type where each entry in the array can have its own tree. This makes storing the data for future feature a little easier as there is only one way to store the data. Previously to insert a directory the code had to insert the directory & then the file at the right point in the array. Now the directory can be inserted anywhere & then a file can be quickly added into this directory. The rendering is still done with a single array, but this is handled through underscore. Underscore takes the array & then goes through each item to flatten it into one. It is done this way to save changing the markup away from table, keeping it as a table keeps it semantically correct.
Diffstat (limited to 'app/controllers/projects/tree_controller.rb')
-rw-r--r--app/controllers/projects/tree_controller.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index f3719059f88..d3de3509988 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -36,6 +36,7 @@ class Projects::TreeController < Projects::ApplicationController
format.json do
page_title @path.presence || _("Files"), @ref, @project.name_with_namespace
+ response.header['Is-Root'] = @path.empty?
# n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/38261
Gitlab::GitalyClient.allow_n_plus_1_calls do