Revision 1297:0a574315af3e .svn/pristine/77

View differences:

.svn/pristine/77/77248ddaa6a6eab05f401eccdc6d5bf821a5413d.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
class WatchersController < ApplicationController
19
  before_filter :find_project
20
  before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch]
21
  before_filter :authorize, :only => [:new, :destroy]
22

  
23
  def watch
24
    if @watched.respond_to?(:visible?) && !@watched.visible?(User.current)
25
      render_403
26
    else
27
      set_watcher(User.current, true)
28
    end
29
  end
30

  
31
  def unwatch
32
    set_watcher(User.current, false)
33
  end
34

  
35
  def new
36
  end
37

  
38
  def create
39
    if params[:watcher].is_a?(Hash) && request.post?
40
      user_ids = params[:watcher][:user_ids] || [params[:watcher][:user_id]]
41
      user_ids.each do |user_id|
42
        Watcher.create(:watchable => @watched, :user_id => user_id)
43
      end
44
    end
45
    respond_to do |format|
46
      format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
47
      format.js
48
    end
49
  end
50

  
51
  def append
52
    if params[:watcher].is_a?(Hash)
53
      user_ids = params[:watcher][:user_ids] || [params[:watcher][:user_id]]
54
      @users = User.active.find_all_by_id(user_ids)
55
    end
56
  end
57

  
58
  def destroy
59
    @watched.set_watcher(User.find(params[:user_id]), false) if request.post?
60
    respond_to do |format|
61
      format.html { redirect_to :back }
62
      format.js
63
    end
64
  end
65

  
66
  def autocomplete_for_user
67
    @users = User.active.like(params[:q]).find(:all, :limit => 100)
68
    if @watched
69
      @users -= @watched.watcher_users
70
    end
71
    render :layout => false
72
  end
73

  
74
private
75
  def find_project
76
    if params[:object_type] && params[:object_id]
77
      klass = Object.const_get(params[:object_type].camelcase)
78
      return false unless klass.respond_to?('watched_by')
79
      @watched = klass.find(params[:object_id])
80
      @project = @watched.project
81
    elsif params[:project_id]
82
      @project = Project.visible.find_by_param(params[:project_id])
83
    end
84
  rescue
85
    render_404
86
  end
87

  
88
  def set_watcher(user, watching)
89
    @watched.set_watcher(user, watching)
90
    respond_to do |format|
91
      format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
92
      format.js { render :partial => 'set_watcher', :locals => {:user => user, :watched => @watched} }
93
    end
94
  end
95
end
.svn/pristine/77/779ea9e70e281cf8e8422126215401ab50f4c8e4.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
require File.expand_path('../../../test_helper', __FILE__)
19

  
20
class ApiTest::AttachmentsTest < ActionController::IntegrationTest
21
  fixtures :projects, :trackers, :issue_statuses, :issues,
22
           :enumerations, :users, :issue_categories,
23
           :projects_trackers,
24
           :roles,
25
           :member_roles,
26
           :members,
27
           :enabled_modules,
28
           :workflows,
29
           :attachments
30

  
31
  def setup
32
    Setting.rest_api_enabled = '1'
33
    set_fixtures_attachments_directory
34
  end
35

  
36
  def teardown
37
    set_tmp_attachments_directory
38
  end
39

  
40
  test "GET /attachments/:id.xml should return the attachment" do
41
    get '/attachments/7.xml', {}, credentials('jsmith')
42
    assert_response :success
43
    assert_equal 'application/xml', @response.content_type
44
    assert_tag :tag => 'attachment',
45
      :child => {
46
        :tag => 'id',
47
        :content => '7',
48
        :sibling => {
49
          :tag => 'filename',
50
          :content => 'archive.zip',
51
          :sibling => {
52
            :tag => 'content_url',
53
            :content => 'http://www.example.com/attachments/download/7/archive.zip'
54
          }
55
        }
56
      }
57
  end
58

  
59
  test "GET /attachments/:id.xml should deny access without credentials" do
60
    get '/attachments/7.xml'
61
    assert_response 401
62
    set_tmp_attachments_directory
63
  end
64

  
65
  test "GET /attachments/download/:id/:filename should return the attachment content" do
66
    get '/attachments/download/7/archive.zip', {}, credentials('jsmith')
67
    assert_response :success
68
    assert_equal 'application/octet-stream', @response.content_type
69
    set_tmp_attachments_directory
70
  end
71

  
72
  test "GET /attachments/download/:id/:filename should deny access without credentials" do
73
    get '/attachments/download/7/archive.zip'
74
    assert_response 302
75
    set_tmp_attachments_directory
76
  end
77

  
78
  test "POST /uploads.xml should return the token" do
79
    set_tmp_attachments_directory
80
    assert_difference 'Attachment.count' do
81
      post '/uploads.xml', 'File content', {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
82
      assert_response :created
83
      assert_equal 'application/xml', response.content_type
84
    end
85

  
86
    xml = Hash.from_xml(response.body)
87
    assert_kind_of Hash, xml['upload']
88
    token = xml['upload']['token']
89
    assert_not_nil token
90

  
91
    attachment = Attachment.first(:order => 'id DESC')
92
    assert_equal token, attachment.token
93
    assert_nil attachment.container
94
    assert_equal 2, attachment.author_id
95
    assert_equal 'File content'.size, attachment.filesize
96
    assert attachment.content_type.blank?
97
    assert attachment.filename.present?
98
    assert_match /\d+_[0-9a-z]+/, attachment.diskfile
99
    assert File.exist?(attachment.diskfile)
100
    assert_equal 'File content', File.read(attachment.diskfile)
101
  end
102

  
103
  test "POST /uploads.json should return the token" do
104
    set_tmp_attachments_directory
105
    assert_difference 'Attachment.count' do
106
      post '/uploads.json', 'File content', {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
107
      assert_response :created
108
      assert_equal 'application/json', response.content_type
109
    end
110

  
111
    json = ActiveSupport::JSON.decode(response.body)
112
    assert_kind_of Hash, json['upload']
113
    token = json['upload']['token']
114
    assert_not_nil token
115

  
116
    attachment = Attachment.first(:order => 'id DESC')
117
    assert_equal token, attachment.token
118
  end
119

  
120
  test "POST /uploads.xml should accept :filename param as the attachment filename" do
121
    set_tmp_attachments_directory
122
    assert_difference 'Attachment.count' do
123
      post '/uploads.xml?filename=test.txt', 'File content', {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
124
      assert_response :created
125
    end
126

  
127
    attachment = Attachment.order('id DESC').first
128
    assert_equal 'test.txt', attachment.filename
129
    assert_match /_test\.txt$/, attachment.diskfile
130
  end
131

  
132
  test "POST /uploads.xml should not accept other content types" do
133
    set_tmp_attachments_directory
134
    assert_no_difference 'Attachment.count' do
135
      post '/uploads.xml', 'PNG DATA', {"CONTENT_TYPE" => 'image/png'}.merge(credentials('jsmith'))
136
      assert_response 406
137
    end
138
  end
139

  
140
  test "POST /uploads.xml should return errors if file is too big" do
141
    set_tmp_attachments_directory
142
    with_settings :attachment_max_size => 1 do
143
      assert_no_difference 'Attachment.count' do
144
        post '/uploads.xml', ('x' * 2048), {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
145
        assert_response 422
146
        assert_tag 'error', :content => /exceeds the maximum allowed file size/
147
      end
148
    end
149
  end
150
end
.svn/pristine/77/77a6954f03d58f7e24de8e5590a7b9bd1ed61ac2.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
require File.expand_path('../../test_helper', __FILE__)
19

  
20
class AdminTest < ActionController::IntegrationTest
21
  fixtures :projects, :trackers, :issue_statuses, :issues,
22
           :enumerations, :users, :issue_categories,
23
           :projects_trackers,
24
           :roles,
25
           :member_roles,
26
           :members,
27
           :enabled_modules,
28
           :workflows
29

  
30
  def test_add_user
31
    log_user("admin", "admin")
32
    get "/users/new"
33
    assert_response :success
34
    assert_template "users/new"
35
    post "/users",
36
         :user => { :login => "psmith", :firstname => "Paul",
37
                    :lastname => "Smith", :mail => "psmith@somenet.foo",
38
                    :language => "en", :password => "psmith09",
39
                    :password_confirmation => "psmith09" }
40

  
41
    user = User.find_by_login("psmith")
42
    assert_kind_of User, user
43
    assert_redirected_to "/users/#{ user.id }/edit"
44

  
45
    logged_user = User.try_to_login("psmith", "psmith09")
46
    assert_kind_of User, logged_user
47
    assert_equal "Paul", logged_user.firstname
48

  
49
    put "users/#{user.id}", :id => user.id, :user => { :status => User::STATUS_LOCKED }
50
    assert_redirected_to "/users/#{ user.id }/edit"
51
    locked_user = User.try_to_login("psmith", "psmith09")
52
    assert_equal nil, locked_user
53
  end
54

  
55
  test "Add a user as an anonymous user should fail" do
56
    post '/users',
57
         :user => { :login => 'psmith', :firstname => 'Paul'},
58
         :password => "psmith09", :password_confirmation => "psmith09"
59
    assert_response :redirect
60
    assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fusers"
61
  end
62
end
.svn/pristine/77/77dca881d9fa5f30825d9090833ebab69a043327.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
require File.expand_path('../../test_helper', __FILE__)
19

  
20
class VersionTest < ActiveSupport::TestCase
21
  fixtures :projects, :users, :issues, :issue_statuses, :trackers, :enumerations, :versions, :projects_trackers
22

  
23
  def setup
24
  end
25

  
26
  def test_create
27
    v = Version.new(:project => Project.find(1), :name => '1.1', :effective_date => '2011-03-25')
28
    assert v.save
29
    assert_equal 'open', v.status
30
    assert_equal 'none', v.sharing
31
  end
32

  
33
  def test_invalid_effective_date_validation
34
    v = Version.new(:project => Project.find(1), :name => '1.1', :effective_date => '99999-01-01')
35
    assert !v.valid?
36
    v.effective_date = '2012-11-33'
37
    assert !v.valid?
38
    v.effective_date = '2012-31-11'
39
    assert !v.valid?
40
    v.effective_date = 'ABC'
41
    assert !v.valid?
42
    assert_include I18n.translate('activerecord.errors.messages.not_a_date'),
43
                   v.errors[:effective_date]
44
  end
45

  
46
  def test_progress_should_be_0_with_no_assigned_issues
47
    project = Project.find(1)
48
    v = Version.create!(:project => project, :name => 'Progress')
49
    assert_equal 0, v.completed_pourcent
50
    assert_equal 0, v.closed_pourcent
51
  end
52

  
53
  def test_progress_should_be_0_with_unbegun_assigned_issues
54
    project = Project.find(1)
55
    v = Version.create!(:project => project, :name => 'Progress')
56
    add_issue(v)
57
    add_issue(v, :done_ratio => 0)
58
    assert_progress_equal 0, v.completed_pourcent
59
    assert_progress_equal 0, v.closed_pourcent
60
  end
61

  
62
  def test_progress_should_be_100_with_closed_assigned_issues
63
    project = Project.find(1)
64
    status = IssueStatus.find(:first, :conditions => {:is_closed => true})
65
    v = Version.create!(:project => project, :name => 'Progress')
66
    add_issue(v, :status => status)
67
    add_issue(v, :status => status, :done_ratio => 20)
68
    add_issue(v, :status => status, :done_ratio => 70, :estimated_hours => 25)
69
    add_issue(v, :status => status, :estimated_hours => 15)
70
    assert_progress_equal 100.0, v.completed_pourcent
71
    assert_progress_equal 100.0, v.closed_pourcent
72
  end
73

  
74
  def test_progress_should_consider_done_ratio_of_open_assigned_issues
75
    project = Project.find(1)
76
    v = Version.create!(:project => project, :name => 'Progress')
77
    add_issue(v)
78
    add_issue(v, :done_ratio => 20)
79
    add_issue(v, :done_ratio => 70)
80
    assert_progress_equal (0.0 + 20.0 + 70.0)/3, v.completed_pourcent
81
    assert_progress_equal 0, v.closed_pourcent
82
  end
83

  
84
  def test_progress_should_consider_closed_issues_as_completed
85
    project = Project.find(1)
86
    v = Version.create!(:project => project, :name => 'Progress')
87
    add_issue(v)
88
    add_issue(v, :done_ratio => 20)
89
    add_issue(v, :status => IssueStatus.find(:first, :conditions => {:is_closed => true}))
90
    assert_progress_equal (0.0 + 20.0 + 100.0)/3, v.completed_pourcent
91
    assert_progress_equal (100.0)/3, v.closed_pourcent
92
  end
93

  
94
  def test_progress_should_consider_estimated_hours_to_weigth_issues
95
    project = Project.find(1)
96
    v = Version.create!(:project => project, :name => 'Progress')
97
    add_issue(v, :estimated_hours => 10)
98
    add_issue(v, :estimated_hours => 20, :done_ratio => 30)
99
    add_issue(v, :estimated_hours => 40, :done_ratio => 10)
100
    add_issue(v, :estimated_hours => 25, :status => IssueStatus.find(:first, :conditions => {:is_closed => true}))
101
    assert_progress_equal (10.0*0 + 20.0*0.3 + 40*0.1 + 25.0*1)/95.0*100, v.completed_pourcent
102
    assert_progress_equal 25.0/95.0*100, v.closed_pourcent
103
  end
104

  
105
  def test_progress_should_consider_average_estimated_hours_to_weigth_unestimated_issues
106
    project = Project.find(1)
107
    v = Version.create!(:project => project, :name => 'Progress')
108
    add_issue(v, :done_ratio => 20)
109
    add_issue(v, :status => IssueStatus.find(:first, :conditions => {:is_closed => true}))
110
    add_issue(v, :estimated_hours => 10, :done_ratio => 30)
111
    add_issue(v, :estimated_hours => 40, :done_ratio => 10)
112
    assert_progress_equal (25.0*0.2 + 25.0*1 + 10.0*0.3 + 40.0*0.1)/100.0*100, v.completed_pourcent
113
    assert_progress_equal 25.0/100.0*100, v.closed_pourcent
114
  end
115

  
116
  def test_should_sort_scheduled_then_unscheduled_versions
117
    Version.delete_all
118
    v4 = Version.create!(:project_id => 1, :name => 'v4')
119
    v3 = Version.create!(:project_id => 1, :name => 'v2', :effective_date => '2012-07-14')
120
    v2 = Version.create!(:project_id => 1, :name => 'v1')
121
    v1 = Version.create!(:project_id => 1, :name => 'v3', :effective_date => '2012-08-02')
122
    v5 = Version.create!(:project_id => 1, :name => 'v5', :effective_date => '2012-07-02')
123

  
124
    assert_equal [v5, v3, v1, v2, v4], [v1, v2, v3, v4, v5].sort
125
    assert_equal [v5, v3, v1, v2, v4], Version.sorted.all
126
  end
127

  
128
  def test_completed_should_be_false_when_due_today
129
    version = Version.create!(:project_id => 1, :effective_date => Date.today, :name => 'Due today')
130
    assert_equal false, version.completed?
131
  end
132

  
133
  context "#behind_schedule?" do
134
    setup do
135
      ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
136
      @project = Project.create!(:name => 'test0', :identifier => 'test0')
137
      @project.trackers << Tracker.create!(:name => 'track')
138

  
139
      @version = Version.create!(:project => @project, :effective_date => nil, :name => 'version')
140
    end
141

  
142
    should "be false if there are no issues assigned" do
143
      @version.update_attribute(:effective_date, Date.yesterday)
144
      assert_equal false, @version.behind_schedule?
145
    end
146

  
147
    should "be false if there is no effective_date" do
148
      assert_equal false, @version.behind_schedule?
149
    end
150

  
151
    should "be false if all of the issues are ahead of schedule" do
152
      @version.update_attribute(:effective_date, 7.days.from_now.to_date)
153
      add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
154
      add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
155
      assert_equal 60, @version.completed_pourcent
156
      assert_equal false, @version.behind_schedule?
157
    end
158

  
159
    should "be true if any of the issues are behind schedule" do
160
      @version.update_attribute(:effective_date, 7.days.from_now.to_date)
161
      add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
162
      add_issue(@version, :start_date => 7.days.ago, :done_ratio => 20) # 14 day span, 20% done, 50% time left
163
      assert_equal 40, @version.completed_pourcent
164
      assert_equal true, @version.behind_schedule?
165
    end
166

  
167
    should "be false if all of the issues are complete" do
168
      @version.update_attribute(:effective_date, 7.days.from_now.to_date)
169
      add_issue(@version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
170
      add_issue(@version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
171
      assert_equal 100, @version.completed_pourcent
172
      assert_equal false, @version.behind_schedule?
173
    end
174
  end
175

  
176
  context "#estimated_hours" do
177
    setup do
178
      @version = Version.create!(:project_id => 1, :name => '#estimated_hours')
179
    end
180

  
181
    should "return 0 with no assigned issues" do
182
      assert_equal 0, @version.estimated_hours
183
    end
184

  
185
    should "return 0 with no estimated hours" do
186
      add_issue(@version)
187
      assert_equal 0, @version.estimated_hours
188
    end
189

  
190
    should "return the sum of estimated hours" do
191
      add_issue(@version, :estimated_hours => 2.5)
192
      add_issue(@version, :estimated_hours => 5)
193
      assert_equal 7.5, @version.estimated_hours
194
    end
195

  
196
    should "return the sum of leaves estimated hours" do
197
      parent = add_issue(@version)
198
      add_issue(@version, :estimated_hours => 2.5, :parent_issue_id => parent.id)
199
      add_issue(@version, :estimated_hours => 5, :parent_issue_id => parent.id)
200
      assert_equal 7.5, @version.estimated_hours
201
    end
202
  end
203

  
204
  test "should update all issue's fixed_version associations in case the hierarchy changed XXX" do
205
    User.current = User.find(1) # Need the admin's permissions
206

  
207
    @version = Version.find(7)
208
    # Separate hierarchy
209
    project_1_issue = Issue.find(1)
210
    project_1_issue.fixed_version = @version
211
    assert project_1_issue.save, project_1_issue.errors.full_messages.to_s
212

  
213
    project_5_issue = Issue.find(6)
214
    project_5_issue.fixed_version = @version
215
    assert project_5_issue.save
216

  
217
    # Project
218
    project_2_issue = Issue.find(4)
219
    project_2_issue.fixed_version = @version
220
    assert project_2_issue.save
221

  
222
    # Update the sharing
223
    @version.sharing = 'none'
224
    assert @version.save
225

  
226
    # Project 1 now out of the shared scope
227
    project_1_issue.reload
228
    assert_equal nil, project_1_issue.fixed_version, "Fixed version is still set after changing the Version's sharing"
229

  
230
    # Project 5 now out of the shared scope
231
    project_5_issue.reload
232
    assert_equal nil, project_5_issue.fixed_version, "Fixed version is still set after changing the Version's sharing"
233

  
234
    # Project 2 issue remains
235
    project_2_issue.reload
236
    assert_equal @version, project_2_issue.fixed_version
237
  end
238

  
239
  private
240

  
241
  def add_issue(version, attributes={})
242
    Issue.create!({:project => version.project,
243
                   :fixed_version => version,
244
                   :subject => 'Test',
245
                   :author => User.find(:first),
246
                   :tracker => version.project.trackers.find(:first)}.merge(attributes))
247
  end
248

  
249
  def assert_progress_equal(expected_float, actual_float, message="")
250
    assert_in_delta(expected_float, actual_float, 0.000001, message="")
251
  end
252
end
.svn/pristine/77/77ec4500ba84dc62ffa71710497a489cc1dddafb.svn-base
1
<h2><%=h @attachment.filename %></h2>
2

  
3
<div class="attachments">
4
<p><%= h("#{@attachment.description} - ") unless @attachment.description.blank? %>
5
   <span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
6
<p><%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%>
7
   <span class="size">(<%= number_to_human_size @attachment.filesize %>)</span></p>
8
</div>
9
<%= form_tag({}, :method => 'get') do %>
10
  <p>
11
    <%= l(:label_view_diff) %>:
12
    <label><%= radio_button_tag 'type', 'inline', @diff_type != 'sbs', :onchange => "this.form.submit()" %> <%= l(:label_diff_inline) %></label>
13
    <label><%= radio_button_tag 'type', 'sbs', @diff_type == 'sbs', :onchange => "this.form.submit()" %> <%= l(:label_diff_side_by_side) %></label>
14
  </p>
15
<% end %>
16
<%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type, :diff_style => nil} %>
17

  
18
<% html_title @attachment.filename %>
19

  
20
<% content_for :header_tags do -%>
21
    <%= stylesheet_link_tag "scm" -%>
22
<% end -%>
.svn/pristine/77/77f3a652890e7717cf692415832f070c03c8e44f.svn-base
1
<%= error_messages_for 'repository' %>
2

  
3
<div class="box tabular">
4
<p>
5
<%= label_tag('repository_scm', l(:label_scm)) %><%= scm_select_tag(@repository) %>
6
<% if @repository && ! @repository.class.scm_available %>
7
  <em class="info error"><%= l(:text_scm_command_not_available) %></em>
8
<% end %>
9
</p>
10

  
11
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
12
<p><%= f.text_field :identifier, :disabled => @repository.identifier_frozen?  %>
13
<% unless @repository.identifier_frozen? %>
14
  <em class="info"><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_repository_identifier_info).html_safe %></em>
15
<% end %></p>
16

  
17
<% button_disabled = true %>
18
<% if @repository %>
19
<%   button_disabled = ! @repository.class.scm_available %>
20
<%=    repository_field_tags(f, @repository)%>
21
<% end %>
22
</div>
23

  
24
<p>
25
  <%= submit_tag(@repository.new_record? ? l(:button_create) : l(:button_save), :disabled => button_disabled) %>
26
	<%= link_to l(:button_cancel), settings_project_path(@project, :tab => 'repositories') %>
27
</p>

Also available in: Unified diff