diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-15 20:52:10 +0400 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-15 20:52:10 +0400 |
commit | bd5dbe14e45a19b30c5b9ff23a82559c79bd2e6f (patch) | |
tree | 27d81435cf5e5d907c5d817203584e0be1ca1e6d /app/views | |
parent | c01b0fd5d4fb8110be2539b165b2e028540ad6f6 (diff) | |
parent | 809aefb828e0d4b5c06304fcde2dcfced66ab4e9 (diff) |
Merge branch 'web_editor'
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/tree/_tree_file.html.haml | 8 | ||||
-rw-r--r-- | app/views/tree/edit.html.haml | 30 |
2 files changed, 35 insertions, 3 deletions
diff --git a/app/views/tree/_tree_file.html.haml b/app/views/tree/_tree_file.html.haml index 82aaed24bdc..5202126792a 100644 --- a/app/views/tree/_tree_file.html.haml +++ b/app/views/tree/_tree_file.html.haml @@ -5,9 +5,11 @@ = tree_file.name.force_encoding('utf-8') %small #{tree_file.mode} %span.options - = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank" - = link_to "history", project_commits_path(@project, @id), class: "btn very_small" - = link_to "blame", project_blame_path(@project, @id), class: "btn very_small" + .btn-group.tree-btn-group + = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank" + = link_to "history", project_commits_path(@project, @id), class: "btn very_small" + = link_to "blame", project_blame_path(@project, @id), class: "btn very_small" + = link_to "edit", edit_project_tree_path(@project, @id), class: "btn very_small" - if tree_file.text? - if gitlab_markdown?(tree_file.name) .file_content.wiki diff --git a/app/views/tree/edit.html.haml b/app/views/tree/edit.html.haml new file mode 100644 index 00000000000..b81373b5587 --- /dev/null +++ b/app/views/tree/edit.html.haml @@ -0,0 +1,30 @@ +.file-editor + = form_tag(project_tree_path(@project, @id), :method => :put) do + .file_holder + .file_title + %i.icon-file + %span.file_name + = @tree.path.force_encoding('utf-8') + %span.options + = link_to "cancel editing", project_tree_path(@project, @id), class: "btn very_small" + .file_content.code + #editor= @tree.data + + .editor-commit-comment + = label_tag 'commit_message' do + %p.slead Commit message + = text_area_tag 'commit_message', '', :required => true + .form-actions + = hidden_field_tag 'last_commit', @last_commit + = hidden_field_tag 'content', '', :id => :file_content + = button_tag "Save", class: 'btn save-btn' + +:javascript + var editor = ace.edit("editor"); + editor.setTheme("ace/theme/twilight"); + editor.getSession().setMode("ace/mode/javascript"); + + $(".save-btn").click(function(){ + $("#file_content").val(editor.getValue()); + $(".form_editor form").submit(); + }); |