Fixed some tests and snippet colorize
This commit is contained in:
parent
470aa7675e
commit
9304d049de
13 changed files with 64 additions and 68 deletions
|
@ -74,6 +74,6 @@ class Admin::GroupsController < AdminController
|
|||
private
|
||||
|
||||
def group
|
||||
@group = Group.find_by_code(params[:id])
|
||||
@group = Group.find_by_path(params[:id])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -50,7 +50,7 @@ class GroupsController < ApplicationController
|
|||
protected
|
||||
|
||||
def group
|
||||
@group ||= Group.find_by_code(params[:id])
|
||||
@group ||= Group.find_by_path(params[:id])
|
||||
end
|
||||
|
||||
def projects
|
||||
|
|
|
@ -86,7 +86,7 @@ class Project < ActiveRecord::Base
|
|||
|
||||
def create_by_user(params, user)
|
||||
namespace_id = params.delete(:namespace_id)
|
||||
namespace_id ||= user.namespace_id
|
||||
namespace_id ||= user.namespace.try(:id)
|
||||
|
||||
project = Project.new params
|
||||
|
||||
|
@ -222,6 +222,8 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def move_repo
|
||||
# For compatibility with old code
|
||||
def code
|
||||
path
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,8 +15,12 @@
|
|||
%span.options
|
||||
= link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank"
|
||||
.file_content.code
|
||||
%div{class: current_user.dark_scheme ? "black" : ""}
|
||||
= raw @snippet.colorize(options: { linenos: 'True'})
|
||||
- unless @snippet.content.empty?
|
||||
%div{class: current_user.dark_scheme ? "black" : "white"}
|
||||
= preserve do
|
||||
= raw Pygments.highlight(@snippet.content, formatter: :gitlab)
|
||||
- else
|
||||
%h4.nothing_here_message Empty file
|
||||
|
||||
|
||||
%div
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue