diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-01-22 00:46:49 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-01-22 00:46:49 +0300 |
commit | 9369b7ec1f98f8e94a0483e4fbb8c36c2333d60b (patch) | |
tree | bf73f8507ded979b7d7ba60c78c10e2d54628056 /app/helpers/blob_helper.rb | |
parent | 3f7993b5ceb9c5ba616dffef39f9b535482d92c1 (diff) |
Fix MR diff 'Edit' button
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 7c55934edda..8b689b29a41 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -26,10 +26,10 @@ module BlobHelper tree_join(ref, path), link_opts) - if !on_top_of_branch? + if !on_top_of_branch?(project, ref) button_tag "Edit", class: "btn btn-default disabled has_tooltip", title: "You can only edit files when you are on a branch", data: { container: 'body' } - elsif can_edit_blob?(blob) - link_to "Edit", edit_path, class: 'btn btn-small' + elsif can_edit_blob?(blob, project, ref) + link_to "Edit", edit_path, class: 'btn' elsif can?(current_user, :fork_project, project) continue_params = { to: edit_path, @@ -39,7 +39,7 @@ module BlobHelper fork_path = namespace_project_fork_path(project.namespace, project, namespace_key: current_user.namespace.id, continue: continue_params) - link_to "Edit", fork_path, class: 'btn btn-small', method: :post + link_to "Edit", fork_path, class: 'btn', method: :post end end @@ -50,11 +50,11 @@ module BlobHelper return unless blob - if !on_top_of_branch? + if !on_top_of_branch?(project, ref) button_tag label, class: "btn btn-#{btn_class} disabled has_tooltip", title: "You can only #{action} files when you are on a branch", data: { container: 'body' } elsif blob.lfs_pointer? button_tag label, class: "btn btn-#{btn_class} disabled has_tooltip", title: "It is not possible to #{action} files that are stored in LFS using the web interface", data: { container: 'body' } - elsif can_edit_blob?(blob) + elsif can_edit_blob?(blob, project, ref) button_tag label, class: "btn btn-#{btn_class}", 'data-target' => "#modal-#{modal_type}-blob", 'data-toggle' => 'modal' elsif can?(current_user, :fork_project, project) continue_params = { |