Commit 762946995ea9d477f00fea19e5040bf4dd437cb9

Authored by Valery Sizov
2 parents dc844f01 2f790001

Merge remote-tracking branch 'origin/master' into network_graph

Conflicts:
	app/assets/stylesheets/projects.css.scss
	lib/commit_ext.rb
app/assets/stylesheets/application.css
... ... @@ -8,3 +8,34 @@
8 8 *= require_self
9 9 *= require_tree .
10 10 */
  11 +
  12 +/** COLORS **/
  13 +.cgray { color:gray; }
  14 +.cred { color:#D12F19; }
  15 +.cgreen { color:#44aa22; }
  16 +
  17 +/** COMMON STYLES **/
  18 +.left {
  19 + float:left;
  20 +}
  21 +.right {
  22 + float:right;
  23 +}
  24 +.width-50p{
  25 + width:50%;
  26 +}
  27 +.width-49p{
  28 + width:49%;
  29 +}
  30 +.width-30p{
  31 + width:30%;
  32 +}
  33 +.width-65p{
  34 + width:65%;
  35 +}
  36 +.append-bottom-10 {
  37 + margin-bottom:10px;
  38 +}
  39 +.prepend-top-10 {
  40 + margin-top:10px;
  41 +}
... ...
app/assets/stylesheets/commits.css.scss
... ... @@ -37,4 +37,6 @@
37 37 }
38 38 }
39 39  
40   -
  40 +pre.commit_message {
  41 + white-space: pre-wrap;
  42 +}
... ...
app/assets/stylesheets/issues.css.scss
... ... @@ -10,14 +10,13 @@
10 10 color: #444;
11 11 }
12 12  
13   -#issues-table-holder .issue:hover .action-links { display:block; }
14   -
15 13 .issues_filter {
16 14 margin-top:10px;
17 15 .left {
18 16 margin-right:15px;
19 17 }
20 18 }
  19 +
21 20 .top_panel_issues{
22 21 #issue_search_form {
23 22 margin:5px 0;
... ... @@ -36,3 +35,14 @@
36 35 }
37 36 }
38 37 }
  38 +
  39 +/** ISSUES LIST **/
  40 +.issue .action-links {
  41 + display:none;
  42 + a {
  43 + margin-left:10px;
  44 + }
  45 +}
  46 +.issue:hover .action-links { display:block; }
  47 +
  48 +
... ...
app/assets/stylesheets/projects.css.scss
1   -// Place all the styles related to the Projects controller here.
2   -// They will automatically be included in application.css.
3   -// You can use Sass (SCSS) here: http://sass-lang.com/
4   -
  1 +/** MIXINS **/
5 2 @mixin round-borders-bottom($radius) {
6 3 border-top: 1px solid #eaeaea;
7 4 -moz-border-radius-bottomright: $radius;
... ... @@ -29,18 +26,6 @@
29 26 border-radius: $radius;
30 27 }
31 28  
32   -@mixin hover-color {
33   - background-color:#FFFFCF;
34   -}
35   -
36   -@mixin panel-color {
37   - background: #111 !important;
38   - background: -webkit-gradient(linear,left top,left bottom,from(#333),to(#111)) !important;
39   - background: -moz-linear-gradient(top,#333,#111) !important;
40   - background: transparent 9 !important;
41   -}
42   -
43   -
44 29 /** File stat **/
45 30 .file_stats {
46 31 margin-bottom:10px;
... ... @@ -66,24 +51,16 @@
66 51 @include round-borders-all(4px);
67 52 padding: 4px 0px;
68 53 }
  54 +
69 55 table.round-borders {
70 56 float:left;
71 57 }
72 58  
73   -
74   -#content-container{
75   - min-height:250px;
76   - background: #fff;
77   - @include round-borders-bottom(8px);
78   - borders:2px solid #eaeaea;
79   - border-top: none;
80   - padding:20px;
81   -}
82   -
83 59 a {
84 60 color: #111;
85 61 }
86 62  
  63 +/** FILE CONTENT VIEW **/
87 64 .view_file_content{
88 65 .old_line, .new_line {
89 66 background:#ECECEC;
... ... @@ -122,10 +99,34 @@ a {
122 99 }
123 100 }
124 101  
125   -.back_small.button{
  102 +td.code {
  103 + width: 100%;
  104 + .highlight {
  105 + margin-left: 55px;
  106 + overflow:auto;
  107 + overflow-y:hidden;
  108 + }
  109 +}
  110 +.highlight pre {
  111 + white-space: pre;
  112 + word-wrap:normal;
  113 +}
126 114  
  115 +.highlighttable tr:hover {
  116 + background:white;
  117 +}
  118 +table.highlighttable pre{
  119 + line-height:16px !important;
  120 + font-size:12px !important;
  121 +}
  122 +
  123 +
  124 +table.highlighttable .linenodiv pre {
  125 + text-align: right;
  126 + padding-right: 4px;
127 127 }
128 128  
  129 +/** PROJECTS **/
129 130 input.ssh_project_url {
130 131 padding:5px;
131 132 margin:0px;
... ... @@ -149,38 +150,7 @@ input.ssh_project_url {
149 150 clear: both;
150 151 }
151 152  
152   -.top_project_menu {
153   - a {
154   - border-right: 1px solid #FFFFFF;
155   - box-shadow: -1px 0 #DDDDDD inset;
156   - color: #666;
157   - display: block;
158   - font-size: 16px;
159   - text-decoration: none;
160   - line-height: 20px;
161   - padding: 11px 26px 12px 24px;
162   - text-shadow: 0 1px 0 #FFFFFF;
163   - float:left;
164   -
165   - &.current {
166   - background-color: #FFFFFF;
167   - color: #222222;
168   - }
169   - }
170   -}
171   -
172   -.top_bar {
173   - margin-top:50px;
174   - background-color: #F4F4F4;
175   - @include round-borders-top(8px);
176   - box-shadow: 0 1px #FFFFFF inset, 0 -1px #DDDDDD inset;
177   - height: 43px;
178   - overflow: hidden;
179   - width:990px;
180   -}
181   -
182 153 /** FORM INPUTS **/
183   -
184 154 .user_new,
185 155 .new_key,
186 156 .new_issue,
... ... @@ -202,7 +172,6 @@ input.ssh_project_url {
202 172 }
203 173  
204 174 .input_button {
205   - //@include round-borders-all(4px);
206 175 padding:8px;
207 176 font-size:14px;
208 177 cursor:pointer;
... ... @@ -214,7 +183,6 @@ input.ssh_project_url {
214 183 }
215 184  
216 185 /** FLASH **/
217   -
218 186 #flash_container {
219 187 height:40px;
220 188 position:fixed;
... ... @@ -236,7 +204,6 @@ input.ssh_project_url {
236 204 }
237 205  
238 206 /** Buttons **/
239   -
240 207 .lbutton,
241 208 .lite_button {
242 209 display:block;
... ... @@ -273,126 +240,10 @@ input.ssh_project_url {
273 240 width: 60px;
274 241 }
275 242  
276   -.project_thumb {
277   - margin:20px 0;
278   - width: 250px;
279   - float:left;
280   - padding:20px;
281   - text-align:center;
282   - p, h4 {
283   - text-align:left;
284   - }
285   - .lbutton {
286   - float:left;
287   - }
288   -}
289   -
290 243 .handle:hover{
291 244 cursor: move;
292 245 }
293 246  
294   -.handle{
295   - width: 12px;
296   - height: 12px;
297   - padding: 10px;
298   -}
299   -
300   -
301   -.tag {
302   - @include round-borders-all(4px);
303   - padding:2px 4px;
304   - border:none;
305   - text-shadow:none;
306   -
307   - &.high {
308   - background: #D12F19;
309   - color:white;
310   - }
311   -
312   - &.today {
313   - background: #44aa22;
314   - color:white;
315   - }
316   -
317   - &.yours {
318   - background: #4466cc;
319   - color:white;
320   - }
321   - &.normal {
322   - background: #2c5ca6;
323   - color:white;
324   - }
325   - &.notes {
326   - background: #2c5c66;
327   - color:white;
328   - }
329   -}
330   -
331   -
332   -.left {
333   - float:left;
334   -}
335   -.right {
336   - float:right;
337   -}
338   -
339   -.width-50p{
340   - width:50%;
341   -}
342   -.width-49p{
343   - width:49%;
344   -}
345   -.width-30p{
346   - width:30%;
347   -}
348   -.width-65p{
349   - width:65%;
350   -}
351   -pre.commit_message {
352   - white-space: pre-wrap;
353   -}
354   -
355   -#container {
356   -/* min-height:100%;*/
357   -}
358   -.ui-selectmenu{
359   - @include round-borders-all(4px);
360   - margin-right:10px;
361   - font-size:1.5em;
362   - height:auto;
363   - font-weight:bold;
364   - .ui-selectmenu-status {
365   - padding:3px 10px;
366   - }
367   -}
368   -
369   -td.code {
370   - width: 100%;
371   - .highlight {
372   - margin-left: 55px;
373   - overflow:auto;
374   - overflow-y:hidden;
375   - }
376   -}
377   -.highlight pre {
378   - white-space: pre;
379   - word-wrap:normal;
380   -}
381   -
382   -.highlighttable tr:hover {
383   - background:white;
384   -}
385   -table.highlighttable pre{
386   - line-height:16px !important;
387   - font-size:12px !important;
388   -}
389   -
390   -
391   -table.highlighttable .linenodiv pre {
392   - text-align: right;
393   - padding-right: 4px;
394   -}
395   -
396 247 .project-refs-form {
397 248 span {
398 249 background: none !important;
... ... @@ -408,11 +259,6 @@ table.highlighttable .linenodiv pre {
408 259  
409 260 .filter .left { margin-right:15px; }
410 261  
411   -
412   -.cgray { color:gray; }
413   -.cred { color:#D12F19; }
414   -.cgreen { color:#44aa22; }
415   -
416 262 body.project-page table .commit {
417 263 a.tree-commit-link {
418 264 color:gray;
... ... @@ -422,56 +268,114 @@ body.project-page table .commit {
422 268 }
423 269 }
424 270  
  271 +/** NEW PROJECT **/
  272 +.new-project-hodler {
  273 + .icon span { background-position: -31px -70px; }
  274 + td { border-bottom: 1px solid #DEE2E3; }
  275 +}
  276 +
  277 +/** Feed entry **/
  278 +.commit,
  279 +.snippet,
  280 +.message {
  281 + .title {
  282 + color:#666;
  283 + a { color:#666 !important; }
  284 + p { margin-top:0px; }
  285 + }
  286 + .author { color: #999 }
  287 +}
425 288  
426   -.snippet .action-links,
427   -#issues-table-holder .issue .action-links {
  289 +/** JQuery UI **/
  290 +.ui-autocomplete { @include round-borders-all(5px); }
  291 +.ui-menu-item { cursor: pointer }
  292 +.ui-selectmenu{
  293 + @include round-borders-all(4px);
  294 + margin-right:10px;
  295 + font-size:1.5em;
  296 + height:auto;
  297 + font-weight:bold;
  298 + .ui-selectmenu-status {
  299 + padding:3px 10px;
  300 + }
  301 +}
  302 +
  303 +/** Snippets **/
  304 +.new_snippet textarea,
  305 +.edit_snippet textarea {
  306 + height:300px;
  307 + padding: 8px;
  308 + width: 95%;
  309 +}
  310 +.snippet .action-links {
428 311 display:none;
429 312 a {
430 313 margin-left:10px;
431 314 }
432 315 }
433   -
434 316 .snippet:hover .action-links { display:block; }
435 317  
  318 +/** ISSUES TAGS **/
  319 +.tag {
  320 + @include round-borders-all(4px);
  321 + padding:2px 4px;
  322 + border:none;
  323 + text-shadow:none;
436 324  
437   -
438   -/** NEW PROJECT **/
439   -.new-project-hodler {
440   - .icon span {
441   - background-position: -31px -70px;
442   - }
443   - td {
444   - border-bottom: 1px solid #DEE2E3;
  325 + &.high {
  326 + background: #D12F19;
  327 + color:white;
445 328 }
446   -}
447   -
448   -//.message .note-title p { margin-bottom:0px; }
449 329  
450   -.commit,
451   -.snippet,
452   -.message {
453   - .title {
454   - color:#666;
455   - a {
456   - color:#666 !important;
457   - }
458   - p {
459   - margin-top:0px;
460   - }
  330 + &.today {
  331 + background: #44aa22;
  332 + color:white;
461 333 }
462 334  
463   - .author {
464   - color: #999
  335 + &.yours {
  336 + background: #4466cc;
  337 + color:white;
  338 + }
  339 + &.normal {
  340 + background: #2c5ca6;
  341 + color:white;
  342 + }
  343 + &.notes {
  344 + background: #2c5c66;
  345 + color:white;
  346 + }
  347 + &.note {
  348 + background: #2c5c66;
  349 + color:white;
  350 + }
  351 + &.issue {
  352 + background: #D12F19;
  353 + color:white;
  354 + }
  355 + &.commit {
  356 + background: #44aacc;
  357 + color:white;
465 358 }
466 359 }
467 360  
468   -/** UI autocomplete **/
469   -.ui-autocomplete { @include round-borders-all(5px); }
470   -.ui-menu-item { cursor: pointer }
471   -
472 361 #holder {
473 362 border: solid 1px #999;
474 363 cursor: move;
475 364 height: 70%;
476 365 overflow: hidden;
477 366 }
  367 +
  368 +/* Project Dashboard Page */
  369 +html, body { height: 100%; }
  370 +
  371 +body.dashboard.project-page .news-feed h2{float: left;}
  372 +body.dashboard.project-page .news-feed .project-updates {margin-bottom: 20px; display: block; width: 100%;}
  373 +body.dashboard.project-page .news-feed .project-updates .data{ padding: 0}
  374 +body.dashboard.project-page .news-feed .project-updates a.project-update {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
  375 +body.dashboard.project-page .news-feed .project-updates a.project-update:last-child{border-bottom: 0}
  376 +body.dashboard.project-page .news-feed .project-updates a.project-update img{float: left; margin-right: 10px;}
  377 +body.dashboard.project-page .news-feed .project-updates a.project-update span.update-title, .dashboard-page .news-feed .project-updates li a span.update-author{display: block;}
  378 +body.dashboard.project-page .news-feed .project-updates a.project-update span.update-title{margin-bottom: 10px}
  379 +body.dashboard.project-page .news-feed .project-updates a.project-update span.update-author{color: #999; font-weight: normal; font-style: italic;}
  380 +body.dashboard.project-page .news-feed .project-updates a.project-update span.update-author strong{font-weight: bold; font-style: normal;}
  381 +/* eo Dashboard Page */
... ...
app/controllers/projects_controller.rb
... ... @@ -66,21 +66,8 @@ class ProjectsController < ApplicationController
66 66  
67 67 def show
68 68 return render "projects/empty" unless @project.repo_exists?
69   - @date = case params[:view]
70   - when "week" then Date.today - 7.days
71   - when "day" then Date.today
72   - else nil
73   - end
74   -
75   - if @date
76   - @date = @date.at_beginning_of_day
77   -
78   - @commits = @project.commits_since(@date)
79   - @messages = project.notes.since(@date).order("created_at DESC")
80   - else
81   - @commits = @project.fresh_commits
82   - @messages = project.notes.fresh.limit(10)
83   - end
  69 + limit = (params[:limit] || 40).to_i
  70 + @activities = @project.updates(limit)
84 71 end
85 72  
86 73 #
... ...
app/models/repository.rb
... ... @@ -73,7 +73,7 @@ class Repository
73 73  
74 74 def fresh_commits(n = 10)
75 75 commits = heads.map do |h|
76   - repo.commits(h.name, n)
  76 + repo.commits(h.name, n).each { |c| c.head = h }
77 77 end.flatten.uniq { |c| c.id }
78 78  
79 79 commits.sort! do |x, y|
... ... @@ -85,7 +85,7 @@ class Repository
85 85  
86 86 def commits_since(date)
87 87 commits = heads.map do |h|
88   - repo.log(h.name, nil, :since => date)
  88 + repo.log(h.name, nil, :since => date).each { |c| c.head = h }
89 89 end.flatten.uniq { |c| c.id }
90 90  
91 91 commits.sort! do |x, y|
... ...
app/views/dashboard/index.html.haml
... ... @@ -27,6 +27,8 @@
27 27 %a.project-update{:href => dashboard_feed_path(project, update)}
28 28 = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
29 29 %span.update-title
  30 + - if update.kind_of?(Grit::Commit)
  31 + %span.right.tag.commit= update.head.name
30 32 = dashboard_feed_title(update)
31 33 %span.update-author
32 34 %strong= update.author_name
... ...
app/views/layouts/project.html.haml
... ... @@ -19,7 +19,7 @@
19 19 .git_url_wrapper
20 20 %input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo, :class => "one_click_select"}
21 21 %aside
22   - = link_to "History", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
  22 + = link_to "Activities", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
23 23 = link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil
24 24 = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil
25 25 = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
... ...
app/views/notes/_form.html.haml
... ... @@ -28,4 +28,4 @@
28 28  
29 29 .clear
30 30 %br
31   - = f.submit 'Add note', :class => "lbutton vm", :id => "submit_note"
  31 + = f.submit 'Add note', :class => "button", :id => "submit_note"
... ...
app/views/projects/_feed.html.haml 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +%a.project-update{:href => dashboard_feed_path(project, update)}
  2 + = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
  3 + %span.update-title
  4 + = dashboard_feed_title(update)
  5 + %span.update-author
  6 + %strong= update.author_name
  7 + authored
  8 + = time_ago_in_words(update.created_at)
  9 + ago
  10 + .right
  11 + - klass = update.class.to_s.split("::").last.downcase
  12 + %span.tag{ :class => klass }= klass
  13 + - if update.kind_of?(Grit::Commit)
  14 + %span.tag.commit= update.head.name
  15 +
... ...
app/views/projects/_recent_commits.html.haml
... ... @@ -1,32 +0,0 @@
1   -%table
2   - %thead
3   - %th
4   - Commits
5   - .filter.right
6   - = form_tag project_path(@project), :method => :get, :class => "right" do
7   - .left
8   - = radio_button_tag :view, "recent", (params[:view] || "recent") == "recent", :onclick => "this.form.submit()", :id => "recent_view"
9   - = label_tag "recent_view","Recent"
10   - .left
11   - = radio_button_tag :view, "day", params[:view] == "day", :onclick => "this.form.submit()", :id => "day_view"
12   - = label_tag "day_view","Today"
13   - .left
14   - = radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view"
15   - = label_tag "week_view","Week"
16   - - @commits.each do |commit|
17   - %tr
18   - %td
19   - %div.commit
20   - - if commit.author.email
21   - = image_tag gravatar_icon(commit.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
22   - - else
23   - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
24   - .title
25   - %p= link_to truncate(commit.safe_message, :length => 40), project_commit_path(@project, :id => commit.id)
26   -
27   - %span
28   - %span.author
29   - %strong= commit.author.name.force_encoding("UTF-8")
30   - %cite.cgray
31   - = time_ago_in_words(commit.committed_date)
32   - ago
app/views/projects/_recent_messages.html.haml
... ... @@ -1,27 +0,0 @@
1   -- @messages.group_by{ |x| [x.noteable_id, x.noteable_type]}.each do |item, notes|
2   - - id, type = item[0], item[1]
3   - - parent = load_note_parent(id, type, @project)
4   - - next unless parent
5   -
6   - %table
7   - %thead
8   - %th
9   - %div{ :class => "recent_message_parent"}
10   - = link_to(truncate(dashboard_feed_title(parent), :length => 40 ), dashboard_feed_path(@project, parent))
11   - - notes.sort {|x,y| y.updated_at <=> x.updated_at }.each do |note|
12   - %tr
13   - %td
14   - %div.message
15   - = image_tag gravatar_icon(note.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
16   - %div.title
17   - = link_to markdown(truncate(note.note, :length => 40)), dashboard_feed_path(@project, parent) + "#note_#{note.id}"
18   - - if note.attachment.url
19   - %br
20   - Attachment:
21   - = link_to note.attachment_identifier, note.attachment.url
22   - %div.author
23   - %strong= note.author_name
24   - %cite.cgray
25   - = time_ago_in_words(note.updated_at)
26   - ago
27   - %br
app/views/projects/show.html.haml
1   -.left.width-49p
2   - =render "projects/recent_commits"
  1 +- content_for(:body_class, "project-page dashboard")
3 2  
4   -.right.width-49p
5   - =render "projects/recent_messages"
  3 +#news-feed.news-feed
  4 + %h2.icon
  5 + %span>
  6 + Activities
  7 + .project-box.project-updates.ui-box.ui-box-small.ui-box-big
  8 + - @activities.each do |update|
  9 + = render "projects/feed", :update => update, :project => @project
6 10  
7 11 :javascript
8 12 function updateDashboard(){
... ...
app/views/snippets/_form.html.haml
... ... @@ -19,7 +19,8 @@
19 19 %td{:colspan => 2}
20 20 = f.label :content, "Code"
21 21 %br
22   - = f.text_area :content, :style => "height:240px;width:932px;"
  22 + %br
  23 + = f.text_area :content
23 24  
24 25 .actions.prepend-top
25   - = f.submit 'Save', :class => "lbutton vm"
  26 + = f.submit 'Save', :class => "button"
... ...
app/views/snippets/index.html.haml
1 1 %div
2 2 - if can? current_user, :write_snippet, @project
3   - .left= link_to 'New Snippet', new_project_snippet_path(@project), :class => "lbutton vm"
  3 + = link_to 'New Snippet', new_project_snippet_path(@project), :class => "button append-bottom-10"
4 4  
5 5 %table.round-borders#snippets-table
6 6 %thead
... ...
lib/commit_ext.rb
1 1 module CommitExt
2   -
  2 + attr_accessor :head
3 3 attr_accessor :refs
4 4  
5 5 def safe_message
... ...
spec/requests/dashboard_spec.rb
... ... @@ -22,6 +22,7 @@ describe &quot;Dashboard&quot; do
22 22  
23 23 it "should have news feed" do
24 24 within "#news-feed" do
  25 + page.should have_content("master")
25 26 page.should have_content(@project.commit.author.name)
26 27 page.should have_content(@project.commit.safe_message)
27 28 end
... ...
spec/requests/projects_spec.rb
... ... @@ -72,10 +72,13 @@ describe &quot;Projects&quot; do
72 72 current_path.should == project_path(@project)
73 73 end
74 74  
75   - it "should beahave like dashboard" do
76   - page.should have_content("History")
  75 + it "should beahave like activities page" do
  76 + within ".project-update" do
  77 + page.should have_content("master")
  78 + page.should have_content(@project.commit.author.name)
  79 + page.should have_content(@project.commit.safe_message)
  80 + end
77 81 end
78   -
79 82 end
80 83  
81 84 describe "GET /projects/team" do
... ...