Commit 2a29f992 authored by Anastasia McDonald's avatar Anastasia McDonald

Remove haml duplicates from NewSnippet and Snippet/Edit pages

See https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/492
parent 83dede41
......@@ -10,7 +10,7 @@
.form-group
= f.label :title, class: 'label-bold'
= f.text_field :title, class: 'form-control', required: true, autofocus: true, data: { qa_selector: 'snippet_title_field' }
= f.text_field :title, class: 'form-control', required: true, autofocus: true
.form-group.js-description-input
- description_placeholder = s_('Snippets|Optionally add a description about what your snippet does or how to use it...')
......@@ -18,17 +18,17 @@
= f.label :description, s_("Snippets|Description (optional)"), class: 'label-bold'
.js-collapsible-input
.js-collapsed{ class: ('d-none' if is_expanded) }
= text_field_tag nil, nil, class: 'form-control', placeholder: description_placeholder, data: { qa_selector: 'description_placeholder' }
= text_field_tag nil, nil, class: 'form-control', placeholder: description_placeholder
.js-expanded{ class: ('d-none' if !is_expanded) }
= render layout: 'shared/md_preview', locals: { url: preview_markdown_path(@project), referenced_users: true } do
= render 'shared/zen', f: f, attr: :description, classes: 'note-textarea', placeholder: description_placeholder, qa_selector: 'snippet_description_field'
= render 'shared/zen', f: f, attr: :description, classes: 'note-textarea', placeholder: description_placeholder
= render 'shared/notes/hints'
.form-group.file-editor
= f.label :file_name, s_('Snippets|File')
.file-holder.snippet
.js-file-title.file-title-flex-parent
= f.text_field :file_name, placeholder: s_("Snippets|Give your file a name to add code highlighting, e.g. example.rb for Ruby"), class: 'form-control js-snippet-file-name', data: { qa_selector: 'file_name_field' }
= f.text_field :file_name, placeholder: s_("Snippets|Give your file a name to add code highlighting, e.g. example.rb for Ruby"), class: 'form-control js-snippet-file-name'
.file-content.code
#editor{ data: { 'editor-loading': true } }<
%pre.editor-loading-content= @snippet.content
......@@ -46,9 +46,9 @@
.form-actions
- if @snippet.new_record?
= f.submit 'Create snippet', class: "btn-success btn gl-button", data: { qa_selector: 'submit_button' }
= f.submit 'Create snippet', class: "btn-success btn gl-button"
- else
= f.submit 'Save changes', class: "btn-success btn gl-button", data: { qa_selector: 'submit_button' }
= f.submit 'Save changes', class: "btn-success btn gl-button"
- if @snippet.project_id
= link_to "Cancel", project_snippets_path(@project), class: "btn gl-button btn-default"
......
......@@ -24,18 +24,6 @@ module QA
element :file_holder_container
end
base.view 'app/views/shared/form_elements/_description.html.haml' do
element :issuable_form_description
end
base.view 'app/views/shared/snippets/_form.html.haml' do
element :snippet_description_field
element :description_placeholder
element :snippet_title_field
element :file_name_field
element :submit_button
end
base.view 'app/assets/javascripts/snippets/components/snippet_blob_actions_edit.vue' do
element :add_file_button
end
......
......@@ -5,10 +5,6 @@ module QA
module Dashboard
module Snippet
class Edit < Page::Base
view 'app/views/shared/snippets/_form.html.haml' do
element :submit_button
end
view 'app/assets/javascripts/snippets/components/edit.vue' do
element :submit_button
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment