2016-06-24 14:26:11 -04:00
- content_for :page_specific_javascripts do
= page_specific_javascript_tag('lib/ace.js')
2016-11-03 17:38:54 -04:00
= page_specific_javascript_bundle_tag('snippet')
2016-06-24 14:26:11 -04:00
2013-03-23 15:13:51 -04:00
.snippet-form-holder
2017-05-03 11:26:49 -04:00
= form_for @snippet, url: url, html: { class: "form-horizontal snippet-form js-requires-input js-quick-submit common-note-form" } do |f|
2016-04-04 21:25:38 -04:00
= form_errors(@snippet)
2013-03-23 15:13:51 -04:00
2013-12-30 18:27:02 -05:00
.form-group
2014-01-11 12:15:47 -05:00
= f.label :title, class: 'control-label'
2015-12-02 08:36:44 -05:00
.col-sm-10
= f.text_field :title, class: 'form-control', required: true, autofocus: true
2014-06-14 05:36:46 -04:00
2017-05-03 11:26:49 -04:00
= render 'shared/form_elements/description', model: @snippet, project: @project, form: f
2017-02-01 11:38:52 -05:00
= render 'shared/visibility_level', f: f, visibility_level: @snippet.visibility_level, can_change_visibility_level: true, form_model: @snippet
2015-05-16 16:09:04 -04:00
2015-06-15 18:58:58 -04:00
.file-editor
.form-group
2014-01-11 12:15:47 -05:00
= f.label :file_name, "File", class: 'control-label'
2013-12-30 18:27:02 -05:00
.col-sm-10
2013-07-13 02:52:47 -04:00
.file-holder.snippet
2017-02-05 17:28:48 -05:00
.js-file-title.file-title
2015-06-12 10:15:44 -04:00
= 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'
2013-07-13 02:52:47 -04:00
.file-content.code
2013-03-23 15:13:51 -04:00
%pre#editor= @snippet.content
= f.hidden_field :content, class: 'snippet-file-content'
2017-05-03 11:26:49 -04:00
- if params[:files]
- params[:files].each_with_index do |file, index|
= hidden_field_tag "files[]", file, id: "files_#{index}"
2013-03-23 15:13:51 -04:00
.form-actions
2013-08-12 05:08:52 -04:00
- if @snippet.new_record?
= f.submit 'Create snippet', class: "btn-create btn"
- else
2015-12-02 08:33:14 -05:00
= f.submit 'Save changes', class: "btn-save btn"
2013-03-23 15:13:51 -04:00
2015-05-14 20:15:06 -04:00
- if @snippet.project_id
2017-06-29 13:06:35 -04:00
= link_to "Cancel", project_snippets_path(@project), class: "btn btn-cancel"
2014-06-14 05:36:46 -04:00
- else
= link_to "Cancel", snippets_path(@project), class: "btn btn-cancel"