Index: . =================================================================== --- . (revision 13451) +++ . (working copy) Property changes on: . ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r13284-13285,13287,13299,13303,13322-13327,13329-13331 Index: app/helpers/application_helper.rb =================================================================== --- app/helpers/application_helper.rb (revision 13451) +++ app/helpers/application_helper.rb (working copy) @@ -155,6 +155,13 @@ end end + # Generates a link to a version + def link_to_version(version, options = {}) + return '' unless version && version.is_a?(Version) + options = {:title => format_date(version.effective_date)}.merge(options) + link_to_if version.visible?, format_version_name(version), version_path(version), options + end + # Helper that formats object for html or text rendering def format_object(object, html=true, &block) if block_given? @@ -176,7 +183,7 @@ when 'Project' html ? link_to_project(object) : object.to_s when 'Version' - html ? link_to(object.name, version_path(object)) : object.to_s + html ? link_to_version(object) : object.to_s when 'TrueClass' l(:general_text_Yes) when 'FalseClass' @@ -238,7 +245,7 @@ end def format_version_name(version) - if version.project == @project + if !version.shared? || version.project == @project h(version) else h("#{version.project} - #{version}") Index: app/helpers/projects_helper.rb =================================================================== --- app/helpers/projects_helper.rb (revision 13451) +++ app/helpers/projects_helper.rb (working copy) @@ -18,11 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module ProjectsHelper - def link_to_version(version, options = {}) - return '' unless version && version.is_a?(Version) - link_to_if version.visible?, format_version_name(version), version_path(version), options - end - def project_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural}, {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural}, Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 13451) +++ app/models/issue.rb (working copy) @@ -1136,7 +1136,6 @@ def parent_issue_id=(arg) s = arg.to_s.strip.presence if s && (m = s.match(%r{\A#?(\d+)\z})) && (@parent_issue = Issue.find_by_id(m[1])) - @parent_issue.id @invalid_parent_issue_id = nil elsif s.blank? @parent_issue = nil Index: app/models/project.rb =================================================================== --- app/models/project.rb (revision 13451) +++ app/models/project.rb (working copy) @@ -969,10 +969,11 @@ def copy_queries(project) project.queries.each do |query| new_query = IssueQuery.new - new_query.attributes = query.attributes.dup.except("id", "project_id", "sort_criteria") + new_query.attributes = query.attributes.dup.except("id", "project_id", "sort_criteria", "user_id", "type") new_query.sort_criteria = query.sort_criteria if query.sort_criteria new_query.project = self new_query.user_id = query.user_id + new_query.role_ids = query.role_ids if query.visibility == IssueQuery::VISIBILITY_ROLES self.queries << new_query end end Index: app/models/user.rb =================================================================== --- app/models/user.rb (revision 13451) +++ app/models/user.rb (working copy) @@ -727,17 +727,17 @@ return if self.id.nil? substitute = User.anonymous - Attachment.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id]) + Attachment.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id]) Comment.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id]) Issue.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id]) Issue.where(['assigned_to_id = ?', id]).update_all('assigned_to_id = NULL') - Journal.where(['user_id = ?', id]).update_all(['user_id = ?', substitute.id]) + Journal.where(['user_id = ?', id]).update_all(['user_id = ?', substitute.id]) JournalDetail. where(["property = 'attr' AND prop_key = 'assigned_to_id' AND old_value = ?", id.to_s]). update_all(['old_value = ?', substitute.id.to_s]) JournalDetail. where(["property = 'attr' AND prop_key = 'assigned_to_id' AND value = ?", id.to_s]). - update_all(['value = ?', substitute.id.to_s]) + update_all(['value = ?', substitute.id.to_s]) Message.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id]) News.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id]) # Remove private queries and keep public ones Index: app/models/version.rb =================================================================== --- app/models/version.rb (revision 13451) +++ app/models/version.rb (working copy) @@ -233,6 +233,11 @@ end end + # Returns true if the version is shared, otherwise false + def shared? + sharing != 'none' + end + private def load_issue_counts Index: app/views/common/_tabs.html.erb =================================================================== --- app/views/common/_tabs.html.erb (revision 13451) +++ app/views/common/_tabs.html.erb (working copy) @@ -8,8 +8,8 @@ <% end -%> Index: config/initializers/30-redmine.rb =================================================================== --- config/initializers/30-redmine.rb (revision 13451) +++ config/initializers/30-redmine.rb (working copy) @@ -22,3 +22,9 @@ unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false Redmine::Plugin.mirror_assets end + +Rails.application.config.to_prepare do + Redmine::FieldFormat::RecordList.subclasses.each do |klass| + klass.instance.reset_target_class + end +end \ No newline at end of file Index: config/locales/bg.yml =================================================================== --- config/locales/bg.yml (revision 13451) +++ config/locales/bg.yml (working copy) @@ -914,6 +914,7 @@ label_only: само label_drop_down_list: drop-down списък label_checkboxes: чек-бокс + label_radio_buttons: радио-бутони label_link_values_to: URL (опция) label_custom_field_select_type: "Изберете тип на обект, към който потребителското поле да бъде асоциирано" label_check_for_updates: Проверка за нови версии @@ -1111,4 +1112,3 @@ description_date_from: Въведете начална дата description_date_to: Въведете крайна дата text_repository_identifier_info: 'Позволени са малки букви (a-z), цифри, тирета и _.
Промяна след създаването му не е възможна.' - label_radio_buttons: radio buttons Index: config/locales/de.yml =================================================================== --- config/locales/de.yml (revision 13451) +++ config/locales/de.yml (working copy) @@ -684,6 +684,7 @@ label_query: Benutzerdefinierte Abfrage label_query_new: Neue Abfrage label_query_plural: Benutzerdefinierte Abfragen + label_radio_buttons: Radio-Buttons label_read: Lesen... label_readonly: Nur-Lese-Zugriff label_register: Registrieren @@ -1124,6 +1125,5 @@ version_status_open: offen warning_attachments_not_saved: "%{count} Datei(en) konnten nicht gespeichert werden." - label_radio_buttons: radio buttons label_group_anonymous: Anonymous users label_group_non_member: Non member users Index: config/locales/ja.yml =================================================================== --- config/locales/ja.yml (revision 13451) +++ config/locales/ja.yml (working copy) @@ -249,8 +249,8 @@ field_is_for_all: 全プロジェクト向け field_possible_values: 選択肢 field_regexp: 正規表現 - field_min_length: 最小値 - field_max_length: 最大値 + field_min_length: 最短長 + field_max_length: 最大長 field_value: 値 field_category: カテゴリ field_title: タイトル @@ -305,7 +305,7 @@ field_activity: 活動 field_spent_on: 日付 field_identifier: 識別子 - field_is_filter: フィルタとして使う + field_is_filter: フィルタとして使用 field_issue_to: 関連するチケット field_delay: 遅延 field_assignable: このロールにチケットを割り当て可能 @@ -314,7 +314,7 @@ field_column_names: 項目 field_time_entries: 時間を記録 field_time_zone: タイムゾーン - field_searchable: 検索条件に設定可能とする + field_searchable: 検索対象 field_default_value: デフォルト値 field_comments_sorting: コメントの表示順 field_parent_title: 親ページ @@ -541,7 +541,7 @@ label_subproject_plural: サブプロジェクト label_subproject_new: 新しいサブプロジェクト label_and_its_subprojects: "%{value} とサブプロジェクト" - label_min_max_length: 最小値 - 最大値の長さ + label_min_max_length: 最短 - 最大長 label_list: リストから選択 label_date: 日付 label_integer: 整数 Index: config/locales/zh-TW.yml =================================================================== --- config/locales/zh-TW.yml (revision 13451) +++ config/locales/zh-TW.yml (working copy) @@ -996,6 +996,7 @@ label_only: 僅於 label_drop_down_list: 下拉式清單 label_checkboxes: 核取方塊 + label_radio_buttons: 選項按鈕 label_link_values_to: 連結欄位值至此網址 label_custom_field_select_type: 請選擇連結此自訂欄位的物件類型 label_check_for_updates: 檢查更新 @@ -1194,4 +1195,3 @@ description_date_from: 輸入起始日期 description_date_to: 輸入結束日期 text_repository_identifier_info: '僅允許使用小寫英文字母 (a-z), 阿拉伯數字, 虛線與底線。
一旦儲存之後, 代碼便無法再次被更改。' - label_radio_buttons: radio buttons Index: doc/CHANGELOG =================================================================== --- doc/CHANGELOG (revision 13451) +++ doc/CHANGELOG (working copy) @@ -14,7 +14,7 @@ * Defect #16655: start_date not set despite settings[default_issue_start_date_to_creation_date] being set. * Defect #16668: Redmine links broken when object name contains special characters * Defect #16669: Markdown formatter should use the :no_intra_emphasis extension -* Defect #16708: Form is submitted when swithing tab +* Defect #16708: Form is submitted when switching tab * Defect #16739: custom_fields.json only returns single tracker instead of array of trackers * Defect #16747: Remove useless settings when editing a query from the gantt * Defect #16755: Field set as read-only still available in the issues list context menu Index: lib/redmine/field_format.rb =================================================================== --- lib/redmine/field_format.rb (revision 13451) +++ lib/redmine/field_format.rb (working copy) @@ -597,6 +597,10 @@ def target_class @target_class ||= self.class.name[/^(.*::)?(.+)Format$/, 2].constantize rescue nil end + + def reset_target_class + @target_class = nil + end def possible_custom_value_options(custom_value) options = possible_values_options(custom_value.custom_field, custom_value.customized) Index: test/object_helpers.rb =================================================================== --- test/object_helpers.rb (revision 13451) +++ test/object_helpers.rb (working copy) @@ -178,6 +178,14 @@ changeset.save! changeset end + + def Query.generate!(attributes={}) + query = new(attributes) + query.name = "Generated query" if query.name.blank? + query.user ||= User.find(1) + query.save! + query + end end module IssueObjectHelpers Index: test/unit/helpers/projects_helper_test.rb =================================================================== --- test/unit/helpers/projects_helper_test.rb (revision 13451) +++ test/unit/helpers/projects_helper_test.rb (working copy) @@ -42,16 +42,23 @@ def test_link_to_version_within_project @project = Project.find(2) User.current = User.find(1) - assert_equal 'Alpha', link_to_version(Version.find(5)) + assert_equal 'Alpha', link_to_version(Version.find(5)) end def test_link_to_version User.current = User.find(1) - assert_equal 'OnlineStore - Alpha', link_to_version(Version.find(5)) + assert_equal 'Alpha', link_to_version(Version.find(5)) end + def test_link_to_version_without_effective_date + User.current = User.find(1) + version = Version.find(5) + version.effective_date = nil + assert_equal 'Alpha', link_to_version(version) + end + def test_link_to_private_version - assert_equal 'OnlineStore - Alpha', link_to_version(Version.find(5)) + assert_equal 'Alpha', link_to_version(Version.find(5)) end def test_link_to_version_invalid_version @@ -64,13 +71,22 @@ end def test_format_version_name - assert_equal "eCookbook - 0.1", format_version_name(Version.find(1)) + assert_equal "0.1", format_version_name(Version.find(1)) end - def test_format_version_name_for_system_version - assert_equal "OnlineStore - Systemwide visible version", format_version_name(Version.find(7)) + def test_format_version_name_for_shared_version_within_project_should_not_display_project_name + @project = Project.find(1) + version = Version.find(1) + version.sharing = 'system' + assert_equal "0.1", format_version_name(version) end + def test_format_version_name_for_shared_version_should_display_project_name + version = Version.find(1) + version.sharing = 'system' + assert_equal "eCookbook - 0.1", format_version_name(version) + end + def test_version_options_for_select_with_no_versions assert_equal '', version_options_for_select([]) assert_equal '', version_options_for_select([], Version.find(1)) Index: test/unit/project_copy_test.rb =================================================================== --- test/unit/project_copy_test.rb (revision 13451) +++ test/unit/project_copy_test.rb (working copy) @@ -222,6 +222,17 @@ assert_equal @source_project.queries.map(&:user_id).sort, @project.queries.map(&:user_id).sort end + def test_copy_should_copy_queries_roles_visibility + source = Project.generate! + target = Project.new(:name => 'Copy Test', :identifier => 'copy-test') + IssueQuery.generate!(:project => source, :visibility => Query::VISIBILITY_ROLES, :roles => Role.where(:id => [1, 3]).to_a) + + assert target.copy(source) + assert_equal 1, target.queries.size + query = target.queries.first + assert_equal [1, 3], query.role_ids.sort + end + test "#copy should copy versions" do @source_project.versions << Version.generate! @source_project.versions << Version.generate!