diff options
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 281d5c923d0..02f69327dff 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -2,9 +2,7 @@ module BlobHelper def edit_blob_path(project = @project, ref = @ref, path = @path, options = {}) - project_edit_blob_path(project, - tree_join(ref, path), - options[:link_opts]) + project_edit_blob_path(project, tree_join(ref, path), options[:link_opts]) end def ide_edit_path(project = @project, ref = @ref, path = @path) @@ -52,9 +50,11 @@ module BlobHelper def fork_path_for_current_user(project, path, with_notice: true) return unless current_user - project_forks_path(project, - namespace_key: current_user.namespace&.id, - continue: edit_blob_fork_params(path, with_notice: with_notice)) + project_forks_path( + project, + namespace_key: current_user.namespace&.id, + continue: edit_blob_fork_params(path, with_notice: with_notice) + ) end def encode_ide_path(path) @@ -66,12 +66,14 @@ module BlobHelper common_classes = "btn gl-button btn-confirm js-edit-blob gl-ml-3 #{options[:extra_class]}" - edit_button_tag(blob, - common_classes, - _('Edit'), - edit_blob_path(project, ref, path, options), - project, - ref) + edit_button_tag( + blob, + common_classes, + _('Edit'), + edit_blob_path(project, ref, path, options), + project, + ref + ) end def can_modify_blob?(blob, project = @project, ref = @ref) @@ -282,8 +284,8 @@ module BlobHelper fork_path = project_forks_path(project, namespace_key: current_user.namespace.id, continue: params) button_tag label, - class: "#{common_classes} js-edit-blob-link-fork-toggler", - data: { action: action, fork_path: fork_path } + class: "#{common_classes} js-edit-blob-link-fork-toggler", + data: { action: action, fork_path: fork_path } end def edit_disabled_button_tag(button_text, common_classes) @@ -328,4 +330,17 @@ module BlobHelper @path.to_s.end_with?(Ci::Pipeline::CONFIG_EXTENSION) || @path.to_s == @project.ci_config_path_or_default end + + def vue_blob_app_data(project, blob, ref) + { + blob_path: blob.path, + project_path: project.full_path, + resource_id: project.to_global_id, + user_id: current_user.present? ? current_user.to_global_id : '', + target_branch: project.empty_repo? ? ref : @ref, + original_branch: @ref + } + end end + +BlobHelper.prepend_mod_with('BlobHelper') |