Permalink
Browse files

fixes #104

  • Loading branch information...
1 parent 1c1a66e commit 6aac612da116812f93867a89e745489f03431d0f @kawasima committed Aug 18, 2012
Showing with 38 additions and 0 deletions.
  1. +1 −0 config/locales/en.yml
  2. +3 −0 config/locales/ja.yml
  3. +4 −0 init.rb
  4. +30 −0 lib/impasse_versions_controller_patch.rb
View
@@ -66,6 +66,7 @@ en:
permission_view_testcases: "View test cases"
permission_manage_test_cases: "Manage test cases"
+ notice_delete_test_plans_first: "Delete related test plans first."
error_can_not_manage_test_cases: "You aren't permitted to manage test cases."
error_failed_to_update: "Failed to update."
View
@@ -65,7 +65,10 @@ ja:
permission_view_testcases: "テストの参照"
permission_manage_test_cases: "テストの更新"
+ notice_delete_test_plans_first: "まず関連したテスト計画を削除してください。"
error_can_not_manage_test_cases: "権限がないため、その操作は行えません。"
+ error_failed_to_update: "更新できませんでした。"
+
text_assign_cases: "ここにケースをドラッグ&ドロップするとテスト計画に追加できます"
text_assign_users: "日付やメンバをケースにドラッグ&ドロップすると、ケースの実行予定日やテスターの割当ができます"
field_test_step_actions: Actions
View
@@ -15,6 +15,10 @@
ProjectsHelper.send(:include, ImpasseProjectsHelperPatch)
end
+ unless VersionsController.included_modules.include? ImpasseVersionsControllerPatch
+ VersionsController.send(:include, ImpasseVersionsControllerPatch)
+ end
+
Project.class_eval do
has_and_belongs_to_many :test_case_custom_fields,
:class_name => 'Impasse::TestCaseCustomField',
@@ -0,0 +1,30 @@
+require_dependency 'versions_controller'
+
+module ImpasseVersionsControllerPatch
+ def self.included(base) # :nodoc:
+ base.send(:include, InstanceMethods)
+
+ base.class_eval do
+ alias_method_chain :destroy, :impasse
+ end
+
+ end
+
+ module InstanceMethods
+ def destroy_with_impasse
+ test_plans = Impasse::TestPlan.find_by_version_id(@version.id)
+ if test_plans
+ respond_to do |format|
+ format.html {
+ flash[:error] = l(:notice_unable_delete_version) << l(:notice_delete_test_plans_first)
+ redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
+ }
+ format.api { head :unprocessable_entity }
+ end
+ else
+ destroy_without_impasse
+ end
+ end
+ end
+end
+

0 comments on commit 6aac612

Please sign in to comment.