parlement 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/CHANGES +14 -4
  2. data/README +25 -5
  3. data/Rakefile +21 -21
  4. data/app/controllers/account_controller.rb +5 -1
  5. data/app/controllers/elt_controller.rb +7 -10
  6. data/app/controllers/person_controller.rb +9 -0
  7. data/app/controllers/subscriber_controller.rb +21 -0
  8. data/app/helpers/elt_helper.rb +25 -13
  9. data/app/helpers/mailman.rb +9 -92
  10. data/app/helpers/subscriber_helper.rb +2 -0
  11. data/app/models/attachment.rb +2 -0
  12. data/app/models/elt.rb +64 -2
  13. data/app/models/mail.rb +198 -0
  14. data/app/models/mail_notify.rb +63 -0
  15. data/app/models/person.rb +8 -1
  16. data/app/views/account/_login.rhtml +31 -28
  17. data/app/views/account/_show.rhtml +4 -4
  18. data/app/views/elt/_elt.rhtml +23 -28
  19. data/app/views/elt/_list.rhtml +6 -2
  20. data/app/views/elt/new.rhtml +1 -1
  21. data/app/views/elt/show.rhtml +32 -10
  22. data/app/views/layouts/top.rhtml +16 -10
  23. data/app/views/mail_notify/publish.text.html.rhtml +46 -0
  24. data/app/views/mail_notify/publish.text.plain.rhtml +2 -0
  25. data/app/views/person/_listElts.rhtml +33 -0
  26. data/app/views/person/show.rhtml +21 -19
  27. data/config/boot.rb +2 -0
  28. data/config/environment.rb +19 -13
  29. data/config/environments/development.rb +3 -1
  30. data/config/environments/production.rb +2 -0
  31. data/config/environments/test.rb +2 -0
  32. data/config/routes.rb +5 -2
  33. data/db/ROOT/mail.txt +2 -0
  34. data/db/ROOT/parlement/news/release0.2.txt +8 -0
  35. data/db/ROOT/parlement/news/release0.3.txt +11 -0
  36. data/db/ROOT/parlement/test.txt +6 -1
  37. data/db/ROOT/parlement.txt +23 -30
  38. data/db/ROOT/perso.txt +17 -18
  39. data/db/development_structure.sql +133 -217
  40. data/db/schema.rb +83 -0
  41. data/db/schema.sql +11 -15
  42. data/lib/data_import.rb +3 -1
  43. data/public/attachment/file/architecture.png +0 -0
  44. data/public/attachment/file/architecture.svg +8972 -0
  45. data/public/attachment/file/security.svg +8960 -0
  46. data/public/images/Sleep-Deprivation-5.JPG +0 -0
  47. data/public/images/eltBackground.png +0 -0
  48. data/public/images/eltBackground.svg +89 -0
  49. data/public/images/orange_by_darren_Hester_350o.jpg +0 -0
  50. data/public/images/rails.png +0 -0
  51. data/public/images/smile.png +0 -0
  52. data/public/images/smile.svg +257 -0
  53. data/public/images/world.png +0 -0
  54. data/public/images/world.svg +170 -0
  55. data/public/javascripts/controls.js +30 -1
  56. data/public/javascripts/dragdrop.js +210 -145
  57. data/public/javascripts/effects.js +261 -399
  58. data/public/javascripts/ie7.js +6 -0
  59. data/public/javascripts/prototype.js +131 -72
  60. data/public/oldindex.html +270 -71
  61. data/public/stylesheets/default.css +189 -215
  62. data/script/about +1 -1
  63. data/script/breakpointer +1 -1
  64. data/script/console +1 -1
  65. data/script/destroy +1 -1
  66. data/script/generate +1 -1
  67. data/script/performance/benchmarker +1 -1
  68. data/script/performance/profiler +1 -1
  69. data/script/plugin +1 -1
  70. data/script/process/reaper +1 -1
  71. data/script/process/spawner +1 -1
  72. data/script/process/spinner +1 -1
  73. data/script/runner +1 -1
  74. data/script/server +1 -1
  75. data/test/fixtures/elts.yml +2 -0
  76. data/test/fixtures/mail/mail_ruby +27 -0
  77. data/test/fixtures/mail/mail_rubyChild +28 -0
  78. data/test/fixtures/mail/mail_rubyWithAttachment +7932 -0
  79. data/test/fixtures/mail/mail_rubyWithSubject +27 -0
  80. data/test/fixtures/mails.yml +7 -1
  81. data/test/fixtures/people.yml +5 -0
  82. data/test/fixtures/subscribers.yml +11 -0
  83. data/test/functional/account_controller_test.rb +38 -37
  84. data/test/functional/subscriber_controller_test.rb +128 -0
  85. data/test/test_helper.rb +44 -0
  86. data/test/unit/attachment_test.rb +1 -1
  87. data/test/unit/elt_test.rb +3 -2
  88. data/test/unit/mail_notify_test.rb +37 -0
  89. data/test/unit/mail_test.rb +124 -1
  90. data/test/unit/notifier_test.rb +0 -14
  91. data/test/unit/person_test.rb +2 -1
  92. data/test/unit/subscriber_test.rb +35 -0
  93. data/test/unit/user_test.rb +3 -3
  94. data/vendor/plugins/file_column/CHANGELOG +64 -0
  95. data/vendor/plugins/file_column/README +54 -0
  96. data/vendor/plugins/file_column/Rakefile +36 -0
  97. data/vendor/plugins/file_column/TODO +6 -0
  98. data/vendor/plugins/file_column/init.rb +12 -0
  99. data/vendor/plugins/file_column/lib/file_column.rb +719 -0
  100. data/vendor/plugins/file_column/lib/file_column_helper.rb +145 -0
  101. data/vendor/plugins/file_column/lib/file_compat.rb +28 -0
  102. data/vendor/plugins/file_column/lib/magick_file_column.rb +188 -0
  103. data/vendor/plugins/file_column/lib/validations.rb +112 -0
  104. data/vendor/plugins/file_column/test/abstract_unit.rb +90 -0
  105. data/vendor/plugins/file_column/test/connection.rb +17 -0
  106. data/vendor/plugins/file_column/test/file_column_helper_test.rb +97 -0
  107. data/vendor/plugins/file_column/test/file_column_test.rb +630 -0
  108. data/vendor/plugins/file_column/test/fixtures/entry.rb +32 -0
  109. data/vendor/plugins/file_column/test/fixtures/invalid-image.jpg +1 -0
  110. data/vendor/plugins/file_column/test/fixtures/kerb.jpg +0 -0
  111. data/vendor/plugins/file_column/test/fixtures/mysql.sql +25 -0
  112. data/vendor/plugins/file_column/test/fixtures/schema.rb +10 -0
  113. data/vendor/plugins/file_column/test/fixtures/skanthak.png +0 -0
  114. data/vendor/plugins/file_column/test/magick_test.rb +251 -0
  115. data/vendor/plugins/file_column/test/magick_view_only_test.rb +21 -0
  116. data/vendor/plugins/guid/README.TXT +19 -0
  117. data/vendor/plugins/guid/init.rb +23 -0
  118. data/vendor/plugins/guid/lib/usesguid.rb +37 -0
  119. data/vendor/plugins/guid/lib/uuid22.rb +43 -0
  120. data/vendor/plugins/guid/lib/uuidtools.rb +565 -0
  121. metadata +83 -15
  122. data/db/ROOT/CV.txt +0 -166
  123. data/lib/file_column.rb +0 -263
  124. data/lib/file_column_helper.rb +0 -45
  125. /data/{lib → vendor/plugins/file_column/lib}/rails_file_column.rb +0 -0
@@ -0,0 +1,35 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class SubscriberTest < Test::Unit::TestCase
4
+ fixtures :people, :users, :elts, :mails, :attachments, :subscribers
5
+
6
+ def setup
7
+ @elt = Elt.find('ROOT')
8
+ @person = Person.find('first')
9
+ end
10
+
11
+ def test_add_subscriber
12
+ num = @elt.subscribers.size
13
+ @elt.subscribers << Person.find('bob')
14
+ assert_equal (num + 1), @elt.subscribers.size
15
+ end
16
+
17
+ def test_delete_subscriber
18
+ num = @elt.subscribers.size
19
+ @elt.subscribers.delete(@person)
20
+ assert_equal (num - 1), @elt.subscribers.size
21
+ end
22
+
23
+ def test_add_subscribed_elt
24
+ num = @person.subscribed_elts.size
25
+ @person.subscribed_elts << Elt.find('0')
26
+ assert_equal (num + 1), @person.subscribed_elts.size
27
+ end
28
+
29
+ def test_delete_subscribed_elt
30
+ num = @person.subscribed_elts.size
31
+ @person.subscribed_elts.delete(@elt)
32
+ assert_equal (num - 1), @person.subscribed_elts.size
33
+ end
34
+ end
35
+
@@ -1,8 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper'
2
2
 
3
3
  class UserTest < Test::Unit::TestCase
4
-
5
- fixtures :people, LoginEngine.config(:user_table).to_sym
4
+ fixtures :people, :users, :subscribers
6
5
 
7
6
  def setup
8
7
  LoginEngine::CONFIG[:salt] = "test-salt"
@@ -83,7 +82,7 @@ class UserTest < Test::Unit::TestCase
83
82
  def test_create
84
83
  p = Person.new
85
84
  p.name = "otherbob"
86
- p.save
85
+ assert p.save
87
86
 
88
87
  u = User.new
89
88
  u.login = p.name
@@ -92,3 +91,4 @@ class UserTest < Test::Unit::TestCase
92
91
  assert u.save
93
92
  end
94
93
  end
94
+
@@ -0,0 +1,64 @@
1
+ *svn*
2
+ * allow for directories in file_column dirs as well
3
+ * use subdirs for versions instead of fiddling with filename
4
+ * url_for_image_column_helper for dynamic resizing of images from views
5
+ * new "crop" feature [Sean Treadway]
6
+ * url_for_file_column helper: do not require model objects to be stored in
7
+ instance variables
8
+ * allow more fined-grained control over :store_dir via callback
9
+ methods [Gerret Apelt]
10
+ * allow assignment of regular file objects
11
+ * validation of file format and file size [Kyle Maxwell]
12
+ * validation of image dimensions [Lee O'Mara]
13
+ * file permissions can be set via :permissions option
14
+ * fixed bug that prevents deleting of file via assigning nil if
15
+ column is declared as NON NULL on some databases
16
+ * don't expand absolute paths. This is necessary for file_column to work
17
+ when your rails app is deployed into a sub-directory via a symbolic link
18
+ * url_for_*_column will no longer return absolute URLs! Instead, although the
19
+ generated URL starts with a slash, it will be relative to your application's
20
+ root URL. This is so, because rails' image_tag helper will automatically
21
+ convert it to an absolute URL. If you need an absolute URL (e.g., to pass
22
+ it to link_to) use url_for_file_column's :absolute => true option.
23
+
24
+ 0.3.1
25
+ * make object with file_columns serializable
26
+ * use normal require for RMagick, so that it works with gem
27
+ and custom install as well
28
+
29
+ 0.3
30
+ * fixed bug where empty file uploads were not recognized with some browsers
31
+ * fixed bug on windows when "file" utility is not present
32
+ * added option to disable automatic file extension correction
33
+ * Only allow one attribute per call to file_column, so that options only
34
+ apply to one argument
35
+ * try to detect when people forget to set the form encoding to
36
+ 'multipart/form-data'
37
+ * converted to rails plugin
38
+ * easy integration with RMagick
39
+
40
+ 0.2
41
+ * complete rewrite using state pattern
42
+ * fixed sanitize filename [Michael Raidel]
43
+ * fixed bug when no file was uploaded [Michael Raidel]
44
+ * try to fix filename extensions [Michael Raidel]
45
+ * Feed absolute paths through File.expand_path to make them as simple as possible
46
+ * Make file_column_field helper work with auto-ids (e.g., "event[]")
47
+
48
+ 0.1.3
49
+ * test cases with more than 1 file_column
50
+ * fixed bug when file_column was called with several arguments
51
+ * treat empty ("") file_columns as nil
52
+ * support for binary files on windows
53
+
54
+ 0.1.2
55
+ * better rails integration, so that you do not have to include the modules yourself. You
56
+ just have to "require 'rails_file_column'" in your "config/environment.rb"
57
+ * Rakefile for testing and packaging
58
+
59
+ 0.1.1 (2005-08-11)
60
+ * fixed nasty bug in url_for_file_column that made it unusable on Apache
61
+ * prepared for public release
62
+
63
+ 0.1 (2005-08-10)
64
+ * initial release
@@ -0,0 +1,54 @@
1
+ FEATURES
2
+ ========
3
+
4
+ Let's assume an model class named Entry, where we want to define the "image" column
5
+ as a "file_upload" column.
6
+
7
+ class Entry < ActiveRecord::Base
8
+ file_column :image
9
+ end
10
+
11
+ * every entry can have one uploaded file, the filename will be stored in the "image" column
12
+
13
+ * files will be stored in "public/entry/image/<entry.id>/filename.ext"
14
+
15
+ * Newly uploaded files will be stored in "public/entry/tmp/<random>/filename.ext" so that
16
+ they can be reused in form redisplays (due to validation etc.)
17
+
18
+ * in a view, "<%= file_column_field 'entry', 'image' %> will create a file upload field as well
19
+ as a hidden field to recover files uploaded before in a case of a form redisplay
20
+
21
+ * in a view, "<%= url_for_file_column 'entry', 'image' %> will create an URL to access the
22
+ uploaded file. Note that you need an Entry object in the instance variable @entry for this
23
+ to work.
24
+
25
+ * easy integration with RMagick to resize images and/or create thumb-nails.
26
+
27
+ USAGE
28
+ =====
29
+
30
+ Just drop the whole directory into your application's "vendor/plugins" directory. Starting
31
+ with version 1.0rc of rails, it will be automatically picked for you by rails plugin
32
+ mechanism.
33
+
34
+ DOCUMENTATION
35
+ =============
36
+
37
+ Please look at the rdoc-generated documentation in the "doc" directory.
38
+
39
+ RUNNING UNITTESTS
40
+ =================
41
+
42
+ There are extensive unittests in the "test" directory. Currently, only MySQL is supported, but
43
+ you should be able to easily fix this by looking at "connection.rb". You have to create a
44
+ database for the tests and put the connection information into "connection.rb". The schema
45
+ for MySQL can be found in "test/fixtures/mysql.sql".
46
+
47
+ You can run the tests by starting the "*_test.rb" in the directory "test"
48
+
49
+ BUGS & FEEDBACK
50
+ ===============
51
+
52
+ Bug reports (as well as patches) and feedback are very welcome. Please send it to
53
+ sebastian.kanthak@muehlheim.de
54
+
@@ -0,0 +1,36 @@
1
+ task :default => [:test]
2
+
3
+ PKG_NAME = "file-column"
4
+ PKG_VERSION = "0.3.1"
5
+
6
+ PKG_DIR = "release/#{PKG_NAME}-#{PKG_VERSION}"
7
+
8
+ task :clean do
9
+ rm_rf "release"
10
+ end
11
+
12
+ task :setup_directories do
13
+ mkpath "release"
14
+ end
15
+
16
+
17
+ task :checkout_release => :setup_directories do
18
+ rm_rf PKG_DIR
19
+ revision = ENV["REVISION"] || "HEAD"
20
+ sh "svn export -r #{revision} . #{PKG_DIR}"
21
+ end
22
+
23
+ task :release_docs => :checkout_release do
24
+ sh "cd #{PKG_DIR}; rdoc lib"
25
+ end
26
+
27
+ task :package => [:checkout_release, :release_docs] do
28
+ sh "cd release; tar czf #{PKG_NAME}-#{PKG_VERSION}.tar.gz #{PKG_NAME}-#{PKG_VERSION}"
29
+ end
30
+
31
+ task :test do
32
+ sh "cd test; ruby file_column_test.rb"
33
+ sh "cd test; ruby file_column_helper_test.rb"
34
+ sh "cd test; ruby magick_test.rb"
35
+ sh "cd test; ruby magick_view_only_test.rb"
36
+ end
@@ -0,0 +1,6 @@
1
+ * document configuration options better
2
+ * support setting of permissions
3
+ * validation methods for file format/size
4
+ * delete stale files from tmp directories
5
+
6
+ * ensure valid URLs are created even when deployed at sub-path (compute_public_url?)
@@ -0,0 +1,12 @@
1
+ # plugin init file for rails
2
+ # this file will be picked up by rails automatically and
3
+ # add the file_column extensions to rails
4
+
5
+ require 'file_column'
6
+ require 'file_compat'
7
+ require 'file_column_helper'
8
+ require 'validations'
9
+
10
+ ActiveRecord::Base.send(:include, FileColumn)
11
+ ActionView::Base.send(:include, FileColumnHelper)
12
+ ActiveRecord::Base.send(:include, FileColumn::Validations)