Revision 1297:0a574315af3e .svn/pristine/98

View differences:

.svn/pristine/98/9810c4e90aced6647301b39d69f6aa9159da4626.svn-base
1
<%= error_messages_for @board %>
2

  
3
<div class="box tabular">
4
<p><%= f.text_field :name, :required => true %></p>
5
<p><%= f.text_field :description, :required => true, :size => 80 %></p>
6
<% if @board.valid_parents.any? %>
7
<p><%= f.select :parent_id, boards_options_for_select(@board.valid_parents), :include_blank => true, :label => :field_board_parent %></p>
8
<% end %>
9
</div>
.svn/pristine/98/9816a87cddfd272dcfaae9280e3c0e06d8daace7.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 WelcomeController < ApplicationController
19
  caches_action :robots
20

  
21
  def index
22
    @news = News.latest User.current
23
    @projects = Project.latest User.current
24
  end
25

  
26
  def robots
27
    @projects = Project.all_public.active
28
    render :layout => false, :content_type => 'text/plain'
29
  end
30
end
.svn/pristine/98/9831098b57185dccdb40ff45add07f32d5297f97.svn-base
1
/* Latvian (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
/* @author Arturas Paleicikas <arturas.paleicikas@metasite.net> */
3
jQuery(function($){
4
	$.datepicker.regional['lv'] = {
5
		closeText: 'Aizvērt',
6
		prevText: 'Iepr',
7
		nextText: 'Nāka',
8
		currentText: 'Šodien',
9
		monthNames: ['Janvāris','Februāris','Marts','Aprīlis','Maijs','Jūnijs',
10
		'Jūlijs','Augusts','Septembris','Oktobris','Novembris','Decembris'],
11
		monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jūn',
12
		'Jūl','Aug','Sep','Okt','Nov','Dec'],
13
		dayNames: ['svētdiena','pirmdiena','otrdiena','trešdiena','ceturtdiena','piektdiena','sestdiena'],
14
		dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'],
15
		dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'],
16
		weekHeader: 'Nav',
17
		dateFormat: 'dd-mm-yy',
18
		firstDay: 1,
19
		isRTL: false,
20
		showMonthAfterYear: false,
21
		yearSuffix: ''};
22
	$.datepicker.setDefaults($.datepicker.regional['lv']);
23
});
.svn/pristine/98/9867490a9476af1ee1f31febcf3fd21259c41d90.svn-base
1
# encoding: utf-8
2
#
3
# Redmine - project management software
4
# Copyright (C) 2006-2012  Jean-Philippe Lang
5
#
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License
8
# as published by the Free Software Foundation; either version 2
9
# of the License, or (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19

  
20
module WikiHelper
21

  
22
  def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0)
23
    pages = pages.group_by(&:parent) unless pages.is_a?(Hash)
24
    s = ''.html_safe
25
    if pages.has_key?(parent)
26
      pages[parent].each do |page|
27
        attrs = "value='#{page.id}'"
28
        attrs << " selected='selected'" if selected == page
29
        indent = (level > 0) ? ('&nbsp;' * level * 2 + '&#187; ') : ''
30

  
31
        s << content_tag('option', (indent + h(page.pretty_title)).html_safe, :value => page.id.to_s, :selected => selected == page) +
32
               wiki_page_options_for_select(pages, selected, page, level + 1)
33
      end
34
    end
35
    s
36
  end
37

  
38
  def wiki_page_breadcrumb(page)
39
    breadcrumb(page.ancestors.reverse.collect {|parent|
40
      link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project, :version => nil})
41
    })
42
  end
43
end
.svn/pristine/98/9897bfb6f0632665c35d69507fed8abf717e1117.svn-base
1
<h2><%=l(:label_version_new)%></h2>
2

  
3
<%= labelled_form_for @version, :url => project_versions_path(@project) do |f| %>
4
<%= render :partial => 'versions/form', :locals => { :f => f } %>
5
<%= submit_tag l(:button_create) %>
6
<% end %>
.svn/pristine/98/98a5258051109b3158da9d70775bc4f9d0d7e352.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 WatcherTest < ActiveSupport::TestCase
21
  fixtures :projects, :users, :members, :member_roles, :roles, :enabled_modules,
22
           :issues, :issue_statuses, :enumerations, :trackers, :projects_trackers,
23
           :boards, :messages,
24
           :wikis, :wiki_pages,
25
           :watchers
26

  
27
  def setup
28
    @user = User.find(1)
29
    @issue = Issue.find(1)
30
  end
31

  
32
  def test_validate
33
    user = User.find(5)
34
    assert !user.active?
35
    watcher = Watcher.new(:user_id => user.id)
36
    assert !watcher.save
37
  end
38

  
39
  def test_watch
40
    assert @issue.add_watcher(@user)
41
    @issue.reload
42
    assert @issue.watchers.detect { |w| w.user == @user }
43
  end
44

  
45
  def test_cant_watch_twice
46
    assert @issue.add_watcher(@user)
47
    assert !@issue.add_watcher(@user)
48
  end
49

  
50
  def test_watched_by
51
    assert @issue.add_watcher(@user)
52
    @issue.reload
53
    assert @issue.watched_by?(@user)
54
    assert Issue.watched_by(@user).include?(@issue)
55
  end
56

  
57
  def test_watcher_users
58
    watcher_users = Issue.find(2).watcher_users
59
    assert_kind_of Array, watcher_users
60
    assert_kind_of User, watcher_users.first
61
  end
62

  
63
  def test_watcher_users_should_not_validate_user
64
    User.update_all("firstname = ''", "id=1")
65
    @user.reload
66
    assert !@user.valid?
67

  
68
    issue = Issue.new(:project => Project.find(1), :tracker_id => 1, :subject => "test", :author => User.find(2))
69
    issue.watcher_users << @user
70
    issue.save!
71
    assert issue.watched_by?(@user)
72
  end
73

  
74
  def test_watcher_user_ids
75
    assert_equal [1, 3], Issue.find(2).watcher_user_ids.sort
76
  end
77

  
78
  def test_watcher_user_ids=
79
    issue = Issue.new
80
    issue.watcher_user_ids = ['1', '3']
81
    assert issue.watched_by?(User.find(1))
82
  end
83

  
84
  def test_watcher_user_ids_should_make_ids_uniq
85
    issue = Issue.new(:project => Project.find(1), :tracker_id => 1, :subject => "test", :author => User.find(2))
86
    issue.watcher_user_ids = ['1', '3', '1']
87
    issue.save!
88
    assert_equal 2, issue.watchers.count
89
  end
90

  
91
  def test_addable_watcher_users
92
    addable_watcher_users = @issue.addable_watcher_users
93
    assert_kind_of Array, addable_watcher_users
94
    assert_kind_of User, addable_watcher_users.first
95
  end
96

  
97
  def test_addable_watcher_users_should_not_include_user_that_cannot_view_the_object
98
    issue = Issue.new(:project => Project.find(1), :is_private => true)
99
    assert_nil issue.addable_watcher_users.detect {|user| !issue.visible?(user)}
100
  end
101

  
102
  def test_recipients
103
    @issue.watchers.delete_all
104
    @issue.reload
105

  
106
    assert @issue.watcher_recipients.empty?
107
    assert @issue.add_watcher(@user)
108

  
109
    @user.mail_notification = 'all'
110
    @user.save!
111
    @issue.reload
112
    assert @issue.watcher_recipients.include?(@user.mail)
113

  
114
    @user.mail_notification = 'none'
115
    @user.save!
116
    @issue.reload
117
    assert !@issue.watcher_recipients.include?(@user.mail)
118
  end
119

  
120
  def test_unwatch
121
    assert @issue.add_watcher(@user)
122
    @issue.reload
123
    assert_equal 1, @issue.remove_watcher(@user)
124
  end
125

  
126
  def test_prune
127
    Watcher.delete_all("user_id = 9")
128
    user = User.find(9)
129

  
130
    # public
131
    Watcher.create!(:watchable => Issue.find(1), :user => user)
132
    Watcher.create!(:watchable => Issue.find(2), :user => user)
133
    Watcher.create!(:watchable => Message.find(1), :user => user)
134
    Watcher.create!(:watchable => Wiki.find(1), :user => user)
135
    Watcher.create!(:watchable => WikiPage.find(2), :user => user)
136

  
137
    # private project (id: 2)
138
    Member.create!(:project => Project.find(2), :principal => user, :role_ids => [1])
139
    Watcher.create!(:watchable => Issue.find(4), :user => user)
140
    Watcher.create!(:watchable => Message.find(7), :user => user)
141
    Watcher.create!(:watchable => Wiki.find(2), :user => user)
142
    Watcher.create!(:watchable => WikiPage.find(3), :user => user)
143

  
144
    assert_no_difference 'Watcher.count' do
145
      Watcher.prune(:user => User.find(9))
146
    end
147

  
148
    Member.delete_all
149

  
150
    assert_difference 'Watcher.count', -4 do
151
      Watcher.prune(:user => User.find(9))
152
    end
153

  
154
    assert Issue.find(1).watched_by?(user)
155
    assert !Issue.find(4).watched_by?(user)
156
  end
157

  
158
  def test_prune_all
159
    user = User.find(9)
160
    Watcher.new(:watchable => Issue.find(4), :user => User.find(9)).save(:validate => false)
161

  
162
    assert Watcher.prune > 0
163
    assert !Issue.find(4).watched_by?(user)
164
  end
165
end
.svn/pristine/98/98b7bf221df0f1182696e0abac31a272f5e32e88.svn-base
1
$('#tab-content-memberships').html('<%= escape_javascript(render :partial => 'groups/memberships') %>');
.svn/pristine/98/98c30219e38bafbc07625c852133d782b2016988.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 AuthSourcesControllerTest < ActionController::TestCase
21
  fixtures :users, :auth_sources
22

  
23
  def setup
24
    @request.session[:user_id] = 1
25
  end
26

  
27
  def test_index
28
    get :index
29

  
30
    assert_response :success
31
    assert_template 'index'
32
    assert_not_nil assigns(:auth_sources)
33
  end
34

  
35
  def test_new
36
    get :new
37

  
38
    assert_response :success
39
    assert_template 'new'
40

  
41
    source = assigns(:auth_source)
42
    assert_equal AuthSourceLdap, source.class
43
    assert source.new_record?
44

  
45
    assert_tag 'input', :attributes => {:name => 'type', :value => 'AuthSourceLdap'}
46
    assert_tag 'input', :attributes => {:name => 'auth_source[host]'}
47
  end
48

  
49
  def test_create
50
    assert_difference 'AuthSourceLdap.count' do
51
      post :create, :type => 'AuthSourceLdap', :auth_source => {:name => 'Test', :host => '127.0.0.1', :port => '389', :attr_login => 'cn'}
52
      assert_redirected_to '/auth_sources'
53
    end
54

  
55
    source = AuthSourceLdap.first(:order => 'id DESC')
56
    assert_equal 'Test', source.name
57
    assert_equal '127.0.0.1', source.host
58
    assert_equal 389, source.port
59
    assert_equal 'cn', source.attr_login
60
  end
61

  
62
  def test_create_with_failure
63
    assert_no_difference 'AuthSourceLdap.count' do
64
      post :create, :type => 'AuthSourceLdap', :auth_source => {:name => 'Test', :host => '', :port => '389', :attr_login => 'cn'}
65
      assert_response :success
66
      assert_template 'new'
67
    end
68
    assert_error_tag :content => /host can&#x27;t be blank/i
69
  end
70

  
71
  def test_edit
72
    get :edit, :id => 1
73

  
74
    assert_response :success
75
    assert_template 'edit'
76

  
77
    assert_tag 'input', :attributes => {:name => 'auth_source[host]'}
78
  end
79

  
80
  def test_update
81
    put :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '192.168.0.10', :port => '389', :attr_login => 'uid'}
82
    assert_redirected_to '/auth_sources'
83

  
84
    source = AuthSourceLdap.find(1)
85
    assert_equal 'Renamed', source.name
86
    assert_equal '192.168.0.10', source.host
87
  end
88

  
89
  def test_update_with_failure
90
    put :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '', :port => '389', :attr_login => 'uid'}
91
    assert_response :success
92
    assert_template 'edit'
93
    assert_error_tag :content => /host can&#x27;t be blank/i
94
  end
95

  
96
  def test_destroy
97
    assert_difference 'AuthSourceLdap.count', -1 do
98
      delete :destroy, :id => 1
99
    end
100
  end
101

  
102
  def test_destroy_auth_source_in_use
103
    User.find(2).update_attribute :auth_source_id, 1
104

  
105
    assert_no_difference 'AuthSourceLdap.count' do
106
      delete :destroy, :id => 1
107
    end
108
  end
109

  
110
  def test_test_connection
111
    AuthSourceLdap.any_instance.stubs(:test_connection).returns(true)
112

  
113
    get :test_connection, :id => 1
114
    assert_redirected_to '/auth_sources'
115
    assert_not_nil flash[:notice]
116
    assert_match /successful/i, flash[:notice]
117
  end
118

  
119
  def test_test_connection_with_failure
120
    AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError.new("Something went wrong"))
121

  
122
    get :test_connection, :id => 1
123
    assert_redirected_to '/auth_sources'
124
    assert_not_nil flash[:error]
125
    assert_include 'Something went wrong', flash[:error]
126
  end
127
end
.svn/pristine/98/98c535923711c9c3fa39d1ee5c856fea93a89c6d.svn-base
1
<%= render :partial => 'action_menu' %>
2

  
3
<h2><%= issue_heading(@issue) %></h2>
4

  
5
<div class="<%= @issue.css_classes %> details">
6
  <% if @prev_issue_id || @next_issue_id %>
7
    <div class="next-prev-links contextual">
8
      <%= link_to_if @prev_issue_id,
9
                     "\xc2\xab #{l(:label_previous)}",
10
                     (@prev_issue_id ? issue_path(@prev_issue_id) : nil),
11
                     :title => "##{@prev_issue_id}" %> |
12
      <% if @issue_position && @issue_count %>
13
        <span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
14
      <% end %>
15
      <%= link_to_if @next_issue_id,
16
                     "#{l(:label_next)} \xc2\xbb",
17
                     (@next_issue_id ? issue_path(@next_issue_id) : nil),
18
                     :title => "##{@next_issue_id}" %>
19
    </div>
20
  <% end %>
21

  
22
  <%= avatar(@issue.author, :size => "50") %>
23

  
24
<div class="subject">
25
<%= render_issue_subject_with_tree(@issue) %>
26
</div>
27
        <p class="author">
28
        <%= authoring @issue.created_on, @issue.author %>.
29
        <% if @issue.created_on != @issue.updated_on %>
30
        <%= l(:label_updated_time, time_tag(@issue.updated_on)).html_safe %>.
31
        <% end %>
32
        </p>
33

  
34
<table class="attributes">
35
<%= issue_fields_rows do |rows|
36
  rows.left l(:field_status), h(@issue.status.name), :class => 'status'
37
  rows.left l(:field_priority), h(@issue.priority.name), :class => 'priority'
38

  
39
  unless @issue.disabled_core_fields.include?('assigned_to_id')
40
    rows.left l(:field_assigned_to), avatar(@issue.assigned_to, :size => "14").to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to'
41
  end
42
  unless @issue.disabled_core_fields.include?('category_id')
43
    rows.left l(:field_category), h(@issue.category ? @issue.category.name : "-"), :class => 'category'
44
  end
45
  unless @issue.disabled_core_fields.include?('fixed_version_id')
46
    rows.left l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version'
47
  end
48

  
49
  unless @issue.disabled_core_fields.include?('start_date')
50
    rows.right l(:field_start_date), format_date(@issue.start_date), :class => 'start-date'
51
  end
52
  unless @issue.disabled_core_fields.include?('due_date')
53
    rows.right l(:field_due_date), format_date(@issue.due_date), :class => 'due-date'
54
  end
55
  unless @issue.disabled_core_fields.include?('done_ratio')
56
    rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%"), :class => 'progress'
57
  end
58
  unless @issue.disabled_core_fields.include?('estimated_hours')
59
    unless @issue.estimated_hours.nil?
60
      rows.right l(:field_estimated_hours), l_hours(@issue.estimated_hours), :class => 'estimated-hours'
61
    end
62
  end
63
  if User.current.allowed_to?(:view_time_entries, @project)
64
    rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? (link_to l_hours(@issue.total_spent_hours), {:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}) : "-"), :class => 'spent-time'
65
  end
66
end %>
67
<%= render_custom_fields_rows(@issue) %>
68
<%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
69
</table>
70

  
71
<% if @issue.description? || @issue.attachments.any? -%>
72
<hr />
73
<% if @issue.description? %>
74
<div class="description">
75
  <div class="contextual">
76
  <%= link_to l(:button_quote),
77
              {:controller => 'journals', :action => 'new', :id => @issue},
78
              :remote => true,
79
              :method => 'post',
80
              :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
81
  </div>
82

  
83
  <p><strong><%=l(:field_description)%></strong></p>
84
  <div class="wiki">
85
  <%= textilizable @issue, :description, :attachments => @issue.attachments %>
86
  </div>
87
</div>
88
<% end %>
89
<%= link_to_attachments @issue, :thumbnails => true %>
90
<% end -%>
91

  
92
<%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
93

  
94
<% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %>
95
<hr />
96
<div id="issue_tree">
97
<div class="contextual">
98
  <%= link_to_new_subtask(@issue) if User.current.allowed_to?(:manage_subtasks, @project) %>
99
</div>
100
<p><strong><%=l(:label_subtask_plural)%></strong></p>
101
<%= render_descendants_tree(@issue) unless @issue.leaf? %>
102
</div>
103
<% end %>
104

  
105
<% if @relations.present? || User.current.allowed_to?(:manage_issue_relations, @project) %>
106
<hr />
107
<div id="relations">
108
<%= render :partial => 'relations' %>
109
</div>
110
<% end %>
111

  
112
</div>
113

  
114
<% if @changesets.present? %>
115
<div id="issue-changesets">
116
<h3><%=l(:label_associated_revisions)%></h3>
117
<%= render :partial => 'changesets', :locals => { :changesets => @changesets} %>
118
</div>
119
<% end %>
120

  
121
<% if @journals.present? %>
122
<div id="history">
123
<h3><%=l(:label_history)%></h3>
124
<%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %>
125
</div>
126
<% end %>
127

  
128

  
129
<div style="clear: both;"></div>
130
<%= render :partial => 'action_menu' %>
131

  
132
<div style="clear: both;"></div>
133
<% if authorize_for('issues', 'edit') %>
134
  <div id="update" style="display:none;">
135
  <h3><%= l(:button_update) %></h3>
136
  <%= render :partial => 'edit' %>
137
  </div>
138
<% end %>
139

  
140
<% other_formats_links do |f| %>
141
  <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
142
  <%= f.link_to 'PDF' %>
143
<% end %>
144

  
145
<% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
146

  
147
<% content_for :sidebar do %>
148
  <%= render :partial => 'issues/sidebar' %>
149

  
150
  <% if User.current.allowed_to?(:add_issue_watchers, @project) ||
151
    (@issue.watchers.present? && User.current.allowed_to?(:view_issue_watchers, @project)) %>
152
    <div id="watchers">
153
      <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %>
154
    </div>
155
  <% end %>
156
<% end %>
157

  
158
<% content_for :header_tags do %>
159
    <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %>
160
<% end %>
161

  
162
<%= context_menu issues_context_menu_path %>

Also available in: Unified diff