diff options
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 6c09e15f56f..f08c1a2ff0a 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -74,24 +74,6 @@ module BlobHelper ref) end - def modify_file_button(project = @project, ref = @ref, path = @path, blob:, label:, action:, btn_class:, modal_type:) - return unless current_user - return unless blob - - common_classes = "btn gl-button btn-default btn-#{btn_class}" - base_button = button_tag(label, class: "#{common_classes} disabled", disabled: true) - - if !on_top_of_branch?(project, ref) - modify_file_button_tooltip(base_button, _("You can only %{action} files when you are on a branch") % { action: action }) - elsif blob.stored_externally? - modify_file_button_tooltip(base_button, _("It is not possible to %{action} files that are stored in LFS using the web interface") % { action: action }) - elsif can_modify_blob?(blob, project, ref) - button_tag label, class: "#{common_classes}", 'data-target' => "#modal-#{modal_type}-blob", 'data-toggle' => 'modal' - elsif can?(current_user, :fork_project, project) && can?(current_user, :create_merge_request_in, project) - edit_fork_button_tag(common_classes, project, label, edit_modify_file_fork_params(action), action) - end - end - def can_modify_blob?(blob, project = @project, ref = @ref) !blob.stored_externally? && can_edit_tree?(project, ref) end @@ -346,12 +328,4 @@ module BlobHelper @path.to_s.end_with?(Ci::Pipeline::CONFIG_EXTENSION) || @path.to_s == @project.ci_config_path_or_default end - - private - - def modify_file_button_tooltip(button, tooltip_message) - # Disabled buttons with tooltips should have the tooltip attached - # to a wrapper element https://bootstrap-vue.org/docs/components/tooltip#disabled-elements - content_tag(:span, button, class: 'btn-group has-tooltip', title: tooltip_message, data: { container: 'body' }) - end end |