Commit 0ddf1d9d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'feature/edit_from_mr'

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	CHANGELOG
parents d68525ff 4e15cbf4
v 6.7.0 v 6.7.0
- Add support for Gemnasium as a Project Service - Add support for Gemnasium as a Project Service
- Add edit file button to MergeRequest diff
v 6.6.0 v 6.6.0
- Retrieving user ssh keys publically(github style): http://__HOST__/__USERNAME__.keys - Retrieving user ssh keys publically(github style): http://__HOST__/__USERNAME__.keys
......
...@@ -27,10 +27,14 @@ ...@@ -27,10 +27,14 @@
line-height: 2; line-height: 2;
} }
.view-file { .diff-btn-group {
font-weight: bold;
float: right; float: right;
.btn {
background-color: #EEE; background-color: #EEE;
color: #666;
font-weight: bolder;
}
} }
.commit-short-id { .commit-short-id {
......
...@@ -12,7 +12,16 @@ class Projects::EditTreeController < Projects::BaseTreeController ...@@ -12,7 +12,16 @@ class Projects::EditTreeController < Projects::BaseTreeController
if result[:status] == :success if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed" flash[:notice] = "Your changes have been successfully committed"
# If blob edit was initiated from merge request page
from_merge_request = MergeRequest.find_by(id: params[:from_merge_request_id])
if from_merge_request
from_merge_request.reload_code
redirect_to diffs_project_merge_request_path(from_merge_request.target_project, from_merge_request)
else
redirect_to project_blob_path(@project, @id) redirect_to project_blob_path(@project, @id)
end
else else
flash[:alert] = result[:error] flash[:alert] = result[:error]
render :show render :show
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
- if diff.deleted_file - if diff.deleted_file
%span= diff.old_path %span= diff.old_path
.diff-btn-group
- if @commit.parent_ids.present? - if @commit.parent_ids.present?
= link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), { class: 'btn btn-small view-file' } do = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), { class: 'btn btn-small view-file' } do
View file @ View file @
...@@ -58,10 +59,17 @@ ...@@ -58,10 +59,17 @@
- if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
%span.file-mode= "#{diff.a_mode}#{diff.b_mode}" %span.file-mode= "#{diff.a_mode}#{diff.b_mode}"
.diff-btn-group
- if @merge_request && @merge_request.source_project
= link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do
Edit
&nbsp;
= link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), { class: 'btn btn-small view-file' } do = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), { class: 'btn btn-small view-file' } do
View file @ View file @
%span.commit-short-id= @commit.short_id(6) %span.commit-short-id= @commit.short_id(6)
.content .content
-# Skipp all non non-supported blobs -# Skipp all non non-supported blobs
- next unless file.respond_to?('text?') - next unless file.respond_to?('text?')
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
.form-actions .form-actions
= hidden_field_tag 'last_commit', @last_commit = hidden_field_tag 'last_commit', @last_commit
= hidden_field_tag 'content', '', id: "file-content" = hidden_field_tag 'content', '', id: "file-content"
= hidden_field_tag 'from_merge_request_id', params[:from_merge_request_id]
.commit-button-annotation .commit-button-annotation
= button_tag "Commit changes", class: 'btn commit-btn js-commit-button btn-primary' = button_tag "Commit changes", class: 'btn commit-btn js-commit-button btn-primary'
.message .message
......
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