Commit 6bd9a9fb authored by Douwe Maan's avatar Douwe Maan

Set vars used by tree view in project show action.

parent 6f085653
class ProjectsController < ApplicationController class ProjectsController < ApplicationController
include ExtractsPath
prepend_before_filter :render_go_import, only: [:show] prepend_before_filter :render_go_import, only: [:show]
skip_before_action :authenticate_user!, only: [:show, :activity] skip_before_action :authenticate_user!, only: [:show, :activity]
before_action :project, except: [:new, :create] before_action :project, except: [:new, :create]
before_action :repository, except: [:new, :create] before_action :repository, except: [:new, :create]
before_action :assign_ref_vars, :tree, only: [:show]
# Authorize # Authorize
before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive] before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive]
...@@ -89,10 +92,7 @@ class ProjectsController < ApplicationController ...@@ -89,10 +92,7 @@ class ProjectsController < ApplicationController
if current_user if current_user
@membership = @project.project_member_by_id(current_user.id) @membership = @project.project_member_by_id(current_user.id)
end end
@ref = "master"
@id = "master"
@commit = @project.repository.commit(@ref)
@tree = @project.repository.tree(@commit.id)
render :show render :show
end end
else else
...@@ -228,4 +228,8 @@ class ProjectsController < ApplicationController ...@@ -228,4 +228,8 @@ class ProjectsController < ApplicationController
render "go_import", layout: false render "go_import", layout: false
end end
def get_id
project.repository.root_ref
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