1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-03-10 19:23:06 +00:00

Merge branch 'master' of git://github.com/edavis10/redmine

This commit is contained in:
Holger Just 2010-09-20 17:32:07 +02:00
commit 5b52a06b89
57 changed files with 125 additions and 21 deletions

View File

@ -18,9 +18,9 @@
class NewsController < ApplicationController
default_search_scope :news
model_object News
before_filter :find_model_object, :except => [:new, :index, :preview]
before_filter :find_project_from_association, :except => [:new, :index, :preview]
before_filter :find_project, :only => [:new, :preview]
before_filter :find_model_object, :except => [:new, :create, :index, :preview]
before_filter :find_project_from_association, :except => [:new, :create, :index, :preview]
before_filter :find_project, :only => [:new, :create, :preview]
before_filter :authorize, :except => [:index, :preview]
before_filter :find_optional_project, :only => :index
accept_key_auth :index
@ -46,11 +46,17 @@ class NewsController < ApplicationController
def new
@news = News.new(:project => @project, :author => User.current)
end
def create
@news = News.new(:project => @project, :author => User.current)
if request.post?
@news.attributes = params[:news]
if @news.save
flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'news', :action => 'index', :project_id => @project
else
render :action => 'new'
end
end
end

View File

@ -829,7 +829,7 @@ module ApplicationHelper
# +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>')
def avatar(user, options = { })
if Setting.gravatar_enabled?
options.merge!({:ssl => Setting.protocol == 'https', :default => Setting.gravatar_default})
options.merge!({:ssl => (defined?(request) && request.ssl?), :default => Setting.gravatar_default})
email = nil
if user.respond_to?(:mail)
email = user.mail

View File

@ -382,6 +382,11 @@ class Issue < ActiveRecord::Base
done_date = start_date + ((due_date - start_date+1)* done_ratio/100).floor
return done_date <= Date.today
end
# Does this issue have children?
def children?
!leaf?
end
# Users the issue can be assigned to
def assignable_users

View File

@ -6,5 +6,5 @@
<%= link_to_if_authorized l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue }, :class => 'icon icon-duplicate' %>
<%= link_to_if_authorized l(:button_copy), new_issue_move_path(:id => @issue, :copy_options => {:copy => 't'}), :class => 'icon icon-copy' %>
<%= link_to_if_authorized l(:button_move), new_issue_move_path(:id => @issue), :class => 'icon icon-move' %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => (@issue.leaf? ? l(:text_are_you_sure) : l(:text_are_you_sure_with_children)), :method => :post, :class => 'icon icon-del' %>
</div>

View File

@ -12,3 +12,7 @@
}, :accesskey => accesskey(:preview) %>
<% end %>
<div id="preview" class="wiki"></div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>

View File

@ -7,7 +7,7 @@
<div id="add-news" style="display:none;">
<h2><%=l(:label_news_new)%></h2>
<% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'new', :project_id => @project },
<% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'create', :project_id => @project },
:html => { :id => 'news-form' } do |f| %>
<%= render :partial => 'news/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create) %>
@ -45,6 +45,7 @@
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title(l(:label_news_plural)) -%>

View File

@ -1,6 +1,6 @@
<h2><%=l(:label_news_new)%></h2>
<% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'new', :project_id => @project },
<% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'create', :project_id => @project },
:html => { :id => 'news-form' } do |f| %>
<%= render :partial => 'news/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create) %>

View File

@ -1,5 +1,6 @@
<div class="contextual">
<%= link_to_if_authorized l(:button_edit), {:controller => 'versions', :action => 'edit', :id => @version}, :class => 'icon icon-edit' %>
<%= link_to_if_authorized(l(:button_edit_associated_wikipage, :page_title => @version.wiki_page_title), {:controller => 'wiki', :action => 'edit', :page => Wiki.titleize(@version.wiki_page_title)}, :class => 'icon icon-edit') unless @version.wiki_page_title.blank? || @project.wiki.nil? %>
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
</div>

View File

@ -909,3 +909,5 @@ bg:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -929,3 +929,5 @@ bs:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -918,3 +918,5 @@ ca:
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -915,3 +915,5 @@ cs:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -931,3 +931,5 @@ da:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -803,6 +803,7 @@ de:
button_create_and_continue: Anlegen + nächstes Ticket
button_test: Testen
button_edit: Bearbeiten
button_edit_associated_wikipage: "Zugehörige Wikiseite bearbeiten: {{page_title}}"
button_add: Hinzufügen
button_change: Wechseln
button_apply: Anwenden
@ -934,3 +935,4 @@ de:
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -915,3 +915,5 @@ el:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -919,3 +919,5 @@ en-GB:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -786,6 +786,7 @@ en:
button_create_and_continue: Create and continue
button_test: Test
button_edit: Edit
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
button_add: Add
button_change: Change
button_apply: Apply
@ -837,6 +838,7 @@ en:
text_subprojects_destroy_warning: "Its subproject(s): {{value}} will be also deleted."
text_workflow_edit: Select a role and a tracker to edit the workflow
text_are_you_sure: Are you sure ?
text_are_you_sure_with_children: "Delete issue and all child issues?"
text_journal_changed: "{{label}} changed from {{old}} to {{new}}"
text_journal_set_to: "{{label}} set to {{value}}"
text_journal_deleted: "{{label}} deleted ({{old}})"

View File

@ -955,3 +955,5 @@ es:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -919,3 +919,5 @@ eu:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -940,3 +940,5 @@ fi:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -933,3 +933,5 @@ fr:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Modifier la page de Wiki associée: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -931,3 +931,5 @@ gl:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -920,3 +920,5 @@ he:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -922,3 +922,5 @@ hr:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -938,3 +938,5 @@
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -923,3 +923,5 @@ id:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -919,3 +919,5 @@ it:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -940,3 +940,5 @@ ja:
enumeration_doc_categories: 文書カテゴリ
enumeration_activities: 作業分類 (時間トラッキング)
enumeration_system_activity: システム作業分類
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -971,3 +971,5 @@ ko:
project_module_calendar: 달력
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -979,3 +979,5 @@ lt:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -910,3 +910,5 @@ lv:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -915,3 +915,5 @@ mk:
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -916,3 +916,5 @@ mn:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -897,3 +897,5 @@ nl:
project_module_calendar: Kalender
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -906,3 +906,5 @@
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -936,3 +936,5 @@ pl:
project_module_calendar: Kalendarz
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -939,3 +939,5 @@ pt-BR:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -923,3 +923,5 @@ pt:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -908,3 +908,5 @@ ro:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -230,6 +230,7 @@ ru:
button_delete: Удалить
button_download: Загрузить
button_edit: Редактировать
button_edit_associated_wikipage: "Редактировать связанную wiki-страницу: {{page_title}}"
button_list: Список
button_lock: Заблокировать
button_login: Вход
@ -1032,3 +1033,4 @@ ru:
notice_unable_delete_time_entry: Невозможно удалить запись журнала.
label_overall_spent_time: Всего затрачено времени
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -910,3 +910,5 @@ sk:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -911,3 +911,5 @@ sl:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -915,3 +915,5 @@ sr-YU:
project_module_calendar: Kalendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -916,3 +916,5 @@ sr:
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -960,3 +960,5 @@ sv:
enumeration_system_activity: Systemaktivitet
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -912,3 +912,5 @@ th:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -938,3 +938,5 @@ tr:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -911,3 +911,5 @@ uk:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -970,3 +970,5 @@ vi:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -366,6 +366,7 @@
field_redirect_existing_links: 重新導向現有連結
field_estimated_hours: 預估工時
field_column_names: 欄位
field_time_entries: 耗用工時
field_time_zone: 時區
field_searchable: 可用做搜尋條件
field_default_value: 預設值
@ -378,8 +379,9 @@
field_group_by: 結果分組方式
field_sharing: 共用
field_parent_issue: 父工作項目
field_time_entries: 耗用工時
field_member_of_group: 所屬群組
field_assigned_to_role: 所屬角色
setting_app_title: 標題
setting_app_subtitle: 副標題
setting_welcome_text: 歡迎詞
@ -870,6 +872,7 @@
button_create_and_continue: 繼續建立
button_test: 測試
button_edit: 編輯
button_edit_associated_wikipage: "編輯相關 Wiki 頁面: {{page_title}}"
button_add: 新增
button_change: 修改
button_apply: 套用
@ -998,5 +1001,5 @@
enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (時間追蹤)
enumeration_system_activity: 系統活動
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -933,3 +933,5 @@ zh:
project_module_calendar: Calendar
field_member_of_group: Member of Group
field_assigned_to_role: Member of Role
button_edit_associated_wikipage: "Edit associated Wiki page: {{page_title}}"
text_are_you_sure_with_children: Delete issue and all child issues?

View File

@ -148,7 +148,7 @@ ActionController::Routing::Routes.draw do |map|
news_views.connect 'news/:id/edit', :action => 'edit'
end
news_routes.with_options do |news_actions|
news_actions.connect 'projects/:project_id/news', :action => 'new'
news_actions.connect 'projects/:project_id/news', :action => 'create', :conditions => {:method => :post}
news_actions.connect 'news/:id/edit', :action => 'edit'
news_actions.connect 'news/:id/destroy', :action => 'destroy'
end

View File

@ -91,7 +91,7 @@ Redmine::AccessControl.map do |map|
end
map.project_module :news do |map|
map.permission :manage_news, {:news => [:new, :edit, :destroy, :destroy_comment]}, :require => :member
map.permission :manage_news, {:news => [:new, :create, :edit, :destroy, :destroy_comment]}, :require => :member
map.permission :view_news, {:news => [:index, :show]}, :public => true
map.permission :comment_news, {:news => :add_comment}
end

View File

@ -154,7 +154,7 @@ module Redmine
if query.grouped? && (group = query.group_by_column.value(issue)) != previous_group
pdf.SetFontStyle('B',9)
pdf.Cell(277, row_height,
(group.blank? ? 'None' : group.to_s) + " (#{@issue_count_by_group[group]})",
(group.blank? ? 'None' : group.to_s) + " (#{query.issue_count_by_group[group]})",
1, 1, 'L')
pdf.SetFontStyle('',8)
previous_group = group
@ -255,7 +255,7 @@ module Redmine
pdf.SetFontStyle('B',9)
pdf.Cell(35,5, l(:field_description) + ":")
pdf.SetFontStyle('',9)
pdf.MultiCell(155,5, @issue.description,"BR")
pdf.MultiCell(155,5, issue.description,"BR")
pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY)
pdf.Line(pdf.GetX, pdf.GetY, 170, pdf.GetY)

View File

@ -65,12 +65,12 @@ class NewsControllerTest < ActionController::TestCase
assert_template 'new'
end
def test_post_new
def test_post_create
ActionMailer::Base.deliveries.clear
Setting.notified_events << 'news_added'
@request.session[:user_id] = 2
post :new, :project_id => 1, :news => { :title => 'NewsControllerTest',
post :create, :project_id => 1, :news => { :title => 'NewsControllerTest',
:description => 'This is the description',
:summary => '' }
assert_redirected_to 'projects/ecookbook/news'
@ -98,9 +98,9 @@ class NewsControllerTest < ActionController::TestCase
assert_equal 'Description changed by test_post_edit', news.description
end
def test_post_new_with_validation_failure
def test_post_create_with_validation_failure
@request.session[:user_id] = 2
post :new, :project_id => 1, :news => { :title => '',
post :create, :project_id => 1, :news => { :title => '',
:description => 'This is the description',
:summary => '' }
assert_response :success

View File

@ -157,7 +157,7 @@ class RoutingTest < ActionController::IntegrationTest
should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
should_route :post, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
should_route :post, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
should_route :post, "/news/567/destroy", :controller => 'news', :action => 'destroy', :id => '567'
end

View File

@ -400,7 +400,7 @@ class QueryTest < ActiveSupport::TestCase
[group1.name, group1.id],
[group2.name, group2.id]
]
assert_equal expected_group_list, @query.available_filters["member_of_group"][:values]
assert_equal expected_group_list.sort, @query.available_filters["member_of_group"][:values].sort
end
end