Commit eb7bbedb20e57e7ff266dfd0611d4d25b69cde1b

Authored by Dmitriy Zaporozhets
1 parent cb59aade

Polishin & fixed tree switch

app/models/event.rb
@@ -33,6 +33,10 @@ class Event < ActiveRecord::Base @@ -33,6 +33,10 @@ class Event < ActiveRecord::Base
33 action == self.class::Pushed 33 action == self.class::Pushed
34 end 34 end
35 35
  36 + def new_tag?
  37 + data[:ref]["refs/tags"]
  38 + end
  39 +
36 def new_branch? 40 def new_branch?
37 data[:before] =~ /^00000/ 41 data[:before] =~ /^00000/
38 end 42 end
@@ -49,6 +53,10 @@ class Event < ActiveRecord::Base @@ -49,6 +53,10 @@ class Event < ActiveRecord::Base
49 @branch_name ||= data[:ref].gsub("refs/heads/", "") 53 @branch_name ||= data[:ref].gsub("refs/heads/", "")
50 end 54 end
51 55
  56 + def tag_name
  57 + @tag_name ||= data[:ref].gsub("refs/tags/", "")
  58 + end
  59 +
52 def pusher 60 def pusher
53 User.find_by_id(data[:user_id]) 61 User.find_by_id(data[:user_id])
54 end 62 end
app/views/dashboard/index.html.haml
1 - if current_user.require_ssh_key? 1 - if current_user.require_ssh_key?
2 - .alert-message.warning 2 + .alert-message.block-message.error
3 %p 3 %p
4 You wont be able to pull/push project code unless you 4 You wont be able to pull/push project code unless you
5 = link_to new_key_path, :class => "vlink" do 5 = link_to new_key_path, :class => "vlink" do
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 New Project » 32 New Project »
33 33
34 34
35 -- unless @merge_requests.blank? 35 +- if @merge_requests.any?
36 %div.dashboard_category 36 %div.dashboard_category
37 %h3 37 %h3
38 = link_to "Merge Requests" , "#merge_requests", :id => "merge_requests" 38 = link_to "Merge Requests" , "#merge_requests", :id => "merge_requests"
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 .row 45 .row
46 .dashboard_block= render "dashboard/merge_requests_feed" 46 .dashboard_block= render "dashboard/merge_requests_feed"
47 47
48 -- unless @issues.blank? 48 +- if @issues.any?
49 %div.dashboard_category 49 %div.dashboard_category
50 %h3 50 %h3
51 = link_to "Issues" , "#issues", :id => "issues" 51 = link_to "Issues" , "#issues", :id => "issues"
@@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
57 .row 57 .row
58 .dashboard_block= render "dashboard/issues_feed" 58 .dashboard_block= render "dashboard/issues_feed"
59 59
60 -- unless @events.blank? 60 +- if @events.any?
61 %div.dashboard_category 61 %div.dashboard_category
62 %h3 62 %h3
63 %span.ico.activities 63 %span.ico.activities
app/views/dashboard/issues.html.haml
@@ -3,4 +3,5 @@ @@ -3,4 +3,5 @@
3 %small ( assigned to you ) 3 %small ( assigned to you )
4 4
5 %br 5 %br
6 -.ui-box= render "dashboard/issues_feed" 6 +- if @issues.any?
  7 + .ui-box= render "dashboard/issues_feed"
app/views/dashboard/merge_requests.html.haml
@@ -3,4 +3,5 @@ @@ -3,4 +3,5 @@
3 %small ( authored or assigned to you ) 3 %small ( authored or assigned to you )
4 4
5 %br 5 %br
6 -.ui-box= render "dashboard/merge_requests_feed" 6 +- if @merge_requests.any?
  7 + .ui-box= render "dashboard/merge_requests_feed"
app/views/deploy_keys/index.html.haml
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 = link_to new_project_deploy_key_path(@project), :class => "btn small", :title => "New Deploy Key" do 5 = link_to new_project_deploy_key_path(@project), :class => "btn small", :title => "New Deploy Key" do
6 Add Deploy Key 6 Add Deploy Key
7 7
8 -%table.zebra-striped.borders  
9 - - @keys.each do |key|  
10 - = render(:partial => 'show', :locals => {:key => key}) 8 +- if @keys.any?
  9 + %table.zebra-striped.borders
  10 + - @keys.each do |key|
  11 + = render(:partial => 'show', :locals => {:key => key})
app/views/events/_event_push.html.haml
1 -- if event.new_branch? 1 +- if event.new_branch? || event.new_tag?
2 = image_tag gravatar_icon(event.pusher_email), :class => "avatar" 2 = image_tag gravatar_icon(event.pusher_email), :class => "avatar"
3 %strong #{event.pusher_name} 3 %strong #{event.pusher_name}
4 - pushed new branch  
5 - = link_to project_commits_path(event.project, :ref => event.branch_name) do  
6 - %strong= event.branch_name 4 + pushed new
  5 + - if event.new_tag?
  6 + tag
  7 + = link_to project_commits_path(event.project, :ref => event.tag_name) do
  8 + %strong= event.tag_name
  9 + - else
  10 + branch
  11 + = link_to project_commits_path(event.project, :ref => event.branch_name) do
  12 + %strong= event.branch_name
7 at 13 at
8 %strong= link_to event.project.name, event.project 14 %strong= link_to event.project.name, event.project
9 %span.cgray 15 %span.cgray
app/views/hooks/_data_ex.html.erb
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 :before => "95790bf891e76fee5e1747ab589903a6a1f80f22", 3 :before => "95790bf891e76fee5e1747ab589903a6a1f80f22",
4 :after => "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", 4 :after => "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
5 :ref => "refs/heads/master", 5 :ref => "refs/heads/master",
  6 + :user_id => 4,
  7 + :user_name => "John Smith",
6 :repository => { 8 :repository => {
7 :name => "Diaspora", 9 :name => "Diaspora",
8 :url => "localhost/diaspora", 10 :url => "localhost/diaspora",
app/views/hooks/index.html.haml
@@ -6,17 +6,16 @@ @@ -6,17 +6,16 @@
6 = link_to new_project_hook_path(@project), :class => "btn small", :title => "New Web Hook" do 6 = link_to new_project_hook_path(@project), :class => "btn small", :title => "New Web Hook" do
7 Add Post Receive Hook 7 Add Post Receive Hook
8 8
9 -%table.zebra-striped.borders  
10 - - @hooks.each do |hook|  
11 - %tr  
12 - %td  
13 - = link_to project_hook_path(@project, hook) do  
14 - = hook.url  
15 - %td  
16 - = link_to 'Remove', project_hook_path(@project, hook), :confirm => 'Are you sure?', :method => :delete, :class => "danger btn small" 9 +-if @hooks.any?
  10 + %table.zebra-striped.borders
  11 + - @hooks.each do |hook|
  12 + %tr
  13 + %td
  14 + = link_to project_hook_path(@project, hook) do
  15 + = hook.url
  16 + %td
  17 + = link_to 'Remove', project_hook_path(@project, hook), :confirm => 'Are you sure?', :method => :delete, :class => "danger btn small"
17 18
18 -  
19 -.alert-message.block-message  
20 - We send some data with POST request when someone makes git push  
21 -  
22 -.well= render "data_ex" 19 +.ui-box
  20 + %h5 Hooks request example
  21 + .data= render "data_ex"
app/views/projects/files.html.haml
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 = time_ago_in_words(note.created_at) 13 = time_ago_in_words(note.created_at)
14 ago 14 ago
15 - else 15 - else
16 - .notice_holder  
17 - %li All files attached to project wall, issues etc will be displayed here 16 + .alert-message.block-message
  17 + %p All files attached to project wall, issues etc will be displayed here
18 18
19 19
app/views/projects/index.html.haml
1 -.row  
2 - .span4  
3 - %div.leftbar.ui-box  
4 - %h5  
5 - Projects  
6 - - if current_user.can_create_project?  
7 - %span.right  
8 - = link_to new_project_path, :class => "btn very_small info" do  
9 - New Project  
10 - .content_list  
11 - - @projects.each do |project|  
12 - = link_to project_path(project), :remote => true, :class => dom_class(project) do  
13 - %h4  
14 - %span.ico.project  
15 - = truncate(project.name, :length => 22)  
16 - .span12.right  
17 - .show_holder.ui-box.padded  
18 - .loading 1 +- if @projects.any?
  2 + .row
  3 + .span4
  4 + %div.leftbar.ui-box
  5 + %h5
  6 + Projects
  7 + - if current_user.can_create_project?
  8 + %span.right
  9 + = link_to new_project_path, :class => "btn very_small info" do
  10 + New Project
  11 + .content_list
  12 + - @projects.each do |project|
  13 + = link_to project_path(project), :remote => true, :class => dom_class(project) do
  14 + %h4
  15 + %span.ico.project
  16 + = truncate(project.name, :length => 22)
  17 + .span12.right
  18 + .show_holder.ui-box.padded
  19 + .loading
  20 +
  21 +- else
  22 + %h3 Nothing here
  23 + %br
  24 + - if current_user.can_create_project?
  25 + .alert-message.block-message.warning
  26 + You can create up to
  27 + = current_user.projects_limit
  28 + projects. Click on link below to add a new one
  29 + .link_holder
  30 + = link_to new_project_path, :class => "" do
  31 + New Project »
  32 + - else
  33 + If you will be added to project - it will be displayed here
19 34
20 35
21 :javascript 36 :javascript
app/views/refs/tree.js.haml
1 :plain 1 :plain
2 - //$("#tree-content-holder").hide("slide", { direction: "left" }, 150, function(){  
3 - $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}");  
4 - $("#tree-content-holder").show("slide", { direction: "right" }, 150);  
5 - //}); 2 + $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}");
  3 + $("#tree-content-holder").show("slide", { direction: "right" }, 150);
  4 + $('.project-refs-form #path').val("#{params[:path]}");