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 51 if (terms.length >= 2 || terms.length == 0) {
52 52 $.get(href, { 'f': status, 'terms': terms, 'milestone_id': milestone_id }, function(response) {
53 53 $('#issues-table').html(response);
54   - setSortable();
55 54 });
56 55 }
57 56 }
... ... @@ -68,7 +67,6 @@ function initIssuesSearch() {
68 67 */
69 68 function issuesPage(){
70 69 initIssuesSearch();
71   - setSortable();
72 70 $("#label_name").chosen();
73 71 $("#assignee_id").chosen();
74 72 $("#milestone_id").chosen();
... ...
app/assets/stylesheets/gitlab_bootstrap.scss
... ... @@ -201,6 +201,7 @@ a:focus {
201 201 .cred { color:#D12F19; }
202 202 .cgreen { color:#44aa22; }
203 203 .cblack { color:#111; }
  204 +.cdark { color:#444 }
204 205 .cwhite { color:#fff !important }
205 206  
206 207 /** COMMON STYLES **/
... ...
app/mailers/notify.rb
... ... @@ -2,8 +2,9 @@ class Notify < ActionMailer::Base
2 2 include Resque::Mailer
3 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 6 default_url_options[:protocol] = Gitlab.config.web_protocol
  7 + default_url_options[:port] = Gitlab.config.web_port
7 8  
8 9 default from: Gitlab.config.email_from
9 10  
... ...
app/models/project.rb
... ... @@ -13,7 +13,7 @@ class Project < ActiveRecord::Base
13 13 has_many :users, :through => :users_projects
14 14 has_many :events, :dependent => :destroy
15 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 17 has_many :milestones, :dependent => :destroy
18 18 has_many :users_projects, :dependent => :destroy
19 19 has_many :notes, :dependent => :destroy
... ...
app/views/issues/_show.html.haml
... ... @@ -29,6 +29,7 @@
29 29 %p.row_title= truncate(issue.title, :length => 100)
30 30  
31 31 %span.update-author
  32 + %small.cdark= "##{issue.id}"
32 33 - if issue.assignee
33 34 assigned to #{issue.assignee_name}
34 35 - else
... ...
app/views/issues/index.html.haml
... ... @@ -46,24 +46,3 @@
46 46 $(function(){
47 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 1 :plain
2 2 $('#issues-table').html("#{escape_javascript(render('issues'))}");
3   - setSortable();
... ...
config/initializers/1_settings.rb
... ... @@ -3,7 +3,7 @@ class Settings < Settingslogic
3 3  
4 4 class << self
5 5 def web_protocol
6   - self.web['protocol'] ||= web.https ? "https://" : "http://"
  6 + self.web['protocol'] ||= web.https ? "https" : "http"
7 7 end
8 8  
9 9 def web_host
... ... @@ -18,10 +18,15 @@ class Settings &lt; Settingslogic
18 18 self['url'] ||= build_url
19 19 end
20 20  
  21 + def web_port
  22 + web['port'] ||= 80
  23 + end
  24 +
21 25 def build_url
22 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 30 raw_url
26 31 end
27 32  
... ...
lib/color.rb
1 1 module Color
  2 + extend self
  3 +
2 4 def colorize(text, color_code)
3 5 "\033[#{color_code}#{text}\033[0m"
4 6 end
... ...
spec/mailers/notify_spec.rb
... ... @@ -4,10 +4,6 @@ describe Notify do
4 4 include EmailSpec::Helpers
5 5 include EmailSpec::Matchers
6 6  
7   - before :all do
8   - default_url_options[:host] = Gitlab.config.web_host
9   - end
10   -
11 7 let(:recipient) { Factory.create(:user, :email => 'recipient@example.com') }
12 8 let(:project) { Factory.create(:project) }
13 9  
... ... @@ -18,7 +14,7 @@ describe Notify do
18 14 end
19 15  
20 16 describe 'for new users, the email' do
21   - let(:example_site_url) { root_url }
  17 + let(:example_site_path) { root_path }
22 18 let(:new_user) { Factory.create(:user, :email => 'newguy@example.com') }
23 19  
24 20 subject { Notify.new_user_email(new_user.id, new_user.password) }
... ... @@ -40,7 +36,7 @@ describe Notify do
40 36 end
41 37  
42 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 40 end
45 41 end
46 42  
... ... @@ -68,7 +64,7 @@ describe Notify do
68 64 end
69 65  
70 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 68 end
73 69 end
74 70  
... ... @@ -92,7 +88,7 @@ describe Notify do
92 88 end
93 89  
94 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 92 end
97 93 end
98 94 end
... ... @@ -110,7 +106,7 @@ describe Notify do
110 106 end
111 107  
112 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 110 end
115 111  
116 112 it 'contains the source branch for the merge request' do
... ... @@ -142,7 +138,7 @@ describe Notify do
142 138 end
143 139  
144 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 142 end
147 143  
148 144 end
... ... @@ -172,7 +168,7 @@ describe Notify do
172 168 end
173 169  
174 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 173 subject { Notify.note_wall_email(recipient.id, note.id) }
178 174  
... ... @@ -183,7 +179,7 @@ describe Notify do
183 179 end
184 180  
185 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 183 end
188 184 end
189 185  
... ... @@ -211,7 +207,7 @@ describe Notify do
211 207  
212 208 describe 'on a merge request' do
213 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 211 before(:each) { note.stub(:noteable).and_return(merge_request) }
216 212  
217 213 subject { Notify.note_merge_request_email(recipient.id, note.id) }
... ... @@ -223,13 +219,13 @@ describe Notify do
223 219 end
224 220  
225 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 223 end
228 224 end
229 225  
230 226 describe 'on an issue' do
231 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 229 before(:each) { note.stub(:noteable).and_return(issue) }
234 230  
235 231 subject { Notify.note_issue_email(recipient.id, note.id) }
... ... @@ -241,7 +237,7 @@ describe Notify do
241 237 end
242 238  
243 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 241 end
246 242 end
247 243 end
... ...
spec/models/project_hooks_spec.rb
... ... @@ -106,7 +106,7 @@ describe Project, &quot;Hooks&quot; do
106 106 it { should include(id: @commit.id) }
107 107 it { should include(message: @commit.safe_message) }
108 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 111 context "with a author" do
112 112 subject { @data[:commits].first[:author] }
... ...
spec/models/project_spec.rb
... ... @@ -46,7 +46,7 @@ describe Project do
46 46  
47 47 it "should return valid url to repo" do
48 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 50 end
51 51  
52 52 it "should return path to repo" do
... ...