diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-11-23 22:31:09 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-11-23 22:31:09 +0300 |
commit | 9304d049de0493de457fdec02114d5a23d116f9b (patch) | |
tree | 673933810f30af8931f9ff7beb20cc61d9978b7b /app | |
parent | 470aa7675e07724ff48f159ee12da40409949222 (diff) | |
download | gitlab-ce-9304d049de0493de457fdec02114d5a23d116f9b.tar.gz |
Fixed some tests and snippet colorize
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/groups_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/groups_controller.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 6 | ||||
-rw-r--r-- | app/views/snippets/show.html.haml | 8 |
4 files changed, 12 insertions, 6 deletions
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 1e523050ff2..4e1329c10fb 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -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 diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index c98332eb984..07f613033c4 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index 3cd495fbae5..2d12aa804c5 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index 1b8701e91ed..f05e73c2273 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -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 |