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