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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/commits')
-rw-r--r--app/views/commits/_commits.html.haml22
-rw-r--r--app/views/commits/_diff.html.haml58
-rw-r--r--app/views/commits/_index.html.haml9
-rw-r--r--app/views/commits/index.html.haml13
-rw-r--r--app/views/commits/index.js.erb2
-rw-r--r--app/views/commits/show.html.haml39
-rw-r--r--app/views/commits/show.js.haml6
7 files changed, 149 insertions, 0 deletions
diff --git a/app/views/commits/_commits.html.haml b/app/views/commits/_commits.html.haml
new file mode 100644
index 00000000000..4eebb83aa15
--- /dev/null
+++ b/app/views/commits/_commits.html.haml
@@ -0,0 +1,22 @@
+- @commits.group_by { |c| c.committed_date.to_date }.each do |day, commits|
+ .day-commits-table
+ .day-header
+ %h3= day.stamp("28 Aug, 2010")
+ %ul
+ - commits.each do |commit|
+ %li{ :class => "commit", :url => project_commit_path(@project, :id => commit.id) }
+ - if commit.author.email
+ = image_tag gravatar_icon(commit.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
+ - else
+ = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
+ %p
+ %strong
+ = commit.message.length > 60 ? (commit.message[0..59] + "...") : commit.message
+ = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right"
+ = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right"
+ %span
+ %span
+ [ #{commit.author} ]
+ = time_ago_in_words(commit.committed_date)
+ ago
+= more_commits_link if @commits.size > 99
diff --git a/app/views/commits/_diff.html.haml b/app/views/commits/_diff.html.haml
new file mode 100644
index 00000000000..dff99bf12f0
--- /dev/null
+++ b/app/views/commits/_diff.html.haml
@@ -0,0 +1,58 @@
+- require "utils"
+.file_stats
+ - @commit.diffs.each do |diff|
+ - if diff.deleted_file
+ %span.removed_file
+ %a{:href => "##{diff.a_path}"}
+ = diff.a_path
+ = image_tag "blueprint_delete.png"
+ - elsif diff.renamed_file
+ %span.moved_file
+ %a{:href => "##{diff.b_path}"}
+ = diff.a_path
+ = "->"
+ = diff.b_path
+ = image_tag "blueprint_notice.png"
+ - elsif diff.new_file
+ %span.new_file
+ %a{:href => "##{diff.b_path}"}
+ = diff.b_path
+ = image_tag "blueprint_add.png"
+ - else
+ %span.edit_file
+ %a{:href => "##{diff.b_path}"}
+ = diff.b_path
+ = image_tag "blueprint_info.png"
+- @commit.diffs.each do |diff|
+ - next if diff.diff.empty?
+ - file = (@commit.tree / diff.b_path)
+ - next unless file
+ .diff_file
+ .diff_file_header
+ - if diff.deleted_file
+ %strong{:id => "#{diff.b_path}"}= diff.a_path
+ - else
+ %strong{:id => "#{diff.b_path}"}= diff.b_path
+ %br/
+ .diff_file_content
+ - if file.mime_type =~ /application|text/ && !Utils.binary?(file.data)
+ - lines_arr = diff.diff.lines.to_a
+ - line_old = lines_arr[2].match(/-(\d)/)[0].to_i.abs rescue 0
+ - line_new = lines_arr[2].match(/\+(\d)/)[0].to_i.abs rescue 0
+ - lines = lines_arr[3..-1].join
+ - lines.each_line do |line|
+ = diff_line(line, line_new, line_old)
+ - if line[0] == "+"
+ - line_new += 1
+ - elsif
+ - line[0] == "-"
+ - line_old += 1
+ - else
+ - line_new += 1
+ - line_old += 1
+ - elsif file.mime_type =~ /image/
+ .diff_file_content_image
+ %img{:src => "data:image/jpeg;base64,#{Base64.encode64(file.data)}"}
+ - else
+ %p
+ %center No preview for this file type
diff --git a/app/views/commits/_index.html.haml b/app/views/commits/_index.html.haml
new file mode 100644
index 00000000000..e4c9cc6e83c
--- /dev/null
+++ b/app/views/commits/_index.html.haml
@@ -0,0 +1,9 @@
+= form_tag project_commits_path(@project), :method => :get do
+ %h3
+ = @project.name
+ [ #{select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "small"} ]
+= link_to 'Back', project_path(@project), :class => "button"
+%h1 Listing commits
+%div{:id => dom_id(@project)}
+ = render "commits"
+%br/ \ No newline at end of file
diff --git a/app/views/commits/index.html.haml b/app/views/commits/index.html.haml
new file mode 100644
index 00000000000..95579119aee
--- /dev/null
+++ b/app/views/commits/index.html.haml
@@ -0,0 +1,13 @@
+%div
+ %h3
+ .left
+ = form_tag project_commits_path(@project), :method => :get do
+ = select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Branches"
+  
+ .left.prepend-1
+ = form_tag project_commits_path(@project), :method => :get do
+ = select_tag "tag", options_for_select(@project.tags, @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
+ = text_field_tag "ssh", @project.url_to_repo, :class => ["ssh_project_url", "one_click_select"]
+ .clear
+ %div{:id => dom_id(@project)}
+ = render "commits"
diff --git a/app/views/commits/index.js.erb b/app/views/commits/index.js.erb
new file mode 100644
index 00000000000..94daa396c5c
--- /dev/null
+++ b/app/views/commits/index.js.erb
@@ -0,0 +1,2 @@
+$("#more-commits-link").remove();
+$('#<%= dom_id(@project)%>').append('<%= escape_javascript(render("commits")) %>');
diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml
new file mode 100644
index 00000000000..147aaafb855
--- /dev/null
+++ b/app/views/commits/show.html.haml
@@ -0,0 +1,39 @@
+%h3
+ = "[ #{@commit.committer} ] #{truncate @commit.message, :length => 80}"
+-#= link_to 'Back', project_commits_path(@project), :class => "button"
+%table.round-borders
+ %tr
+ %td ID
+ %td= @commit.id
+ %tr
+ %td Author
+ %td= @commit.author
+ %tr
+ %td Commiter
+ %td= @commit.committer
+ %tr
+ %td Commited Date
+ %td= @commit.committed_date
+ %tr
+ %td Message
+ %td= @commit.message
+ %tr
+ %td Tree
+ %td= link_to 'Browse Code', tree_project_path(@project, :commit_id => @commit.id)
+.clear
+
+#tabs
+ %ul
+ %li
+ %a{ :href => "#tabs-1" } Diff
+ %li
+ %a{ :href => "#tabs-2" } Comments
+ %span{ :class => "notes_count" }= @notes.count
+ %hr
+ #tabs-1
+ = render "commits/diff"
+ #tabs-2
+ = render "notes/notes"
+
+:javascript
+ $(function() { $( "#tabs" ).tabs(); });
diff --git a/app/views/commits/show.js.haml b/app/views/commits/show.js.haml
new file mode 100644
index 00000000000..2c46689b1ed
--- /dev/null
+++ b/app/views/commits/show.js.haml
@@ -0,0 +1,6 @@
+:plain
+ $("#side-commit-preview").remove();
+ var side = $("<div id='side-commit-preview'></div>");
+ side.html("#{escape_javascript(render "commits/show")}");
+ $("##{dom_id(@project)}").parent().append(side);
+ $("##{dom_id(@project)}").addClass("span-14");