Welcome to mirror list, hosted at ThFree Co, Russian Federation.

_form.html.haml « snippets « projects « views « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a4f307347896d42ab994ff99a79d3c942c43538b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%h3.page-title
  = @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"
%hr
.snippet-form-holder
  = form_for [@project, @snippet], as: :project_snippet, url: url do |f|
    -if @snippet.errors.any?
      .alert.alert-error
        %ul
          - @snippet.errors.full_messages.each do |msg|
            %li= msg

    .clearfix
      = f.label :title
      .input= f.text_field :title, placeholder: "Example Snippet", class: 'input-xlarge', required: true
    .clearfix
      = f.label "Lifetime"
      .input= f.select :expires_at, lifetime_select_options, {}, {class: 'chosen span2'}
    .clearfix
      .file-editor
        = f.label :file_name, "File"
        .input
          .file_holder.snippet
            .file_title
              = f.text_field :file_name, placeholder: "example.rb", class: 'snippet-file-name', required: true
            .file_content.code
              %pre#editor= @snippet.content
              = f.hidden_field :content, class: 'snippet-file-content'

    .form-actions
      = f.submit 'Save', class: "btn-save btn"
      = link_to "Cancel", project_snippets_path(@project), class: " btn"
      - unless @snippet.new_record?
        .pull-right= link_to 'Destroy', project_snippet_path(@project, @snippet), confirm: 'Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}"


:javascript
  var editor = ace.edit("editor");
  $(".snippet-form-holder form").submit(function(){
    $(".snippet-file-content").val(editor.getValue());
  });