diff options
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index f0e8ff7778e..fcf6a177984 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -65,40 +65,13 @@ module BlobHelper return unless blob = readable_blob(options, path, project, ref) common_classes = "btn gl-button btn-confirm js-edit-blob gl-ml-3 #{options[:extra_class]}" - data = { track_action: 'click_edit', track_label: 'edit' } - - if Feature.enabled?(:web_ide_primary_edit, project.group) - common_classes += " btn-inverted" - data[:track_property] = 'secondary' - end edit_button_tag(blob, common_classes, _('Edit'), edit_blob_path(project, ref, path, options), project, - ref, - data) - end - - def ide_edit_button(project = @project, ref = @ref, path = @path, blob:) - return unless blob - - common_classes = 'btn gl-button btn-confirm ide-edit-button gl-ml-3' - data = { track_action: 'click_edit_ide', track_label: 'web_ide' } - - unless Feature.enabled?(:web_ide_primary_edit, project.group) - common_classes += " btn-inverted" - data[:track_property] = 'secondary' - end - - edit_button_tag(blob, - common_classes, - _('Web IDE'), - ide_edit_path(project, ref, path), - project, - ref, - data) + ref) end def modify_file_button(project = @project, ref = @ref, path = @path, blob:, label:, action:, btn_class:, modal_type:) @@ -363,16 +336,16 @@ module BlobHelper content_tag(:span, button, class: 'has-tooltip', title: _('You can only edit files when you are on a branch'), data: { container: 'body' }) end - def edit_link_tag(link_text, edit_path, common_classes, data) - link_to link_text, edit_path, class: "#{common_classes}", data: data + def edit_link_tag(link_text, edit_path, common_classes) + link_to link_text, edit_path, class: "#{common_classes}" end - def edit_button_tag(blob, common_classes, text, edit_path, project, ref, data) + def edit_button_tag(blob, common_classes, text, edit_path, project, ref) if !on_top_of_branch?(project, ref) edit_disabled_button_tag(text, common_classes) # This condition only applies to users who are logged in elsif !current_user || (current_user && can_modify_blob?(blob, project, ref)) - edit_link_tag(text, edit_path, common_classes, data) + edit_link_tag(text, edit_path, common_classes) elsif can?(current_user, :fork_project, project) && can?(current_user, :create_merge_request_in, project) edit_fork_button_tag(common_classes, project, text, edit_blob_fork_params(edit_path)) end |