2016-09-13 17:45:13 +05:30
- content_for :page_specific_javascripts do
= page_specific_javascript_tag('lib/ace.js')
2014-09-02 18:07:02 +05:30
.snippet-form-holder
2018-11-08 19:23:39 +05:30
= form_for @snippet, url: url,
2019-03-02 22:35:43 +05:30
html: { class: "snippet-form js-requires-input js-quick-submit common-note-form" } do |f|
2016-06-02 11:05:42 +05:30
= form_errors(@snippet)
2014-09-02 18:07:02 +05:30
2018-11-08 19:23:39 +05:30
.form-group.row
= f.label :title, class: 'col-form-label col-sm-2'
2015-12-23 02:04:40 +05:30
.col-sm-10
2019-05-30 16:15:17 +05:30
= f.text_field :title, class: 'form-control', required: true, autofocus: true
2014-09-02 18:07:02 +05:30
2017-09-10 17:25:29 +05:30
= render 'shared/form_elements/description', model: @snippet, project: @project, form: f
2018-12-13 13:39:08 +05:30
= render 'shared/old_visibility_level', f: f, visibility_level: @snippet.visibility_level, can_change_visibility_level: true, form_model: @snippet, with_label: false
2015-09-11 14:41:01 +05:30
.file-editor
2018-11-08 19:23:39 +05:30
.form-group.row
= f.label :file_name, "File", class: 'col-form-label col-sm-2'
2014-09-02 18:07:02 +05:30
.col-sm-10
.file-holder.snippet
2017-08-17 22:00:37 +05:30
.js-file-title.file-title
2019-05-30 16:15:17 +05:30
= f.text_field :file_name, placeholder: "Optionally name this file to add code highlighting, e.g. example.rb for Ruby.", class: 'form-control snippet-file-name'
2014-09-02 18:07:02 +05:30
.file-content.code
%pre#editor= @snippet.content
= f.hidden_field :content, class: 'snippet-file-content'
2017-09-10 17:25:29 +05:30
- if params[:files]
- params[:files].each_with_index do |file, index|
= hidden_field_tag "files[]", file, id: "files_#{index}"
2014-09-02 18:07:02 +05:30
.form-actions
- if @snippet.new_record?
2019-05-30 16:15:17 +05:30
= f.submit 'Create snippet', class: "btn-success btn"
2014-09-02 18:07:02 +05:30
- else
2018-12-05 23:21:45 +05:30
= f.submit 'Save changes', class: "btn-success btn"
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
- if @snippet.project_id
2017-09-10 17:25:29 +05:30
= link_to "Cancel", project_snippets_path(@project), class: "btn btn-cancel"
2014-09-02 18:07:02 +05:30
- else
= link_to "Cancel", snippets_path(@project), class: "btn btn-cancel"