Commit fe1433c37907e9f1ee3c538d9d8cd79754541684

Authored by Dmitriy Zaporozhets
2 parents c98301d7 3f70316c

Merge branch 'dev'

Conflicts:
	app/helpers/dashboard_helper.rb
app/assets/javascripts/projects.js
... ... @@ -40,3 +40,19 @@ $(document).ready(function(){
40 40 function focusSearch() {
41 41 $("#search").focus();
42 42 }
  43 +
  44 +function taggifyForm(){
  45 + var tag_field = $('#tag_field').tagify();
  46 +
  47 + tag_field.tagify('inputField').autocomplete({
  48 + source: '/tags.json'
  49 + });
  50 +
  51 +
  52 + $('form').submit( function() {
  53 + var tag_field = $('#tag_field')
  54 + tag_field.val( tag_field.tagify('serialize') );
  55 + return true;
  56 + });
  57 +}
  58 +
... ...
app/assets/stylesheets/projects.css.scss
... ... @@ -443,67 +443,6 @@ input.ssh_project_url {
443 443 padding: 10px;
444 444 }
445 445  
446   -.recent_message_parent {
447   - img {
448   - padding-right:10px;
449   - }
450   -
451   - float: left;
452   - margin: 0 20px 20px 0px;
453   - padding: 5px 0px;;
454   - width: 420px;
455   -
456   - &.dash_wall{
457   - border-bottom: 2px solid orange;
458   - span {
459   - background: orange;
460   - color:black;
461   - }
462   - }
463   -
464   - &.dash_issue{
465   - border-bottom: 2px solid #ffbbbb;
466   - span {
467   - background: #ffbbbb;
468   - }
469   - }
470   - &.dash_commit{
471   - border-bottom: 2px solid #bbbbff;
472   -
473   - span{
474   - background: #bbbbff;
475   - }
476   - }
477   -
478   - &.dash_snippet{
479   - border-bottom: 2px solid #bbffbb;
480   -
481   - span{
482   - background: #bbffbb;
483   - }
484   - }
485   -
486   - span{
487   - border: 1px solid #aaa;
488   - color:black;
489   - padding:1px 4px;
490   - }
491   -
492   - h4 {
493   - margin-bottom:3px;
494   - }
495   -
496   -}
497   -.commit,
498   -.message{
499   - .author {
500   - background: #eaeaea;
501   - color: #333;
502   - border: 1px solid #aaa;
503   - padding:1px 2px;
504   - margin-right:5px;
505   - }
506   -}
507 446  
508 447 /* Note textare */
509 448 #note_note {
... ... @@ -665,6 +604,8 @@ table.highlighttable pre{
665 604 margin-right:15px;
666 605 }
667 606 }
  607 +.filter .left { margin-right:15px; }
  608 +
668 609  
669 610 .cgray { color:gray; }
670 611 .cred { color:#D12F19; }
... ... @@ -710,3 +651,33 @@ body.project-page #notes-list .note span.note-title{display: block;}
710 651 body.project-page #notes-list .note span.note-title{margin-bottom: 10px}
711 652 body.project-page #notes-list .note span.note-author{color: #999; font-weight: normal; font-style: italic;}
712 653 body.project-page #notes-list .note span.note-author strong{font-weight: bold; font-style: normal;}
  654 +
  655 +
  656 +/** NEW PROJECT **/
  657 +.new-project-hodler {
  658 + .icon span {
  659 + background-position: -31px -70px;
  660 + }
  661 + td {
  662 + border-bottom: 1px solid #DEE2E3;
  663 + }
  664 +}
  665 +
  666 +//.message .note-title p { margin-bottom:0px; }
  667 +
  668 +.commit,
  669 +.message {
  670 + .title {
  671 + color:#666;
  672 + a {
  673 + color:#666 !important;
  674 + }
  675 + p {
  676 + margin-top:0px;
  677 + }
  678 + }
  679 +
  680 + .author {
  681 + color: #999
  682 + }
  683 +}
... ...
app/assets/stylesheets/tags.css.css
... ... @@ -27,4 +27,18 @@
27 27 color: #FFF;
28 28 text-shadow: none;
29 29 font-weight: bold;
  30 +}
  31 +
  32 +
  33 +.medium-tags a{
  34 + font-size: 12px;
  35 +
  36 + display: inline-block;
  37 + padding: 3px 4px 2px 4px;
  38 + margin: 0px 7px 8px 0px;
  39 + border-radius: 3px;
  40 + background-color: #72bbdf;
  41 + color: #FFF;
  42 + text-shadow: none;
  43 + font-weight: bold;
30 44 }
31 45 \ No newline at end of file
... ...
app/helpers/dashboard_helper.rb
... ... @@ -12,7 +12,7 @@ module DashboardHelper
12 12 when "Commit" then project_commit_path(project, :id => note.noteable_id)
13 13 else wall_project_path(project)
14 14 end
15   - else "#"
  15 + else wall_project_path(project)
16 16 end
17 17 rescue
18 18 "#"
... ... @@ -24,8 +24,8 @@ module DashboardHelper
24 24 title = case klass
25 25 when "Note" then markdown(object.note)
26 26 when "Issue" then object.title
27   - when "Commit" then object.safe_message
28   - else ""
  27 + when "Grit::Commit" then object.safe_message
  28 + else return "Project Wall"
29 29 end
30 30  
31 31 "[#{klass}] #{truncate(sanitize(title, :tags => []), :length => 60)} "
... ...
app/helpers/issues_helper.rb
1 1 module IssuesHelper
  2 + def sort_class
  3 + if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0")
  4 + "handle"
  5 + end
  6 + end
  7 +
  8 + def project_issues_filter_path project, params = {}
  9 + params[:f] ||= cookies['issue_filter']
  10 + project_issues_path project, params
  11 + end
2 12 end
... ...
app/helpers/tags_helper.rb 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +module TagsHelper
  2 + def tag_path tag
  3 + "/tags/#{tag}"
  4 + end
  5 +
  6 + def tag_list project
  7 + html = ''
  8 + project.tag_list.each do |tag|
  9 + html += link_to tag, tag_path(tag)
  10 + end
  11 +
  12 + html.html_safe
  13 + end
  14 +
  15 +end
... ...
app/views/admin/projects/_form.html.haml
1 1 = form_for [:admin, @admin_project] do |f|
2 2 -if @admin_project.errors.any?
3 3 #error_explanation
4   - %h2= "#{pluralize(@admin_project.errors.count, "error")} prohibited this admin_project from being saved:"
  4 + %h2= "#{pluralize(@admin_project.errors.count, "error")} prohibited this admin_project from being saved:"
5 5 %ul
6 6 - @admin_project.errors.full_messages.each do |msg|
7 7 %li= msg
8 8  
9   - .span-24
10   - .span-12
11   - .field
12   - = f.label :name
13   - %br
14   - = f.text_field :name
15   - .field
16   - = f.label :code
17   - %br
18   - = f.text_field :code
19   - .field
20   - = f.label :path
21   - %br
22   - = f.text_field :path
23   - .span-10
24   - .field
25   - = f.label :description
26   - %br
27   - = f.text_area :description
  9 + .form-row
  10 + = f.label :name
  11 + %br
  12 + = f.text_field :name
  13 + .form-row
  14 + = f.label :code
  15 + %br
  16 + = f.text_field :code
  17 + .form-row
  18 + = f.label :path
  19 + %br
  20 + = f.text_field :path
  21 +
  22 +
  23 + .form-row
  24 + = f.label :tag_list
  25 + %br
  26 + = f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
  27 +
  28 + .form-row
  29 + = f.label :description
  30 + %br
  31 + = f.text_area :description
28 32 .clear
29 33 .actions
30 34 = f.submit 'Save', :class => "lbutton"
  35 +
  36 +:javascript
  37 + $(function(){
  38 + taggifyForm();
  39 + })
... ...
app/views/commits/_text_file.html.haml
... ... @@ -13,10 +13,8 @@
13 13 = diff_line(line, line_new, line_old)
14 14 - if line[0] == "+"
15 15 - line_new += 1
16   - - elsif
17   - - line[0] == "-"
  16 + - elsif line[0] == "-"
18 17 - line_old += 1
19 18 - else
20 19 - line_new += 1
21 20 - line_old += 1
22   -
... ...
app/views/dashboard/index.html.haml
... ... @@ -23,7 +23,7 @@
23 23 .project-box.project-updates.ui-box.ui-box-small.ui-box-big
24 24 %h3= project.name
25 25 .data
26   - - project.updates.each do |update|
  26 + - project.updates(4).each do |update|
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
... ... @@ -34,7 +34,5 @@
34 34 = time_ago_in_words(update.created_at)
35 35 ago
36 36 %br
37   - / .project-update
38   - / .project-updates
39 37 / #news-feed
40 38 / #dashboard-content
... ...
app/views/issues/_show.html.haml
1 1 %tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) }
2   - -#- if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0")
3   - %td
4   - = image_tag "move.png" , :class => [:handle, :left]
5 2 %td
6   - %strong.issue-number= "##{issue.id}"
  3 + %strong.issue-number{:class => sort_class}= "##{issue.id}"
7 4 %span
8 5 = truncate(html_escape(issue.title), :length => fixed_mode? ? 100 : 200)
9 6 %br
... ...
app/views/issues/index.html.haml
... ... @@ -13,16 +13,16 @@
13 13 .right.issues_filter
14 14 = form_tag project_issues_path(@project), :method => :get do
15 15 .left
16   - = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues", :class => "status"
  16 + = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "setIssueFilter(this.form, 0)", :id => "open_issues", :class => "status"
17 17 = label_tag "open_issues","Open"
18 18 .left
19   - = radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues", :class => "status"
  19 + = radio_button_tag :f, 2, params[:f] == "2", :onclick => "setIssueFilter(this.form, 2)", :id => "closed_issues", :class => "status"
20 20 = label_tag "closed_issues","Closed"
21 21 .left
22   - = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues", :class => "status"
  22 + = radio_button_tag :f, 3, params[:f] == "3", :onclick => "setIssueFilter(this.form, 3)", :id => "my_issues", :class => "status"
23 23 = label_tag "my_issues","To Me"
24 24 .left
25   - = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues", :class => "status"
  25 + = radio_button_tag :f, 1, params[:f] == "1", :onclick => "setIssueFilter(this.form, 1)", :id => "all_issues", :class => "status"
26 26 = label_tag "all_issues","All"
27 27  
28 28 = render "issues"
... ... @@ -31,6 +31,12 @@
31 31 var href = $('.issue_search').parent().attr('action');
32 32 var last_terms = '';
33 33  
  34 +
  35 + var setIssueFilter = function(form, value){
  36 + $.cookie('issue_filter', value, { expires: 140 });
  37 + form.submit();
  38 + }
  39 +
34 40 $('.issue_search').keyup(function() {
35 41 var terms = $(this).val();
36 42 var project_id = $('#project_id').val();
... ...
app/views/layouts/project.html.haml
... ... @@ -25,7 +25,7 @@
25 25 Team
26 26 - if @project.users_projects.count > 0
27 27 %span{ :class => "number" }= @project.users_projects.count
28   - = link_to project_issues_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
  28 + = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
29 29 Issues
30 30 - if @project.issues.opened.count > 0
31 31 %span{ :class => "number" }= @project.issues.opened.count
... ... @@ -40,5 +40,7 @@
40 40 - if @commit
41 41 = link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil
42 42  
  43 + .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project
  44 +
43 45 .project-content
44 46 = yield
... ...
app/views/projects/_form.html.haml
1 1 = form_for(@project, :remote => true) do |f|
2 2 %div.form_content
3 3 - unless @project.new_record?
4   - %h1 Edit Project
  4 + %h2.icon
  5 + %span
  6 + = @project.name
5 7 - if @project.errors.any?
6 8 #error_explanation
7 9 %h2
... ... @@ -10,7 +12,7 @@
10 12 %ul
11 13 - @project.errors.full_messages.each do |msg|
12 14 %li= msg
13   - %table.round-borders
  15 + %table
14 16 %tr
15 17 %td= f.label :name
16 18 %td= f.text_field :name, :placeholder => "Example Project"
... ... @@ -29,15 +31,13 @@
29 31 %tr
30 32 %td= f.label :tag_list
31 33 %td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
  34 + %tr
  35 + %td= f.label :description
  36 + %td= f.text_area :description, :placeholder => "project description", :style => "height:50px"
32 37  
33   - .field
34   - = f.label :description
35   - %br/
36   - = f.text_area :description, :style => "height:140px;width:932px;"
37   - .clear
38   - %hr.prepend-top
  38 + %br
39 39 .actions
40   - = f.submit :class => "lbutton vm"
  40 + = f.submit :class => "button"
41 41  
42 42 %div{ :class => "ajax_loader", :style => "display:none;height:200px;"}
43 43 %center
... ... @@ -55,16 +55,5 @@
55 55  
56 56 :javascript
57 57 $(function(){
58   - var tag_field = $('#tag_field').tagify();
59   -
60   - tag_field.tagify('inputField').autocomplete({
61   - source: '/tags.json'
62   - });
63   -
64   -
65   - $('form').submit( function() {
66   - var tag_field = $('#tag_field')
67   - tag_field.val( tag_field.tagify('serialize') );
68   - return true;
69   - });
  58 + taggifyForm();
70 59 })
... ...
app/views/projects/_list.html.haml
... ... @@ -12,9 +12,8 @@
12 12 %tr{ :class => "project", :url => project_path(project) }
13 13 %td
14 14 = project.name
15   - .small-tags
16   - - project.tag_list.each do |tag|
17   - = link_to tag, "/tags/#{tag}"
  15 + .small-tags= tag_list project
  16 +
18 17  
19 18 %td= truncate project.url_to_repo
20 19 %td= project.code
... ...
app/views/projects/_recent_commits.html.haml
1   -- @commits.each do |commit|
2   - %div.commit
3   - - if commit.author.email
4   - = image_tag gravatar_icon(commit.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
5   - - else
6   - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
7   - %p{:style => "margin-bottom: 3px;"}
8   - %strong
9   - = link_to truncate(commit.safe_message, :length => 60), project_commit_path(@project, :id => commit.id)
10   -
11   - %span
12   - %span.author
13   - = commit.author.name.force_encoding("UTF-8")
14   - %cite
15   - = time_ago_in_words(commit.committed_date)
16   - ago
17   - %br
  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 => fixed_mode? ? 40 : 100), project_commit_path(@project, :id => commit.id)
18 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
... ... @@ -3,50 +3,25 @@
3 3 - parent = load_note_parent(id, type, @project)
4 4 - next unless parent
5 5  
6   - - case type
7   - - when "Issue"
8   - - css_class = "dash_issue"
9   - - issue = parent
10   - - item_code = issue.author.email
11   - - link_item_name = truncate(issue.title, :length => 50)
12   - - link_to_item = project_issue_path(@project, issue)
13   - - when "Snippet"
14   - - css_class = "dash_snippet"
15   - - item_code = parent.author.email
16   - - link_item_name = parent.title
17   - - link_to_item = project_snippet_path(@project, parent)
18   - - when "Commit"
19   - - css_class = "dash_commit"
20   - - commit = parent
21   - - item_code = commit.author.email
22   - - link_item_name = truncate(commit.safe_message, :length => 50)
23   - - link_to_item = project_commit_path(@project, :id => commit.id)
24   - - else
25   - - css_class = "dash_wall"
26   - - item_code = @project.name
27   - - link_item_name = "Project Wall"
28   - - link_to_item = wall_project_path(@project)
29   -
30   - %div{ :class => "recent_message_parent #{css_class}"}
31   - = image_tag gravatar_icon(item_code), :class => "left", :width => 40
32   - %h4
33   - = link_to(link_item_name, link_to_item)
34   - %span
35   - = type
36   - .clear
37   - - notes.sort {|x,y| x.updated_at <=> y.updated_at }.each do |note|
38   - %div.message
39   - = image_tag gravatar_icon(note.author.email), :class => "left", :width => 24, :style => "padding-right:5px;"
40   - %p{:style => "margin-bottom: 3px;"}
41   - %span.author
42   - = note.author.name
43   - = link_to markdown(truncate(note.note, :length => 200)), link_to_item + "#note_#{note.id}"
44   - - if note.attachment.url
45   - %br
46   - Attachment:
47   - = link_to note.attachment_identifier, note.attachment.url
48   - %br
49   - %br
50   - .append-bottom
51   - &nbsp;
52   - .clear
  6 + %table
  7 + %thead
  8 + %th
  9 + %div{ :class => "recent_message_parent"}
  10 + = link_to(truncate(dashboard_feed_title(parent), :length => fixed_mode? ? 40 : 100 ), 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 => fixed_mode? ? 40 : 100)), 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/_tile.html.haml
... ... @@ -13,9 +13,7 @@
13 13 - last_note = project.notes.last
14 14 = last_note ? last_note.created_at.stamp("24 Aug, 2011") : "Never"
15 15  
16   - %p.small-tags
17   - - project.tag_list.each do |tag|
18   - = link_to tag, "/tags/#{tag}"
  16 + %p.small-tags= tag_list project
19 17  
20 18 .buttons
21 19 %a.browse-code.button.yellow{:href => tree_project_path(project)} Browse code
... ...
app/views/projects/new.html.erb
... ... @@ -1 +0,0 @@
1   -<%= render 'form' %>
app/views/projects/new.html.haml 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +.new-project-hodler
  2 + .container_4
  3 + %h2.icon
  4 + %span
  5 + New Project
  6 +
  7 + %div.clear
  8 + = render 'form'
... ...
app/views/projects/show.html.haml
1   -%div
2   - %h2.left History
3   - .right
4   - = form_tag project_path(@project), :method => :get do
5   - .span-2
6   - = radio_button_tag :view, "recent", (params[:view] || "recent") == "recent", :onclick => "this.form.submit()", :id => "recent_view"
7   - = label_tag "recent_view","Recent"
8   - .span-2
9   - = radio_button_tag :view, "day", params[:view] == "day", :onclick => "this.form.submit()", :id => "day_view"
10   - = label_tag "day_view","Today"
11   - .span-2
12   - = radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view"
13   - = label_tag "week_view","Week"
14   - .clear
15   - %hr
16 1 .left.width-49p
17   - %h3 Commits
18 2 =render "projects/recent_commits"
19 3  
20 4 .right.width-49p
21   - %h3 Talk
22 5 =render "projects/recent_messages"
23 6  
24 7 :javascript
25 8 function updateDashboard(){
26   - $('#content-container').load("#{escape_javascript(project_path(@project))} #content-container>*");
  9 + $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*");
27 10 }
28 11 setInterval("updateDashboard()", 300000);
... ...
app/views/tags/index.html.haml
... ... @@ -7,5 +7,5 @@
7 7  
8 8 .tags-list
9 9 - @tags.all.each do |tag|
10   - = link_to "#{tag.name}(#{tag.count})", "/tags/#{tag.name}"
  10 + = link_to "#{tag.name}(#{tag.count})", tag_path(name)
11 11  
... ...
spec/requests/issues_spec.rb
... ... @@ -158,7 +158,6 @@ describe &quot;Issues&quot; do
158 158 it "should have valid show page for issue" do
159 159 page.should have_content @issue.title
160 160 page.should have_content @user.name
161   - page.should have_content "today"
162 161 end
163 162 end
164 163  
... ...