gitlab-org--gitlab-foss/app/views/projects/blob/_editor.html.haml

49 lines
2.1 KiB
Text
Raw Normal View History

- 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.align-items-center.clearfix{ data: { current_action: action } }
.editor-ref.block-truncated.has-tooltip{ title: ref }
2017-12-01 14:30:49 -05:00
= sprite_icon('fork', size: 12)
2015-01-26 23:57:42 -05:00
= 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 new-file-path js-file-path-name-input'
= render 'template_selectors'
2015-01-26 23:57:42 -05:00
- if current_action?(:new) || current_action?(:create)
%span.float-left.gl-mr-3
2015-01-26 23:57:42 -05:00
\/
= text_field_tag 'file_name', params[:file_name], placeholder: "File name",
required: true, class: 'form-control 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: { toggle: 'popover',
target: '#gitlab-ci-yml-selector',
track_label: 'suggest_gitlab_ci_yml',
dismiss_key: @project.id,
human_access: human_access } }
.file-buttons
- if is_markdown
= render 'shared/blob/markdown_buttons', show_fullscreen_button: false
= button_tag class: 'soft-wrap-toggle btn', type: 'button', tabindex: '-1' do
2016-09-27 17:08:05 -04:00
%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'
2015-01-26 23:57:42 -05:00
2016-07-05 08:52:20 -04:00
.file-editor.code
%pre.js-edit-mode-pane.qa-editor#editor{ data: { 'editor-loading': true } }= params[:content] || local_assigns[:blob_data]
2015-01-26 23:57:42 -05:00
- if local_assigns[:path]
2018-04-23 15:30:22 -04:00
.js-edit-mode-pane#preview.hide
2015-01-26 23:57:42 -05:00
.center
%h2
%i.icon-spinner.icon-spin