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

show.html.haml « edit_tree « projects « views « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 101b479afedbb89042dc55cf107c5add15a06c0f (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
42
43
44
45
.file-editor
  = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do
    .file_holder
      .file_title
        %i.icon-file
        %span.file_name
          = @path
          %small
            on
            %strong= @ref
        %span.options
          .btn-group.tree-btn-group
            = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: leave_edit_message
      .file_content.code
        %pre#editor= @blob.data

    .control-group.commit_message-group
      = label_tag 'commit_message', class: "control-label" do
        Commit message
      .controls
        = text_area_tag 'commit_message', '', placeholder: "Update #{@blob.name}", required: true, rows: 3
    .form-actions
      = hidden_field_tag 'last_commit', @last_commit
      = hidden_field_tag 'content', '', id: :file_content
      .commit-button-annotation
        = button_tag "Commit changes", class: 'btn commit-btn js-commit-button btn-primary'
        .message
          to branch
          %strong= @ref
      = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-cancel", confirm: leave_edit_message

:javascript
  ace.config.set("modePath", "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict")
  var ace_mode = "#{@blob.language.try(:ace_mode)}";
  var editor = ace.edit("editor");
  if (ace_mode) {
    editor.getSession().setMode('ace/mode/' + ace_mode);
  }

  disableButtonIfEmptyField("#commit_message", ".js-commit-button");

  $(".js-commit-button").click(function(){
    $("#file_content").val(editor.getValue());
    $(".file-editor form").submit();
  });