Commit 3250a024ef82bc6bb89f7c1dafdc824b6e09439b
1 parent
f1795a49
Exists in
master
and in
4 other branches
1. Improved admin -> new project form
2. Fixed bug: post-receive file was not added when create project via admin
Showing
6 changed files
with
20 additions
and
8 deletions
Show diff stats
app/controllers/admin/projects_controller.rb
app/models/project/repository_trait.rb
... | ... | @@ -47,6 +47,11 @@ module Project::RepositoryTrait |
47 | 47 | File.chmod(0775, hook_file) |
48 | 48 | end |
49 | 49 | |
50 | + def has_post_receive_file? | |
51 | + hook_file = File.join(path_to_repo, 'hooks', 'post-receive') | |
52 | + File.exists?(hook_file) | |
53 | + end | |
54 | + | |
50 | 55 | def tags |
51 | 56 | repo.tags.map(&:name).sort.reverse |
52 | 57 | end | ... | ... |
app/views/admin/projects/_form.html.haml
... | ... | @@ -56,11 +56,11 @@ |
56 | 56 | .actions |
57 | 57 | = f.submit 'Save', :class => "btn primary" |
58 | 58 | = link_to 'Cancel', [:admin, @admin_project], :class => "btn" |
59 | - = link_to 'Destroy', [:admin, @admin_project], :confirm => 'Are you sure?', :method => :delete, :class => "btn danger right" | |
59 | + - unless @admin_project.new_record? | |
60 | + = link_to 'Destroy', [:admin, @admin_project], :confirm => 'Are you sure?', :method => :delete, :class => "btn danger right" | |
60 | 61 | |
61 | 62 | :javascript |
62 | 63 | $(function(){ |
63 | - taggifyForm(); | |
64 | 64 | $('#project_owner_id').chosen(); |
65 | - $('#project_default_branch').chosen(); | |
65 | + new Projects(); | |
66 | 66 | }) | ... | ... |
app/views/admin/projects/index.html.haml
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | %th Name |
8 | 8 | %th Path |
9 | 9 | %th Team Members |
10 | + %th Post Receive | |
10 | 11 | %th Last Commit |
11 | 12 | %th |
12 | 13 | %th |
... | ... | @@ -16,6 +17,7 @@ |
16 | 17 | %td= link_to project.name, [:admin, project] |
17 | 18 | %td= project.path |
18 | 19 | %td= project.users_projects.count |
20 | + %td= check_box_tag :post_receive_file, 1, project.has_post_receive_file?, :disabled => true | |
19 | 21 | %td= last_commit(project) |
20 | 22 | %td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}", :class => "btn small" |
21 | 23 | %td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger" | ... | ... |
app/views/admin/projects/new.html.haml
app/views/admin/projects/show.html.haml