Commit 3250a024 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

1. Improved admin -> new project form

2. Fixed bug: post-receive file was not added when create project via admin
parent f1795a49
...@@ -34,6 +34,8 @@ class Admin::ProjectsController < ApplicationController ...@@ -34,6 +34,8 @@ class Admin::ProjectsController < ApplicationController
params[:project_access] params[:project_access]
) )
@admin_project.update_repository
redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.' redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
end end
......
...@@ -47,6 +47,11 @@ module Project::RepositoryTrait ...@@ -47,6 +47,11 @@ module Project::RepositoryTrait
File.chmod(0775, hook_file) File.chmod(0775, hook_file)
end end
def has_post_receive_file?
hook_file = File.join(path_to_repo, 'hooks', 'post-receive')
File.exists?(hook_file)
end
def tags def tags
repo.tags.map(&:name).sort.reverse repo.tags.map(&:name).sort.reverse
end end
......
...@@ -56,11 +56,11 @@ ...@@ -56,11 +56,11 @@
.actions .actions
= f.submit 'Save', :class => "btn primary" = f.submit 'Save', :class => "btn primary"
= link_to 'Cancel', [:admin, @admin_project], :class => "btn" = link_to 'Cancel', [:admin, @admin_project], :class => "btn"
= link_to 'Destroy', [:admin, @admin_project], :confirm => 'Are you sure?', :method => :delete, :class => "btn danger right" - unless @admin_project.new_record?
= link_to 'Destroy', [:admin, @admin_project], :confirm => 'Are you sure?', :method => :delete, :class => "btn danger right"
:javascript :javascript
$(function(){ $(function(){
taggifyForm();
$('#project_owner_id').chosen(); $('#project_owner_id').chosen();
$('#project_default_branch').chosen(); new Projects();
}) })
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
%th Name %th Name
%th Path %th Path
%th Team Members %th Team Members
%th Post Receive
%th Last Commit %th Last Commit
%th %th
%th %th
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
%td= link_to project.name, [:admin, project] %td= link_to project.name, [:admin, project]
%td= project.path %td= project.path
%td= project.users_projects.count %td= project.users_projects.count
%td= check_box_tag :post_receive_file, 1, project.has_post_receive_file?, :disabled => true
%td= last_commit(project) %td= last_commit(project)
%td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}", :class => "btn small" %td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}", :class => "btn small"
%td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger" %td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
......
%h1 New project %h2 New project
%hr
= render 'form' = render 'form'
%br
= link_to 'Back', admin_projects_path, :class => ''
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
Description: Description:
%td %td
= @admin_project.description = @admin_project.description
%tr
%td
%b
Post Receive File:
%td
= check_box_tag :post_receive_file, 1, @admin_project.has_post_receive_file?, :disabled => true
%br %br
%h3 %h3
Team Team
......
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