annotate .svn/pristine/04/043366b6d2160c545cba1a2e40dbe400262cc0d0.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents 038ba2d95de8
children
rev   line source
Chris@1296 1 class Note < ActiveRecord::Base
Chris@1296 2 acts_as_nested_set :scope => [:notable_id, :notable_type]
Chris@1296 3 end
Chris@1296 4
Chris@1296 5 class Default < ActiveRecord::Base
Chris@1296 6 self.table_name = 'categories'
Chris@1296 7 acts_as_nested_set
Chris@1296 8 end
Chris@1296 9
Chris@1296 10 class ScopedCategory < ActiveRecord::Base
Chris@1296 11 self.table_name = 'categories'
Chris@1296 12 acts_as_nested_set :scope => :organization
Chris@1296 13 end
Chris@1296 14
Chris@1296 15 class RenamedColumns < ActiveRecord::Base
Chris@1296 16 acts_as_nested_set :parent_column => 'mother_id', :left_column => 'red', :right_column => 'black'
Chris@1296 17 end
Chris@1296 18
Chris@1296 19 class Category < ActiveRecord::Base
Chris@1296 20 acts_as_nested_set
Chris@1296 21
Chris@1296 22 validates_presence_of :name
Chris@1296 23
Chris@1296 24 # Setup a callback that we can switch to true or false per-test
Chris@1296 25 set_callback :move, :before, :custom_before_move
Chris@1296 26 cattr_accessor :test_allows_move
Chris@1296 27 @@test_allows_move = true
Chris@1296 28 def custom_before_move
Chris@1296 29 @@test_allows_move
Chris@1296 30 end
Chris@1296 31
Chris@1296 32 def to_s
Chris@1296 33 name
Chris@1296 34 end
Chris@1296 35
Chris@1296 36 def recurse &block
Chris@1296 37 block.call self, lambda{
Chris@1296 38 self.children.each do |child|
Chris@1296 39 child.recurse &block
Chris@1296 40 end
Chris@1296 41 }
Chris@1296 42 end
Chris@1296 43 end
Chris@1296 44
Chris@1296 45 class Thing < ActiveRecord::Base
Chris@1296 46 acts_as_nested_set :counter_cache => 'children_count'
Chris@1296 47 end
Chris@1296 48
Chris@1296 49 class DefaultWithCallbacks < ActiveRecord::Base
Chris@1296 50
Chris@1296 51 self.table_name = 'categories'
Chris@1296 52
Chris@1296 53 attr_accessor :before_add, :after_add, :before_remove, :after_remove
Chris@1296 54
Chris@1296 55 acts_as_nested_set :before_add => :do_before_add_stuff,
Chris@1296 56 :after_add => :do_after_add_stuff,
Chris@1296 57 :before_remove => :do_before_remove_stuff,
Chris@1296 58 :after_remove => :do_after_remove_stuff
Chris@1296 59
Chris@1296 60 private
Chris@1296 61
Chris@1296 62 [ :before_add, :after_add, :before_remove, :after_remove ].each do |hook_name|
Chris@1296 63 define_method "do_#{hook_name}_stuff" do |child_node|
Chris@1296 64 self.send("#{hook_name}=", child_node)
Chris@1296 65 end
Chris@1296 66 end
Chris@1296 67
Chris@1296 68 end
Chris@1296 69
Chris@1296 70 class Broken < ActiveRecord::Base
Chris@1296 71 acts_as_nested_set
Chris@1296 72 end