Commit a2eda66b30d737e3ca1a5fc17a7f36416939a41f

Authored by Dmitriy Zaporozhets
1 parent e00390b3

Disable issues sort. Recent issues on top. Fixed tests

app/assets/javascripts/issues.js
@@ -51,7 +51,6 @@ function initIssuesSearch() { @@ -51,7 +51,6 @@ function initIssuesSearch() {
51 if (terms.length >= 2 || terms.length == 0) { 51 if (terms.length >= 2 || terms.length == 0) {
52 $.get(href, { 'f': status, 'terms': terms, 'milestone_id': milestone_id }, function(response) { 52 $.get(href, { 'f': status, 'terms': terms, 'milestone_id': milestone_id }, function(response) {
53 $('#issues-table').html(response); 53 $('#issues-table').html(response);
54 - setSortable();  
55 }); 54 });
56 } 55 }
57 } 56 }
@@ -68,7 +67,6 @@ function initIssuesSearch() { @@ -68,7 +67,6 @@ function initIssuesSearch() {
68 */ 67 */
69 function issuesPage(){ 68 function issuesPage(){
70 initIssuesSearch(); 69 initIssuesSearch();
71 - setSortable();  
72 $("#label_name").chosen(); 70 $("#label_name").chosen();
73 $("#assignee_id").chosen(); 71 $("#assignee_id").chosen();
74 $("#milestone_id").chosen(); 72 $("#milestone_id").chosen();
app/assets/stylesheets/gitlab_bootstrap.scss
@@ -201,6 +201,7 @@ a:focus { @@ -201,6 +201,7 @@ a:focus {
201 .cred { color:#D12F19; } 201 .cred { color:#D12F19; }
202 .cgreen { color:#44aa22; } 202 .cgreen { color:#44aa22; }
203 .cblack { color:#111; } 203 .cblack { color:#111; }
  204 +.cdark { color:#444 }
204 .cwhite { color:#fff !important } 205 .cwhite { color:#fff !important }
205 206
206 /** COMMON STYLES **/ 207 /** COMMON STYLES **/
app/mailers/notify.rb
@@ -2,8 +2,9 @@ class Notify < ActionMailer::Base @@ -2,8 +2,9 @@ class Notify < ActionMailer::Base
2 include Resque::Mailer 2 include Resque::Mailer
3 add_template_helper ApplicationHelper 3 add_template_helper ApplicationHelper
4 4
5 - default_url_options[:host] = Gitlab.config.web_host 5 + default_url_options[:host] = Gitlab.config.web_host
6 default_url_options[:protocol] = Gitlab.config.web_protocol 6 default_url_options[:protocol] = Gitlab.config.web_protocol
  7 + default_url_options[:port] = Gitlab.config.web_port
7 8
8 default from: Gitlab.config.email_from 9 default from: Gitlab.config.email_from
9 10
app/models/project.rb
@@ -13,7 +13,7 @@ class Project < ActiveRecord::Base @@ -13,7 +13,7 @@ class Project < ActiveRecord::Base
13 has_many :users, :through => :users_projects 13 has_many :users, :through => :users_projects
14 has_many :events, :dependent => :destroy 14 has_many :events, :dependent => :destroy
15 has_many :merge_requests, :dependent => :destroy 15 has_many :merge_requests, :dependent => :destroy
16 - has_many :issues, :dependent => :destroy, :order => "closed, position" 16 + has_many :issues, :dependent => :destroy, :order => "closed, created_at DESC"
17 has_many :milestones, :dependent => :destroy 17 has_many :milestones, :dependent => :destroy
18 has_many :users_projects, :dependent => :destroy 18 has_many :users_projects, :dependent => :destroy
19 has_many :notes, :dependent => :destroy 19 has_many :notes, :dependent => :destroy
app/views/issues/_show.html.haml
@@ -29,6 +29,7 @@ @@ -29,6 +29,7 @@
29 %p.row_title= truncate(issue.title, :length => 100) 29 %p.row_title= truncate(issue.title, :length => 100)
30 30
31 %span.update-author 31 %span.update-author
  32 + %small.cdark= "##{issue.id}"
32 - if issue.assignee 33 - if issue.assignee
33 assigned to #{issue.assignee_name} 34 assigned to #{issue.assignee_name}
34 - else 35 - else
app/views/issues/index.html.haml
@@ -46,24 +46,3 @@ @@ -46,24 +46,3 @@
46 $(function(){ 46 $(function(){
47 issuesPage(); 47 issuesPage();
48 }) 48 })
49 -  
50 - function setSortable(){  
51 - $('#issues-table').sortable({  
52 - axis: 'y',  
53 - dropOnEmpty: false,  
54 - handle: '.avatar',  
55 - items: 'li',  
56 - opacity: 0.4,  
57 - scroll: true,  
58 - update: function(){  
59 - $.ajax({  
60 - type: 'post',  
61 - data: $('#issues-table').sortable('serialize'),  
62 - dataType: 'script',  
63 - complete: function(request){  
64 - $('#issues-table').effect('highlight');  
65 - },  
66 - url: "#{sort_project_issues_path(@project)}"})  
67 - }  
68 - });  
69 - }  
app/views/issues/index.js.haml
1 :plain 1 :plain
2 $('#issues-table').html("#{escape_javascript(render('issues'))}"); 2 $('#issues-table').html("#{escape_javascript(render('issues'))}");
3 - setSortable();  
config/initializers/1_settings.rb
@@ -3,7 +3,7 @@ class Settings < Settingslogic @@ -3,7 +3,7 @@ class Settings < Settingslogic
3 3
4 class << self 4 class << self
5 def web_protocol 5 def web_protocol
6 - self.web['protocol'] ||= web.https ? "https://" : "http://" 6 + self.web['protocol'] ||= web.https ? "https" : "http"
7 end 7 end
8 8
9 def web_host 9 def web_host
@@ -18,10 +18,15 @@ class Settings &lt; Settingslogic @@ -18,10 +18,15 @@ class Settings &lt; Settingslogic
18 self['url'] ||= build_url 18 self['url'] ||= build_url
19 end 19 end
20 20
  21 + def web_port
  22 + web['port'] ||= 80
  23 + end
  24 +
21 def build_url 25 def build_url
22 raw_url = self.web_protocol 26 raw_url = self.web_protocol
23 - raw_url << web.host  
24 - raw_url << ":#{web.port}" if web.port.to_i != 80 27 + raw_url << "://"
  28 + raw_url << web_host
  29 + raw_url << ":#{web_port}" if web_port.to_i != 80
25 raw_url 30 raw_url
26 end 31 end
27 32
1 module Color 1 module Color
  2 + extend self
  3 +
2 def colorize(text, color_code) 4 def colorize(text, color_code)
3 "\033[#{color_code}#{text}\033[0m" 5 "\033[#{color_code}#{text}\033[0m"
4 end 6 end
spec/mailers/notify_spec.rb
@@ -4,10 +4,6 @@ describe Notify do @@ -4,10 +4,6 @@ describe Notify do
4 include EmailSpec::Helpers 4 include EmailSpec::Helpers
5 include EmailSpec::Matchers 5 include EmailSpec::Matchers
6 6
7 - before :all do  
8 - default_url_options[:host] = Gitlab.config.web_host  
9 - end  
10 -  
11 let(:recipient) { Factory.create(:user, :email => 'recipient@example.com') } 7 let(:recipient) { Factory.create(:user, :email => 'recipient@example.com') }
12 let(:project) { Factory.create(:project) } 8 let(:project) { Factory.create(:project) }
13 9
@@ -18,7 +14,7 @@ describe Notify do @@ -18,7 +14,7 @@ describe Notify do
18 end 14 end
19 15
20 describe 'for new users, the email' do 16 describe 'for new users, the email' do
21 - let(:example_site_url) { root_url } 17 + let(:example_site_path) { root_path }
22 let(:new_user) { Factory.create(:user, :email => 'newguy@example.com') } 18 let(:new_user) { Factory.create(:user, :email => 'newguy@example.com') }
23 19
24 subject { Notify.new_user_email(new_user.id, new_user.password) } 20 subject { Notify.new_user_email(new_user.id, new_user.password) }
@@ -40,7 +36,7 @@ describe Notify do @@ -40,7 +36,7 @@ describe Notify do
40 end 36 end
41 37
42 it 'includes a link to the site' do 38 it 'includes a link to the site' do
43 - should have_body_text /#{example_site_url}/ 39 + should have_body_text /#{example_site_path}/
44 end 40 end
45 end 41 end
46 42
@@ -68,7 +64,7 @@ describe Notify do @@ -68,7 +64,7 @@ describe Notify do
68 end 64 end
69 65
70 it 'contains a link to the new issue' do 66 it 'contains a link to the new issue' do
71 - should have_body_text /#{project_issue_url project, issue}/ 67 + should have_body_text /#{project_issue_path project, issue}/
72 end 68 end
73 end 69 end
74 70
@@ -92,7 +88,7 @@ describe Notify do @@ -92,7 +88,7 @@ describe Notify do
92 end 88 end
93 89
94 it 'contains a link to the issue' do 90 it 'contains a link to the issue' do
95 - should have_body_text /#{project_issue_url project, issue}/ 91 + should have_body_text /#{project_issue_path project, issue}/
96 end 92 end
97 end 93 end
98 end 94 end
@@ -110,7 +106,7 @@ describe Notify do @@ -110,7 +106,7 @@ describe Notify do
110 end 106 end
111 107
112 it 'contains a link to the new merge request' do 108 it 'contains a link to the new merge request' do
113 - should have_body_text /#{project_merge_request_url(project, merge_request)}/ 109 + should have_body_text /#{project_merge_request_path(project, merge_request)}/
114 end 110 end
115 111
116 it 'contains the source branch for the merge request' do 112 it 'contains the source branch for the merge request' do
@@ -142,7 +138,7 @@ describe Notify do @@ -142,7 +138,7 @@ describe Notify do
142 end 138 end
143 139
144 it 'contains a link to the merge request' do 140 it 'contains a link to the merge request' do
145 - should have_body_text /#{project_merge_request_url project, merge_request}/ 141 + should have_body_text /#{project_merge_request_path project, merge_request}/
146 end 142 end
147 143
148 end 144 end
@@ -172,7 +168,7 @@ describe Notify do @@ -172,7 +168,7 @@ describe Notify do
172 end 168 end
173 169
174 describe 'on a project wall' do 170 describe 'on a project wall' do
175 - let(:note_on_the_wall_url) { wall_project_url(project, :anchor => "note_#{note.id}") } 171 + let(:note_on_the_wall_path) { wall_project_path(project, :anchor => "note_#{note.id}") }
176 172
177 subject { Notify.note_wall_email(recipient.id, note.id) } 173 subject { Notify.note_wall_email(recipient.id, note.id) }
178 174
@@ -183,7 +179,7 @@ describe Notify do @@ -183,7 +179,7 @@ describe Notify do
183 end 179 end
184 180
185 it 'contains a link to the wall note' do 181 it 'contains a link to the wall note' do
186 - should have_body_text /#{note_on_the_wall_url}/ 182 + should have_body_text /#{note_on_the_wall_path}/
187 end 183 end
188 end 184 end
189 185
@@ -211,7 +207,7 @@ describe Notify do @@ -211,7 +207,7 @@ describe Notify do
211 207
212 describe 'on a merge request' do 208 describe 'on a merge request' do
213 let(:merge_request) { Factory.create(:merge_request, :project => project) } 209 let(:merge_request) { Factory.create(:merge_request, :project => project) }
214 - let(:note_on_merge_request_url) { project_merge_request_url(project, merge_request, :anchor => "note_#{note.id}") } 210 + let(:note_on_merge_request_path) { project_merge_request_path(project, merge_request, :anchor => "note_#{note.id}") }
215 before(:each) { note.stub(:noteable).and_return(merge_request) } 211 before(:each) { note.stub(:noteable).and_return(merge_request) }
216 212
217 subject { Notify.note_merge_request_email(recipient.id, note.id) } 213 subject { Notify.note_merge_request_email(recipient.id, note.id) }
@@ -223,13 +219,13 @@ describe Notify do @@ -223,13 +219,13 @@ describe Notify do
223 end 219 end
224 220
225 it 'contains a link to the merge request note' do 221 it 'contains a link to the merge request note' do
226 - should have_body_text /#{note_on_merge_request_url}/ 222 + should have_body_text /#{note_on_merge_request_path}/
227 end 223 end
228 end 224 end
229 225
230 describe 'on an issue' do 226 describe 'on an issue' do
231 let(:issue) { Factory.create(:issue, :project => project) } 227 let(:issue) { Factory.create(:issue, :project => project) }
232 - let(:note_on_issue_url) { project_issue_url(project, issue, :anchor => "note_#{note.id}") } 228 + let(:note_on_issue_path) { project_issue_path(project, issue, :anchor => "note_#{note.id}") }
233 before(:each) { note.stub(:noteable).and_return(issue) } 229 before(:each) { note.stub(:noteable).and_return(issue) }
234 230
235 subject { Notify.note_issue_email(recipient.id, note.id) } 231 subject { Notify.note_issue_email(recipient.id, note.id) }
@@ -241,7 +237,7 @@ describe Notify do @@ -241,7 +237,7 @@ describe Notify do
241 end 237 end
242 238
243 it 'contains a link to the issue note' do 239 it 'contains a link to the issue note' do
244 - should have_body_text /#{note_on_issue_url}/ 240 + should have_body_text /#{note_on_issue_path}/
245 end 241 end
246 end 242 end
247 end 243 end
spec/models/project_hooks_spec.rb
@@ -106,7 +106,7 @@ describe Project, &quot;Hooks&quot; do @@ -106,7 +106,7 @@ describe Project, &quot;Hooks&quot; do
106 it { should include(id: @commit.id) } 106 it { should include(id: @commit.id) }
107 it { should include(message: @commit.safe_message) } 107 it { should include(message: @commit.safe_message) }
108 it { should include(timestamp: @commit.date.xmlschema) } 108 it { should include(timestamp: @commit.date.xmlschema) }
109 - it { should include(url: "http://localhost/#{project.code}/commits/#{@commit.id}") } 109 + it { should include(url: "#{Gitlab.config.url}/#{project.code}/commits/#{@commit.id}") }
110 110
111 context "with a author" do 111 context "with a author" do
112 subject { @data[:commits].first[:author] } 112 subject { @data[:commits].first[:author] }
spec/models/project_spec.rb
@@ -46,7 +46,7 @@ describe Project do @@ -46,7 +46,7 @@ describe Project do
46 46
47 it "should return valid url to repo" do 47 it "should return valid url to repo" do
48 project = Project.new(:path => "somewhere") 48 project = Project.new(:path => "somewhere")
49 - project.url_to_repo.should == "git@localhost:somewhere.git" 49 + project.url_to_repo.should == Gitlab.config.ssh_path + "somewhere.git"
50 end 50 end
51 51
52 it "should return path to repo" do 52 it "should return path to repo" do