Commit 7087e11f1daeaad16406c19894675ea3466f5ed9
Exists in
master
and in
4 other branches
Merge branch 'feature/search_issues' into develop
Showing
51 changed files
with
502 additions
and
138 deletions
Show diff stats
CHANGELOG
1 | v 1.1.0 | 1 | v 1.1.0 |
2 | + - project dashboard | ||
3 | + - wall redesigned | ||
2 | - feature: code snippets | 4 | - feature: code snippets |
3 | - fixed horizontal scroll on file preview | 5 | - fixed horizontal scroll on file preview |
4 | - fixed app crash if commit message has invalid chars | 6 | - fixed app crash if commit message has invalid chars |
Gemfile
@@ -15,11 +15,12 @@ gem 'therubyracer' | @@ -15,11 +15,12 @@ gem 'therubyracer' | ||
15 | gem 'faker' | 15 | gem 'faker' |
16 | gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git' | 16 | gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git' |
17 | gem "inifile" | 17 | gem "inifile" |
18 | -gem "albino", :git => "git://github.com/gitlabhq/albino.git" | 18 | +gem "pygments.rb", "0.2.3" |
19 | gem "kaminari" | 19 | gem "kaminari" |
20 | gem "thin" | 20 | gem "thin" |
21 | gem "git" | 21 | gem "git" |
22 | gem "acts_as_list" | 22 | gem "acts_as_list" |
23 | +gem "mysql2" | ||
23 | 24 | ||
24 | group :assets do | 25 | group :assets do |
25 | gem 'sass-rails', " ~> 3.1.0" | 26 | gem 'sass-rails', " ~> 3.1.0" |
Gemfile.lock
@@ -5,13 +5,6 @@ GIT | @@ -5,13 +5,6 @@ GIT | ||
5 | annotate (2.4.1.beta1) | 5 | annotate (2.4.1.beta1) |
6 | 6 | ||
7 | GIT | 7 | GIT |
8 | - remote: git://github.com/gitlabhq/albino.git | ||
9 | - revision: 118380924969f3a856659f86ea1f40c1ba7bfcb1 | ||
10 | - specs: | ||
11 | - albino (1.3.3) | ||
12 | - posix-spawn (>= 0.3.6) | ||
13 | - | ||
14 | -GIT | ||
15 | remote: git://github.com/gitlabhq/grit.git | 8 | remote: git://github.com/gitlabhq/grit.git |
16 | revision: ff015074ef35bd94cba943f9c0f98e161ab5851c | 9 | revision: ff015074ef35bd94cba943f9c0f98e161ab5851c |
17 | specs: | 10 | specs: |
@@ -72,6 +65,7 @@ GEM | @@ -72,6 +65,7 @@ GEM | ||
72 | ZenTest (= 4.5) | 65 | ZenTest (= 4.5) |
73 | awesome_print (0.4.0) | 66 | awesome_print (0.4.0) |
74 | bcrypt-ruby (3.0.1) | 67 | bcrypt-ruby (3.0.1) |
68 | + blankslate (2.1.2.4) | ||
75 | builder (3.0.0) | 69 | builder (3.0.0) |
76 | capybara (1.0.1) | 70 | capybara (1.0.1) |
77 | mime-types (>= 1.16) | 71 | mime-types (>= 1.16) |
@@ -134,10 +128,13 @@ GEM | @@ -134,10 +128,13 @@ GEM | ||
134 | treetop (~> 1.4.8) | 128 | treetop (~> 1.4.8) |
135 | mime-types (1.16) | 129 | mime-types (1.16) |
136 | multi_json (1.0.3) | 130 | multi_json (1.0.3) |
131 | + mysql2 (0.3.7) | ||
137 | nokogiri (1.5.0) | 132 | nokogiri (1.5.0) |
138 | orm_adapter (0.0.5) | 133 | orm_adapter (0.0.5) |
139 | polyglot (0.3.2) | 134 | polyglot (0.3.2) |
140 | posix-spawn (0.3.6) | 135 | posix-spawn (0.3.6) |
136 | + pygments.rb (0.2.3) | ||
137 | + rubypython (>= 0.5.1) | ||
141 | rack (1.3.2) | 138 | rack (1.3.2) |
142 | rack-cache (1.0.3) | 139 | rack-cache (1.0.3) |
143 | rack (>= 0.4) | 140 | rack (>= 0.4) |
@@ -189,6 +186,9 @@ GEM | @@ -189,6 +186,9 @@ GEM | ||
189 | ruby-debug-base19 (>= 0.11.19) | 186 | ruby-debug-base19 (>= 0.11.19) |
190 | ruby_core_source (0.1.5) | 187 | ruby_core_source (0.1.5) |
191 | archive-tar-minitar (>= 0.5.2) | 188 | archive-tar-minitar (>= 0.5.2) |
189 | + rubypython (0.5.1) | ||
190 | + blankslate (>= 2.1.2.3) | ||
191 | + ffi (~> 1.0.7) | ||
192 | rubyzip (0.9.4) | 192 | rubyzip (0.9.4) |
193 | sass (3.1.7) | 193 | sass (3.1.7) |
194 | sass-rails (3.1.1) | 194 | sass-rails (3.1.1) |
@@ -242,7 +242,6 @@ PLATFORMS | @@ -242,7 +242,6 @@ PLATFORMS | ||
242 | 242 | ||
243 | DEPENDENCIES | 243 | DEPENDENCIES |
244 | acts_as_list | 244 | acts_as_list |
245 | - albino! | ||
246 | annotate! | 245 | annotate! |
247 | autotest | 246 | autotest |
248 | autotest-rails | 247 | autotest-rails |
@@ -260,6 +259,8 @@ DEPENDENCIES | @@ -260,6 +259,8 @@ DEPENDENCIES | ||
260 | jquery-rails | 259 | jquery-rails |
261 | kaminari | 260 | kaminari |
262 | launchy | 261 | launchy |
262 | + mysql2 | ||
263 | + pygments.rb (= 0.2.3) | ||
263 | rails (= 3.1.0) | 264 | rails (= 3.1.0) |
264 | rails-footnotes (>= 3.7.5.rc4) | 265 | rails-footnotes (>= 3.7.5.rc4) |
265 | rspec-rails | 266 | rspec-rails |
VERSION
app/assets/javascripts/application.js
@@ -16,3 +16,7 @@ $(function(){ | @@ -16,3 +16,7 @@ $(function(){ | ||
16 | $('select#branch').selectmenu({style:'popup', width:200}); | 16 | $('select#branch').selectmenu({style:'popup', width:200}); |
17 | $('select#tag').selectmenu({style:'popup', width:200}); | 17 | $('select#tag').selectmenu({style:'popup', width:200}); |
18 | }); | 18 | }); |
19 | + | ||
20 | +function updatePage(){ | ||
21 | + $.ajax({type: "GET", url: location.href, dataType: "script"}); | ||
22 | +} |
app/assets/stylesheets/projects.css.scss
@@ -491,8 +491,14 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -491,8 +491,14 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
491 | background: white; | 491 | background: white; |
492 | } | 492 | } |
493 | p { | 493 | p { |
494 | - margin-bottom: 3px; | ||
495 | - font-size: 12px; | 494 | + margin-bottom: 4px; |
495 | + font-size: 13px; | ||
496 | + color:#111; | ||
497 | + } | ||
498 | + } | ||
499 | + cite { | ||
500 | + &.ago { | ||
501 | + color:#666; | ||
496 | } | 502 | } |
497 | } | 503 | } |
498 | } | 504 | } |
@@ -515,7 +521,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -515,7 +521,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
515 | } | 521 | } |
516 | .note_content { | 522 | .note_content { |
517 | float:left; | 523 | float:left; |
518 | - width:750px; | 524 | + width:650px; |
519 | } | 525 | } |
520 | 526 | ||
521 | .issue_notes { | 527 | .issue_notes { |
@@ -557,21 +563,78 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | @@ -557,21 +563,78 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
557 | img { | 563 | img { |
558 | padding-right:10px; | 564 | padding-right:10px; |
559 | } | 565 | } |
560 | - background: #fff !important; | ||
561 | - background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#EAEAEA)) !important; | ||
562 | - background: -moz-linear-gradient(top,#fff,#EAEAEA) !important; | ||
563 | - background: transparent 9 !important; | ||
564 | 566 | ||
565 | float: left; | 567 | float: left; |
566 | margin: 0 20px 20px 0px; | 568 | margin: 0 20px 20px 0px; |
567 | - padding: 5px 5px;; | 569 | + padding: 5px 0px;; |
568 | width: 420px; | 570 | width: 420px; |
569 | 571 | ||
572 | + &.dash_wall{ | ||
573 | + border-bottom: 2px solid orange; | ||
574 | + span { | ||
575 | + background: orange; | ||
576 | + color:black; | ||
577 | + } | ||
578 | + } | ||
579 | + | ||
580 | + &.dash_issue{ | ||
581 | + border-bottom: 2px solid #ffbbbb; | ||
582 | + span { | ||
583 | + background: #ffbbbb; | ||
584 | + } | ||
585 | + } | ||
586 | + &.dash_commit{ | ||
587 | + border-bottom: 2px solid #bbbbff; | ||
588 | + | ||
589 | + span{ | ||
590 | + background: #bbbbff; | ||
591 | + } | ||
592 | + } | ||
593 | + | ||
594 | + &.dash_snippet{ | ||
595 | + border-bottom: 2px solid #bbffbb; | ||
596 | + | ||
597 | + span{ | ||
598 | + background: #bbffbb; | ||
599 | + } | ||
600 | + } | ||
601 | + | ||
602 | + | ||
603 | + span{ | ||
604 | + border: 1px solid #aaa; | ||
605 | + color:black; | ||
606 | + padding:1px 4px; | ||
607 | + } | ||
608 | + | ||
570 | h4 { | 609 | h4 { |
571 | margin-bottom:3px; | 610 | margin-bottom:3px; |
572 | } | 611 | } |
573 | 612 | ||
574 | - span { | ||
575 | - | 613 | +} |
614 | +.commit, | ||
615 | +.message, | ||
616 | +#notes-list{ | ||
617 | + .author { | ||
618 | + background: #eaeaea; | ||
619 | + color: #333; | ||
620 | + border: 1px solid #aaa; | ||
621 | + padding:1px 2px; | ||
622 | + margin-right:5px; | ||
623 | + } | ||
624 | +} | ||
625 | + | ||
626 | +/* Note textare */ | ||
627 | +#note_note { | ||
628 | + height:100px; | ||
629 | + width:97%; | ||
630 | + font-size:14px; | ||
631 | +} | ||
632 | + | ||
633 | +.wall_page { | ||
634 | + #note_note { | ||
635 | + height:25px; | ||
636 | + } | ||
637 | + .attach_holder { | ||
638 | + display:none; | ||
576 | } | 639 | } |
577 | } | 640 | } |
app/controllers/issues_controller.rb
@@ -78,6 +78,13 @@ class IssuesController < ApplicationController | @@ -78,6 +78,13 @@ class IssuesController < ApplicationController | ||
78 | render :nothing => true | 78 | render :nothing => true |
79 | end | 79 | end |
80 | 80 | ||
81 | + def search | ||
82 | + @project = Project.find(params['project']) | ||
83 | + @issues = @project.issues.where("title LIKE ? OR content LIKE ?", "%#{params['terms']}%", "%#{params['terms']}%") | ||
84 | + | ||
85 | + render :partial => 'issues' | ||
86 | + end | ||
87 | + | ||
81 | protected | 88 | protected |
82 | 89 | ||
83 | def issue | 90 | def issue |
app/controllers/profile_controller.rb
@@ -3,6 +3,12 @@ class ProfileController < ApplicationController | @@ -3,6 +3,12 @@ class ProfileController < ApplicationController | ||
3 | @user = current_user | 3 | @user = current_user |
4 | end | 4 | end |
5 | 5 | ||
6 | + def social_update | ||
7 | + @user = current_user | ||
8 | + @user.update_attributes(params[:user]) | ||
9 | + redirect_to [:profile] | ||
10 | + end | ||
11 | + | ||
6 | def password | 12 | def password |
7 | @user = current_user | 13 | @user = current_user |
8 | end | 14 | end |
app/controllers/projects_controller.rb
@@ -60,24 +60,21 @@ class ProjectsController < ApplicationController | @@ -60,24 +60,21 @@ class ProjectsController < ApplicationController | ||
60 | end | 60 | end |
61 | 61 | ||
62 | def show | 62 | def show |
63 | - if @project.repo_exists? | ||
64 | - @date = case params[:view] | ||
65 | - when "week" then Date.today - 7.days | ||
66 | - else Date.today | ||
67 | - end | ||
68 | - | ||
69 | - @heads = @project.repo.heads | ||
70 | - @commits = @heads.map do |h| | ||
71 | - @project.repo.log(h.name, nil, :since => @date - 1.day) | ||
72 | - end.flatten.uniq { |c| c.id } | ||
73 | - | ||
74 | - @commits.sort! do |x, y| | ||
75 | - y.committed_date <=> x.committed_date | ||
76 | - end | ||
77 | - | ||
78 | - @messages = project.notes.since(@date).limit(40).order("created_at DESC") | ||
79 | - else | ||
80 | - return render "projects/empty" | 63 | + return render "projects/empty" unless @project.repo_exists? |
64 | + @date = case params[:view] | ||
65 | + when "week" then Date.today - 7.days | ||
66 | + when "day" then Date.today | ||
67 | + else nil | ||
68 | + end | ||
69 | + | ||
70 | + if @date | ||
71 | + @date = @date.at_beginning_of_day | ||
72 | + | ||
73 | + @commits = @project.commits_since(@date) | ||
74 | + @messages = project.notes.since(@date).order("created_at DESC") | ||
75 | + else | ||
76 | + @commits = @project.fresh_commits | ||
77 | + @messages = project.notes.fresh.limit(10) | ||
81 | end | 78 | end |
82 | end | 79 | end |
83 | 80 | ||
@@ -86,8 +83,15 @@ class ProjectsController < ApplicationController | @@ -86,8 +83,15 @@ class ProjectsController < ApplicationController | ||
86 | # | 83 | # |
87 | 84 | ||
88 | def wall | 85 | def wall |
89 | - @notes = @project.common_notes | ||
90 | @note = Note.new | 86 | @note = Note.new |
87 | + @notes = @project.common_notes.order("created_at DESC") | ||
88 | + | ||
89 | + @notes = case params[:view] | ||
90 | + when "week" then @notes.since((Date.today - 7.days).at_beginning_of_day) | ||
91 | + when "all" then @notes.all | ||
92 | + when "day" then @notes.since(Date.today.at_beginning_of_day) | ||
93 | + else @notes.fresh.limit(10) | ||
94 | + end | ||
91 | end | 95 | end |
92 | 96 | ||
93 | # | 97 | # |
app/helpers/application_helper.rb
@@ -53,25 +53,4 @@ module ApplicationHelper | @@ -53,25 +53,4 @@ module ApplicationHelper | ||
53 | [projects, default_nav, project_nav].flatten.to_json | 53 | [projects, default_nav, project_nav].flatten.to_json |
54 | end | 54 | end |
55 | 55 | ||
56 | - def handle_file_type(file_name, mime_type = nil) | ||
57 | - if file_name =~ /(\.rb|\.ru|\.rake|Rakefile|\.gemspec|\.rbx|Gemfile)$/ | ||
58 | - :ruby | ||
59 | - elsif file_name =~ /\.py$/ | ||
60 | - :python | ||
61 | - elsif file_name =~ /(\.pl|\.scala|\.c|\.cpp|\.java|\.haml|\.html|\.sass|\.scss|\.xml|\.php|\.erb)$/ | ||
62 | - $1[1..-1].to_sym | ||
63 | - elsif file_name =~ /\.js$/ | ||
64 | - :javascript | ||
65 | - elsif file_name =~ /\.sh$/ | ||
66 | - :bash | ||
67 | - elsif file_name =~ /\.coffee$/ | ||
68 | - :coffeescript | ||
69 | - elsif file_name =~ /\.yml$/ | ||
70 | - :yaml | ||
71 | - elsif file_name =~ /\.md$/ | ||
72 | - :minid | ||
73 | - else | ||
74 | - :text | ||
75 | - end | ||
76 | - end | ||
77 | end | 56 | end |
app/helpers/projects_helper.rb
@@ -8,6 +8,7 @@ module ProjectsHelper | @@ -8,6 +8,7 @@ module ProjectsHelper | ||
8 | case type | 8 | case type |
9 | when "Issue" then @project.issues.find(id) | 9 | when "Issue" then @project.issues.find(id) |
10 | when "Commit" then @project.repo.commits(id).first | 10 | when "Commit" then @project.repo.commits(id).first |
11 | + when "Snippet" then @project.snippets.find(id) | ||
11 | else | 12 | else |
12 | true | 13 | true |
13 | end | 14 | end |
app/models/note.rb
@@ -24,6 +24,7 @@ class Note < ActiveRecord::Base | @@ -24,6 +24,7 @@ class Note < ActiveRecord::Base | ||
24 | 24 | ||
25 | scope :last_week, where("created_at >= :date", :date => (Date.today - 7.days)) | 25 | scope :last_week, where("created_at >= :date", :date => (Date.today - 7.days)) |
26 | scope :since, lambda { |day| where("created_at >= :date", :date => (day)) } | 26 | scope :since, lambda { |day| where("created_at >= :date", :date => (day)) } |
27 | + scope :fresh, order("created_at DESC") | ||
27 | 28 | ||
28 | mount_uploader :attachment, AttachmentUploader | 29 | mount_uploader :attachment, AttachmentUploader |
29 | end | 30 | end |
app/models/project.rb
@@ -126,6 +126,34 @@ class Project < ActiveRecord::Base | @@ -126,6 +126,34 @@ class Project < ActiveRecord::Base | ||
126 | end | 126 | end |
127 | end | 127 | end |
128 | 128 | ||
129 | + def heads | ||
130 | + @heads ||= repo.heads | ||
131 | + end | ||
132 | + | ||
133 | + def fresh_commits | ||
134 | + commits = heads.map do |h| | ||
135 | + repo.commits(h.name, 10) | ||
136 | + end.flatten.uniq { |c| c.id } | ||
137 | + | ||
138 | + commits.sort! do |x, y| | ||
139 | + y.committed_date <=> x.committed_date | ||
140 | + end | ||
141 | + | ||
142 | + commits[0..10] | ||
143 | + end | ||
144 | + | ||
145 | + def commits_since(date) | ||
146 | + commits = heads.map do |h| | ||
147 | + repo.log(h.name, nil, :since => date) | ||
148 | + end.flatten.uniq { |c| c.id } | ||
149 | + | ||
150 | + commits.sort! do |x, y| | ||
151 | + y.committed_date <=> x.committed_date | ||
152 | + end | ||
153 | + | ||
154 | + commits | ||
155 | + end | ||
156 | + | ||
129 | def tree(fcommit, path = nil) | 157 | def tree(fcommit, path = nil) |
130 | fcommit = commit if fcommit == :head | 158 | fcommit = commit if fcommit == :head |
131 | tree = fcommit.tree | 159 | tree = fcommit.tree |
app/models/snippet.rb
1 | class Snippet < ActiveRecord::Base | 1 | class Snippet < ActiveRecord::Base |
2 | + include Utils::Colorize | ||
3 | + | ||
2 | belongs_to :project | 4 | belongs_to :project |
3 | belongs_to :author, :class_name => "User" | 5 | belongs_to :author, :class_name => "User" |
4 | has_many :notes, :as => :noteable | 6 | has_many :notes, :as => :noteable |
@@ -28,6 +30,10 @@ class Snippet < ActiveRecord::Base | @@ -28,6 +30,10 @@ class Snippet < ActiveRecord::Base | ||
28 | ".js", ".sh", ".coffee", ".yml", ".md" | 30 | ".js", ".sh", ".coffee", ".yml", ".md" |
29 | ] | 31 | ] |
30 | end | 32 | end |
33 | + | ||
34 | + def colorize | ||
35 | + system_colorize(content, file_name) | ||
36 | + end | ||
31 | end | 37 | end |
32 | # == Schema Information | 38 | # == Schema Information |
33 | # | 39 | # |
app/models/user.rb
@@ -5,7 +5,8 @@ class User < ActiveRecord::Base | @@ -5,7 +5,8 @@ class User < ActiveRecord::Base | ||
5 | :recoverable, :rememberable, :trackable, :validatable | 5 | :recoverable, :rememberable, :trackable, :validatable |
6 | 6 | ||
7 | # Setup accessible (or protected) attributes for your model | 7 | # Setup accessible (or protected) attributes for your model |
8 | - attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :projects_limit | 8 | + attr_accessible :email, :password, :password_confirmation, :remember_me, |
9 | + :name, :projects_limit, :skype, :linkedin, :twitter | ||
9 | 10 | ||
10 | has_many :users_projects, :dependent => :destroy | 11 | has_many :users_projects, :dependent => :destroy |
11 | has_many :projects, :through => :users_projects | 12 | has_many :projects, :through => :users_projects |
@@ -58,5 +59,8 @@ end | @@ -58,5 +59,8 @@ end | ||
58 | # name :string(255) | 59 | # name :string(255) |
59 | # admin :boolean default(FALSE), not null | 60 | # admin :boolean default(FALSE), not null |
60 | # projects_limit :integer | 61 | # projects_limit :integer |
62 | +# skype :string | ||
63 | +# linkedin :string | ||
64 | +# twitter :string | ||
61 | # | 65 | # |
62 | 66 |
app/views/admin/users/_form.html.haml
@@ -25,13 +25,26 @@ | @@ -25,13 +25,26 @@ | ||
25 | = f.label :password_confirmation | 25 | = f.label :password_confirmation |
26 | %br | 26 | %br |
27 | = f.password_field :password_confirmation | 27 | = f.password_field :password_confirmation |
28 | - .span-11 | ||
29 | - .field.prepend-top.append-bottom | 28 | + .field.prepend-top |
30 | = f.check_box :admin | 29 | = f.check_box :admin |
31 | = f.label :admin | 30 | = f.label :admin |
31 | + .span-11 | ||
32 | .field.prepend-top | 32 | .field.prepend-top |
33 | = f.text_field :projects_limit, :class => "small_input" | 33 | = f.text_field :projects_limit, :class => "small_input" |
34 | = f.label :projects_limit | 34 | = f.label :projects_limit |
35 | + | ||
36 | + .field | ||
37 | + = f.label :skype | ||
38 | + %br | ||
39 | + = f.text_field :skype | ||
40 | + .field | ||
41 | + = f.label :linkedin | ||
42 | + %br | ||
43 | + = f.text_field :linkedin | ||
44 | + .field | ||
45 | + = f.label :twitter | ||
46 | + %br | ||
47 | + = f.text_field :twitter | ||
35 | .clear | 48 | .clear |
36 | %br | 49 | %br |
37 | .actions | 50 | .actions |
app/views/admin/users/show.html.haml
@@ -14,6 +14,17 @@ | @@ -14,6 +14,17 @@ | ||
14 | %b Projects limit: | 14 | %b Projects limit: |
15 | = @admin_user.projects_limit | 15 | = @admin_user.projects_limit |
16 | 16 | ||
17 | + %p | ||
18 | + %b Skype: | ||
19 | + = @admin_user.skype | ||
20 | + %p | ||
21 | + %b LinkedIn: | ||
22 | + = @admin_user.linkedin | ||
23 | + %p | ||
24 | + %b Twitter: | ||
25 | + = @admin_user.twitter | ||
26 | + | ||
27 | + | ||
17 | .clear | 28 | .clear |
18 | = link_to 'Edit', edit_admin_user_path(@admin_user) | 29 | = link_to 'Edit', edit_admin_user_path(@admin_user) |
19 | \| | 30 | \| |
app/views/commits/_commits.html.haml
@@ -15,8 +15,8 @@ | @@ -15,8 +15,8 @@ | ||
15 | = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right" | 15 | = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right" |
16 | = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right" | 16 | = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right" |
17 | %span | 17 | %span |
18 | - %span | ||
19 | - [ #{commit.author} ] | 18 | + %span.author |
19 | + = commit.author | ||
20 | = time_ago_in_words(commit.committed_date) | 20 | = time_ago_in_words(commit.committed_date) |
21 | ago | 21 | ago |
22 | = more_commits_link if @commits.size > 99 | 22 | = more_commits_link if @commits.size > 99 |
app/views/commits/_diff.html.haml
1 | -- require "utils" | ||
2 | .file_stats | 1 | .file_stats |
3 | - @commit.diffs.each do |diff| | 2 | - @commit.diffs.each do |diff| |
4 | - if diff.deleted_file | 3 | - if diff.deleted_file |
@@ -35,7 +34,7 @@ | @@ -35,7 +34,7 @@ | ||
35 | %strong{:id => "#{diff.b_path}"}= diff.b_path | 34 | %strong{:id => "#{diff.b_path}"}= diff.b_path |
36 | %br/ | 35 | %br/ |
37 | .diff_file_content | 36 | .diff_file_content |
38 | - - if file.mime_type =~ /application|text/ && !Utils.binary?(file.data) | 37 | + - if file.text? |
39 | - lines_arr = diff.diff.lines.to_a | 38 | - lines_arr = diff.diff.lines.to_a |
40 | - line_old = lines_arr[2].match(/-(\d)/)[0].to_i.abs rescue 0 | 39 | - line_old = lines_arr[2].match(/-(\d)/)[0].to_i.abs rescue 0 |
41 | - line_new = lines_arr[2].match(/\+(\d)/)[0].to_i.abs rescue 0 | 40 | - line_new = lines_arr[2].match(/\+(\d)/)[0].to_i.abs rescue 0 |
@@ -50,9 +49,9 @@ | @@ -50,9 +49,9 @@ | ||
50 | - else | 49 | - else |
51 | - line_new += 1 | 50 | - line_new += 1 |
52 | - line_old += 1 | 51 | - line_old += 1 |
53 | - - elsif file.mime_type =~ /image/ | 52 | + - elsif file.image? |
54 | .diff_file_content_image | 53 | .diff_file_content_image |
55 | - %img{:src => "data:image/jpeg;base64,#{Base64.encode64(file.data)}"} | 54 | + %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} |
56 | - else | 55 | - else |
57 | %p | 56 | %p |
58 | %center No preview for this file type | 57 | %center No preview for this file type |
app/views/commits/show.js.haml
1 | -:plain | 1 | +-#:plain |
2 | $("#side-commit-preview").remove(); | 2 | $("#side-commit-preview").remove(); |
3 | var side = $("<div id='side-commit-preview'></div>"); | 3 | var side = $("<div id='side-commit-preview'></div>"); |
4 | side.html("#{escape_javascript(render "commits/show")}"); | 4 | side.html("#{escape_javascript(render "commits/show")}"); |
5 | $("##{dom_id(@project)}").parent().append(side); | 5 | $("##{dom_id(@project)}").parent().append(side); |
6 | $("##{dom_id(@project)}").addClass("span-14"); | 6 | $("##{dom_id(@project)}").addClass("span-14"); |
7 | +:plain | ||
8 | + $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); |
app/views/issues/index.html.haml
1 | %div | 1 | %div |
2 | - if can? current_user, :write_issue, @project | 2 | - if can? current_user, :write_issue, @project |
3 | - .left= link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm" | 3 | + .left |
4 | + = form_tag search_project_issues_path(@project), :method => :get, :remote => true do | ||
5 | + = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' } | ||
6 | + = link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm" | ||
7 | + | ||
4 | .right | 8 | .right |
5 | = form_tag project_issues_path(@project), :method => :get do | 9 | = form_tag project_issues_path(@project), :method => :get do |
6 | .span-2 | 10 | .span-2 |
@@ -20,6 +24,18 @@ | @@ -20,6 +24,18 @@ | ||
20 | #issues-table-holder= render "issues" | 24 | #issues-table-holder= render "issues" |
21 | %br | 25 | %br |
22 | :javascript | 26 | :javascript |
27 | + $('.issue_search').keyup(function() { | ||
28 | + var terms = $(this).val(); | ||
29 | + var project_id = 1; | ||
30 | + | ||
31 | + if (terms.length >= 2) { | ||
32 | + $.get($(this).parent().attr('action'), { 'terms': terms, project: project_id }, function(response) { | ||
33 | + $('#issues-table').html(response); | ||
34 | + setSortable(); | ||
35 | + }); | ||
36 | + } | ||
37 | + }); | ||
38 | + | ||
23 | $('.delete-issue').live('ajax:success', function() { | 39 | $('.delete-issue').live('ajax:success', function() { |
24 | $(this).closest('tr').fadeOut(); }); | 40 | $(this).closest('tr').fadeOut(); }); |
25 | 41 |
app/views/notes/_form.html.haml
@@ -12,9 +12,9 @@ | @@ -12,9 +12,9 @@ | ||
12 | = f.label :note | 12 | = f.label :note |
13 | %cite (255 symbols only) | 13 | %cite (255 symbols only) |
14 | %br | 14 | %br |
15 | - = f.text_area :note, :style => "width:97%;height:100px", :size => 255 | 15 | + = f.text_area :note, :size => 255 |
16 | 16 | ||
17 | - %div | 17 | + %div.attach_holder |
18 | = f.label :attachment | 18 | = f.label :attachment |
19 | %cite (less than 10 MB) | 19 | %cite (less than 10 MB) |
20 | %br | 20 | %br |
app/views/notes/_notes.html.haml
1 | -%ul#notes-list= render "notes/notes_list" | 1 | +- if controller.action_name == "wall" |
2 | + %ul#notes-list= render "notes/notes_list" | ||
2 | 3 | ||
3 | -%br | ||
4 | -%br | ||
5 | -- if can? current_user, :write_note, @project | ||
6 | - = render "notes/form" | 4 | +- else |
5 | + %ul#notes-list= render "notes/notes_list" | ||
6 | + %br | ||
7 | + %br | ||
8 | + - if can? current_user, :write_note, @project | ||
9 | + = render "notes/form" | ||
7 | 10 | ||
8 | :javascript | 11 | :javascript |
9 | $('.delete-note').live('ajax:success', function() { | 12 | $('.delete-note').live('ajax:success', function() { |
@@ -23,7 +26,3 @@ | @@ -23,7 +26,3 @@ | ||
23 | $(function(){ | 26 | $(function(){ |
24 | var int =self.setInterval("updatePage()", 20000); | 27 | var int =self.setInterval("updatePage()", 20000); |
25 | }); | 28 | }); |
26 | - | ||
27 | - function updatePage(){ | ||
28 | - $.ajax({type: "GET", url: location.href, dataType: "script"}); | ||
29 | - } |
app/views/notes/_show.html.haml
1 | %li{:id => dom_id(note)} | 1 | %li{:id => dom_id(note)} |
2 | %div.note_author | 2 | %div.note_author |
3 | = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" | 3 | = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" |
4 | - %div.note_content | 4 | + %div.note_content.left |
5 | = simple_format(html_escape(note.note)) | 5 | = simple_format(html_escape(note.note)) |
6 | - if note.attachment.url | 6 | - if note.attachment.url |
7 | Attachment: | 7 | Attachment: |
8 | - = link_to note.attachment_identifier, note.attachment.url | 8 | + = link_to note.attachment_identifier, note.attachment.url, :target => "_blank" |
9 | %br | 9 | %br |
10 | - %span | ||
11 | - %span | ||
12 | - [ #{note.author.name} ] | ||
13 | - | 10 | + %span.author= note.author.name |
11 | + %cite.ago | ||
14 | = time_ago_in_words(note.updated_at) | 12 | = time_ago_in_words(note.updated_at) |
15 | ago | 13 | ago |
16 | - %br | 14 | + %br |
17 | - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) | 15 | - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) |
18 | = link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative" | 16 | = link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative" |
19 | .clear | 17 | .clear |
app/views/notes/create.js.haml
1 | - if @note.valid? | 1 | - if @note.valid? |
2 | :plain | 2 | :plain |
3 | $("#new_note .errors").remove(); | 3 | $("#new_note .errors").remove(); |
4 | - $("#notes-list").append("#{escape_javascript(render(:partial => 'show', :locals => {:note => @note} ))}"); | 4 | + updatePage(); |
5 | $('#note_note').val(""); | 5 | $('#note_note').val(""); |
6 | - else | 6 | - else |
7 | :plain | 7 | :plain |
app/views/profile/show.html.haml
@@ -6,3 +6,28 @@ | @@ -6,3 +6,28 @@ | ||
6 | %p | 6 | %p |
7 | %b Email: | 7 | %b Email: |
8 | = @user.email | 8 | = @user.email |
9 | + | ||
10 | +%br | ||
11 | + | ||
12 | += form_for @user, :url => profile_edit_path, :method => :put do |f| | ||
13 | + -if @user.errors.any? | ||
14 | + #error_explanation | ||
15 | + %ul | ||
16 | + - @user.errors.full_messages.each do |msg| | ||
17 | + %li= msg | ||
18 | + | ||
19 | + .div | ||
20 | + = f.label :skype | ||
21 | + %br | ||
22 | + = f.text_field :skype | ||
23 | + .div | ||
24 | + = f.label :linkedin | ||
25 | + %br | ||
26 | + = f.text_field :linkedin | ||
27 | + .div | ||
28 | + = f.label :twitter | ||
29 | + %br | ||
30 | + = f.text_field :twitter | ||
31 | + .actions | ||
32 | + = f.submit 'Save', :class => "lbutton vm" | ||
33 | + |
app/views/projects/_recent_commits.html.haml
@@ -9,8 +9,8 @@ | @@ -9,8 +9,8 @@ | ||
9 | = link_to truncate_commit_message(commit, 60), project_commit_path(@project, :id => commit.id) | 9 | = link_to truncate_commit_message(commit, 60), project_commit_path(@project, :id => commit.id) |
10 | 10 | ||
11 | %span | 11 | %span |
12 | - %span | ||
13 | - [ #{commit.author} ] | 12 | + %span.author |
13 | + = commit.author.name.force_encoding("UTF-8") | ||
14 | %cite | 14 | %cite |
15 | = time_ago_in_words(commit.committed_date) | 15 | = time_ago_in_words(commit.committed_date) |
16 | ago | 16 | ago |
app/views/projects/_recent_messages.html.haml
@@ -5,21 +5,29 @@ | @@ -5,21 +5,29 @@ | ||
5 | 5 | ||
6 | - case type | 6 | - case type |
7 | - when "Issue" | 7 | - when "Issue" |
8 | + - css_class = "dash_issue" | ||
8 | - issue = parent | 9 | - issue = parent |
9 | - item_code = issue.author.email | 10 | - item_code = issue.author.email |
10 | - link_item_name = truncate(issue.title, :length => 50) | 11 | - link_item_name = truncate(issue.title, :length => 50) |
11 | - link_to_item = project_issue_path(@project, issue) | 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) | ||
12 | - when "Commit" | 18 | - when "Commit" |
19 | + - css_class = "dash_commit" | ||
13 | - commit = parent | 20 | - commit = parent |
14 | - item_code = commit.author.email | 21 | - item_code = commit.author.email |
15 | - link_item_name = truncate_commit_message(commit, 50) | 22 | - link_item_name = truncate_commit_message(commit, 50) |
16 | - link_to_item = project_commit_path(@project, :id => commit.id) | 23 | - link_to_item = project_commit_path(@project, :id => commit.id) |
17 | - else | 24 | - else |
25 | + - css_class = "dash_wall" | ||
18 | - item_code = @project.name | 26 | - item_code = @project.name |
19 | - link_item_name = "Project Wall" | 27 | - link_item_name = "Project Wall" |
20 | - link_to_item = wall_project_path(@project) | 28 | - link_to_item = wall_project_path(@project) |
21 | 29 | ||
22 | - %div.recent_message_parent | 30 | + %div{ :class => "recent_message_parent #{css_class}"} |
23 | = image_tag gravatar_icon(item_code), :class => "left", :width => 40 | 31 | = image_tag gravatar_icon(item_code), :class => "left", :width => 40 |
24 | %h4 | 32 | %h4 |
25 | = link_to(link_item_name, link_to_item) | 33 | = link_to(link_item_name, link_to_item) |
@@ -30,18 +38,14 @@ | @@ -30,18 +38,14 @@ | ||
30 | %div.message | 38 | %div.message |
31 | = image_tag gravatar_icon(note.author.email), :class => "left", :width => 24, :style => "padding-right:5px;" | 39 | = image_tag gravatar_icon(note.author.email), :class => "left", :width => 24, :style => "padding-right:5px;" |
32 | %p{:style => "margin-bottom: 3px;"} | 40 | %p{:style => "margin-bottom: 3px;"} |
33 | - = link_to truncate(note.note, :length => 50), "#" | 41 | + %span.author |
42 | + = note.author.name | ||
43 | + = link_to truncate(note.note, :length => 200), link_to_item + "#note_#{note.id}" | ||
34 | - if note.attachment.url | 44 | - if note.attachment.url |
35 | %br | 45 | %br |
36 | Attachment: | 46 | Attachment: |
37 | = link_to note.attachment_identifier, note.attachment.url | 47 | = link_to note.attachment_identifier, note.attachment.url |
38 | %br | 48 | %br |
39 | - %span | ||
40 | - %span | ||
41 | - [ #{note.author.name} ] | ||
42 | - %cite | ||
43 | - = time_ago_in_words(note.created_at) | ||
44 | - ago | ||
45 | %br | 49 | %br |
46 | .append-bottom | 50 | .append-bottom |
47 | | 51 | |
app/views/projects/_tile.html.haml
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | %div{ :class => "project", :url => project_path(project) } | 4 | %div{ :class => "project", :url => project_path(project) } |
5 | %h2 | 5 | %h2 |
6 | = image_tag gravatar_icon(project.name), :class => "left", :width => 40, :style => "padding-right:5px;" | 6 | = image_tag gravatar_icon(project.name), :class => "left", :width => 40, :style => "padding-right:5px;" |
7 | - = "/" + project.code | 7 | + = link_to ("/" + project.code), project_path(project), :style => "text-decoration:none" |
8 | %p= project.name | 8 | %p= project.name |
9 | %p= project.url_to_repo | 9 | %p= project.url_to_repo |
10 | -#%p | 10 | -#%p |
app/views/projects/_top_menu.html.haml
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | %span= link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil | 5 | %span= link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil |
6 | %span= link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil | 6 | %span= link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil |
7 | %span | 7 | %span |
8 | - = link_to team_project_path(@project), :class => current_page?(:controller => "projects", :action => "team", :id => @project) ? "current" : nil do | 8 | + = link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do |
9 | Team | 9 | Team |
10 | - if @project.users_projects.count > 0 | 10 | - if @project.users_projects.count > 0 |
11 | %span{ :class => "top_menu_count" }= @project.users_projects.count | 11 | %span{ :class => "top_menu_count" }= @project.users_projects.count |
app/views/projects/_tree_file.html.haml
1 | -- require "utils" | 1 | +:css |
2 | .view_file | 2 | .view_file |
3 | .view_file_header | 3 | .view_file_header |
4 | %strong | 4 | %strong |
@@ -6,14 +6,13 @@ | @@ -6,14 +6,13 @@ | ||
6 | = link_to "raw", blob_project_path(@project, :commit_id => @commit.id, :path => params[:path] ), :class => "right", :target => "_blank" | 6 | = link_to "raw", blob_project_path(@project, :commit_id => @commit.id, :path => params[:path] ), :class => "right", :target => "_blank" |
7 | = link_to "history", project_commits_path(@project, :path => params[:path]), :class => "right", :style => "margin-right:10px;" | 7 | = link_to "history", project_commits_path(@project, :path => params[:path]), :class => "right", :style => "margin-right:10px;" |
8 | %br/ | 8 | %br/ |
9 | - - if file.mime_type =~ /application|text/ && !Utils.binary?(file.data) | 9 | + - if file.text? |
10 | .view_file_content | 10 | .view_file_content |
11 | - - ft = handle_file_type(file.name, file.mime_type) | ||
12 | :erb | 11 | :erb |
13 | - <%= raw Albino.colorize(content, ft, :html, 'utf-8', "linenos=True") %> | ||
14 | - - elsif file.mime_type =~ /image/ | 12 | + <%= raw file.colorize %> |
13 | + - elsif file.image? | ||
15 | .view_file_content_image | 14 | .view_file_content_image |
16 | - %img{ :src => "data:image/jpeg;base64,#{Base64.encode64(file.data)}"} | 15 | + %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} |
17 | - else | 16 | - else |
18 | %p | 17 | %p |
19 | %center No preview for this file type | 18 | %center No preview for this file type |
app/views/projects/empty.html.erb
1 | +<% bash_lexer = Pygments::Lexer[:bash] %> | ||
1 | <div class=""> | 2 | <div class=""> |
2 | <div class="git-empty"> | 3 | <div class="git-empty"> |
3 | <h2>Git global setup:</h2> | 4 | <h2>Git global setup:</h2> |
@@ -6,7 +7,7 @@ git config --global user.name "#{current_user.name}" | @@ -6,7 +7,7 @@ git config --global user.name "#{current_user.name}" | ||
6 | git config --global user.email "#{current_user.email}" | 7 | git config --global user.email "#{current_user.email}" |
7 | eos | 8 | eos |
8 | %> | 9 | %> |
9 | - <%= raw Albino.colorize(setup_str, :bash) %> | 10 | + <%= raw bash_lexer.highlight(setup_str) %> |
10 | <br /> | 11 | <br /> |
11 | <br /> | 12 | <br /> |
12 | <h2>Next steps:</h2> | 13 | <h2>Next steps:</h2> |
@@ -21,7 +22,7 @@ git remote add origin #{@project.url_to_repo} | @@ -21,7 +22,7 @@ git remote add origin #{@project.url_to_repo} | ||
21 | git push -u origin master | 22 | git push -u origin master |
22 | eos | 23 | eos |
23 | %> | 24 | %> |
24 | - <%= raw Albino.colorize(repo_setup_str, :bash) %> | 25 | + <%= raw bash_lexer.highlight(repo_setup_str) %> |
25 | 26 | ||
26 | <br /><br /> | 27 | <br /><br /> |
27 | <h2>Existing Git Repo?</h2> | 28 | <h2>Existing Git Repo?</h2> |
@@ -31,7 +32,7 @@ git remote add origin #{@project.url_to_repo} | @@ -31,7 +32,7 @@ git remote add origin #{@project.url_to_repo} | ||
31 | git push -u origin master | 32 | git push -u origin master |
32 | eos | 33 | eos |
33 | %> | 34 | %> |
34 | - <%= raw Albino.colorize(exist_repo_setup_str, :bash) %> | 35 | + <%= raw bash_lexer.highlight(exist_repo_setup_str) %> |
35 | 36 | ||
36 | <br /><br /> | 37 | <br /><br /> |
37 | <h2>Remove this project?</h2> | 38 | <h2>Remove this project?</h2> |
app/views/projects/show.html.haml
1 | %div | 1 | %div |
2 | - %h2.left Recent history | 2 | + %h2.left History |
3 | .right | 3 | .right |
4 | = form_tag project_path(@project), :method => :get do | 4 | = form_tag project_path(@project), :method => :get do |
5 | .span-2 | 5 | .span-2 |
6 | - = radio_button_tag :view, "day", (params[:view] || "day") == "day", :onclick => "this.form.submit()", :id => "day_view" | ||
7 | - = label_tag "day_view","Day" | 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" | ||
8 | .span-2 | 11 | .span-2 |
9 | = radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view" | 12 | = radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view" |
10 | = label_tag "week_view","Week" | 13 | = label_tag "week_view","Week" |
@@ -15,6 +18,6 @@ | @@ -15,6 +18,6 @@ | ||
15 | =render "projects/recent_commits" | 18 | =render "projects/recent_commits" |
16 | 19 | ||
17 | .span-11.right | 20 | .span-11.right |
18 | - %h3 Messages | 21 | + %h3 Talk |
19 | =render "projects/recent_messages" | 22 | =render "projects/recent_messages" |
20 | 23 |
app/views/projects/wall.html.haml
1 | +%div.wall_page | ||
2 | + - if can? current_user, :write_note, @project | ||
3 | + = render "notes/form" | ||
4 | + .right | ||
5 | + = form_tag wall_project_path(@project), :method => :get do | ||
6 | + .span-2 | ||
7 | + = radio_button_tag :view, "recent", (params[:view] || "recent") == "recent", :onclick => "this.form.submit()", :id => "recent_view" | ||
8 | + = label_tag "recent_view","Recent" | ||
9 | + .span-2 | ||
10 | + = radio_button_tag :view, "day", params[:view] == "day", :onclick => "this.form.submit()", :id => "day_view" | ||
11 | + = label_tag "day_view","Today" | ||
12 | + .span-2 | ||
13 | + = radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view" | ||
14 | + = label_tag "week_view","Week" | ||
15 | + .span-2 | ||
16 | + = radio_button_tag :view, "all", params[:view] == "all", :onclick => "this.form.submit()", :id => "all_view" | ||
17 | + = label_tag "all_view","All" | ||
18 | + .clear | ||
19 | + %br | ||
20 | + %hr | ||
1 | = render "notes/notes" | 21 | = render "notes/notes" |
22 | + | ||
23 | +:javascript | ||
24 | + $(function(){ | ||
25 | + $("#note_note").live("click", function(){ | ||
26 | + $(this).css("height", "100px"); | ||
27 | + $('.attach_holder').show(); | ||
28 | + }); | ||
29 | + }); |
app/views/snippets/show.html.haml
@@ -7,14 +7,14 @@ | @@ -7,14 +7,14 @@ | ||
7 | = @snippet.file_name | 7 | = @snippet.file_name |
8 | %br/ | 8 | %br/ |
9 | .view_file_content | 9 | .view_file_content |
10 | - - ft = handle_file_type(@snippet.file_name) | ||
11 | :erb | 10 | :erb |
12 | - <%= raw Albino.colorize(@snippet.content, ft, :html, 'utf-8', "linenos=True") %> | 11 | + <%= raw @snippet.colorize %> |
13 | 12 | ||
14 | - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | 13 | - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user |
15 | = link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive" | 14 | = link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive" |
16 | - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | 15 | - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user |
17 | = link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" | 16 | = link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" |
17 | +.clear | ||
18 | %br | 18 | %br |
19 | .snippet_notes= render "notes/notes" | 19 | .snippet_notes= render "notes/notes" |
20 | 20 |
app/views/team_members/_show.html.haml
1 | - user = member.user | 1 | - user = member.user |
2 | %tr{:id => dom_id(member)} | 2 | %tr{:id => dom_id(member)} |
3 | %td | 3 | %td |
4 | - = image_tag gravatar_icon(user.email), :class => "left", :width => 40, :style => "padding:0 5px;" | ||
5 | - = truncate user.name, :lenght => 16 | 4 | + = link_to image_tag(gravatar_icon(user.email), :class => "left", :width => 40, :style => "padding:0 5px;"), project_team_member_path(@project, member) |
5 | + | ||
6 | + = link_to truncate(user.name, :lenght => 16), project_team_member_path(@project, member) | ||
7 | + | ||
6 | %td= truncate user.email, :lenght => 16 | 8 | %td= truncate user.email, :lenght => 16 |
7 | - if can? current_user, :admin_project, @project | 9 | - if can? current_user, :admin_project, @project |
8 | = form_for(member, :as => :team_member, :url => project_team_member_path(@project, member)) do |f| | 10 | = form_for(member, :as => :team_member, :url => project_team_member_path(@project, member)) do |f| |
@@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
1 | +- user = @team_member.user | ||
2 | +.span-2 | ||
3 | + = image_tag gravatar_icon(user.email), :class => "left", :width => 60, :style => "padding-right:5px;" | ||
4 | +%p | ||
5 | + %b Name: | ||
6 | + = user.name | ||
7 | +%p | ||
8 | + %b Email: | ||
9 | + = user.email | ||
10 | + | ||
11 | +%br | ||
12 | + | ||
13 | +- unless user.skype.empty? | ||
14 | + .div | ||
15 | + %b Skype: | ||
16 | + = user.skype | ||
17 | + | ||
18 | +- unless user.linkedin.empty? | ||
19 | + .div | ||
20 | + %b LinkedIn: | ||
21 | + = user.linkedin | ||
22 | + | ||
23 | +- unless user.twitter.empty? | ||
24 | + .div | ||
25 | + %b Twitter: | ||
26 | + = user.twitter | ||
27 | + | ||
28 | + |
config/database.yml
@@ -4,8 +4,9 @@ | @@ -4,8 +4,9 @@ | ||
4 | # Ensure the SQLite 3 gem is defined in your Gemfile | 4 | # Ensure the SQLite 3 gem is defined in your Gemfile |
5 | # gem 'sqlite3' | 5 | # gem 'sqlite3' |
6 | development: | 6 | development: |
7 | - adapter: sqlite3 | ||
8 | - database: db/development.sqlite3 | 7 | + adapter: mysql2 |
8 | + database: gitlab_development | ||
9 | + username: root | ||
9 | pool: 5 | 10 | pool: 5 |
10 | timeout: 5000 | 11 | timeout: 5000 |
11 | 12 | ||
@@ -13,13 +14,11 @@ development: | @@ -13,13 +14,11 @@ development: | ||
13 | # re-generated from your development database when you run "rake". | 14 | # re-generated from your development database when you run "rake". |
14 | # Do not set this db to the same as development or production. | 15 | # Do not set this db to the same as development or production. |
15 | test: | 16 | test: |
16 | - adapter: sqlite3 | ||
17 | - database: db/test.sqlite3 | ||
18 | - pool: 5 | ||
19 | - timeout: 5000 | 17 | + adapter: mysql2 |
18 | + database: gitlab_development | ||
19 | + username: root | ||
20 | 20 | ||
21 | production: | 21 | production: |
22 | - adapter: sqlite3 | ||
23 | - database: db/production.sqlite3 | ||
24 | - pool: 5 | ||
25 | - timeout: 5000 | 22 | + adatper: mysql2 |
23 | + database: gitlab_test | ||
24 | + username: root |
config/routes.rb
@@ -13,6 +13,7 @@ Gitlab::Application.routes.draw do | @@ -13,6 +13,7 @@ Gitlab::Application.routes.draw do | ||
13 | get "errors/gitosis" | 13 | get "errors/gitosis" |
14 | get "profile/password", :to => "profile#password" | 14 | get "profile/password", :to => "profile#password" |
15 | put "profile/password", :to => "profile#password_update" | 15 | put "profile/password", :to => "profile#password_update" |
16 | + put "profile/edit", :to => "profile#social_update" | ||
16 | get "profile", :to => "profile#show" | 17 | get "profile", :to => "profile#show" |
17 | #get "profile/:id", :to => "profile#show" | 18 | #get "profile/:id", :to => "profile#show" |
18 | 19 | ||
@@ -46,6 +47,9 @@ Gitlab::Application.routes.draw do | @@ -46,6 +47,9 @@ Gitlab::Application.routes.draw do | ||
46 | collection do | 47 | collection do |
47 | post :sort | 48 | post :sort |
48 | end | 49 | end |
50 | + collection do | ||
51 | + get :search | ||
52 | + end | ||
49 | end | 53 | end |
50 | resources :notes, :only => [:create, :destroy] | 54 | resources :notes, :only => [:create, :destroy] |
51 | end | 55 | end |
db/migrate/20111021101550_change_social_fields_in_users.rb
0 → 100644
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +class ChangeSocialFieldsInUsers < ActiveRecord::Migration | ||
2 | + def up | ||
3 | + remove_column :users, :skype | ||
4 | + remove_column :users, :linkedin | ||
5 | + remove_column :users, :twitter | ||
6 | + | ||
7 | + add_column :users, :skype, :string, {:null => false, :default => ''} | ||
8 | + add_column :users, :linkedin, :string, {:null => false, :default => ''} | ||
9 | + add_column :users, :twitter, :string, {:null => false, :default => ''} | ||
10 | + end | ||
11 | + | ||
12 | + def down | ||
13 | + end | ||
14 | +end |
db/schema.rb
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | # | 11 | # |
12 | # It's strongly recommended to check this file into your version control system. | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | ||
14 | -ActiveRecord::Schema.define(:version => 20111016195506) do | 14 | +ActiveRecord::Schema.define(:version => 20111021101550) do |
15 | 15 | ||
16 | create_table "issues", :force => true do |t| | 16 | create_table "issues", :force => true do |t| |
17 | t.string "title" | 17 | t.string "title" |
@@ -82,6 +82,9 @@ ActiveRecord::Schema.define(:version => 20111016195506) do | @@ -82,6 +82,9 @@ ActiveRecord::Schema.define(:version => 20111016195506) do | ||
82 | t.string "name" | 82 | t.string "name" |
83 | t.boolean "admin", :default => false, :null => false | 83 | t.boolean "admin", :default => false, :null => false |
84 | t.integer "projects_limit", :default => 10 | 84 | t.integer "projects_limit", :default => 10 |
85 | + t.string "skype", :default => "", :null => false | ||
86 | + t.string "linkedin", :default => "", :null => false | ||
87 | + t.string "twitter", :default => "", :null => false | ||
85 | end | 88 | end |
86 | 89 | ||
87 | add_index "users", ["email"], :name => "index_users_on_email", :unique => true | 90 | add_index "users", ["email"], :name => "index_users_on_email", :unique => true |
lib/utils.rb
1 | module Utils | 1 | module Utils |
2 | - def self.binary?(string) | ||
3 | - string.each_byte do |x| | ||
4 | - x.nonzero? or return true | 2 | + module FileHelper |
3 | + def binary?(string) | ||
4 | + string.each_byte do |x| | ||
5 | + x.nonzero? or return true | ||
6 | + end | ||
7 | + false | ||
8 | + end | ||
9 | + | ||
10 | + def image? | ||
11 | + mime_type =~ /image/ | ||
12 | + end | ||
13 | + | ||
14 | + def text? | ||
15 | + mime_type =~ /application|text/ && !binary?(data) | ||
16 | + end | ||
17 | + end | ||
18 | + | ||
19 | + module Colorize | ||
20 | + def colorize | ||
21 | + system_colorize(data, name) | ||
22 | + end | ||
23 | + | ||
24 | + def system_colorize(data, file_name) | ||
25 | + ft = handle_file_type(file_name) | ||
26 | + Pygments.highlight(data, :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' }) | ||
27 | + end | ||
28 | + | ||
29 | + def handle_file_type(file_name, mime_type = nil) | ||
30 | + if file_name =~ /(\.rb|\.ru|\.rake|Rakefile|\.gemspec|\.rbx|Gemfile)$/ | ||
31 | + :ruby | ||
32 | + elsif file_name =~ /\.py$/ | ||
33 | + :python | ||
34 | + elsif file_name =~ /(\.pl|\.scala|\.c|\.cpp|\.java|\.haml|\.html|\.sass|\.scss|\.xml|\.php|\.erb)$/ | ||
35 | + $1[1..-1].to_sym | ||
36 | + elsif file_name =~ /\.js$/ | ||
37 | + :javascript | ||
38 | + elsif file_name =~ /\.sh$/ | ||
39 | + :bash | ||
40 | + elsif file_name =~ /\.coffee$/ | ||
41 | + :coffeescript | ||
42 | + elsif file_name =~ /\.yml$/ | ||
43 | + :yaml | ||
44 | + elsif file_name =~ /\.md$/ | ||
45 | + :minid | ||
46 | + else | ||
47 | + :text | ||
48 | + end | ||
5 | end | 49 | end |
6 | - false | ||
7 | end | 50 | end |
8 | end | 51 | end |
spec/models/user_spec.rb
@@ -39,5 +39,8 @@ end | @@ -39,5 +39,8 @@ end | ||
39 | # name :string(255) | 39 | # name :string(255) |
40 | # admin :boolean default(FALSE), not null | 40 | # admin :boolean default(FALSE), not null |
41 | # projects_limit :integer | 41 | # projects_limit :integer |
42 | +# skype :string | ||
43 | +# linkedin :string | ||
44 | +# twitter :string | ||
42 | # | 45 | # |
43 | 46 |
spec/requests/issues_spec.rb
@@ -144,4 +144,26 @@ describe "Issues" do | @@ -144,4 +144,26 @@ describe "Issues" do | ||
144 | end | 144 | end |
145 | end | 145 | end |
146 | end | 146 | end |
147 | + | ||
148 | + describe "Search issue", :js => true do | ||
149 | + before do | ||
150 | + ['foobar', 'foobar2', 'gitlab'].each do |title| | ||
151 | + @issue = Factory :issue, | ||
152 | + :author => @user, | ||
153 | + :assignee => @user, | ||
154 | + :project => project, | ||
155 | + :title => title | ||
156 | + @issue.save | ||
157 | + end | ||
158 | + end | ||
159 | + | ||
160 | + it "should search and return the correct results" do | ||
161 | + visit project_issues_path(project) | ||
162 | + fill_in "issue_search", :with => "foobar" | ||
163 | + page.should have_content 'foobar' | ||
164 | + page.should have_content 'foobar2' | ||
165 | + page.should_not have_content 'gitlab' | ||
166 | + end | ||
167 | + end | ||
168 | + | ||
147 | end | 169 | end |
spec/requests/profile_spec.rb
@@ -14,6 +14,22 @@ describe "Profile" do | @@ -14,6 +14,22 @@ describe "Profile" do | ||
14 | it { page.should have_content(@user.email) } | 14 | it { page.should have_content(@user.email) } |
15 | end | 15 | end |
16 | 16 | ||
17 | + describe "Profile update" do | ||
18 | + before do | ||
19 | + visit profile_path | ||
20 | + fill_in "user_skype", :with => "testskype" | ||
21 | + fill_in "user_linkedin", :with => "testlinkedin" | ||
22 | + fill_in "user_twitter", :with => "testtwitter" | ||
23 | + click_button "Save" | ||
24 | + @user.reload | ||
25 | + end | ||
26 | + | ||
27 | + it { @user.skype.should == 'testskype' } | ||
28 | + it { @user.linkedin.should == 'testlinkedin' } | ||
29 | + it { @user.twitter.should == 'testtwitter' } | ||
30 | + end | ||
31 | + | ||
32 | + | ||
17 | describe "Password update" do | 33 | describe "Password update" do |
18 | before do | 34 | before do |
19 | visit profile_password_path | 35 | visit profile_password_path |
spec/requests/projects_spec.rb
@@ -73,7 +73,7 @@ describe "Projects" do | @@ -73,7 +73,7 @@ describe "Projects" do | ||
73 | end | 73 | end |
74 | 74 | ||
75 | it "should beahave like dashboard" do | 75 | it "should beahave like dashboard" do |
76 | - page.should have_content("Recent history") | 76 | + page.should have_content("History") |
77 | end | 77 | end |
78 | 78 | ||
79 | end | 79 | end |
spec/requests/team_members_spec.rb
@@ -7,6 +7,15 @@ describe "TeamMembers" do | @@ -7,6 +7,15 @@ describe "TeamMembers" do | ||
7 | @project.add_access(@user, :read, :admin) | 7 | @project.add_access(@user, :read, :admin) |
8 | end | 8 | end |
9 | 9 | ||
10 | + describe "View profile" do | ||
11 | + it "should be available" do | ||
12 | + visit(team_project_path(@project)) | ||
13 | + find(:xpath, "//table[@id='team-table']//a[1]").click | ||
14 | + page.should have_content @user.skype | ||
15 | + page.should_not have_content 'Twitter' | ||
16 | + end | ||
17 | + end | ||
18 | + | ||
10 | describe "New Team member", :js => true do | 19 | describe "New Team member", :js => true do |
11 | before do | 20 | before do |
12 | @user_1 = Factory :user | 21 | @user_1 = Factory :user |
spec/support/login.rb
@@ -3,7 +3,8 @@ module LoginMacros | @@ -3,7 +3,8 @@ module LoginMacros | ||
3 | @user = User.create(:email => "user#{User.count}@mail.com", | 3 | @user = User.create(:email => "user#{User.count}@mail.com", |
4 | :name => "John Smith", | 4 | :name => "John Smith", |
5 | :password => "123456", | 5 | :password => "123456", |
6 | - :password_confirmation => "123456") | 6 | + :password_confirmation => "123456", |
7 | + :skype => 'user_skype') | ||
7 | 8 | ||
8 | if role == :admin | 9 | if role == :admin |
9 | @user.admin = true | 10 | @user.admin = true |
update.rb
@@ -19,8 +19,8 @@ env = if envs.include?(ARGV[0]) | @@ -19,8 +19,8 @@ env = if envs.include?(ARGV[0]) | ||
19 | puts yellow "== RAILS ENV | #{env}" | 19 | puts yellow "== RAILS ENV | #{env}" |
20 | current_version = version | 20 | current_version = version |
21 | puts yellow "Your version is #{current_version}" | 21 | puts yellow "Your version is #{current_version}" |
22 | -puts yellow "Check for new version: $ git pull origin" | ||
23 | -`git pull origin` # pull from origin | 22 | +puts yellow "Check for new version: $ git pull origin 1x" |
23 | +`git pull origin 1x` # pull from origin | ||
24 | 24 | ||
25 | # latest version | 25 | # latest version |
26 | if version == current_version | 26 | if version == current_version |