Project

General

Profile

Patch #2540 » pt-br_2286.patch

Patch for pt-br, rev 2286 - Alexandre da Silva, 2009-01-19 17:47

View differences:

app/helpers/issues_helper.rb (cópia de trabalho)
5 5
# modify it under the terms of the GNU General Public License
6 6
# as published by the Free Software Foundation; either version 2
7 7
# of the License, or (at your option) any later version.
8
# 
8
#
9 9
# This program is distributed in the hope that it will be useful,
10 10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 12
# GNU General Public License for more details.
13
# 
13
#
14 14
# You should have received a copy of the GNU General Public License
15 15
# along with this program; if not, write to the Free Software
16 16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
......
25 25
    @cached_label_due_date ||= l(:field_due_date)
26 26
    @cached_label_assigned_to ||= l(:field_assigned_to)
27 27
    @cached_label_priority ||= l(:field_priority)
28
    
28

  
29 29
    link_to_issue(issue) + ": #{h(issue.subject)}<br /><br />" +
30 30
      "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />" +
31 31
      "<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />" +
32 32
      "<strong>#{@cached_label_assigned_to}</strong>: #{issue.assigned_to}<br />" +
33 33
      "<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}"
34 34
  end
35
  
35

  
36 36
  # Returns a string of css classes that apply to the given issue
37 37
  def css_issue_classes(issue)
38 38
    s = "issue status-#{issue.status.position} priority-#{issue.priority.position}"
......
40 40
    s << ' overdue' if issue.overdue?
41 41
    s
42 42
  end
43
  
43

  
44 44
  def sidebar_queries
45 45
    unless @sidebar_queries
46 46
      # User can see public queries and his own queries
47 47
      visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (User.current.logged? ? User.current.id : 0)])
48 48
      # Project specific queries and global queries
49 49
      visible << (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
50
      @sidebar_queries = Query.find(:all, 
50
      @sidebar_queries = Query.find(:all,
51 51
                                    :order => "name ASC",
52 52
                                    :conditions => visible.conditions)
53 53
    end
......
57 57
  def show_detail(detail, no_html=false)
58 58
    case detail.property
59 59
    when 'attr'
60
      label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)   
60
      label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
61 61
      case detail.prop_key
62 62
      when 'due_date', 'start_date'
63 63
        value = format_date(detail.value.to_date) if detail.value
......
102 102
    label ||= detail.prop_key
103 103
    value ||= detail.value
104 104
    old_value ||= detail.old_value
105
    
105

  
106 106
    unless no_html
107 107
      label = content_tag('strong', label)
108 108
      old_value = content_tag("i", h(old_value)) if detail.old_value
......
114 114
        value = content_tag("i", h(value)) if value
115 115
      end
116 116
    end
117
    
117

  
118 118
    if !detail.value.blank?
119 119
      case detail.property
120 120
      when 'attr', 'cf'
......
135 135
      end
136 136
    end
137 137
  end
138
  
138

  
139 139
  def issues_to_csv(issues, project = nil)
140
    ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')    
140
    ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
141 141
    decimal_separator = l(:general_csv_decimal_separator)
142 142
    export = StringIO.new
143 143
    CSV::Writer.generate(export, l(:general_csv_separator)) do |csv|
144 144
      # csv header fields
145 145
      headers = [ "#",
146
                  l(:field_status), 
146
                  l(:field_status),
147 147
                  l(:field_project),
148 148
                  l(:field_tracker),
149 149
                  l(:field_priority),
......
169 169
      # csv lines
170 170
      issues.each do |issue|
171 171
        fields = [issue.id,
172
                  issue.status.name, 
172
                  issue.status.name,
173 173
                  issue.project.name,
174
                  issue.tracker.name, 
174
                  issue.tracker.name,
175 175
                  issue.priority.name,
176 176
                  issue.subject,
177 177
                  issue.assigned_to,
......
182 182
                  format_date(issue.due_date),
183 183
                  issue.done_ratio,
184 184
                  issue.estimated_hours.to_s.gsub('.', decimal_separator),
185
                  format_time(issue.created_on),  
185
                  format_time(issue.created_on),
186 186
                  format_time(issue.updated_on)
187 187
                  ]
188 188
        custom_fields.each {|f| fields << show_value(issue.custom_value_for(f)) }
app/helpers/application_helper.rb (cópia de trabalho)
106 106
    @time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format)
107 107
    include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format)
108 108
  end
109
  
109

  
110 110
  def format_activity_title(text)
111 111
    h(truncate_single_line(text, 100))
112 112
  end
113
  
113

  
114 114
  def format_activity_day(date)
115 115
    date == Date.today ? l(:label_today).titleize : format_date(date)
116 116
  end
117
  
117

  
118 118
  def format_activity_description(text)
119 119
    h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...'))
120 120
  end
......
147 147
    end
148 148
    content
149 149
  end
150
  
150

  
151 151
  # Renders flash messages
152 152
  def render_flash_messages
153 153
    s = ''
......
168 168

  
169 169
  def authoring(created, author, options={})
170 170
    time_tag = @project.nil? ? content_tag('acronym', distance_of_time_in_words(Time.now, created), :title => format_time(created)) :
171
                               link_to(distance_of_time_in_words(Time.now, created), 
171
                               link_to(distance_of_time_in_words(Time.now, created),
172 172
                                       {:controller => 'projects', :action => 'activity', :id => @project, :from => created.to_date},
173 173
                                       :title => format_time(created))
174 174
    author_tag = (author.is_a?(User) && !author.anonymous?) ? link_to(h(author), :controller => 'account', :action => 'show', :id => author) : h(author || 'Anonymous')
app/controllers/projects_controller.rb (cópia de trabalho)
5 5
# modify it under the terms of the GNU General Public License
6 6
# as published by the Free Software Foundation; either version 2
7 7
# of the License, or (at your option) any later version.
8
# 
8
#
9 9
# This program is distributed in the hope that it will be useful,
10 10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 12
# GNU General Public License for more details.
13
# 
13
#
14 14
# You should have received a copy of the GNU General Public License
15 15
# along with this program; if not, write to the Free Software
16 16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
......
22 22
  menu_item :files, :only => [:list_files, :add_file]
23 23
  menu_item :settings, :only => :settings
24 24
  menu_item :issues, :only => [:changelog]
25
  
25

  
26 26
  before_filter :find_project, :except => [ :index, :list, :add, :activity ]
27 27
  before_filter :find_optional_project, :only => :activity
28 28
  before_filter :authorize, :except => [ :index, :list, :add, :archive, :unarchive, :destroy, :activity ]
29 29
  before_filter :require_admin, :only => [ :add, :archive, :unarchive, :destroy ]
30 30
  accept_key_auth :activity
31
  
31

  
32 32
  helper :sort
33 33
  include SortHelper
34 34
  helper :custom_fields
35
  include CustomFieldsHelper   
35
  include CustomFieldsHelper
36 36
  helper :issues
37 37
  helper IssuesHelper
38 38
  helper :queries
......
40 40
  helper :repositories
41 41
  include RepositoriesHelper
42 42
  include ProjectsHelper
43
  
43

  
44 44
  # Lists visible projects
45 45
  def index
46 46
    projects = Project.find :all,
47 47
                            :conditions => Project.visible_by(User.current),
48 48
                            :include => :parent
49 49
    respond_to do |format|
50
      format.html { 
50
      format.html {
51 51
        @project_tree = projects.group_by {|p| p.parent || p}
52
        @project_tree.keys.each {|p| @project_tree[p] -= [p]} 
52
        @project_tree.keys.each {|p| @project_tree[p] -= [p]}
53 53
      }
54 54
      format.atom {
55
        render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i), 
55
        render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i),
56 56
                                  :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
57 57
      }
58 58
    end
59 59
  end
60
  
60

  
61 61
  # Add a new project
62 62
  def add
63 63
    @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
......
76 76
      if @project.save
77 77
        flash[:notice] = l(:notice_successful_create)
78 78
        redirect_to :controller => 'admin', :action => 'projects'
79
	  end		
80
    end	
79
	  end
80
    end
81 81
  end
82
	
82

  
83 83
  # Show @project
84 84
  def show
85 85
    if params[:jump]
86 86
      # try to redirect to the requested menu item
87 87
      redirect_to_project_menu_item(@project, params[:jump]) && return
88 88
    end
89
    
89

  
90 90
    @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
91 91
    @subprojects = @project.children.find(:all, :conditions => Project.visible_by(User.current))
92 92
    @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
93 93
    @trackers = @project.rolled_up_trackers
94
    
94

  
95 95
    cond = @project.project_condition(Setting.display_subprojects_issues?)
96 96
    Issue.visible_by(User.current) do
97 97
      @open_issues_by_tracker = Issue.count(:group => :tracker,
......
102 102
                                            :conditions => cond)
103 103
    end
104 104
    TimeEntry.visible_by(User.current) do
105
      @total_hours = TimeEntry.sum(:hours, 
105
      @total_hours = TimeEntry.sum(:hours,
106 106
                                   :include => :project,
107 107
                                   :conditions => cond).to_f
108 108
    end
......
120 120
    @repository ||= @project.repository
121 121
    @wiki ||= @project.wiki
122 122
  end
123
  
123

  
124 124
  # Edit @project
125 125
  def edit
126 126
    if request.post?
......
134 134
      end
135 135
    end
136 136
  end
137
  
137

  
138 138
  def modules
139 139
    @project.enabled_module_names = params[:enabled_modules]
140 140
    redirect_to :action => 'settings', :id => @project, :tab => 'modules'
......
144 144
    @project.archive if request.post? && @project.active?
145 145
    redirect_to :controller => 'admin', :action => 'projects'
146 146
  end
147
  
147

  
148 148
  def unarchive
149 149
    @project.unarchive if request.post? && !@project.active?
150 150
    redirect_to :controller => 'admin', :action => 'projects'
151 151
  end
152
  
152

  
153 153
  # Delete @project
154 154
  def destroy
155 155
    @project_to_destroy = @project
......
160 160
    # hide project in layout
161 161
    @project = nil
162 162
  end
163
	
163

  
164 164
  # Add a new issue category to @project
165 165
  def add_issue_category
166 166
    @category = @project.issue_categories.build(params[:category])
......
179 179
      end
180 180
    end
181 181
  end
182
	
182

  
183 183
  # Add a new version to @project
184 184
  def add_version
185 185
  	@version = @project.versions.build(params[:version])
......
201 201
    end
202 202
    @versions = @project.versions.sort
203 203
  end
204
  
204

  
205 205
  def list_files
206 206
    sort_init 'filename', 'asc'
207 207
    sort_update 'filename' => "#{Attachment.table_name}.filename",
208 208
                'created_on' => "#{Attachment.table_name}.created_on",
209 209
                'size' => "#{Attachment.table_name}.filesize",
210 210
                'downloads' => "#{Attachment.table_name}.downloads"
211
                
211

  
212 212
    @containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)]
213 213
    @containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
214 214
    render :layout => !request.xhr?
215 215
  end
216
  
216

  
217 217
  # Show changelog for @project
218 218
  def changelog
219 219
    @trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
220
    retrieve_selected_tracker_ids(@trackers)    
220
    retrieve_selected_tracker_ids(@trackers)
221 221
    @versions = @project.versions.sort
222 222
  end
223 223

  
......
227 227
    @versions = @project.versions.sort
228 228
    @versions = @versions.select {|v| !v.completed? } unless params[:completed]
229 229
  end
230
  
230

  
231 231
  def activity
232 232
    @days = Setting.activity_days_default.to_i
233
    
233

  
234 234
    if params[:from]
235 235
      begin; @date_to = params[:from].to_date + 1; rescue; end
236 236
    end
......
239 239
    @date_from = @date_to - @days
240 240
    @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
241 241
    @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
242
    
243
    @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, 
242

  
243
    @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
244 244
                                                             :with_subprojects => @with_subprojects,
245 245
                                                             :author => @author)
246 246
    @activity.scope_select {|t| !params["show_#{t}"].nil?}
247 247
    @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
248 248

  
249 249
    events = @activity.events(@date_from, @date_to)
250
    
250

  
251 251
    respond_to do |format|
252
      format.html { 
252
      format.html {
253 253
        @events_by_day = events.group_by(&:event_date)
254 254
        render :layout => false if request.xhr?
255 255
      }
......
263 263
        render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
264 264
      }
265 265
    end
266
    
266

  
267 267
  rescue ActiveRecord::RecordNotFound
268 268
    render_404
269 269
  end
270
  
270

  
271 271
private
272 272
  # Find project of id params[:id]
273 273
  # if not found, redirect to project list
......
277 277
  rescue ActiveRecord::RecordNotFound
278 278
    render_404
279 279
  end
280
  
280

  
281 281
  def find_optional_project
282 282
    return true unless params[:id]
283 283
    @project = Project.find(params[:id])
app/controllers/issue_categories_controller.rb (cópia de trabalho)
5 5
# modify it under the terms of the GNU General Public License
6 6
# as published by the Free Software Foundation; either version 2
7 7
# of the License, or (at your option) any later version.
8
# 
8
#
9 9
# This program is distributed in the hope that it will be useful,
10 10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 12
# GNU General Public License for more details.
13
# 
13
#
14 14
# You should have received a copy of the GNU General Public License
15 15
# along with this program; if not, write to the Free Software
16 16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
......
18 18
class IssueCategoriesController < ApplicationController
19 19
  menu_item :settings
20 20
  before_filter :find_project, :authorize
21
  
21

  
22 22
  verify :method => :post, :only => :destroy
23 23

  
24 24
  def edit
......
48 48
    @project = @category.project
49 49
  rescue ActiveRecord::RecordNotFound
50 50
    render_404
51
  end    
51
  end
52 52
end
lang/pt-br.yml (cópia de trabalho)
699 699
setting_diff_max_lines_displayed: Número máximo de linhas exibidas no diff
700 700
text_plugin_assets_writable: Diretório de plugins gravável
701 701
warning_attachments_not_saved: "%d arquivo(s) não puderam ser salvo(s)."
702
button_create_and_continue: Create and continue
703
text_custom_field_possible_values_info: 'One line for each value'
704
label_display: Display
705
field_editable: Editable
702
button_create_and_continue: Criar e continuar
703
text_custom_field_possible_values_info: 'Uma linha para cada valor'
704
label_display: Exibição
705
field_editable: Editável
    (1-1/1)