summaryrefslogtreecommitdiff
path: root/app/views/projects/blob/_editor.html.haml
blob: c9303e19d5d6a125e8fb4a8421ce6ccca21df8e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- action = current_action?(:edit) || current_action?(:update) ? 'edit' : 'create'
- file_name = params[:id].split("/").last ||= ""
- is_markdown = Gitlab::MarkupHelper.gitlab_markdown?(file_name)

.file-holder-bottom-radius.file-holder.file.gl-mb-3
  .js-file-title.file-title.gl-display-flex.gl-align-items-center.clearfix{ data: { current_action: action } }
    .editor-ref.block-truncated.has-tooltip{ title: ref }
      = sprite_icon('branch', size: 12)
      = ref
    - if current_action?(:edit) || current_action?(:update)
      %span.float-left.gl-mr-3
      = text_field_tag 'file_path', (params[:file_path] || @path),
        class: 'form-control gl-form-input new-file-path js-file-path-name-input'
      = render 'template_selectors'

    - if current_action?(:new) || current_action?(:create)
      %span.float-left.gl-mr-3
        \/
      = text_field_tag 'file_name', params[:file_name], placeholder: "File name",
        required: true, class: 'form-control gl-form-input new-file-name js-file-path-name-input', value: params[:file_name] || (should_suggest_gitlab_ci_yml? ? '.gitlab-ci.yml' : '')
      = render 'template_selectors'
      - if should_suggest_gitlab_ci_yml?
        .js-suggest-gitlab-ci-yml{ data: { target: '#gitlab-ci-yml-selector',
          track_label: 'suggest_gitlab_ci_yml',
          merge_request_path: params[:mr_path],
          dismiss_key: @project.id,
          human_access: human_access } }

    .file-buttons.gl-display-flex.gl-align-items-center.gl-justify-content-end
      - if is_markdown
        = render 'shared/blob/markdown_buttons', show_fullscreen_button: false
      = button_tag class: 'soft-wrap-toggle btn gl-button btn-default', type: 'button', tabindex: '-1' do
        .no-wrap
          = sprite_icon('soft-unwrap', css_class: 'gl-button-icon')
          %span.gl-button-text
            No wrap
        .soft-wrap
          = sprite_icon('soft-wrap', css_class: 'gl-button-icon')
          %span.gl-button-text
            Soft wrap

  .file-editor.code
    .js-edit-mode-pane.qa-editor#editor{ data: { 'editor-loading': true } }<
      %pre.editor-loading-content= params[:content] || local_assigns[:blob_data]
    - if local_assigns[:path]
      .js-edit-mode-pane#preview.hide
        .center
          = gl_loading_icon(size: 'lg')