Commit 470aa767 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix project.code-related functionality

parent c50ec72b
......@@ -86,7 +86,7 @@ class Project < ActiveRecord::Base
def create_by_user(params, user)
namespace_id = params.delete(:namespace_id)
namespace_id ||= current_user.namespace_id
namespace_id ||= user.namespace_id
project = Project.new params
......
......@@ -14,7 +14,7 @@
%table
%thead
%th Name
%th Code
%th Path
%th Projects
%th Edit
%th.cred Danger Zone!
......@@ -22,7 +22,7 @@
- @groups.each do |group|
%tr
%td= link_to group.name, [:admin, group]
%td= group.code
%td= group.path
%td= group.projects.count
%td= link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn small"
%td.bgred= link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn small danger"
......
......@@ -20,9 +20,9 @@
%tr
%td
%b
Code:
Path:
%td
= @group.code
= @group.path
%tr
%td
%b
......
......@@ -26,12 +26,6 @@
Name:
%td
= @project.name
%tr
%td
%b
Code:
%td
= @project.code
%tr
%td
%b
......
......@@ -11,7 +11,7 @@
%ul.unstyled
- groups.each do |group|
%li.wll
= link_to group_path(id: group.code), class: dom_class(group) do
= link_to group_path(id: group.path), class: dom_class(group) do
%strong.group_name= truncate(group.name, length: 25)
%span.arrow
&rarr;
......
:javascript
$(function() {
GitLab.GfmAutoComplete.Members.url = "#{ "/api/v2/projects/#{@project.code}/members" if @project }";
GitLab.GfmAutoComplete.Members.url = "#{ "/api/v2/projects/#{@project.path}/members" if @project }";
GitLab.GfmAutoComplete.Members.params.private_token = "#{current_user.private_token}";
GitLab.GfmAutoComplete.Emoji.data = #{raw emoji_autocomplete_source};
......
......@@ -7,7 +7,7 @@
.container
%ul.main_menu
= nav_link(html_options: {class: "home #{project_tab_class}"}) do
= link_to @project.code, project_path(@project), title: "Project"
= link_to @project.path, project_path(@project), title: "Project"
- if @project.repo_exists?
- if can? current_user, :download_code, @project
......
......@@ -26,13 +26,12 @@ FactoryGirl.define do
factory :project do
sequence(:name) { |n| "project#{n}" }
path { name.downcase.gsub(/\s/, '_') }
code { name.downcase.gsub(/\s/, '_') }
owner
end
factory :namespace do
sequence(:name) { |n| "group#{n}" }
code { name.downcase.gsub(/\s/, '_') }
path { name.downcase.gsub(/\s/, '_') }
owner
factory :group do
......
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