BigW Consortium Gitlab

_form.html.haml 1.49 KB
Newer Older
1 2 3 4
- content_for :page_specific_javascripts do
  = page_specific_javascript_tag('lib/ace.js')
  = page_specific_javascript_tag('snippet/snippet_bundle.js')

5
.snippet-form-holder
6
  = form_for @snippet, url: url, html: { class: "form-horizontal snippet-form js-requires-input" } do |f|
7
    = form_errors(@snippet)
8

9
    .form-group
10
      = f.label :title, class: 'control-label'
11 12
      .col-sm-10
        = f.text_field :title, class: 'form-control', required: true, autofocus: true
13

Vinnie Okada committed
14
    = render 'shared/visibility_level', f: f, visibility_level: visibility_level, can_change_visibility_level: true, form_model: @snippet
15

16 17
    .file-editor
      .form-group
18
        = f.label :file_name, "File", class: 'control-label'
19
        .col-sm-10
20 21
          .file-holder.snippet
            .file-title
22
              = 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'
23
            .file-content.code
24 25 26 27
              %pre#editor= @snippet.content
              = f.hidden_field :content, class: 'snippet-file-content'

    .form-actions
28 29 30
      - if @snippet.new_record?
        = f.submit 'Create snippet', class: "btn-create btn"
      - else
31
        = f.submit 'Save changes', class: "btn-save btn"
32

33
      - if @snippet.project_id
Vinnie Okada committed
34
        = link_to "Cancel", namespace_project_snippets_path(@project.namespace, @project), class: "btn btn-cancel"
35 36
      - else
        = link_to "Cancel", snippets_path(@project), class: "btn btn-cancel"
37