Commit f6a8e6944984eabb21a3ce9c15d1f14eb87ee06d
1 parent
83797265
Exists in
master
and in
4 other branches
WebEditor: base form
Showing
4 changed files
with
20 additions
and
1 deletions
Show diff stats
app/controllers/tree_controller.rb
| ... | ... | @@ -19,4 +19,12 @@ class TreeController < ProjectResourceController |
| 19 | 19 | format.js { no_cache_headers } |
| 20 | 20 | end |
| 21 | 21 | end |
| 22 | + | |
| 23 | + def edit | |
| 24 | + @last_commit = @project.commits(@ref, @path, 1).first.sha | |
| 25 | + end | |
| 26 | + | |
| 27 | + def update | |
| 28 | + last_commit = @project.commits(@ref, @path, 1).first.sha | |
| 29 | + end | |
| 22 | 30 | end | ... | ... |
app/views/tree/_tree_file.html.haml
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank" |
| 9 | 9 | = link_to "history", project_commits_path(@project, @id), class: "btn very_small" |
| 10 | 10 | = link_to "blame", project_blame_path(@project, @id), class: "btn very_small" |
| 11 | + = link_to "Edit", edit_project_tree_path(@project, @id), class: "btn very_small" | |
| 11 | 12 | - if tree_file.text? |
| 12 | 13 | - if gitlab_markdown?(tree_file.name) |
| 13 | 14 | .file_content.wiki | ... | ... |
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +.file_holder | |
| 2 | + Edit file: | |
| 3 | + %span.file_name | |
| 4 | + = @tree.path.force_encoding('utf-8') | |
| 5 | + %br | |
| 6 | + = form_tag(project_tree_path(@project, @id), :method => :put) do | |
| 7 | + %textarea | |
| 8 | + = @tree.data | |
| 9 | + = hidden_field_tag 'last_commit', @last_commit | |
| 10 | + = submit_tag "Save" | ... | ... |
config/routes.rb
| ... | ... | @@ -183,7 +183,7 @@ Gitlab::Application.routes.draw do |
| 183 | 183 | resources :compare, only: [:index, :create] |
| 184 | 184 | resources :blame, only: [:show], constraints: {id: /.+/} |
| 185 | 185 | resources :blob, only: [:show], constraints: {id: /.+/} |
| 186 | - resources :tree, only: [:show], constraints: {id: /.+/} | |
| 186 | + resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/} | |
| 187 | 187 | match "/compare/:from...:to" => "compare#show", as: "compare", |
| 188 | 188 | :via => [:get, :post], constraints: {from: /.+/, to: /.+/} |
| 189 | 189 | ... | ... |