Revision 1297:0a574315af3e .svn/pristine/aa

View differences:

.svn/pristine/aa/aa0a6733f9e46382631e33a3f33c162d88cd3a1d.svn-base
1
<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %>
2
    <%= error_messages_for 'issue', 'time_entry' %>
3
    <%= render :partial => 'conflict' if @conflict %>
4
    <div class="box">
5
    <% if @edit_allowed || !@allowed_statuses.empty? %>
6
        <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend>
7
        <div id="all_attributes">
8
        <%= render :partial => 'form', :locals => {:f => f} %>
9
        </div>
10
        </fieldset>
11
    <% end %>
12
    <% if User.current.allowed_to?(:log_time, @project) %>
13
        <fieldset class="tabular"><legend><%= l(:button_log_time) %></legend>
14
        <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %>
15
        <div class="splitcontentleft">
16
        <p><%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %></p>
17
        </div>
18
        <div class="splitcontentright">
19
        <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
20
        </div>
21
        <p><%= time_entry.text_field :comments, :size => 60 %></p>
22
        <% @time_entry.custom_field_values.each do |value| %>
23
          <p><%= custom_field_tag_with_label :time_entry, value %></p>
24
        <% end %>
25
        <% end %>
26
    </fieldset>
27
    <% end %>
28

  
29
    <fieldset><legend><%= l(:field_notes) %></legend>
30
    <%= f.text_area :notes, :cols => 60, :rows => 10, :class => 'wiki-edit', :no_label => true %>
31
    <%= wikitoolbar_for 'issue_notes' %>
32

  
33
    <% if @issue.safe_attribute? 'private_notes' %>
34
    <label for="issue_private_notes"><%= f.check_box :private_notes, :no_label => true %> <%= l(:field_private_notes) %></label>
35
    <% end %>
36

  
37
    <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %>
38
    </fieldset>
39

  
40
    <fieldset><legend><%= l(:label_attachment_plural) %></legend>
41
    <p><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
42
    </fieldset>
43
    </div>
44

  
45
    <%= f.hidden_field :lock_version %>
46
    <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %>
47
    <%= submit_tag l(:button_submit) %>
48
    <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' %>
49
<% end %>
50

  
51
<div id="preview" class="wiki"></div>
.svn/pristine/aa/aaf905ee3518e0c52f64e7a528de1f2b7f2001eb.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
require 'settings_controller'
20

  
21
# Re-raise errors caught by the controller.
22
class SettingsController; def rescue_action(e) raise e end; end
23

  
24
class SettingsControllerTest < ActionController::TestCase
25
  fixtures :users
26

  
27
  def setup
28
    @controller = SettingsController.new
29
    @request    = ActionController::TestRequest.new
30
    @response   = ActionController::TestResponse.new
31
    User.current = nil
32
    @request.session[:user_id] = 1 # admin
33
  end
34

  
35
  def test_index
36
    get :index
37
    assert_response :success
38
    assert_template 'edit'
39
  end
40

  
41
  def test_get_edit
42
    get :edit
43
    assert_response :success
44
    assert_template 'edit'
45

  
46
    assert_tag 'input', :attributes => {:name => 'settings[enabled_scm][]', :value => ''}
47
  end
48

  
49
  def test_get_edit_should_preselect_default_issue_list_columns
50
    with_settings :issue_list_default_columns => %w(tracker subject status updated_on) do
51
      get :edit
52
      assert_response :success
53
    end
54

  
55
    assert_select 'select[id=selected_columns][name=?]', 'settings[issue_list_default_columns][]' do
56
      assert_select 'option', 4
57
      assert_select 'option[value=tracker]', :text => 'Tracker'
58
      assert_select 'option[value=subject]', :text => 'Subject'
59
      assert_select 'option[value=status]', :text => 'Status'
60
      assert_select 'option[value=updated_on]', :text => 'Updated'
61
    end
62

  
63
    assert_select 'select[id=available_columns]' do
64
      assert_select 'option[value=tracker]', 0
65
      assert_select 'option[value=priority]', :text => 'Priority'
66
    end
67
  end
68

  
69
  def test_get_edit_without_trackers_should_succeed
70
    Tracker.delete_all
71

  
72
    get :edit
73
    assert_response :success
74
  end
75

  
76
  def test_post_edit_notifications
77
    post :edit, :settings => {:mail_from => 'functional@test.foo',
78
                              :bcc_recipients  => '0',
79
                              :notified_events => %w(issue_added issue_updated news_added),
80
                              :emails_footer => 'Test footer'
81
                              }
82
    assert_redirected_to '/settings/edit'
83
    assert_equal 'functional@test.foo', Setting.mail_from
84
    assert !Setting.bcc_recipients?
85
    assert_equal %w(issue_added issue_updated news_added), Setting.notified_events
86
    assert_equal 'Test footer', Setting.emails_footer
87
    Setting.clear_cache
88
  end
89

  
90
  def test_get_plugin_settings
91
    Setting.stubs(:plugin_foo).returns({'sample_setting' => 'Plugin setting value'})
92
    ActionController::Base.append_view_path(File.join(Rails.root, "test/fixtures/plugins"))
93
    Redmine::Plugin.register :foo do
94
      settings :partial => "foo_plugin/foo_plugin_settings"
95
    end
96

  
97
    get :plugin, :id => 'foo'
98
    assert_response :success
99
    assert_template 'plugin'
100
    assert_tag 'form', :attributes => {:action => '/settings/plugin/foo'},
101
      :descendant => {:tag => 'input', :attributes => {:name => 'settings[sample_setting]', :value => 'Plugin setting value'}}
102

  
103
    Redmine::Plugin.clear
104
  end
105

  
106
  def test_get_invalid_plugin_settings
107
    get :plugin, :id => 'none'
108
    assert_response 404
109
  end
110

  
111
  def test_post_plugin_settings
112
    Setting.expects(:plugin_foo=).with({'sample_setting' => 'Value'}).returns(true)
113
    Redmine::Plugin.register(:foo) {}
114

  
115
    post :plugin, :id => 'foo', :settings => {'sample_setting' => 'Value'}
116
    assert_redirected_to '/settings/plugin/foo'
117
  end
118
end

Also available in: Unified diff