Patch #2540 » pt-br_2286.patch
| app/helpers/issues_helper.rb (cópia de trabalho) | ||
|---|---|---|
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
| ... | ... | |
|
@cached_label_due_date ||= l(:field_due_date)
|
||
|
@cached_label_assigned_to ||= l(:field_assigned_to)
|
||
|
@cached_label_priority ||= l(:field_priority)
|
||
|
|
||
|
link_to_issue(issue) + ": #{h(issue.subject)}<br /><br />" +
|
||
|
"<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />" +
|
||
|
"<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />" +
|
||
|
"<strong>#{@cached_label_assigned_to}</strong>: #{issue.assigned_to}<br />" +
|
||
|
"<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}"
|
||
|
end
|
||
|
|
||
|
# Returns a string of css classes that apply to the given issue
|
||
|
def css_issue_classes(issue)
|
||
|
s = "issue status-#{issue.status.position} priority-#{issue.priority.position}"
|
||
| ... | ... | |
|
s << ' overdue' if issue.overdue?
|
||
|
s
|
||
|
end
|
||
|
|
||
|
def sidebar_queries
|
||
|
unless @sidebar_queries
|
||
|
# User can see public queries and his own queries
|
||
|
visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (User.current.logged? ? User.current.id : 0)])
|
||
|
# Project specific queries and global queries
|
||
|
visible << (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
|
||
|
@sidebar_queries = Query.find(:all,
|
||
|
@sidebar_queries = Query.find(:all,
|
||
|
:order => "name ASC",
|
||
|
:conditions => visible.conditions)
|
||
|
end
|
||
| ... | ... | |
|
def show_detail(detail, no_html=false)
|
||
|
case detail.property
|
||
|
when 'attr'
|
||
|
label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
|
||
|
label = l(("field_" + detail.prop_key.to_s.gsub(/\_id$/, "")).to_sym)
|
||
|
case detail.prop_key
|
||
|
when 'due_date', 'start_date'
|
||
|
value = format_date(detail.value.to_date) if detail.value
|
||
| ... | ... | |
|
label ||= detail.prop_key
|
||
|
value ||= detail.value
|
||
|
old_value ||= detail.old_value
|
||
|
|
||
|
unless no_html
|
||
|
label = content_tag('strong', label)
|
||
|
old_value = content_tag("i", h(old_value)) if detail.old_value
|
||
| ... | ... | |
|
value = content_tag("i", h(value)) if value
|
||
|
end
|
||
|
end
|
||
|
|
||
|
if !detail.value.blank?
|
||
|
case detail.property
|
||
|
when 'attr', 'cf'
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def issues_to_csv(issues, project = nil)
|
||
|
ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
|
||
|
ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
|
||
|
decimal_separator = l(:general_csv_decimal_separator)
|
||
|
export = StringIO.new
|
||
|
CSV::Writer.generate(export, l(:general_csv_separator)) do |csv|
|
||
|
# csv header fields
|
||
|
headers = [ "#",
|
||
|
l(:field_status),
|
||
|
l(:field_status),
|
||
|
l(:field_project),
|
||
|
l(:field_tracker),
|
||
|
l(:field_priority),
|
||
| ... | ... | |
|
# csv lines
|
||
|
issues.each do |issue|
|
||
|
fields = [issue.id,
|
||
|
issue.status.name,
|
||
|
issue.status.name,
|
||
|
issue.project.name,
|
||
|
issue.tracker.name,
|
||
|
issue.tracker.name,
|
||
|
issue.priority.name,
|
||
|
issue.subject,
|
||
|
issue.assigned_to,
|
||
| ... | ... | |
|
format_date(issue.due_date),
|
||
|
issue.done_ratio,
|
||
|
issue.estimated_hours.to_s.gsub('.', decimal_separator),
|
||
|
format_time(issue.created_on),
|
||
|
format_time(issue.created_on),
|
||
|
format_time(issue.updated_on)
|
||
|
]
|
||
|
custom_fields.each {|f| fields << show_value(issue.custom_value_for(f)) }
|
||
| app/helpers/application_helper.rb (cópia de trabalho) | ||
|---|---|---|
|
@time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format)
|
||
|
include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format)
|
||
|
end
|
||
|
|
||
|
def format_activity_title(text)
|
||
|
h(truncate_single_line(text, 100))
|
||
|
end
|
||
|
|
||
|
def format_activity_day(date)
|
||
|
date == Date.today ? l(:label_today).titleize : format_date(date)
|
||
|
end
|
||
|
|
||
|
def format_activity_description(text)
|
||
|
h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...'))
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
content
|
||
|
end
|
||
|
|
||
|
# Renders flash messages
|
||
|
def render_flash_messages
|
||
|
s = ''
|
||
| ... | ... | |
|
def authoring(created, author, options={})
|
||
|
time_tag = @project.nil? ? content_tag('acronym', distance_of_time_in_words(Time.now, created), :title => format_time(created)) :
|
||
|
link_to(distance_of_time_in_words(Time.now, created),
|
||
|
link_to(distance_of_time_in_words(Time.now, created),
|
||
|
{:controller => 'projects', :action => 'activity', :id => @project, :from => created.to_date},
|
||
|
:title => format_time(created))
|
||
|
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) | ||
|---|---|---|
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
| ... | ... | |
|
menu_item :files, :only => [:list_files, :add_file]
|
||
|
menu_item :settings, :only => :settings
|
||
|
menu_item :issues, :only => [:changelog]
|
||
|
|
||
|
before_filter :find_project, :except => [ :index, :list, :add, :activity ]
|
||
|
before_filter :find_optional_project, :only => :activity
|
||
|
before_filter :authorize, :except => [ :index, :list, :add, :archive, :unarchive, :destroy, :activity ]
|
||
|
before_filter :require_admin, :only => [ :add, :archive, :unarchive, :destroy ]
|
||
|
accept_key_auth :activity
|
||
|
|
||
|
helper :sort
|
||
|
include SortHelper
|
||
|
helper :custom_fields
|
||
|
include CustomFieldsHelper
|
||
|
include CustomFieldsHelper
|
||
|
helper :issues
|
||
|
helper IssuesHelper
|
||
|
helper :queries
|
||
| ... | ... | |
|
helper :repositories
|
||
|
include RepositoriesHelper
|
||
|
include ProjectsHelper
|
||
|
|
||
|
# Lists visible projects
|
||
|
def index
|
||
|
projects = Project.find :all,
|
||
|
:conditions => Project.visible_by(User.current),
|
||
|
:include => :parent
|
||
|
respond_to do |format|
|
||
|
format.html {
|
||
|
format.html {
|
||
|
@project_tree = projects.group_by {|p| p.parent || p}
|
||
|
@project_tree.keys.each {|p| @project_tree[p] -= [p]}
|
||
|
@project_tree.keys.each {|p| @project_tree[p] -= [p]}
|
||
|
}
|
||
|
format.atom {
|
||
|
render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i),
|
||
|
render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i),
|
||
|
:title => "#{Setting.app_title}: #{l(:label_project_latest)}")
|
||
|
}
|
||
|
end
|
||
|
end
|
||
|
|
||
|
# Add a new project
|
||
|
def add
|
||
|
@issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
|
||
| ... | ... | |
|
if @project.save
|
||
|
flash[:notice] = l(:notice_successful_create)
|
||
|
redirect_to :controller => 'admin', :action => 'projects'
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
# Show @project
|
||
|
def show
|
||
|
if params[:jump]
|
||
|
# try to redirect to the requested menu item
|
||
|
redirect_to_project_menu_item(@project, params[:jump]) && return
|
||
|
end
|
||
|
|
||
|
@members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
|
||
|
@subprojects = @project.children.find(:all, :conditions => Project.visible_by(User.current))
|
||
|
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
||
|
@trackers = @project.rolled_up_trackers
|
||
|
|
||
|
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
||
|
Issue.visible_by(User.current) do
|
||
|
@open_issues_by_tracker = Issue.count(:group => :tracker,
|
||
| ... | ... | |
|
:conditions => cond)
|
||
|
end
|
||
|
TimeEntry.visible_by(User.current) do
|
||
|
@total_hours = TimeEntry.sum(:hours,
|
||
|
@total_hours = TimeEntry.sum(:hours,
|
||
|
:include => :project,
|
||
|
:conditions => cond).to_f
|
||
|
end
|
||
| ... | ... | |
|
@repository ||= @project.repository
|
||
|
@wiki ||= @project.wiki
|
||
|
end
|
||
|
|
||
|
# Edit @project
|
||
|
def edit
|
||
|
if request.post?
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def modules
|
||
|
@project.enabled_module_names = params[:enabled_modules]
|
||
|
redirect_to :action => 'settings', :id => @project, :tab => 'modules'
|
||
| ... | ... | |
|
@project.archive if request.post? && @project.active?
|
||
|
redirect_to :controller => 'admin', :action => 'projects'
|
||
|
end
|
||
|
|
||
|
def unarchive
|
||
|
@project.unarchive if request.post? && !@project.active?
|
||
|
redirect_to :controller => 'admin', :action => 'projects'
|
||
|
end
|
||
|
|
||
|
# Delete @project
|
||
|
def destroy
|
||
|
@project_to_destroy = @project
|
||
| ... | ... | |
|
# hide project in layout
|
||
|
@project = nil
|
||
|
end
|
||
|
|
||
|
# Add a new issue category to @project
|
||
|
def add_issue_category
|
||
|
@category = @project.issue_categories.build(params[:category])
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
# Add a new version to @project
|
||
|
def add_version
|
||
|
@version = @project.versions.build(params[:version])
|
||
| ... | ... | |
|
end
|
||
|
@versions = @project.versions.sort
|
||
|
end
|
||
|
|
||
|
def list_files
|
||
|
sort_init 'filename', 'asc'
|
||
|
sort_update 'filename' => "#{Attachment.table_name}.filename",
|
||
|
'created_on' => "#{Attachment.table_name}.created_on",
|
||
|
'size' => "#{Attachment.table_name}.filesize",
|
||
|
'downloads' => "#{Attachment.table_name}.downloads"
|
||
|
|
||
|
@containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)]
|
||
|
@containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
|
||
|
render :layout => !request.xhr?
|
||
|
end
|
||
|
|
||
|
# Show changelog for @project
|
||
|
def changelog
|
||
|
@trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
|
||
|
retrieve_selected_tracker_ids(@trackers)
|
||
|
retrieve_selected_tracker_ids(@trackers)
|
||
|
@versions = @project.versions.sort
|
||
|
end
|
||
| ... | ... | |
|
@versions = @project.versions.sort
|
||
|
@versions = @versions.select {|v| !v.completed? } unless params[:completed]
|
||
|
end
|
||
|
|
||
|
def activity
|
||
|
@days = Setting.activity_days_default.to_i
|
||
|
|
||
|
if params[:from]
|
||
|
begin; @date_to = params[:from].to_date + 1; rescue; end
|
||
|
end
|
||
| ... | ... | |
|
@date_from = @date_to - @days
|
||
|
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||
|
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
|
||
|
|
||
|
@activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
|
||
|
@activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
|
||
|
:with_subprojects => @with_subprojects,
|
||
|
:author => @author)
|
||
|
@activity.scope_select {|t| !params["show_#{t}"].nil?}
|
||
|
@activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
|
||
|
events = @activity.events(@date_from, @date_to)
|
||
|
|
||
|
respond_to do |format|
|
||
|
format.html {
|
||
|
format.html {
|
||
|
@events_by_day = events.group_by(&:event_date)
|
||
|
render :layout => false if request.xhr?
|
||
|
}
|
||
| ... | ... | |
|
render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
|
||
|
}
|
||
|
end
|
||
|
|
||
|
rescue ActiveRecord::RecordNotFound
|
||
|
render_404
|
||
|
end
|
||
|
|
||
|
private
|
||
|
# Find project of id params[:id]
|
||
|
# if not found, redirect to project list
|
||
| ... | ... | |
|
rescue ActiveRecord::RecordNotFound
|
||
|
render_404
|
||
|
end
|
||
|
|
||
|
def find_optional_project
|
||
|
return true unless params[:id]
|
||
|
@project = Project.find(params[:id])
|
||
| app/controllers/issue_categories_controller.rb (cópia de trabalho) | ||
|---|---|---|
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
| ... | ... | |
|
class IssueCategoriesController < ApplicationController
|
||
|
menu_item :settings
|
||
|
before_filter :find_project, :authorize
|
||
|
|
||
|
verify :method => :post, :only => :destroy
|
||
|
def edit
|
||
| ... | ... | |
|
@project = @category.project
|
||
|
rescue ActiveRecord::RecordNotFound
|
||
|
render_404
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| lang/pt-br.yml (cópia de trabalho) | ||
|---|---|---|
|
setting_diff_max_lines_displayed: Número máximo de linhas exibidas no diff
|
||
|
text_plugin_assets_writable: Diretório de plugins gravável
|
||
|
warning_attachments_not_saved: "%d arquivo(s) não puderam ser salvo(s)."
|
||
|
button_create_and_continue: Create and continue
|
||
|
text_custom_field_possible_values_info: 'One line for each value'
|
||
|
label_display: Display
|
||
|
field_editable: Editable
|
||
|
button_create_and_continue: Criar e continuar
|
||
|
text_custom_field_possible_values_info: 'Uma linha para cada valor'
|
||
|
label_display: Exibição
|
||
|
field_editable: Editável
|
||