diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 8f1376540c8b650df30d74bc9dd59883e01ff01a..e4b97368fc5b9ba621347067a1fb651cf39e6942 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -34,6 +34,8 @@ class Admin::ProjectsController < ApplicationController params[:project_access] ) + @admin_project.update_repository + redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.' end diff --git a/app/models/project/repository_trait.rb b/app/models/project/repository_trait.rb index 28e47a788ebef4646cf813d03a9252cc105ef907..2cd8159ad81519a305fd9ec812eca2946fb0290b 100644 --- a/app/models/project/repository_trait.rb +++ b/app/models/project/repository_trait.rb @@ -47,6 +47,11 @@ module Project::RepositoryTrait File.chmod(0775, hook_file) end + def has_post_receive_file? + hook_file = File.join(path_to_repo, 'hooks', 'post-receive') + File.exists?(hook_file) + end + def tags repo.tags.map(&:name).sort.reverse end diff --git a/app/views/admin/projects/_form.html.haml b/app/views/admin/projects/_form.html.haml index 84cd030ec0913bc26b910a3897ccfefed74bddb0..4a2d01e19b6ba4a4936192cff1075789613a29a5 100644 --- a/app/views/admin/projects/_form.html.haml +++ b/app/views/admin/projects/_form.html.haml @@ -56,11 +56,11 @@ .actions = f.submit 'Save', :class => "btn primary" = 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 $(function(){ - taggifyForm(); $('#project_owner_id').chosen(); - $('#project_default_branch').chosen(); + new Projects(); }) diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index bf576e49a4fcc62300b84eee1ed0df82595b34e5..f26ddf2b06f1f485c2f046a5676130ae839959e4 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -7,6 +7,7 @@ %th Name %th Path %th Team Members + %th Post Receive %th Last Commit %th %th @@ -16,6 +17,7 @@ %td= link_to project.name, [:admin, project] %td= project.path %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= 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" diff --git a/app/views/admin/projects/new.html.haml b/app/views/admin/projects/new.html.haml index dfbd3edf08011fb5b05288e3a3fce91be69c2994..1e1c7aac46e28e8313ed7250db8386c9fcbf8b4a 100644 --- a/app/views/admin/projects/new.html.haml +++ b/app/views/admin/projects/new.html.haml @@ -1,6 +1,3 @@ -%h1 New project - +%h2 New project +%hr = render 'form' - -%br -= link_to 'Back', admin_projects_path, :class => '' diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 5303a0e6f54aafed7db6927db152404f5a508958..90ed8ea944f99ab53fefe5c8ebd4ea17ef741b45 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -28,6 +28,12 @@ Description: %td = @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 %h3 Team