Revision 1297:0a574315af3e .svn/pristine/6b

View differences:

.svn/pristine/6b/6b0540330b916387a1d60cb84e4a37702409f61c.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
module Redmine
19
  module SyntaxHighlighting
20

  
21
    class << self
22
      attr_reader :highlighter
23
      delegate :highlight_by_filename, :highlight_by_language, :to => :highlighter
24

  
25
      def highlighter=(name)
26
        if name.is_a?(Module)
27
          @highlighter = name
28
        else
29
          @highlighter = const_get(name)
30
        end
31
      end
32
    end
33

  
34
    module CodeRay
35
      require 'coderay'
36
      require 'coderay/helpers/file_type'
37

  
38
      class << self
39
        # Highlights +text+ as the content of +filename+
40
        # Should not return line numbers nor outer pre tag
41
        def highlight_by_filename(text, filename)
42
          language = ::CodeRay::FileType[filename]
43
          language ? ::CodeRay.scan(text, language).html(:break_lines => true) : ERB::Util.h(text)
44
        end
45

  
46
        # Highlights +text+ using +language+ syntax
47
        # Should not return outer pre tag
48
        def highlight_by_language(text, language)
49
          ::CodeRay.scan(text, language).html(:wrap => :span)
50
        end
51
      end
52
    end
53
  end
54

  
55
  SyntaxHighlighting.highlighter = 'CodeRay'
56
end
.svn/pristine/6b/6b05bd90222f8c22a322a8c66db8a262d861c973.svn-base
1
/* Greek (el) initialisation for the jQuery UI date picker plugin. */
2
/* Written by Alex Cicovic (http://www.alexcicovic.com) */
3
jQuery(function($){
4
	$.datepicker.regional['el'] = {
5
		closeText: 'Κλείσιμο',
6
		prevText: 'Προηγούμενος',
7
		nextText: 'Επόμενος',
8
		currentText: 'Τρέχων Μήνας',
9
		monthNames: ['Ιανουάριος','Φεβρουάριος','Μάρτιος','Απρίλιος','Μάιος','Ιούνιος',
10
		'Ιούλιος','Αύγουστος','Σεπτέμβριος','Οκτώβριος','Νοέμβριος','Δεκέμβριος'],
11
		monthNamesShort: ['Ιαν','Φεβ','Μαρ','Απρ','Μαι','Ιουν',
12
		'Ιουλ','Αυγ','Σεπ','Οκτ','Νοε','Δεκ'],
13
		dayNames: ['Κυριακή','Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο'],
14
		dayNamesShort: ['Κυρ','Δευ','Τρι','Τετ','Πεμ','Παρ','Σαβ'],
15
		dayNamesMin: ['Κυ','Δε','Τρ','Τε','Πε','Πα','Σα'],
16
		weekHeader: 'Εβδ',
17
		dateFormat: 'dd/mm/yy',
18
		firstDay: 1,
19
		isRTL: false,
20
		showMonthAfterYear: false,
21
		yearSuffix: ''};
22
	$.datepicker.setDefaults($.datepicker.regional['el']);
23
});
.svn/pristine/6b/6b1106e1c6126179b03f085b5f53f6f2a31a52ef.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 NewsObserver < ActiveRecord::Observer
19
  def after_create(news)
20
    Mailer.news_added(news).deliver if Setting.notified_events.include?('news_added')
21
  end
22
end
.svn/pristine/6b/6b45dce23ff2dc83015e691c7398ac2bde7c8b86.svn-base
1
--- 
2
repositories_001: 
3
  project_id: 1
4
  url: file:///<%= Rails.root %>/tmp/test/subversion_repository
5
  id: 10
6
  root_url: file:///<%= Rails.root %>/tmp/test/subversion_repository
7
  password: ""
8
  login: ""
9
  type: Repository::Subversion
10
  is_default: true
11
repositories_002: 
12
  project_id: 2
13
  url: svn://localhost/test
14
  id: 11
15
  root_url: svn://localhost
16
  password: ""
17
  login: ""
18
  type: Repository::Subversion
19
  is_default: true
.svn/pristine/6b/6bbc4467d82e17475aa84af06e177a795c79d571.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 RoutingWikisTest < ActionController::IntegrationTest
21
  def test_wikis_plural_admin_setup
22
    ["get", "post"].each do |method|
23
      assert_routing(
24
          { :method => method, :path => "/projects/ladida/wiki/destroy" },
25
          { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
26
        )
27
    end
28
    assert_routing(
29
        { :method => 'post', :path => "/projects/ladida/wiki" },
30
        { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
31
      )
32
  end
33
end
.svn/pristine/6b/6be367ffa5b0225556429e9b82a2377cddc858d6.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 'my_controller'
20

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

  
24
class MyControllerTest < ActionController::TestCase
25
  fixtures :users, :user_preferences, :roles, :projects, :members, :member_roles,
26
  :issues, :issue_statuses, :trackers, :enumerations, :custom_fields, :auth_sources
27

  
28
  def setup
29
    @controller = MyController.new
30
    @request    = ActionController::TestRequest.new
31
    @request.session[:user_id] = 2
32
    @response   = ActionController::TestResponse.new
33
  end
34

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

  
41
  def test_page
42
    get :page
43
    assert_response :success
44
    assert_template 'page'
45
  end
46

  
47
  def test_page_with_timelog_block
48
    preferences = User.find(2).pref
49
    preferences[:my_page_layout] = {'top' => ['timelog']}
50
    preferences.save!
51
    TimeEntry.create!(:user => User.find(2), :spent_on => Date.yesterday, :issue_id => 1, :hours => 2.5, :activity_id => 10)
52

  
53
    get :page
54
    assert_response :success
55
    assert_select 'tr.time-entry' do
56
      assert_select 'td.subject a[href=/issues/1]'
57
      assert_select 'td.hours', :text => '2.50'
58
    end
59
  end
60

  
61
  def test_my_account_should_show_editable_custom_fields
62
    get :account
63
    assert_response :success
64
    assert_template 'account'
65
    assert_equal User.find(2), assigns(:user)
66

  
67
    assert_tag :input, :attributes => { :name => 'user[custom_field_values][4]'}
68
  end
69

  
70
  def test_my_account_should_not_show_non_editable_custom_fields
71
    UserCustomField.find(4).update_attribute :editable, false
72

  
73
    get :account
74
    assert_response :success
75
    assert_template 'account'
76
    assert_equal User.find(2), assigns(:user)
77

  
78
    assert_no_tag :input, :attributes => { :name => 'user[custom_field_values][4]'}
79
  end
80

  
81
  def test_update_account
82
    post :account,
83
      :user => {
84
        :firstname => "Joe",
85
        :login => "root",
86
        :admin => 1,
87
        :group_ids => ['10'],
88
        :custom_field_values => {"4" => "0100562500"}
89
      }
90

  
91
    assert_redirected_to '/my/account'
92
    user = User.find(2)
93
    assert_equal user, assigns(:user)
94
    assert_equal "Joe", user.firstname
95
    assert_equal "jsmith", user.login
96
    assert_equal "0100562500", user.custom_value_for(4).value
97
    # ignored
98
    assert !user.admin?
99
    assert user.groups.empty?
100
  end
101

  
102
  def test_my_account_should_show_destroy_link
103
    get :account
104
    assert_select 'a[href=/my/account/destroy]'
105
  end
106

  
107
  def test_get_destroy_should_display_the_destroy_confirmation
108
    get :destroy
109
    assert_response :success
110
    assert_template 'destroy'
111
    assert_select 'form[action=/my/account/destroy]' do
112
      assert_select 'input[name=confirm]'
113
    end
114
  end
115

  
116
  def test_post_destroy_without_confirmation_should_not_destroy_account
117
    assert_no_difference 'User.count' do
118
      post :destroy
119
    end
120
    assert_response :success
121
    assert_template 'destroy'
122
  end
123

  
124
  def test_post_destroy_without_confirmation_should_destroy_account
125
    assert_difference 'User.count', -1 do
126
      post :destroy, :confirm => '1'
127
    end
128
    assert_redirected_to '/'
129
    assert_match /deleted/i, flash[:notice]
130
  end
131

  
132
  def test_post_destroy_with_unsubscribe_not_allowed_should_not_destroy_account
133
    User.any_instance.stubs(:own_account_deletable?).returns(false)
134

  
135
    assert_no_difference 'User.count' do
136
      post :destroy, :confirm => '1'
137
    end
138
    assert_redirected_to '/my/account'
139
  end
140

  
141
  def test_change_password
142
    get :password
143
    assert_response :success
144
    assert_template 'password'
145

  
146
    # non matching password confirmation
147
    post :password, :password => 'jsmith',
148
                    :new_password => 'secret123',
149
                    :new_password_confirmation => 'secret1234'
150
    assert_response :success
151
    assert_template 'password'
152
    assert_error_tag :content => /Password doesn&#x27;t match confirmation/
153

  
154
    # wrong password
155
    post :password, :password => 'wrongpassword',
156
                    :new_password => 'secret123',
157
                    :new_password_confirmation => 'secret123'
158
    assert_response :success
159
    assert_template 'password'
160
    assert_equal 'Wrong password', flash[:error]
161

  
162
    # good password
163
    post :password, :password => 'jsmith',
164
                    :new_password => 'secret123',
165
                    :new_password_confirmation => 'secret123'
166
    assert_redirected_to '/my/account'
167
    assert User.try_to_login('jsmith', 'secret123')
168
  end
169

  
170
  def test_change_password_should_redirect_if_user_cannot_change_its_password
171
    User.find(2).update_attribute(:auth_source_id, 1)
172

  
173
    get :password
174
    assert_not_nil flash[:error]
175
    assert_redirected_to '/my/account'
176
  end
177

  
178
  def test_page_layout
179
    get :page_layout
180
    assert_response :success
181
    assert_template 'page_layout'
182
  end
183

  
184
  def test_add_block
185
    post :add_block, :block => 'issuesreportedbyme'
186
    assert_redirected_to '/my/page_layout'
187
    assert User.find(2).pref[:my_page_layout]['top'].include?('issuesreportedbyme')
188
  end
189

  
190
  def test_remove_block
191
    post :remove_block, :block => 'issuesassignedtome'
192
    assert_redirected_to '/my/page_layout'
193
    assert !User.find(2).pref[:my_page_layout].values.flatten.include?('issuesassignedtome')
194
  end
195

  
196
  def test_order_blocks
197
    xhr :post, :order_blocks, :group => 'left', 'blocks' => ['documents', 'calendar', 'latestnews']
198
    assert_response :success
199
    assert_equal ['documents', 'calendar', 'latestnews'], User.find(2).pref[:my_page_layout]['left']
200
  end
201

  
202
  def test_reset_rss_key_with_existing_key
203
    @previous_token_value = User.find(2).rss_key # Will generate one if it's missing
204
    post :reset_rss_key
205

  
206
    assert_not_equal @previous_token_value, User.find(2).rss_key
207
    assert User.find(2).rss_token
208
    assert_match /reset/, flash[:notice]
209
    assert_redirected_to '/my/account'
210
  end
211

  
212
  def test_reset_rss_key_without_existing_key
213
    assert_nil User.find(2).rss_token
214
    post :reset_rss_key
215

  
216
    assert User.find(2).rss_token
217
    assert_match /reset/, flash[:notice]
218
    assert_redirected_to '/my/account'
219
  end
220

  
221
  def test_reset_api_key_with_existing_key
222
    @previous_token_value = User.find(2).api_key # Will generate one if it's missing
223
    post :reset_api_key
224

  
225
    assert_not_equal @previous_token_value, User.find(2).api_key
226
    assert User.find(2).api_token
227
    assert_match /reset/, flash[:notice]
228
    assert_redirected_to '/my/account'
229
  end
230

  
231
  def test_reset_api_key_without_existing_key
232
    assert_nil User.find(2).api_token
233
    post :reset_api_key
234

  
235
    assert User.find(2).api_token
236
    assert_match /reset/, flash[:notice]
237
    assert_redirected_to '/my/account'
238
  end
239
end
.svn/pristine/6b/6be65077afa803bdec605ecec12428554273b481.svn-base
1
<div class="contextual">
2
<%= link_to l(:label_tracker_new), new_tracker_path, :class => 'icon icon-add' %>
3
<%= link_to l(:field_summary), {:action => 'fields'}, :class => 'icon icon-summary' %>
4
</div>
5

  
6
<h2><%=l(:label_tracker_plural)%></h2>
7

  
8
<table class="list">
9
  <thead><tr>
10
  <th><%=l(:label_tracker)%></th>
11
  <th></th>
12
  <th><%=l(:button_sort)%></th>
13
  <th></th>
14
  </tr></thead>
15
  <tbody>
16
<% for tracker in @trackers %>
17
  <tr class="<%= cycle("odd", "even") %>">
18
  <td><%= link_to h(tracker.name), edit_tracker_path(tracker) %></td>
19
  <td align="center"><% unless tracker.workflow_rules.count > 0 %><span class="icon icon-warning"><%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), {:controller => 'workflows', :action => 'edit', :tracker_id => tracker} %>)</span><% end %></td>
20
  <td align="center" style="width:15%;"><%= reorder_links('tracker', {:action => 'update', :id => tracker}, :put) %></td>
21
  <td class="buttons">
22
    <%= delete_link tracker_path(tracker) %>
23
  </td>
24
  </tr>
25
<% end %>
26
  </tbody>
27
</table>
28

  
29
<p class="pagination"><%= pagination_links_full @tracker_pages %></p>
30

  
31
<% html_title(l(:label_tracker_plural)) -%>

Also available in: Unified diff