Merge branch 'master' into discussions
Conflicts: app/assets/stylesheets/main.scss app/models/project.rb app/views/notes/_common_form.html.haml app/views/notes/_per_line_form.html.haml lib/gitlab/markdown.rb spec/models/note_spec.rb
This commit is contained in:
commit
db2c15369c
276 changed files with 4466 additions and 2603 deletions
|
@ -1,28 +1,41 @@
|
|||
%h3.page_title
|
||||
= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"
|
||||
%hr
|
||||
= form_for [@project, @snippet] do |f|
|
||||
-if @snippet.errors.any?
|
||||
.alert-message.block-message.error
|
||||
%ul
|
||||
- @snippet.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
.snippet-form-holder
|
||||
= form_for [@project, @snippet] do |f|
|
||||
-if @snippet.errors.any?
|
||||
.alert-message.block-message.error
|
||||
%ul
|
||||
- @snippet.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.clearfix
|
||||
= f.label :title
|
||||
.input= f.text_field :title, placeholder: "Example Snippet"
|
||||
.clearfix
|
||||
= f.label :file_name
|
||||
.input= f.text_field :file_name, placeholder: "example.rb"
|
||||
.clearfix
|
||||
= f.label "Lifetime"
|
||||
.input= f.select :expires_at, lifetime_select_options, {}, {class: 'chosen span2'}
|
||||
.clearfix
|
||||
= f.label :content, "Code"
|
||||
.input= f.text_area :content, class: "span8"
|
||||
.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: "save-btn btn"
|
||||
= link_to "Cancel", project_snippets_path(@project), class: " btn"
|
||||
- unless @snippet.new_record?
|
||||
.right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn 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());
|
||||
});
|
||||
|
||||
.form-actions
|
||||
= f.submit 'Save', class: "primary btn"
|
||||
= link_to "Cancel", project_snippets_path(@project), class: " btn"
|
||||
- unless @snippet.new_record?
|
||||
.right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}"
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
%tr
|
||||
%td
|
||||
= image_tag gravatar_icon(snippet.author_email), class: "avatar s24"
|
||||
%a{href: project_snippet_path(snippet.project, snippet)}
|
||||
%strong= truncate(snippet.title, length: 60)
|
||||
%td
|
||||
= snippet.file_name
|
||||
%td
|
||||
%span.cgray
|
||||
- if snippet.expires_at
|
||||
- if snippet.expires_at
|
||||
= snippet.expires_at.to_date.to_s(:short)
|
||||
- else
|
||||
Never
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
= render "projects/project_head"
|
||||
|
||||
- if can? current_user, :write_snippet, @project
|
||||
.alert-message.block-message
|
||||
%h3.page_title
|
||||
Snippets
|
||||
%small share code pastes with others out of git repository
|
||||
|
||||
- if can? current_user, :write_snippet, @project
|
||||
= link_to new_project_snippet_path(@project), class: "btn small add_new right", title: "New Snippet" do
|
||||
Add new snippet
|
||||
Share code pastes with others if it can't be in a git repository
|
||||
%br
|
||||
To add new snippet - click on button.
|
||||
|
||||
%br
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th Title
|
||||
%th File Name
|
||||
%th Expires At
|
||||
= render @snippets.fresh
|
||||
- if @snippets.fresh.empty?
|
||||
= render @snippets
|
||||
- if @snippets.empty?
|
||||
%tr
|
||||
%td{colspan: 3}
|
||||
%h3.nothing_here_message Nothing here.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
= render "projects/project_head"
|
||||
|
||||
%h3
|
||||
%h3.page_title
|
||||
= @snippet.title
|
||||
%small= @snippet.file_name
|
||||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue