summaryrefslogtreecommitdiff
path: root/app/views/projects/blob/_editor.html.haml
blob: a54460f1196a6a807ba920b307b8758cae83c5fe (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
- 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.append-bottom-default
  .js-file-title.file-title.clearfix{ data: { current_action: action } }
    .editor-ref.block-truncated
      = sprite_icon('fork', size: 12)
      = ref
    - if current_action?(:edit) || current_action?(:update)
      %span.pull-left.append-right-10
        = text_field_tag 'file_path', (params[:file_path] || @path),
                                      class: 'form-control new-file-path js-file-path-name-input'

    - if current_action?(:new) || current_action?(:create)
      %span.pull-left.append-right-10
        \/
      = text_field_tag 'file_name', params[:file_name], placeholder: "File name",
        required: true, class: 'form-control new-file-name js-file-path-name-input'

    .file-buttons
      - if is_markdown
        = render 'projects/blob/markdown_buttons', show_fullscreen_button: false
      = button_tag class: 'soft-wrap-toggle btn', type: 'button', tabindex: '-1' do
        %span.no-wrap
          = custom_icon('icon_no_wrap')
          No wrap
        %span.soft-wrap
          = custom_icon('icon_soft_wrap')
          Soft wrap
      .encoding-selector
        = select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'select2', tabindex: '-1'

  .file-editor.code
    %pre.js-edit-mode-pane#editor= params[:content] || local_assigns[:blob_data]
    - if local_assigns[:path]
      .js-edit-mode-pane#preview.hide
        .center
          %h2
            %i.icon-spinner.icon-spin