From 7be4d6417329e2e12406366cb3cf4e1976638391 Mon Sep 17 00:00:00 2001 From: Josh Adams Date: Wed, 7 Jan 2009 20:37:56 -0600 Subject: [PATCH 1/7] Removed README file, as it's been supercede by README.markdown --- README | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 README diff --git a/README b/README deleted file mode 100644 index 1a3bf1f..0000000 --- a/README +++ /dev/null @@ -1,50 +0,0 @@ -== Ansuz - -Ansuz is an open source Content Management System built in Ruby on Rails. -It aims for a modular / plugin-based design, and should have more features -out of the box than any other Rails CMS we’re aware of. - -By combining the CMSes of Isshen Solutions and Isotope 11, we plan to create -a best-of-breed technology suitable for production use on a myriad of sites. -Ansuz is licensed via the BSD license. - -== Gem Dependencies -- mislav-will_paginate - -== Quick Start - - 1. clone from github: git clone git://github.com/knewter/ansuz.git - 2. create database config in config/database.yml (see config/database.yml.example if you need help) - 3. run: gem sources -a http://gems.github.com - 4. install gems: rake gems:install - 5. run: gem install haml --no-ri --no-rdoc - 6. run plugin migrations: rake db:migrate:plugins - 7. create databases: rake db:create:all - 8. run migrations: rake db:migrate - 9. run tests: rake spec -10. create a new user (do not use this in production): rake utils:create_admin -11. create the folder at public/uploads (This is for fckeditor's resource browser / uploader) -12. start server: script/server -p 3000 -13. goto: http://localhost:3000/admin -14. login with admin/admin - -NOTE: SQLite has problems with ansuz, please don't use it for now. - -NOTE: See the Ansuz Site Laucher -If run with sudo on a server with passenger set up and all the gems already installed, -it will check out a new ansuz and set up a fresh database for it and set up a vhost -for the domain specified. So, then if that domain points to the server, Bam! Done. - -== This software is BSD licensed. See the COPYING file for details. - -For help, feel free to contact the authors at: - -josh at isotope11.com -james at isotope11.com -adam at isshen.com - -= Physical Address -Isotope 11, Inc. -600 Beacon Parkway -Suite 950 -Birmingham, AL 35209 From 936094bf20e9cb68c37f91dc78a1d02a6b582e72 Mon Sep 17 00:00:00 2001 From: Josh Adams Date: Wed, 7 Jan 2009 21:47:53 -0600 Subject: [PATCH 2/7] fixed ordering in the menu system plugin (more logical now), made the crowdsound admin widget get shoved in after pageready so we aren't dependent on that response for page load --- app/views/layouts/admin.html.erb | 4 +- app/views/shared/_top_nav.html.erb | 10 ++- public/javascripts/admin.js | 3 + public/themes/knewter/stylesheets/base.css | 66 +++++++++++++++++++ .../admin/menu_entries_controller.rb | 2 +- 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 public/javascripts/admin.js create mode 100644 public/themes/knewter/stylesheets/base.css diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index eb6d4a7..56464e9 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -29,6 +29,7 @@ <%= javascript_include_tag 'ansuz/tree' %> <%= javascript_include_tag 'jquery.clickmenu.pack.js' %> <%= javascript_include_tag 'toggle-content-box.jquery.js' %> + <%= javascript_include_tag 'admin' %> @@ -65,7 +66,8 @@ diff --git a/app/views/shared/_top_nav.html.erb b/app/views/shared/_top_nav.html.erb index b50334e..305b608 100644 --- a/app/views/shared/_top_nav.html.erb +++ b/app/views/shared/_top_nav.html.erb @@ -1,8 +1,12 @@ -<% entries.each do |page| +<% entries.each_with_index do |page, i| isActive = @breadcrumb && (page == @breadcrumb[1] || page == @page) + klasses = [] + klasses << "active" if isActive + klasses << "first" if i == 0 + klasses << "last" if i == (entries.length - 1) url = page.ancestor_path + page.name + "/" %> -
  • > - <%= page.title -%> +
  • "> + <%= page.title -%> <% if page.linked_children.any? && page.parent_id -%>
      <%= render :partial => 'shared/top_nav', :locals => { :entries => page.linked_children } -%> diff --git a/public/javascripts/admin.js b/public/javascripts/admin.js new file mode 100644 index 0000000..5b5989d --- /dev/null +++ b/public/javascripts/admin.js @@ -0,0 +1,3 @@ +jQuery(document).ready(function(){ + jQuery('#crowdsound_replacement').html(""); +}); diff --git a/public/themes/knewter/stylesheets/base.css b/public/themes/knewter/stylesheets/base.css new file mode 100644 index 0000000..e319049 --- /dev/null +++ b/public/themes/knewter/stylesheets/base.css @@ -0,0 +1,66 @@ +/* Layout */ +body{ + background: white; + color: #333; + font-family: Georgia,sans-serif; +} +#content_wrapper{ + width: 920px; + margin: 0 auto; +} +#header h1{ + font-size: 300%; +} +#navigation{ + width: 850px; + margin-bottom: 40px; +} +#navigation h3{ + display: none; +} +#navigation li{ + float: left; + width: 100px; + position: relative; + z-index: 80; +} +#navigation li.first a{ + padding-left: 0; +} +#navigation li a, #navigation li.active li a{ + padding: 5px 10px; + display: block; + text-decoration: none; + cursor: pointer; + color: #555; +} +#navigation li.active li a:hover { + cursor: pointer; +} +#navigation li.active a, +#navigation li.active a:hover { + color: black; + cursor: default; +} +#navigation li a:hover { + color: black; +} +#navigation li ul{ + display: none; +} +#navigation li li a{ +} +#navigation li:hover ul{ + display: block; +} +#footer{ + margin-top: 40px; +} +/* End Layout */ +/* Utilities */ +.clear{ + clear: both; +} +/* End Utilities */ +/* Blog Posts */ +/* End Blog Posts */ diff --git a/vendor/plugins/ansuz_menu_system/app/controllers/admin/menu_entries_controller.rb b/vendor/plugins/ansuz_menu_system/app/controllers/admin/menu_entries_controller.rb index 28aa197..103d43e 100644 --- a/vendor/plugins/ansuz_menu_system/app/controllers/admin/menu_entries_controller.rb +++ b/vendor/plugins/ansuz_menu_system/app/controllers/admin/menu_entries_controller.rb @@ -16,7 +16,7 @@ def load_new_menu_entry end def load_menu_entries - @menu_entries = Ansuz::JAdams::MenuEntry.find(:all, :order => 'created_at DESC') + @menu_entries = Ansuz::JAdams::MenuEntry.find(:all, :order => 'position') end public def new From 291f7883b17f686ce627fb08338e074e83cbf4a4 Mon Sep 17 00:00:00 2001 From: Josh Adams Date: Wed, 7 Jan 2009 22:12:15 -0600 Subject: [PATCH 3/7] removed errant article views from menu system plugin --- .../app/views/articles/index.html.erb | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 vendor/plugins/ansuz_menu_system/app/views/articles/index.html.erb diff --git a/vendor/plugins/ansuz_menu_system/app/views/articles/index.html.erb b/vendor/plugins/ansuz_menu_system/app/views/articles/index.html.erb deleted file mode 100644 index fc95221..0000000 --- a/vendor/plugins/ansuz_menu_system/app/views/articles/index.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<% content_for :sidebar do -%> -

      Tags

      - <%= tag_cloud -%> -<% end -%> -<% @blog_posts.each do |blog_post| -%> -
      -

      <%=h blog_post.title -%>

      -
      - <%= blog_post.contents -%> -
      -
      -<% end -%> From 1fb37740d46e36b62bbb28eb61ae18c2776b8380 Mon Sep 17 00:00:00 2001 From: Josh Adams Date: Wed, 7 Jan 2009 22:19:47 -0600 Subject: [PATCH 4/7] updated environment to use appropriate 2.2 timezone setup, will avoid crazy scary errors from strftime --- app/2 | 459 ++++++++++++++++++ config/environment.rb | 2 +- public/stylesheets/admin.css | 3 + public/themes/knewter/stylesheets/base.css | 14 +- .../app/views/articles/_article.html.erb | 1 + vendor/plugins/userstamp/.gitignore | 2 + vendor/plugins/userstamp/CHANGELOG | 26 + vendor/plugins/userstamp/LICENSE | 20 + vendor/plugins/userstamp/README | 179 +++++++ vendor/plugins/userstamp/Rakefile | 22 + vendor/plugins/userstamp/init.rb | 4 + .../plugins/userstamp/lib/migration_helper.rb | 19 + vendor/plugins/userstamp/lib/stampable.rb | 151 ++++++ vendor/plugins/userstamp/lib/stamper.rb | 43 ++ vendor/plugins/userstamp/lib/userstamp.rb | 44 ++ .../rdoc/classes/Ddb/Controller.html | 111 +++++ .../classes/Ddb/Controller/Userstamp.html | 125 +++++ .../Controller/Userstamp/InstanceMethods.html | 105 ++++ .../userstamp/rdoc/classes/Ddb/Userstamp.html | 121 +++++ .../Ddb/Userstamp/MigrationHelper.html | 111 +++++ .../MigrationHelper/InstanceMethods.html | 142 ++++++ .../rdoc/classes/Ddb/Userstamp/Stampable.html | 128 +++++ .../Ddb/Userstamp/Stampable/ClassMethods.html | 222 +++++++++ .../rdoc/classes/Ddb/Userstamp/Stamper.html | 112 +++++ .../Ddb/Userstamp/Stamper/ClassMethods.html | 142 ++++++ .../Userstamp/Stamper/InstanceMethods.html | 207 ++++++++ vendor/plugins/userstamp/rdoc/created.rid | 1 + .../userstamp/rdoc/files/CHANGELOG.html | 137 ++++++ .../plugins/userstamp/rdoc/files/LICENSE.html | 129 +++++ .../plugins/userstamp/rdoc/files/README.html | 341 +++++++++++++ .../rdoc/files/lib/migration_helper_rb.html | 101 ++++ .../rdoc/files/lib/stampable_rb.html | 101 ++++ .../userstamp/rdoc/files/lib/stamper_rb.html | 101 ++++ .../rdoc/files/lib/userstamp_rb.html | 101 ++++ .../userstamp/rdoc/fr_class_index.html | 37 ++ .../plugins/userstamp/rdoc/fr_file_index.html | 33 ++ .../userstamp/rdoc/fr_method_index.html | 33 ++ vendor/plugins/userstamp/rdoc/index.html | 24 + vendor/plugins/userstamp/rdoc/rdoc-style.css | 208 ++++++++ .../test/compatibility_stamping_test.rb | 63 +++ .../test/controllers/posts_controller.rb | 26 + .../test/controllers/users_controller.rb | 12 + .../test/controllers/userstamp_controller.rb | 9 + vendor/plugins/userstamp/test/database.yml | 4 + .../userstamp/test/fixtures/comments.yml | 16 + .../userstamp/test/fixtures/people.yml | 11 + .../plugins/userstamp/test/fixtures/posts.yml | 9 + .../plugins/userstamp/test/fixtures/users.yml | 7 + .../test/helpers/functional_test_helper.rb | 37 ++ .../test/helpers/unit_test_helper.rb | 29 ++ .../plugins/userstamp/test/models/comment.rb | 4 + .../plugins/userstamp/test/models/person.rb | 3 + vendor/plugins/userstamp/test/models/ping.rb | 7 + vendor/plugins/userstamp/test/models/post.rb | 4 + vendor/plugins/userstamp/test/models/user.rb | 3 + vendor/plugins/userstamp/test/schema.rb | 56 +++ .../plugins/userstamp/test/stamping_test.rb | 110 +++++ .../test/userstamp_controller_test.rb | 118 +++++ 58 files changed, 4388 insertions(+), 2 deletions(-) create mode 100644 app/2 create mode 100644 vendor/plugins/userstamp/.gitignore create mode 100644 vendor/plugins/userstamp/CHANGELOG create mode 100644 vendor/plugins/userstamp/LICENSE create mode 100644 vendor/plugins/userstamp/README create mode 100644 vendor/plugins/userstamp/Rakefile create mode 100644 vendor/plugins/userstamp/init.rb create mode 100644 vendor/plugins/userstamp/lib/migration_helper.rb create mode 100644 vendor/plugins/userstamp/lib/stampable.rb create mode 100644 vendor/plugins/userstamp/lib/stamper.rb create mode 100644 vendor/plugins/userstamp/lib/userstamp.rb create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Controller.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Controller/Userstamp.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Controller/Userstamp/InstanceMethods.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/MigrationHelper.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stampable.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper/ClassMethods.html create mode 100644 vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html create mode 100644 vendor/plugins/userstamp/rdoc/created.rid create mode 100644 vendor/plugins/userstamp/rdoc/files/CHANGELOG.html create mode 100644 vendor/plugins/userstamp/rdoc/files/LICENSE.html create mode 100644 vendor/plugins/userstamp/rdoc/files/README.html create mode 100644 vendor/plugins/userstamp/rdoc/files/lib/migration_helper_rb.html create mode 100644 vendor/plugins/userstamp/rdoc/files/lib/stampable_rb.html create mode 100644 vendor/plugins/userstamp/rdoc/files/lib/stamper_rb.html create mode 100644 vendor/plugins/userstamp/rdoc/files/lib/userstamp_rb.html create mode 100644 vendor/plugins/userstamp/rdoc/fr_class_index.html create mode 100644 vendor/plugins/userstamp/rdoc/fr_file_index.html create mode 100644 vendor/plugins/userstamp/rdoc/fr_method_index.html create mode 100644 vendor/plugins/userstamp/rdoc/index.html create mode 100644 vendor/plugins/userstamp/rdoc/rdoc-style.css create mode 100644 vendor/plugins/userstamp/test/compatibility_stamping_test.rb create mode 100644 vendor/plugins/userstamp/test/controllers/posts_controller.rb create mode 100644 vendor/plugins/userstamp/test/controllers/users_controller.rb create mode 100644 vendor/plugins/userstamp/test/controllers/userstamp_controller.rb create mode 100644 vendor/plugins/userstamp/test/database.yml create mode 100644 vendor/plugins/userstamp/test/fixtures/comments.yml create mode 100644 vendor/plugins/userstamp/test/fixtures/people.yml create mode 100644 vendor/plugins/userstamp/test/fixtures/posts.yml create mode 100644 vendor/plugins/userstamp/test/fixtures/users.yml create mode 100644 vendor/plugins/userstamp/test/helpers/functional_test_helper.rb create mode 100644 vendor/plugins/userstamp/test/helpers/unit_test_helper.rb create mode 100644 vendor/plugins/userstamp/test/models/comment.rb create mode 100644 vendor/plugins/userstamp/test/models/person.rb create mode 100644 vendor/plugins/userstamp/test/models/ping.rb create mode 100644 vendor/plugins/userstamp/test/models/post.rb create mode 100644 vendor/plugins/userstamp/test/models/user.rb create mode 100644 vendor/plugins/userstamp/test/schema.rb create mode 100644 vendor/plugins/userstamp/test/stamping_test.rb create mode 100644 vendor/plugins/userstamp/test/userstamp_controller_test.rb diff --git a/app/2 b/app/2 new file mode 100644 index 0000000..181bcfa --- /dev/null +++ b/app/2 @@ -0,0 +1,459 @@ +html{ + background-color: #ddd; +} + +body{ + font-family: "Bitstream Vera Sans", Arial, sans-serif; + background-color: #ddd; +} + +h1, h2, h3, h4, h5, h6{ + font-family: Georgia,"Times New Roman",Times,serif; +} + +h1{ + text-align: left; + font-size: 200%; + padding: 10px; +} + +h1.title{ + background-color: #222; + color: white; + font-size: 250%; +} + +h1 a.button2{ + font-family: "Bitstream Vera Sans", Arial, sans-serif; + font-size: 14px; + position: relative; + left: 20px; + top: -5px; +} + +h3{ + font-size: 130%; +} + +em{ + font-weight: 600; +} + +#outside{ + position: relative; +} + +#wrapper{ + position: relative; +} + +#header { + width:100%; + text-align: left; + color: white; + padding: 10px; + height: 40px; +} + +#header h1{ + font-size: 250%; +} + +#toolbar{ + background-color: #ddd; + text-align: left; + position: absolute; + top: 0; + height: 20px; + left: 0; + width: 100%; +} + +#content{ + padding-top: 55px; +} + +#sidebar{ + float: left; + width: 25%; + background-color: #ddd; + text-align: left; +} + +#sidebar h2{ + background-color: #bbb; + padding: 4px; + margin: 4px 0; +} + +#sidebar input.text{ + width: 96%; +} + +#doc2{ + width: 71%; + float: left; + margin-right: 10px; +} + +/* Tabs */ +#hd { + width:100%; + height: 27px; + background: #555; +} + +#hd ul { + float: left; +} + +#hd ul#base-links { + float: right; +} + +#hd ul li { + display:inline; +} + +#hd ul li a, #hd ul li span { + text-decoration: none; + padding: 4px 10px; + background:#555; + color: white; +} + +#hd ul li span { + background:#555; + color: white; +} + +#hd ul li a:hover { + background:#333; +} + +#hd ul li { + text-decoration:none; +} + +#bd { + background:white; + padding:5px; + margin-left: 10px; + border-width: 0 2px 2px 0px; + border-style: solid; + border-color: #aaa; + min-height: 400px; +} + +#bd h1{ + font-size: 200%; + padding: 0; + margin-bottom: 10px; + color: black; +} + +#bd h2{ + font-size: 140%; +} + +label.title_label{ + display: block; +} + +.clear{ clear: both; float: none !important; } + +ul.grid{ + display: block; +} + +ul.grid li.item{ + display: block; + float: left; + width: 214px; + margin-right: 10px; +} + +ul.grid li.item img{ + border: 10px solid #ddd; +} + +ul.grid li.item img:hover { + border: 10px solid #bbb; +} +ul.grid li.item.active img { + border-color: #777; +} +#tree li li:hover { + background-color: #eee; +} + +#admin-menu{ + position: relative; + z-index: 200; + font-size: 1.2em; +} + +#admin-menu li{ + float: left; + position: relative; + width: 150px; + z-index: 100; + margin-right: 20px; +} + +#admin-menu li:hover span{ + background: #333; +} + +#admin-menu li span, #admin-menu li a{ + display: block; + width: 150px; +} +#admin-menu li span{ + cursor: default; +} + +#admin-menu li a span{ + cursor: pointer; +} + +#admin-menu li ul{ + display: none; + padding: 0; + margin: 0; + opacity: .9; +} + +#admin-menu li:hover ul{ + display: block; + background: white; +} + +#admin-menu li ul li a, #admin-menu li ul li span{ + padding: 4px 10px; + border-bottom: 1px solid #333; +} + +#admin-menu li ul li a span, #admin-menu li ul li span span{ + padding: 0; + border: 0; +} + +#admin-menu li span.note{ + margin: 0; + font-size: 75%; + font-style: oblique; + background: transparent; +} + +#admin-menu li li:hover a{ + background-color: #333; +} + +.note{ + margin: 10px 0; + background-color: #ccc; + padding: 10px; +} + +#sidebar > .note:first-child { + margin-top: 0; +} + +#sidebar .form-table th, #sidebar .form-table td{ + border-bottom: 0; +} + +a.button{ + padding: 10px; + color: #444; + text-decoration: none; + width: 200px; + display: block; + font-weight: bold; +} +a.button:hover { + color: black; +} +a.button.icon{ + padding-left: 30px; + width: 180px; + background-repeat: no-repeat; + background-position: 5px 10px; +} +a.button.icon.add{ + background-image: url(/images/famfamfam_icons/add.png) +} +a.button.icon.remove{ + background-image: url(/images/famfamfam_icons/delete.png) +} +a.button.icon.back{ + background-image: url(/images/famfamfam_icons/arrow_left.png) +} +a.button.icon.forward{ + background-image: url(/images/famfamfam_icons/arrow_right.png) +} +a.button.icon.edit{ + background-image: url(/images/famfamfam_icons/pencil.png) +} +a.button.icon.rss{ + background-image: url(/images/famfamfam_icons/rss.png) +} +#tree ul li .page_controls ul.dropdown li{ + float: none; +} + +/* Dropdown menu stuff for 'add page' */ + +div.outerbox{ + font-size: 100%; +} + +div.cmDiv{ + border: 0; +} + +.clickMenu li a{ + margin-right: 0 !important; +} + +.clickMenu li.main{ + font-size: 85%; + padding: 4px; + color: white; + border: 0; +} + +.clickMenu ul{ + border: 0; + background-color: #777; +} + +.clickMenu li.main:hover { + background-color: #444; + cursor: pointer; +} + +.clickMenu li.main li{ + min-width: 120px !important; + padding: 4px; +} + +.clickMenu li.main li a{ + color: white; +} + +li.main ul.innerBox li:hover, .clickMenu li.main ul.innerBox li:hover a { + background-color: #666; +} +.clickMenu li.main ul.innerBox li a{ + display: block; + width: 150px; +} +.clickMenu li.main ul.innerBox li a:hover { + cursor: pointer; +} + +/* End Dropdown menu stuff for 'add page' */ + +.ui-tabs-hide{ display: none; } + + +input.text, textarea{ + font-size: 1.5em; + padding: 4px; + margin-bottom: 1em; +} + +input.button, a.button2{ + background-color: #ccc; + border: 1px solid #aaa; + font-size: 1.2em; + padding: 4px; + text-decoration: none; + color: #333; +} + +input.button:hover, a.button2:hover { + background-color: #bbb; + cursor: pointer; +} +li.clear{ + height: 0 !important; + padding: 0 !important; +} + +#page-plugins-tabs li{ + padding-right:10px; + margin-right:10px; +} +#page-plugins-tabs li.top{ + position: relative; +} +#page-plugins-tabs li.top a.delete{ + position: absolute; + right: 0; + height: 21px; + top: 1px; + cursor: pointer; +} +#page-plugins-tabs li.top a.delete:hover { + background-color: #bbb; +} +#advance_display_options{ + display: none; +} +input, textarea{ + border-style: solid; + border-width: 1px; + border-color: #bbb; +} +input:focus, textarea:focus { + border-color: #888; +} + +.blog-post-form input.title{ + width: 98%; +} +.toggle-content-box{ + margin-bottom: 10px; +} +a.toggle-link{ + padding: 4px; + display: block; + background-color: #555; + color: white; + text-decoration: none; +} +a.toggle-link:hover { + background-color: #444; +} + +#supplemental-nav{ +position:absolute; +top: 0; +right: 0; +} +#supplemental-nav ul li{ +float: left; +margin-right: 20px; +margin-top: 8px; +} +#supplemental-nav ul li a{ +color: white; +text-decoration: none; +padding: 8px 12px; +} +#supplemental-nav ul li a:hover { + background-color: #333; +} +#bd .fullwidth{ + margin: 0 -5px 0 -5px !important; +} +ul.admin_actions li{ + float: left; + padding: 2px 6px; +} +.blog_post p{ + margin-bottom: 1em; +} diff --git a/config/environment.rb b/config/environment.rb index e84ee52..9545067 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -63,7 +63,7 @@ # Make Time.zone default to the specified zone, and make Active Record store time values # in the database in UTC, and return them converted to the specified local zone. # Run "rake -D time" for a list of tasks for finding time zone names. Uncomment to use default local time. - config.time_zone = 'UTC' + config.active_record.default_timezone = :utc # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index f49b21f..181bcfa 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css @@ -454,3 +454,6 @@ ul.admin_actions li{ float: left; padding: 2px 6px; } +.blog_post p{ + margin-bottom: 1em; +} diff --git a/public/themes/knewter/stylesheets/base.css b/public/themes/knewter/stylesheets/base.css index e319049..be2ef93 100644 --- a/public/themes/knewter/stylesheets/base.css +++ b/public/themes/knewter/stylesheets/base.css @@ -1,8 +1,9 @@ /* Layout */ body{ background: white; - color: #333; + color: #444; font-family: Georgia,sans-serif; + font-size: 1.2em; } #content_wrapper{ width: 920px; @@ -33,6 +34,7 @@ body{ text-decoration: none; cursor: pointer; color: #555; + font-size: 130%; } #navigation li.active li a:hover { cursor: pointer; @@ -63,4 +65,14 @@ body{ } /* End Utilities */ /* Blog Posts */ +.blog_post{ + margin-bottom: 40px; +} +.blog_post p{ + margin-bottom: 10px; +} +.blog_post h2{ + color: black; + font-size: 150%; + margin-bottom: 10px; /* End Blog Posts */ diff --git a/vendor/plugins/ansuz_blog/app/views/articles/_article.html.erb b/vendor/plugins/ansuz_blog/app/views/articles/_article.html.erb index c80cea9..0e1ff8b 100644 --- a/vendor/plugins/ansuz_blog/app/views/articles/_article.html.erb +++ b/vendor/plugins/ansuz_blog/app/views/articles/_article.html.erb @@ -1,5 +1,6 @@

      <%=h article.title -%>

      +

      Posted on <%= article.created_at.strftime("%B %e, %Y") %> by <%= article.author.login %>.

      <%= article.contents -%>
      diff --git a/vendor/plugins/userstamp/.gitignore b/vendor/plugins/userstamp/.gitignore new file mode 100644 index 0000000..59d5a5c --- /dev/null +++ b/vendor/plugins/userstamp/.gitignore @@ -0,0 +1,2 @@ +*.log +*.sqlite3 \ No newline at end of file diff --git a/vendor/plugins/userstamp/CHANGELOG b/vendor/plugins/userstamp/CHANGELOG new file mode 100644 index 0000000..2922a0b --- /dev/null +++ b/vendor/plugins/userstamp/CHANGELOG @@ -0,0 +1,26 @@ +2.0 (2-17-2008) + * [Ben Wyrosdick] - Added a migration helper that gives migration scripts a userstamps + method. + * [Marshall Roch] - Stamping can be temporarily turned off using the 'without_stamps' class + method. + Example: + Post.without_stamps do + post = Post.find(params[:id]) + post.update_attributes(params[:post]) + post.save + end + + * Models that should receive updates made by 'stampers' now use the acts_as_stampable class + method. This sets up the belongs_to relationships and also injects private methods for use by + the individual callback filter methods. + + * Models that are responsible for updating now use the acts_as_stamper class method. This + injects the stamper= and stamper methods that are thread safe and should be updated per + request by a controller. + + * The Userstamp module is now meant to be included with one of your project's controllers (the + Application Controller is recommended). It creates a before filter called 'set_stampers' that + is responsible for setting all the current Stampers. + +1.0 (01-18-2006) + * Initial Release diff --git a/vendor/plugins/userstamp/LICENSE b/vendor/plugins/userstamp/LICENSE new file mode 100644 index 0000000..554ef61 --- /dev/null +++ b/vendor/plugins/userstamp/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2006-2008 DeLynn Berry + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/plugins/userstamp/README b/vendor/plugins/userstamp/README new file mode 100644 index 0000000..cd4aebc --- /dev/null +++ b/vendor/plugins/userstamp/README @@ -0,0 +1,179 @@ += Userstamp Plugin (v 2.0) + +== Overview + +The Userstamp Plugin extends ActiveRecord::Base[http://api.rubyonrails.com/classes/ActiveRecord/Base.html] to add automatic updating of 'creator', +'updater', and 'deleter' attributes. It is based loosely on the ActiveRecord::Timestamp[http://api.rubyonrails.com/classes/ActiveRecord/Timestamp.html] module. + +Two class methods (model_stamper and stampable) are implemented in this plugin. +The model_stamper method is used in models that are responsible for creating, updating, or +deleting other objects. The stampable method is used in models that are subject to being +created, updated, or deleted by 'stampers'. + + +== Installation +Installation of the plugin can be done using the built in Rails plugin script. Issue the following +command from the root of your application: + + script/plugin install git://github.com/delynn/userstamp.git + +Once installed you will need to restart your application for the plugin to be loaded into the Rails +environment. + +You might also be interested in using Piston[http://piston.rubyforge.org/index.html] to manage the +importing and future updating of this plugin. + +== Usage +In this new version of the Userstamp plug-in, the assumption is that you have two different +categories of objects; those that mani˝pulate, and those that are manipulated. For those objects +that are being manipulated there's the Stampable module and for the manipulators there's the +Stamper module. There's also the actual Userstamp module for your controllers that assists in +setting up your environment on a per request basis. + +To better understand how all this works, I think an example is in order. For this example we will +assume that a weblog application is comprised of User and Post objects. The first thing we need to +do is create the migrations for these objects, and the plug-in gives you a userstamps +method for very easily doing this: + + class CreateUsers < ActiveRecord::Migration + def self.up + create_table :users, :force => true do |t| + t.timestamps + t.userstamps + t.name + end + end + + def self.down + drop_table :users + end + end + + class CreatePosts < ActiveRecord::Migration + def self.up + create_table :posts, :force => true do |t| + t.timestamps + t.userstamps + t.title + end + end + + def self.down + drop_table :posts + end + end + +Second, since Users are going to manipulate other objects in our project, we'll use the +model_stamper method in our User class: + + class User < ActiveRecord::Base + model_stamper + end + +Finally, we need to setup a controller to set the current user of the application. It's +recommended that you do this in your ApplicationController: + + class ApplicationController < ActionController::Base + include Userstamp + end + +If all you are interested in is making sure all tables that have the proper columns are stamped +by the currently logged in user you can stop right here. More than likely you want all your +associations setup on your stamped objects, and that's where the stampable class method +comes in. So in our example we'll want to use this method in both our User and Post classes: + + class User < ActiveRecord::Base + model_stamper + stampable + end + + class Post < ActiveRecord::Base + stampable + end + +Okay, so what all have we done? The model_stamper class method injects two methods into the +User class. They are #stamper= and #stamper and look like this: + + def stamper=(object) + object_stamper = if object.is_a?(ActiveRecord::Base) + object.send("#{object.class.primary_key}".to_sym) + else + object + end + + Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = object_stamper + end + + def stamper + Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] + end + +The big change with this new version is that we are now using Thread.current to save the current +stamper so as to avoid conflict with concurrent requests. + +The stampable method allows you to customize what columns will get stamped, and also +creates the +creator+, +updater+, and +deleter+ associations. + +The Userstamp module that we included into our ApplicationController uses the setter method to +set which user is currently making the request. By default the 'set_stampers' method works perfectly +with the RestfulAuthentication[http://svn.techno-weenie.net/projects/plugins/restful_authentication] plug-in: + + def set_stampers + User.stamper = self.current_user + end + +If you aren't using ActsAsAuthenticated, then you need to create your own version of the +set_stampers method in the controller where you've included the Userstamp module. + +Now, let's get back to the Stampable module (since it really is the interesting one). The Stampable +module sets up before_* filters that are responsible for setting those attributes at the appropriate +times. It also creates the belongs_to relationships for you. + +If you need to customize the columns that are stamped, the stampable method can be +completely customized. Here's an quick example: + + class Post < ActiveRecord::Base + acts_as_stampable :stamper_class_name => :person, + :creator_attribute => :create_user, + :updater_attribute => :update_user, + :deleter_attribute => :delete_user + end + +If you are upgrading your application from the old version of Userstamp, there is a compatibility +mode to have the plug-in use the old "_by" columns by default. To enable this mode, add the +following line to the RAILS_ROOT/config/environment.rb file: + + Ddb::Userstamp.compatibility_mode = true + +If you are having a difficult time getting the Userstamp plug-in to work, I recommend you checkout +the sample application that I created. You can find this application on GitHub[http://github.com/delynn/userstamp_sample] + +== Uninstall +Uninstalling the plugin can be done using the built in Rails plugin script. Issue the following +command from the root of your application: + + script/plugin remove userstamp + + +== Documentation +RDoc has been run on the plugin directory and is available in the doc directory. + + +== Running Unit Tests +There are extensive unit tests in the "test" directory of the plugin. These test can be run +individually by executing the following command from the userstamp directory: + + ruby test/compatibility_stamping_test.rb + ruby test/stamping_test.rb + ruby test/userstamp_controller_test.rb + + +== Bugs & Feedback +Bug reports and feedback are welcome via my delynn+userstamp@gmail.com email address. I also +encouraged everyone to clone the git repository and make modifications--I'll be more than happy +to merge any changes from other people's branches that would be beneficial to the whole project. + + +== Credits and Special Thanks +The original idea for this plugin came from the Rails Wiki article entitled +{Extending ActiveRecord}[http://wiki.rubyonrails.com/rails/pages/ExtendingActiveRecordExample]. \ No newline at end of file diff --git a/vendor/plugins/userstamp/Rakefile b/vendor/plugins/userstamp/Rakefile new file mode 100644 index 0000000..56ffb86 --- /dev/null +++ b/vendor/plugins/userstamp/Rakefile @@ -0,0 +1,22 @@ +require 'rake' +require 'rake/testtask' +require 'rake/rdoctask' + +desc 'Default: run unit tests.' +task :default => :test + +desc 'Test the userstamp plugin.' +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +desc 'Generate documentation for the userstamp plugin.' +Rake::RDocTask.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'Userstamp' + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README', 'CHANGELOG', 'LICENSE') + rdoc.rdoc_files.include('lib/**/*.rb') +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/init.rb b/vendor/plugins/userstamp/init.rb new file mode 100644 index 0000000..bcaa064 --- /dev/null +++ b/vendor/plugins/userstamp/init.rb @@ -0,0 +1,4 @@ +require 'stamper' +require 'stampable' +require 'userstamp' +require 'migration_helper' \ No newline at end of file diff --git a/vendor/plugins/userstamp/lib/migration_helper.rb b/vendor/plugins/userstamp/lib/migration_helper.rb new file mode 100644 index 0000000..3f90bc7 --- /dev/null +++ b/vendor/plugins/userstamp/lib/migration_helper.rb @@ -0,0 +1,19 @@ +module Ddb + module Userstamp + module MigrationHelper + def self.included(base) # :nodoc: + base.send(:include, InstanceMethods) + end + + module InstanceMethods + def userstamps(include_deleted_by = false) + column(Ddb::Userstamp.compatibility_mode ? :created_by : :creator_id, :integer) + column(Ddb::Userstamp.compatibility_mode ? :updated_by : :updater_id, :integer) + column(Ddb::Userstamp.compatibility_mode ? :deleted_by : :deleter_id, :integer) if include_deleted_by + end + end + end + end +end + +ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Ddb::Userstamp::MigrationHelper) \ No newline at end of file diff --git a/vendor/plugins/userstamp/lib/stampable.rb b/vendor/plugins/userstamp/lib/stampable.rb new file mode 100644 index 0000000..df24d39 --- /dev/null +++ b/vendor/plugins/userstamp/lib/stampable.rb @@ -0,0 +1,151 @@ +module Ddb #:nodoc: + module Userstamp + # Determines what default columns to use for recording the current stamper. + # By default this is set to false, so the plug-in will use columns named + # creator_id, updater_id, and deleter_id. + # + # To turn compatibility mode on, place the following line in your environment.rb + # file: + # + # Ddb::Userstamp.compatibility_mode = true + # + # This will cause the plug-in to use columns named created_by, + # updated_by, and deleted_by. + mattr_accessor :compatibility_mode + @@compatibility_mode = false + + # Extends the stamping functionality of ActiveRecord by automatically recording the model + # responsible for creating, updating, and deleting the current object. See the Stamper + # and Userstamp modules for further documentation on how the entire process works. + module Stampable + def self.included(base) #:nodoc: + super + + base.extend(ClassMethods) + base.class_eval do + include InstanceMethods + + # Should ActiveRecord record userstamps? Defaults to true. + class_inheritable_accessor :record_userstamp + self.record_userstamp = true + + # Which class is responsible for stamping? Defaults to :user. + class_inheritable_accessor :stamper_class_name + + # What column should be used for the creator stamp? + # Defaults to :creator_id when compatibility mode is off + # Defaults to :created_by when compatibility mode is on + class_inheritable_accessor :creator_attribute + + # What column should be used for the updater stamp? + # Defaults to :updater_id when compatibility mode is off + # Defaults to :updated_by when compatibility mode is on + class_inheritable_accessor :updater_attribute + + # What column should be used for the deleter stamp? + # Defaults to :deleter_id when compatibility mode is off + # Defaults to :deleted_by when compatibility mode is on + class_inheritable_accessor :deleter_attribute + + self.stampable + end + end + + module ClassMethods + # This method is automatically called on for all classes that inherit from + # ActiveRecord, but if you need to customize how the plug-in functions, this is the + # method to use. Here's an example: + # + # class Post < ActiveRecord::Base + # stampable :stamper_class_name => :person, + # :creator_attribute => :create_user, + # :updater_attribute => :update_user, + # :deleter_attribute => :delete_user + # end + # + # The method will automatically setup all the associations, and create before_save + # and before_create filters for doing the stamping. + def stampable(options = {}) + defaults = { + :stamper_class_name => :user, + :creator_attribute => Ddb::Userstamp.compatibility_mode ? :created_by : :creator_id, + :updater_attribute => Ddb::Userstamp.compatibility_mode ? :updated_by : :updater_id, + :deleter_attribute => Ddb::Userstamp.compatibility_mode ? :deleted_by : :deleter_id + }.merge(options) + + self.stamper_class_name = defaults[:stamper_class_name].to_sym + self.creator_attribute = defaults[:creator_attribute].to_sym + self.updater_attribute = defaults[:updater_attribute].to_sym + self.deleter_attribute = defaults[:deleter_attribute].to_sym + + class_eval do + belongs_to :creator, :class_name => self.stamper_class_name.to_s.singularize.camelize, + :foreign_key => self.creator_attribute + + belongs_to :updater, :class_name => self.stamper_class_name.to_s.singularize.camelize, + :foreign_key => self.updater_attribute + + before_save :set_updater_attribute + before_create :set_creator_attribute + + if defined?(Caboose::Acts::Paranoid) + belongs_to :deleter, :class_name => self.stamper_class_name.to_s.singularize.camelize, + :foreign_key => self.deleter_attribute + before_destroy :set_deleter_attribute + end + end + end + + # Temporarily allows you to turn stamping off. For example: + # + # Post.without_stamps do + # post = Post.find(params[:id]) + # post.update_attributes(params[:post]) + # post.save + # end + def without_stamps + original_value = self.record_userstamp + self.record_userstamp = false + yield + self.record_userstamp = original_value + end + + def stamper_class #:nodoc: + stamper_class_name.to_s.capitalize.constantize rescue nil + end + end + + module InstanceMethods #:nodoc: + private + def has_stamper? + !self.class.stamper_class.nil? && !self.class.stamper_class.stamper.nil? rescue false + end + + def set_creator_attribute + return unless self.record_userstamp + if respond_to?(self.creator_attribute.to_sym) && has_stamper? + self.send("#{self.creator_attribute}=".to_sym, self.class.stamper_class.stamper) + end + end + + def set_updater_attribute + return unless self.record_userstamp + if respond_to?(self.updater_attribute.to_sym) && has_stamper? + self.send("#{self.updater_attribute}=".to_sym, self.class.stamper_class.stamper) + end + end + + def set_deleter_attribute + return unless self.record_userstamp + if respond_to?(self.deleter_attribute.to_sym) && has_stamper? + self.send("#{self.deleter_attribute}=".to_sym, self.class.stamper_class.stamper) + save + end + end + #end private + end + end + end +end + +ActiveRecord::Base.send(:include, Ddb::Userstamp::Stampable) if defined?(ActiveRecord) \ No newline at end of file diff --git a/vendor/plugins/userstamp/lib/stamper.rb b/vendor/plugins/userstamp/lib/stamper.rb new file mode 100644 index 0000000..c0caa83 --- /dev/null +++ b/vendor/plugins/userstamp/lib/stamper.rb @@ -0,0 +1,43 @@ +module Ddb #:nodoc: + module Userstamp + module Stamper + def self.included(base) # :nodoc: + base.extend(ClassMethods) + end + + module ClassMethods + def model_stamper + # don't allow multiple calls + return if self.included_modules.include?(Ddb::Userstamp::Stamper::InstanceMethods) + send(:extend, Ddb::Userstamp::Stamper::InstanceMethods) + end + end + + module InstanceMethods + # Used to set the stamper for a particular request. See the Userstamp module for more + # details on how to use this method. + def stamper=(object) + object_stamper = if object.is_a?(ActiveRecord::Base) + object.send("#{object.class.primary_key}".to_sym) + else + object + end + + Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = object_stamper + end + + # Retrieves the existing stamper for the current request. + def stamper + Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] + end + + # Sets the stamper back to +nil+ to prepare for the next request. + def reset_stamper + Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = nil + end + end + end + end +end + +ActiveRecord::Base.send(:include, Ddb::Userstamp::Stamper) if defined?(ActiveRecord) \ No newline at end of file diff --git a/vendor/plugins/userstamp/lib/userstamp.rb b/vendor/plugins/userstamp/lib/userstamp.rb new file mode 100644 index 0000000..871921a --- /dev/null +++ b/vendor/plugins/userstamp/lib/userstamp.rb @@ -0,0 +1,44 @@ +module Ddb + module Controller + # The Userstamp module, when included into a controller, adds a before filter + # (named set_stamper) and an after filter (name reset_stamper). + # These methods assume a couple of things, but can be re-implemented in your + # controller to better suite your application. + # + # See the documentation for set_stamper and reset_stamper for + # specific implementation details. + module Userstamp + def self.included(base) # :nodoc: + base.send :include, InstanceMethods + base.before_filter :set_stamper + base.after_filter :reset_stamper + end + + module InstanceMethods + private + # The set_stamper method as implemented here assumes a couple + # of things. First, that you are using a +User+ model as the stamper + # and second that your controller has a current_user method + # that contains the currently logged in stamper. If either of these + # are not the case in your application you will want to manually add + # your own implementation of this method to the private section of + # the controller where you are including the Userstamp module. + def set_stamper + User.stamper = self.current_user + end + + # The reset_stamper method as implemented here assumes that a + # +User+ model is being used as the stamper. If this is not the case then + # you will need to manually add your own implementation of this method to + # the private section of the controller where you are including the + # Userstamp module. + def reset_stamper + User.reset_stamper + end + #end private + end + end + end +end + +ActionController::Base.send(:include, Ddb::Controller) if defined?(ActionController) \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller.html new file mode 100644 index 0000000..cb16229 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller.html @@ -0,0 +1,111 @@ + + + + + + Module: Ddb::Controller + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Controller
      In: + + lib/userstamp.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + +
      +

      Classes and Modules

      + + Module Ddb::Controller::Userstamp
      + +
      + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller/Userstamp.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller/Userstamp.html new file mode 100644 index 0000000..06ffb20 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller/Userstamp.html @@ -0,0 +1,125 @@ + + + + + + Module: Ddb::Controller::Userstamp + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Controller::Userstamp
      In: + + lib/userstamp.rb + +
      +
      +
      + + +
      + + + +
      + +
      +

      +The Userstamp module, when included into a +controller, adds a before filter (named set_stamper) and an after +filter (name reset_stamper). These methods assume a couple of +things, but can be re-implemented in your controller to better suite your +application. +

      +

      +See the documentation for set_stamper and reset_stamper +for specific implementation details. +

      + +
      + + +
      + + +
      + + + + +
      + +
      +

      Classes and Modules

      + + Module Ddb::Controller::Userstamp::InstanceMethods
      + +
      + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller/Userstamp/InstanceMethods.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller/Userstamp/InstanceMethods.html new file mode 100644 index 0000000..5319def --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Controller/Userstamp/InstanceMethods.html @@ -0,0 +1,105 @@ + + + + + + Module: Ddb::Controller::Userstamp::InstanceMethods + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Controller::Userstamp::InstanceMethods
      In: + + lib/userstamp.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp.html new file mode 100644 index 0000000..95d34d0 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp.html @@ -0,0 +1,121 @@ + + + + + + Module: Ddb::Userstamp + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Userstamp
      In: + + lib/migration_helper.rb + +
      + + lib/stampable.rb + +
      + + lib/stamper.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + +
      +

      Classes and Modules

      + + Module Ddb::Userstamp::MigrationHelper
      +Module Ddb::Userstamp::Stampable
      +Module Ddb::Userstamp::Stamper
      + +
      + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/MigrationHelper.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/MigrationHelper.html new file mode 100644 index 0000000..502a355 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/MigrationHelper.html @@ -0,0 +1,111 @@ + + + + + + Module: Ddb::Userstamp::MigrationHelper + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Userstamp::MigrationHelper
      In: + + lib/migration_helper.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + +
      +

      Classes and Modules

      + + Module Ddb::Userstamp::MigrationHelper::InstanceMethods
      + +
      + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html new file mode 100644 index 0000000..e271a33 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html @@ -0,0 +1,142 @@ + + + + + + Module: Ddb::Userstamp::MigrationHelper::InstanceMethods + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Userstamp::MigrationHelper::InstanceMethods
      In: + + lib/migration_helper.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + +
      +

      Methods

      + +
      + userstamps   +
      +
      + +
      + + + + +
      + + + + + + + + + +
      +

      Public Instance methods

      + +
      + + + + +
      +

      [Source]

      +
      +
      +    # File lib/migration_helper.rb, line 9
      + 9:         def userstamps(include_deleted_by = false)
      +10:           column(Ddb::Userstamp.compatibility_mode ? :created_by : :creator_id, :integer)
      +11:           column(Ddb::Userstamp.compatibility_mode ? :updated_by : :updater_id, :integer)
      +12:           column(Ddb::Userstamp.compatibility_mode ? :deleted_by : :deleter_id, :integer) if include_deleted_by
      +13:         end
      +
      +
      +
      +
      + + +
      + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stampable.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stampable.html new file mode 100644 index 0000000..1938167 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stampable.html @@ -0,0 +1,128 @@ + + + + + + Module: Ddb::Userstamp::Stampable + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Userstamp::Stampable
      In: + + lib/stampable.rb + +
      +
      +
      + + +
      + + + +
      + +
      +

      +Extends the stamping functionality of ActiveRecord by automatically +recording the model responsible for creating, updating, and deleting the +current object. See the Stamper and Userstamp modules for further documentation on +how the entire process works. +

      + +
      + + +
      + + +
      + + + +
      +

      Included Modules

      + +
      + InstanceMethods +
      +
      + +
      + +
      +

      Classes and Modules

      + + Module Ddb::Userstamp::Stampable::ClassMethods
      + +
      + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html new file mode 100644 index 0000000..8cb54b0 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html @@ -0,0 +1,222 @@ + + + + + + Module: Ddb::Userstamp::Stampable::ClassMethods + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Userstamp::Stampable::ClassMethods
      In: + + lib/stampable.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + +
      +

      Methods

      + +
      + stampable   + without_stamps   +
      +
      + +
      + + + + +
      + + + + + + + + + +
      +

      Public Instance methods

      + +
      + + + + +
      +

      +This method is automatically called on for all classes that inherit from +ActiveRecord, but if you need to customize how the plug-in functions, this +is the method to use. Here‘s an example: +

      +
      +  class Post < ActiveRecord::Base
      +    stampable :stamper_class_name => :person,
      +              :creator_attribute  => :create_user,
      +              :updater_attribute  => :update_user,
      +              :deleter_attribute  => :delete_user
      +  end
      +
      +

      +The method will automatically setup all the associations, and create +before_save and before_create filters for doing the +stamping. +

      +

      [Source]

      +
      +
      +    # File lib/stampable.rb, line 68
      +68:         def stampable(options = {})
      +69:           defaults  = {
      +70:                         :stamper_class_name => :user,
      +71:                         :creator_attribute  => Ddb::Userstamp.compatibility_mode ? :created_by : :creator_id,
      +72:                         :updater_attribute  => Ddb::Userstamp.compatibility_mode ? :updated_by : :updater_id,
      +73:                         :deleter_attribute  => Ddb::Userstamp.compatibility_mode ? :deleted_by : :deleter_id
      +74:                       }.merge(options)
      +75: 
      +76:           self.stamper_class_name = defaults[:stamper_class_name].to_sym
      +77:           self.creator_attribute  = defaults[:creator_attribute].to_sym
      +78:           self.updater_attribute  = defaults[:updater_attribute].to_sym
      +79:           self.deleter_attribute  = defaults[:deleter_attribute].to_sym
      +80: 
      +81:           class_eval do
      +82:             belongs_to :creator, :class_name => self.stamper_class_name.to_s.singularize.camelize,
      +83:                                  :foreign_key => self.creator_attribute
      +84:                                  
      +85:             belongs_to :updater, :class_name => self.stamper_class_name.to_s.singularize.camelize,
      +86:                                  :foreign_key => self.updater_attribute
      +87:                                  
      +88:             before_save     :set_updater_attribute
      +89:             before_create   :set_creator_attribute
      +90:                                  
      +91:             if defined?(Caboose::Acts::Paranoid)
      +92:               belongs_to :deleter, :class_name => self.stamper_class_name,
      +93:                                    :foreign_key => self.deleter_attribute
      +94:               before_destroy  :set_deleter_attribute
      +95:             end
      +96:           end
      +97:         end
      +
      +
      +
      +
      + +
      + + + + +
      +

      +Temporarily allows you to turn stamping off. For example: +

      +
      +  Post.without_stamps do
      +    post = Post.find(params[:id])
      +    post.update_attributes(params[:post])
      +    post.save
      +  end
      +
      +

      [Source]

      +
      +
      +     # File lib/stampable.rb, line 106
      +106:         def without_stamps
      +107:           original_value = self.record_userstamp
      +108:           self.record_userstamp = false
      +109:           yield
      +110:           self.record_userstamp = original_value
      +111:         end
      +
      +
      +
      +
      + + +
      + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper.html new file mode 100644 index 0000000..57d0eb2 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper.html @@ -0,0 +1,112 @@ + + + + + + Module: Ddb::Userstamp::Stamper + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Userstamp::Stamper
      In: + + lib/stamper.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper/ClassMethods.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper/ClassMethods.html new file mode 100644 index 0000000..676b804 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper/ClassMethods.html @@ -0,0 +1,142 @@ + + + + + + Module: Ddb::Userstamp::Stamper::ClassMethods + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Userstamp::Stamper::ClassMethods
      In: + + lib/stamper.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + +
      +

      Methods

      + +
      + model_stamper   +
      +
      + +
      + + + + +
      + + + + + + + + + +
      +

      Public Instance methods

      + +
      + + + + +
      +

      [Source]

      +
      +
      +    # File lib/stamper.rb, line 9
      + 9:         def model_stamper
      +10:           # don't allow multiple calls
      +11:           return if self.included_modules.include?(Ddb::Userstamp::Stamper::InstanceMethods)
      +12:           send(:extend, Ddb::Userstamp::Stamper::InstanceMethods)
      +13:         end
      +
      +
      +
      +
      + + +
      + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html new file mode 100644 index 0000000..64558eb --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html @@ -0,0 +1,207 @@ + + + + + + Module: Ddb::Userstamp::Stamper::InstanceMethods + + + + + + + + + + +
      + + + + + + + + + + +
      ModuleDdb::Userstamp::Stamper::InstanceMethods
      In: + + lib/stamper.rb + +
      +
      +
      + + +
      + + + +
      + + + +
      + +
      +

      Methods

      + +
      + reset_stamper   + stamper   + stamper=   +
      +
      + +
      + + + + +
      + + + + + + + + + +
      +

      Public Instance methods

      + +
      + + + + +
      +

      +Sets the stamper back to +nil to prepare for the next request. +

      +

      [Source]

      +
      +
      +    # File lib/stamper.rb, line 35
      +35:         def reset_stamper
      +36:           Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = nil
      +37:         end
      +
      +
      +
      +
      + +
      + + + + +
      +

      +Retrieves the existing stamper +for the current request. +

      +

      [Source]

      +
      +
      +    # File lib/stamper.rb, line 30
      +30:         def stamper
      +31:           find(Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"])
      +32:         end
      +
      +
      +
      +
      + +
      + + + + +
      +

      +Used to set the stamper for a +particular request. See the Userstamp +module for more details on how to use this method. +

      +

      [Source]

      +
      +
      +    # File lib/stamper.rb, line 19
      +19:         def stamper=(object)
      +20:           object_stamper = if object.is_a?(ActiveRecord::Base)
      +21:             object.send("#{object.class.primary_key}".to_sym)
      +22:           else
      +23:             object
      +24:           end
      +25: 
      +26:           Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = object_stamper
      +27:         end
      +
      +
      +
      +
      + + +
      + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/created.rid b/vendor/plugins/userstamp/rdoc/created.rid new file mode 100644 index 0000000..888ad27 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/created.rid @@ -0,0 +1 @@ +Sat, 05 Apr 2008 15:11:35 -0600 diff --git a/vendor/plugins/userstamp/rdoc/files/CHANGELOG.html b/vendor/plugins/userstamp/rdoc/files/CHANGELOG.html new file mode 100644 index 0000000..69f3448 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/files/CHANGELOG.html @@ -0,0 +1,137 @@ + + + + + + File: CHANGELOG + + + + + + + + + + +
      +

      CHANGELOG

      + + + + + + + + + +
      Path:CHANGELOG +
      Last Update:Sat Apr 05 11:41:29 -0600 2008
      +
      + + +
      + + + +
      + +
      +

      +2.0 (2-17-2008) +

      +
      +    * [Ben  Wyrosdick] - Added a migration helper that gives migration scripts a <tt>userstamps</tt>
      +                         method.
      +    * [Marshall Roch]  - Stamping can be temporarily turned off using the 'without_stamps' class
      +                         method.
      +      Example:
      +        Post.without_stamps do
      +          post = Post.find(params[:id])
      +          post.update_attributes(params[:post])
      +          post.save
      +        end
      +
      +    * Models that should receive updates made by 'stampers' now use the acts_as_stampable class
      +      method. This sets up the belongs_to relationships and also injects private methods for use by
      +      the individual callback filter methods.
      +
      +    * Models that are responsible for updating now use the acts_as_stamper class method. This
      +      injects the stamper= and stamper methods that are thread safe and should be updated per
      +      request by a controller.
      +
      +    * The Userstamp module is now meant to be included with one of your project's controllers (the
      +      Application Controller is recommended). It creates a before filter called 'set_stampers' that
      +      is responsible for setting all the current Stampers.
      +
      +

      +1.0 (01-18-2006) +

      +
      +    * Initial Release
      +
      + +
      + + +
      + + +
      + + + + +
      + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/files/LICENSE.html b/vendor/plugins/userstamp/rdoc/files/LICENSE.html new file mode 100644 index 0000000..ab1a1ac --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/files/LICENSE.html @@ -0,0 +1,129 @@ + + + + + + File: LICENSE + + + + + + + + + + +
      +

      LICENSE

      + + + + + + + + + +
      Path:LICENSE +
      Last Update:Tue Mar 11 20:24:59 -0600 2008
      +
      + + +
      + + + +
      + +
      +

      +Copyright (c) 2006-2008 DeLynn Berry +

      +

      +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to the +following conditions: +

      +

      +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +

      +

      +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. +

      + +
      + + +
      + + +
      + + + + +
      + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/files/README.html b/vendor/plugins/userstamp/rdoc/files/README.html new file mode 100644 index 0000000..732ee54 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/files/README.html @@ -0,0 +1,341 @@ + + + + + + File: README + + + + + + + + + + +
      +

      README

      + + + + + + + + + +
      Path:README +
      Last Update:Sat Apr 05 15:01:24 -0600 2008
      +
      + + +
      + + + +
      + +
      +

      Userstamp Plugin (v 2.0)

      +

      Overview

      +

      +The Userstamp Plugin extends ActiveRecord::Base +to add automatic updating of ‘creator’, ‘updater’, +and ‘deleter’ attributes. It is based loosely on the ActiveRecord::Timestamp +module. +

      +

      +Two class methods (model_stamper and stampable) are +implemented in this plugin. The model_stamper method is used in +models that are responsible for creating, updating, or deleting other +objects. The stampable method is used in models that are subject +to being created, updated, or deleted by ‘stampers’. +

      +

      Installation

      +

      +Installation of the plugin can be done using the built in Rails plugin +script. Issue the following command from the root of your application: +

      +
      +  script/plugin install git://github.com/delynn/userstamp.git
      +
      +

      +Once installed you will need to restart your application for the plugin to +be loaded into the Rails environment. +

      +

      +You might also be interested in using Piston to manage the +importing and future updating of this plugin. +

      +

      Usage

      +

      +In this new version of the Userstamp plug-in, the assumption is that you +have two different categories of objects; those that mani˝pulate, and +those that are manipulated. For those objects that are being manipulated +there‘s the Stampable module and for the manipulators there‘s +the Stamper module. There‘s also the actual Userstamp module for your +controllers that assists in setting up your environment on a per request +basis. +

      +

      +To better understand how all this works, I think an example is in order. +For this example we will assume that a weblog application is comprised of +User and Post objects. The first thing we need to do is create the +migrations for these objects, and the plug-in gives you a +userstamps method for very easily doing this: +

      +
      +  class CreateUsers < ActiveRecord::Migration
      +    def self.up
      +      create_table :users, :force => true do |t|
      +        t.timestamps
      +        t.userstamps
      +        t.name
      +      end
      +    end
      +
      +    def self.down
      +      drop_table :users
      +    end
      +  end
      +
      +  class CreatePosts < ActiveRecord::Migration
      +    def self.up
      +      create_table :posts, :force => true do |t|
      +        t.timestamps
      +        t.userstamps
      +        t.title
      +      end
      +    end
      +
      +    def self.down
      +      drop_table :posts
      +    end
      +  end
      +
      +

      +Second, since Users are going to manipulate other objects in our project, +we‘ll use the model_stamper method in our User class: +

      +
      +  class User < ActiveRecord::Base
      +    model_stamper
      +  end
      +
      +

      +Finally, we need to setup a controller to set the current user of the +application. It‘s recommended that you do this in your +ApplicationController: +

      +
      +  class ApplicationController < ActionController::Base
      +    include Userstamp
      +  end
      +
      +

      +If all you are interested in is making sure all tables that have the proper +columns are stamped by the currently logged in user you can stop right +here. More than likely you want all your associations setup on your stamped +objects, and that‘s where the stampable class method comes +in. So in our example we‘ll want to use this method in both our User +and Post classes: +

      +
      +  class User < ActiveRecord::Base
      +    model_stamper
      +    stampable
      +  end
      +
      +  class Post < ActiveRecord::Base
      +    stampable
      +  end
      +
      +

      +Okay, so what all have we done? The model_stamper class method +injects two methods into the User class. They are stamper= and stamper and +look like this: +

      +
      +  def stamper=(object)
      +    object_stamper = if object.is_a?(ActiveRecord::Base)
      +      object.send("#{object.class.primary_key}".to_sym)
      +    else
      +      object
      +    end
      +
      +    Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = object_stamper
      +  end
      +
      +  def stamper
      +    Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"]
      +  end
      +
      +

      +The big change with this new version is that we are now using +Thread.current to save the current stamper so as to avoid conflict with +concurrent requests. +

      +

      +The stampable method allows you to customize what columns will get +stamped, and also creates the creator, updater, and +deleter associations. +

      +

      +The Userstamp module that we included into our ApplicationController uses +the setter method to set which user is currently making the request. By +default the ‘set_stampers’ method works perfectly with the RestfulAuthentication +plug-in: +

      +
      +  def set_stampers
      +    User.stamper = self.current_user
      +  end
      +
      +

      +If you aren‘t using ActsAsAuthenticated, then you need to create your +own version of the set_stampers method in the controller where +you‘ve included the Userstamp module. +

      +

      +Now, let‘s get back to the Stampable module (since it really is the +interesting one). The Stampable module sets up before_* filters that are +responsible for setting those attributes at the appropriate times. It also +creates the belongs_to relationships for you. +

      +

      +If you need to customize the columns that are stamped, the +stampable method can be completely customized. Here‘s an +quick example: +

      +
      +  class Post < ActiveRecord::Base
      +    acts_as_stampable :stamper_class_name => :person,
      +                      :creator_attribute  => :create_user,
      +                      :updater_attribute  => :update_user,
      +                      :deleter_attribute  => :delete_user
      +  end
      +
      +

      +If you are upgrading your application from the old version of Userstamp, +there is a compatibility mode to have the plug-in use the old +"_by" columns by default. To enable this mode, add the following +line to the RAILS_ROOT/config/environment.rb file: +

      +
      +  Ddb::Userstamp.compatibility_mode = true
      +
      +

      +If you are having a difficult time getting the Userstamp plug-in to work, I +recommend you checkout the sample application that I created. You can find +this application on GitHub +

      +

      Uninstall

      +

      +Uninstalling the plugin can be done using the built in Rails plugin script. +Issue the following command from the root of your application: +

      +
      +  script/plugin remove userstamp
      +
      +

      Documentation

      +

      +RDoc has been run on the plugin directory and is available in the doc +directory. +

      +

      Running Unit Tests

      +

      +There are extensive unit tests in the "test" directory of the +plugin. These test can be run individually by executing the following +command from the userstamp directory: +

      +
      + ruby test/compatibility_stamping_test.rb
      + ruby test/stamping_test.rb
      + ruby test/userstamp_controller_test.rb
      +
      +

      Bugs & Feedback

      +

      +Bug reports and feedback are welcome via my delynn+userstamp@gmail.com +email address. I also encouraged everyone to clone the git repository and +make modifications—I‘ll be more than happy to merge any changes +from other people‘s branches that would be beneficial to the whole +project. +

      +

      Credits and Special Thanks

      +

      +The original idea for this plugin came from the Rails Wiki article entitled +Extending +ActiveRecord. +

      + +
      + + +
      + + +
      + + + + +
      + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/files/lib/migration_helper_rb.html b/vendor/plugins/userstamp/rdoc/files/lib/migration_helper_rb.html new file mode 100644 index 0000000..79cde59 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/files/lib/migration_helper_rb.html @@ -0,0 +1,101 @@ + + + + + + File: migration_helper.rb + + + + + + + + + + +
      +

      migration_helper.rb

      + + + + + + + + + +
      Path:lib/migration_helper.rb +
      Last Update:Sat Apr 05 11:37:18 -0600 2008
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/files/lib/stampable_rb.html b/vendor/plugins/userstamp/rdoc/files/lib/stampable_rb.html new file mode 100644 index 0000000..2956dde --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/files/lib/stampable_rb.html @@ -0,0 +1,101 @@ + + + + + + File: stampable.rb + + + + + + + + + + +
      +

      stampable.rb

      + + + + + + + + + +
      Path:lib/stampable.rb +
      Last Update:Sat Apr 05 14:16:35 -0600 2008
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/files/lib/stamper_rb.html b/vendor/plugins/userstamp/rdoc/files/lib/stamper_rb.html new file mode 100644 index 0000000..56fdc06 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/files/lib/stamper_rb.html @@ -0,0 +1,101 @@ + + + + + + File: stamper.rb + + + + + + + + + + +
      +

      stamper.rb

      + + + + + + + + + +
      Path:lib/stamper.rb +
      Last Update:Sat Apr 05 14:16:03 -0600 2008
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/files/lib/userstamp_rb.html b/vendor/plugins/userstamp/rdoc/files/lib/userstamp_rb.html new file mode 100644 index 0000000..089bd92 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/files/lib/userstamp_rb.html @@ -0,0 +1,101 @@ + + + + + + File: userstamp.rb + + + + + + + + + + +
      +

      userstamp.rb

      + + + + + + + + + +
      Path:lib/userstamp.rb +
      Last Update:Sat Apr 05 14:57:26 -0600 2008
      +
      + + +
      + + + +
      + + + +
      + + +
      + + + + +
      + + + + + + + + + + + +
      + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/fr_class_index.html b/vendor/plugins/userstamp/rdoc/fr_class_index.html new file mode 100644 index 0000000..43c9972 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/fr_class_index.html @@ -0,0 +1,37 @@ + + + + + + + + Classes + + + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/fr_file_index.html b/vendor/plugins/userstamp/rdoc/fr_file_index.html new file mode 100644 index 0000000..72e4532 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/fr_file_index.html @@ -0,0 +1,33 @@ + + + + + + + + Files + + + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/fr_method_index.html b/vendor/plugins/userstamp/rdoc/fr_method_index.html new file mode 100644 index 0000000..ef0f962 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/fr_method_index.html @@ -0,0 +1,33 @@ + + + + + + + + Methods + + + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/index.html b/vendor/plugins/userstamp/rdoc/index.html new file mode 100644 index 0000000..25990c2 --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/index.html @@ -0,0 +1,24 @@ + + + + + + + Userstamp + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/plugins/userstamp/rdoc/rdoc-style.css b/vendor/plugins/userstamp/rdoc/rdoc-style.css new file mode 100644 index 0000000..44c7b3d --- /dev/null +++ b/vendor/plugins/userstamp/rdoc/rdoc-style.css @@ -0,0 +1,208 @@ + +body { + font-family: Verdana,Arial,Helvetica,sans-serif; + font-size: 90%; + margin: 0; + margin-left: 40px; + padding: 0; + background: white; +} + +h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; } +h1 { font-size: 150%; } +h2,h3,h4 { margin-top: 1em; } + +a { background: #eef; color: #039; text-decoration: none; } +a:hover { background: #039; color: #eef; } + +/* Override the base stylesheet's Anchor inside a table cell */ +td > a { + background: transparent; + color: #039; + text-decoration: none; +} + +/* and inside a section title */ +.section-title > a { + background: transparent; + color: #eee; + text-decoration: none; +} + +/* === Structural elements =================================== */ + +div#index { + margin: 0; + margin-left: -40px; + padding: 0; + font-size: 90%; +} + + +div#index a { + margin-left: 0.7em; +} + +div#index .section-bar { + margin-left: 0px; + padding-left: 0.7em; + background: #ccc; + font-size: small; +} + + +div#classHeader, div#fileHeader { + width: auto; + color: white; + padding: 0.5em 1.5em 0.5em 1.5em; + margin: 0; + margin-left: -40px; + border-bottom: 3px solid #006; +} + +div#classHeader a, div#fileHeader a { + background: inherit; + color: white; +} + +div#classHeader td, div#fileHeader td { + background: inherit; + color: white; +} + + +div#fileHeader { + background: #057; +} + +div#classHeader { + background: #048; +} + + +.class-name-in-header { + font-size: 180%; + font-weight: bold; +} + + +div#bodyContent { + padding: 0 1.5em 0 1.5em; +} + +div#description { + padding: 0.5em 1.5em; + background: #efefef; + border: 1px dotted #999; +} + +div#description h1,h2,h3,h4,h5,h6 { + color: #125;; + background: transparent; +} + +div#validator-badges { + text-align: center; +} +div#validator-badges img { border: 0; } + +div#copyright { + color: #333; + background: #efefef; + font: 0.75em sans-serif; + margin-top: 5em; + margin-bottom: 0; + padding: 0.5em 2em; +} + + +/* === Classes =================================== */ + +table.header-table { + color: white; + font-size: small; +} + +.type-note { + font-size: small; + color: #DEDEDE; +} + +.xxsection-bar { + background: #eee; + color: #333; + padding: 3px; +} + +.section-bar { + color: #333; + border-bottom: 1px solid #999; + margin-left: -20px; +} + + +.section-title { + background: #79a; + color: #eee; + padding: 3px; + margin-top: 2em; + margin-left: -30px; + border: 1px solid #999; +} + +.top-aligned-row { vertical-align: top } +.bottom-aligned-row { vertical-align: bottom } + +/* --- Context section classes ----------------------- */ + +.context-row { } +.context-item-name { font-family: monospace; font-weight: bold; color: black; } +.context-item-value { font-size: small; color: #448; } +.context-item-desc { color: #333; padding-left: 2em; } + +/* --- Method classes -------------------------- */ +.method-detail { + background: #efefef; + padding: 0; + margin-top: 0.5em; + margin-bottom: 1em; + border: 1px dotted #ccc; +} +.method-heading { + color: black; + background: #ccc; + border-bottom: 1px solid #666; + padding: 0.2em 0.5em 0 0.5em; +} +.method-signature { color: black; background: inherit; } +.method-name { font-weight: bold; } +.method-args { font-style: italic; } +.method-description { padding: 0 0.5em 0 0.5em; } + +/* --- Source code sections -------------------- */ + +a.source-toggle { font-size: 90%; } +div.method-source-code { + background: #262626; + color: #ffdead; + margin: 1em; + padding: 0.5em; + border: 1px dashed #999; + overflow: hidden; +} + +div.method-source-code pre { color: #ffdead; overflow: hidden; } + +/* --- Ruby keyword styles --------------------- */ + +.standalone-code { background: #221111; color: #ffdead; overflow: hidden; } + +.ruby-constant { color: #7fffd4; background: transparent; } +.ruby-keyword { color: #00ffff; background: transparent; } +.ruby-ivar { color: #eedd82; background: transparent; } +.ruby-operator { color: #00ffee; background: transparent; } +.ruby-identifier { color: #ffdead; background: transparent; } +.ruby-node { color: #ffa07a; background: transparent; } +.ruby-comment { color: #b22222; font-weight: bold; background: transparent; } +.ruby-regexp { color: #ffa07a; background: transparent; } +.ruby-value { color: #7fffd4; background: transparent; } \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/compatibility_stamping_test.rb b/vendor/plugins/userstamp/test/compatibility_stamping_test.rb new file mode 100644 index 0000000..29be528 --- /dev/null +++ b/vendor/plugins/userstamp/test/compatibility_stamping_test.rb @@ -0,0 +1,63 @@ +$:.unshift(File.dirname(__FILE__)) + +require 'helpers/unit_test_helper' +Ddb::Userstamp.compatibility_mode = true +require 'models/user' +require 'models/person' +require 'models/post' +require 'models/comment' + +class CompatibilityStampingTests< Test::Unit::TestCase # :nodoc: + fixtures :people, :comments + + def setup + Person.stamper = @delynn + end + + def test_comment_creation_with_stamped_object + assert_equal @delynn.id, Person.stamper + + comment = Comment.create(:comment => "Test Comment") + assert_equal @delynn.id, comment.created_by + assert_equal @delynn.id, comment.updated_by + assert_equal @delynn, comment.creator + assert_equal @delynn, comment.updater + end + + def test_comment_creation_with_stamped_integer + Person.stamper = 2 + assert_equal 2, Person.stamper + + comment = Comment.create(:comment => "Test Comment - 2") + assert_equal @nicole.id, comment.created_by + assert_equal @nicole.id, comment.updated_by + assert_equal @nicole, comment.creator + assert_equal @nicole, comment.updater + end + + def test_comment_updating_with_stamped_object + Person.stamper = @nicole + assert_equal @nicole.id, Person.stamper + + @first_comment.comment << " - Updated" + @first_comment.save + @first_comment.reload + assert_equal @delynn.id, @first_comment.created_by + assert_equal @nicole.id, @first_comment.updated_by + assert_equal @delynn, @first_comment.creator + assert_equal @nicole, @first_comment.updater + end + + def test_comment_updating_with_stamped_integer + Person.stamper = 2 + assert_equal 2, Person.stamper + + @first_comment.comment << " - Updated" + @first_comment.save + @first_comment.reload + assert_equal @delynn.id, @first_comment.created_by + assert_equal @nicole.id, @first_comment.updated_by + assert_equal @delynn, @first_comment.creator + assert_equal @nicole, @first_comment.updater + end +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/controllers/posts_controller.rb b/vendor/plugins/userstamp/test/controllers/posts_controller.rb new file mode 100644 index 0000000..15af14f --- /dev/null +++ b/vendor/plugins/userstamp/test/controllers/posts_controller.rb @@ -0,0 +1,26 @@ +class PostsController < UserstampController + def edit + @post = Post.find(params[:id]) + render(:inline => "<%= @post.title %>") + end + + def update + @post = Post.find(params[:id]) + @post.update_attributes(params[:post]) + render(:inline => "<%= @post.title %>") + end + + protected + def current_user + Person.find(session[:person_id]) + end + + def set_stamper + Person.stamper = self.current_user + end + + def reset_stamper + Person.reset_stamper + end + #end +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/controllers/users_controller.rb b/vendor/plugins/userstamp/test/controllers/users_controller.rb new file mode 100644 index 0000000..ba204a8 --- /dev/null +++ b/vendor/plugins/userstamp/test/controllers/users_controller.rb @@ -0,0 +1,12 @@ +class UsersController < UserstampController + def edit + @user = User.find(params[:id]) + render(:inline => "<%= @user.name %>") + end + + def update + @user = User.find(params[:id]) + @user.update_attributes(params[:user]) + render(:inline => "<%= @user.name %>") + end +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/controllers/userstamp_controller.rb b/vendor/plugins/userstamp/test/controllers/userstamp_controller.rb new file mode 100644 index 0000000..02c6848 --- /dev/null +++ b/vendor/plugins/userstamp/test/controllers/userstamp_controller.rb @@ -0,0 +1,9 @@ +class UserstampController < ActionController::Base + include Ddb::Controller::Userstamp + + protected + def current_user + User.find(session[:user_id]) + end + #end +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/database.yml b/vendor/plugins/userstamp/test/database.yml new file mode 100644 index 0000000..be1e80e --- /dev/null +++ b/vendor/plugins/userstamp/test/database.yml @@ -0,0 +1,4 @@ +test: + adapter: sqlite3 + database: userstamp_plugin_test.sqlite3 + timeout: 5000 \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/fixtures/comments.yml b/vendor/plugins/userstamp/test/fixtures/comments.yml new file mode 100644 index 0000000..2e426c0 --- /dev/null +++ b/vendor/plugins/userstamp/test/fixtures/comments.yml @@ -0,0 +1,16 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +first_comment: + id: 1 + post_id: 1 + comment: First Comment + created_by: 1 +second_comment: + id: 2 + post_id: 1 + comment: Second Comment + created_by: 2 +third_comment: + id: 3 + post_id: 2 + comment: Third Comment + created_by: 1 \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/fixtures/people.yml b/vendor/plugins/userstamp/test/fixtures/people.yml new file mode 100644 index 0000000..6c6ed0d --- /dev/null +++ b/vendor/plugins/userstamp/test/fixtures/people.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +delynn: + id: 1 + name: DeLynn + creator_id: 1 + updater_id: 1 +nicole: + id: 2 + name: Nicole + creator_id: 2 + updater_id: 2 \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/fixtures/posts.yml b/vendor/plugins/userstamp/test/fixtures/posts.yml new file mode 100644 index 0000000..1abaf82 --- /dev/null +++ b/vendor/plugins/userstamp/test/fixtures/posts.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +first_post: + id: 1 + title: First Post + creator_id: 1 +second_post: + id: 2 + title: Second Post + creator_id: 1 \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/fixtures/users.yml b/vendor/plugins/userstamp/test/fixtures/users.yml new file mode 100644 index 0000000..147baf8 --- /dev/null +++ b/vendor/plugins/userstamp/test/fixtures/users.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +zeus: + id: 1 + name: Zeus +hera: + id: 2 + name: Hera \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/helpers/functional_test_helper.rb b/vendor/plugins/userstamp/test/helpers/functional_test_helper.rb new file mode 100644 index 0000000..4cc597b --- /dev/null +++ b/vendor/plugins/userstamp/test/helpers/functional_test_helper.rb @@ -0,0 +1,37 @@ +$:.unshift(File.dirname(__FILE__) + '/../..') +$:.unshift(File.dirname(__FILE__) + '/../../lib') +schema_file = File.join(File.dirname(__FILE__), '..', 'schema.rb') +ENV["RAILS_ENV"] = "test" +require 'rubygems' +require 'test/unit' +require 'active_support' +require 'active_support/test_case' +require 'active_record' +require 'active_record/fixtures' +require 'action_controller' +require 'action_controller/test_case' +require 'action_controller/test_process' +require 'action_controller/integration' +require 'init' + +config = YAML::load(IO.read(File.join(File.dirname(__FILE__), '..', 'database.yml')))[ENV['DB'] || 'test'] +ActiveRecord::Base.configurations = config +ActiveRecord::Base.establish_connection(config) + +ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/models.log") +ActionController::Base.logger = Logger.new(File.dirname(__FILE__) + "/controllers.log") + +load(schema_file) if File.exist?(schema_file) + +Test::Unit::TestCase.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures') +$:.unshift(Test::Unit::TestCase.fixture_path) + +class Test::Unit::TestCase + # Turn off transactional fixtures if you're working with MyISAM tables in MySQL + self.use_transactional_fixtures = true + + # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david) + self.use_instantiated_fixtures = true + + # Add more helper methods to be used by all tests here... +end diff --git a/vendor/plugins/userstamp/test/helpers/unit_test_helper.rb b/vendor/plugins/userstamp/test/helpers/unit_test_helper.rb new file mode 100644 index 0000000..63fc3c7 --- /dev/null +++ b/vendor/plugins/userstamp/test/helpers/unit_test_helper.rb @@ -0,0 +1,29 @@ +$:.unshift(File.dirname(__FILE__) + '/../..') +$:.unshift(File.dirname(__FILE__) + '/../../lib') +schema_file = File.join(File.dirname(__FILE__), '..', 'schema.rb') + +require 'rubygems' +require 'test/unit' +require 'active_record' +require 'active_record/fixtures' +require 'active_support' +require 'init' + +config = YAML::load(IO.read(File.join(File.dirname(__FILE__), '..', 'database.yml')))[ENV['DB'] || 'test'] +ActiveRecord::Base.configurations = config +ActiveRecord::Base.establish_connection(config) + +load(schema_file) if File.exist?(schema_file) + +Test::Unit::TestCase.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures') +$:.unshift(Test::Unit::TestCase.fixture_path) + +class Test::Unit::TestCase #:nodoc: + # Turn off transactional fixtures if you're working with MyISAM tables in MySQL + self.use_transactional_fixtures = true + + # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david) + self.use_instantiated_fixtures = true + + # Add more helper methods to be used by all tests here... +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/models/comment.rb b/vendor/plugins/userstamp/test/models/comment.rb new file mode 100644 index 0000000..9815aa5 --- /dev/null +++ b/vendor/plugins/userstamp/test/models/comment.rb @@ -0,0 +1,4 @@ +class Comment < ActiveRecord::Base + stampable :stamper_class_name => :person + belongs_to :post +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/models/person.rb b/vendor/plugins/userstamp/test/models/person.rb new file mode 100644 index 0000000..0462fd3 --- /dev/null +++ b/vendor/plugins/userstamp/test/models/person.rb @@ -0,0 +1,3 @@ +class Person < ActiveRecord::Base + model_stamper +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/models/ping.rb b/vendor/plugins/userstamp/test/models/ping.rb new file mode 100644 index 0000000..e460813 --- /dev/null +++ b/vendor/plugins/userstamp/test/models/ping.rb @@ -0,0 +1,7 @@ +class Ping < ActiveRecord::Base + stampable :stamper_class_name => :person, + :creator_attribute => :creator_name, + :updater_attribute => :updater_name, + :deleter_attribute => :deleter_name + belongs_to :post +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/models/post.rb b/vendor/plugins/userstamp/test/models/post.rb new file mode 100644 index 0000000..6644a34 --- /dev/null +++ b/vendor/plugins/userstamp/test/models/post.rb @@ -0,0 +1,4 @@ +class Post < ActiveRecord::Base + stampable :stamper_class_name => :person + has_many :comments +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/models/user.rb b/vendor/plugins/userstamp/test/models/user.rb new file mode 100644 index 0000000..795a4cb --- /dev/null +++ b/vendor/plugins/userstamp/test/models/user.rb @@ -0,0 +1,3 @@ +class User < ActiveRecord::Base + model_stamper +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/schema.rb b/vendor/plugins/userstamp/test/schema.rb new file mode 100644 index 0000000..cbfa8da --- /dev/null +++ b/vendor/plugins/userstamp/test/schema.rb @@ -0,0 +1,56 @@ +ActiveRecord::Schema.define(:version => 0) do + # Users are created and updated by other Users + create_table :users, :force => true do |t| + t.column :name, :string + t.column :creator_id, :integer + t.column :created_on, :datetime + t.column :updater_id, :integer + t.column :updated_at, :datetime + end + + # People are created and updated by Users + create_table :people, :force => true do |t| + t.column :name, :string + t.column :creator_id, :integer + t.column :created_on, :datetime + t.column :updater_id, :integer + t.column :updated_at, :datetime + end + + # Posts are created and updated by People + create_table :posts, :force => true do |t| + t.column :title, :string + t.column :creator_id, :integer + t.column :created_on, :datetime + t.column :updater_id, :integer + t.column :updated_at, :datetime + t.column :deleter_id, :integer + t.column :deleted_at, :datetime + end + + # Comments are created and updated by People + # and also use non-standard foreign keys. + create_table :comments, :force => true do |t| + t.column :post_id, :integer + t.column :comment, :string + t.column :created_by, :integer + t.column :created_at, :datetime + t.column :updated_by, :integer + t.column :updated_at, :datetime + t.column :deleted_by, :integer + t.column :deleted_at, :datetime + end + + # Pings are created and updated by People, + # but they store their foreign keys as strings. + create_table :pings, :force => true do |t| + t.column :post_id, :integer + t.column :ping, :string + t.column :creator_name, :string + t.column :created_at, :datetime + t.column :updater_name, :string + t.column :updated_at, :datetime + t.column :deleter_name, :string + t.column :deleted_at, :datetime + end +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/stamping_test.rb b/vendor/plugins/userstamp/test/stamping_test.rb new file mode 100644 index 0000000..d6850a8 --- /dev/null +++ b/vendor/plugins/userstamp/test/stamping_test.rb @@ -0,0 +1,110 @@ +$:.unshift(File.dirname(__FILE__)) + +require 'helpers/unit_test_helper' +require 'models/user' +require 'models/person' +require 'models/post' +require 'models/comment' + +class StampingTests < Test::Unit::TestCase # :nodoc: + fixtures :users, :people, :posts, :comments + + def setup + User.stamper = @zeus + Person.stamper = @delynn + end + + def test_person_creation_with_stamped_object + assert_equal @zeus.id, User.stamper + + person = Person.create(:name => "David") + assert_equal @zeus.id, person.creator_id + assert_equal @zeus.id, person.updater_id + assert_equal @zeus, person.creator + assert_equal @zeus, person.updater + end + + def test_person_creation_with_stamped_integer + User.stamper = 2 + assert_equal 2, User.stamper + + person = Person.create(:name => "Daniel") + assert_equal @hera.id, person.creator_id + assert_equal @hera.id, person.updater_id + assert_equal @hera, person.creator + assert_equal @hera, person.updater + end + + def test_post_creation_with_stamped_object + assert_equal @delynn.id, Person.stamper + + post = Post.create(:title => "Test Post - 1") + assert_equal @delynn.id, post.creator_id + assert_equal @delynn.id, post.updater_id + assert_equal @delynn, post.creator + assert_equal @delynn, post.updater + end + + def test_post_creation_with_stamped_integer + Person.stamper = 2 + assert_equal 2, Person.stamper + + post = Post.create(:title => "Test Post - 2") + assert_equal @nicole.id, post.creator_id + assert_equal @nicole.id, post.updater_id + assert_equal @nicole, post.creator + assert_equal @nicole, post.updater + end + + def test_person_updating_with_stamped_object + User.stamper = @hera + assert_equal @hera.id, User.stamper + + @delynn.name << " Berry" + @delynn.save + @delynn.reload + assert_equal @zeus, @delynn.creator + assert_equal @hera, @delynn.updater + assert_equal @zeus.id, @delynn.creator_id + assert_equal @hera.id, @delynn.updater_id + end + + def test_person_updating_with_stamped_integer + User.stamper = 2 + assert_equal 2, User.stamper + + @delynn.name << " Berry" + @delynn.save + @delynn.reload + assert_equal @zeus.id, @delynn.creator_id + assert_equal @hera.id, @delynn.updater_id + assert_equal @zeus, @delynn.creator + assert_equal @hera, @delynn.updater + end + + def test_post_updating_with_stamped_object + Person.stamper = @nicole + assert_equal @nicole.id, Person.stamper + + @first_post.title << " - Updated" + @first_post.save + @first_post.reload + assert_equal @delynn.id, @first_post.creator_id + assert_equal @nicole.id, @first_post.updater_id + assert_equal @delynn, @first_post.creator + assert_equal @nicole, @first_post.updater + end + + def test_post_updating_with_stamped_integer + Person.stamper = 2 + assert_equal 2, Person.stamper + + @first_post.title << " - Updated" + @first_post.save + @first_post.reload + assert_equal @delynn.id, @first_post.creator_id + assert_equal @nicole.id, @first_post.updater_id + assert_equal @delynn, @first_post.creator + assert_equal @nicole, @first_post.updater + end +end \ No newline at end of file diff --git a/vendor/plugins/userstamp/test/userstamp_controller_test.rb b/vendor/plugins/userstamp/test/userstamp_controller_test.rb new file mode 100644 index 0000000..74767a3 --- /dev/null +++ b/vendor/plugins/userstamp/test/userstamp_controller_test.rb @@ -0,0 +1,118 @@ +$:.unshift(File.dirname(__FILE__)) + +require 'helpers/functional_test_helper' +require 'controllers/userstamp_controller' +require 'controllers/users_controller' +require 'controllers/posts_controller' +require 'models/user' +require 'models/person' +require 'models/post' +require 'models/comment' + +ActionController::Routing::Routes.draw do |map| + map.connect ':controller/:action/:id' +end + +class PostsControllerTest < Test::Unit::TestCase + fixtures :users, :people, :posts, :comments + + def setup + @controller = PostsController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + def test_update_post + @request.session = {:person_id => 1} + post :update, :id => 1, :post => {:title => 'Different'} + assert_response :success + assert_equal 'Different', assigns["post"].title + assert_equal @delynn, assigns["post"].updater + end + + def test_update_with_multiple_requests + @request.session = {:person_id => 1} + get :edit, :id => 2 + assert_response :success + + simulate_second_request + + post :update, :id => 2, :post => {:title => 'Different'} + assert_response :success + assert_equal 'Different', assigns["post"].title + assert_equal @delynn, assigns["post"].updater + end + + def simulate_second_request + @second_controller = PostsController.new + @second_request = ActionController::TestRequest.new + @second_response = ActionController::TestResponse.new + @second_response.session = {:person_id => 2} + + @second_request.env['REQUEST_METHOD'] = "POST" + @second_request.action = 'update' + + parameters = {:id => 1, :post => {:title => 'Different Second'}} + @second_request.assign_parameters(@second_controller.class.controller_path, 'update', parameters) + @second_request.session = ActionController::TestSession.new(@second_response.session) + + options = @second_controller.send!(:rewrite_options, parameters) + options.update(:only_path => true, :action => 'update') + + url = ActionController::UrlRewriter.new(@second_request, parameters) + @second_request.set_REQUEST_URI(url.rewrite(options)) + @second_controller.process(@second_request, @second_response) + + assert_equal @nicole, @second_response.template.instance_variable_get("@post").updater + end +end + +class UsersControllerTest < Test::Unit::TestCase + fixtures :users, :people, :posts, :comments + + def setup + @controller = UsersController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + def test_update_user + @request.session = {:user_id => 2} + post :update, :id => 2, :user => {:name => 'Different'} + assert_response :success + assert_equal 'Different', assigns["user"].name + assert_equal @hera, assigns["user"].updater + end + + def test_update_with_multiple_requests + @request.session = {:user_id => 2} + get :edit, :id => 2 + assert_response :success + + simulate_second_request + end + + def simulate_second_request + @second_controller = UsersController.new + @second_request = ActionController::TestRequest.new + @second_response = ActionController::TestResponse.new + @second_response.session = {:user_id => 1} + + @second_request.env['REQUEST_METHOD'] = "POST" + @second_request.action = 'update' + + parameters = {:id => 2, :user => {:name => 'Different Second'}} + @second_request.assign_parameters(@second_controller.class.controller_path, 'update', parameters) + + @second_request.session = ActionController::TestSession.new(@second_response.session) + + options = @second_controller.send!(:rewrite_options, parameters) + options.update(:only_path => true, :action => 'update') + + url = ActionController::UrlRewriter.new(@second_request, parameters) + @second_request.set_REQUEST_URI(url.rewrite(options)) + @second_controller.process(@second_request, @second_response) + + assert_equal @zeus, @second_response.template.instance_variable_get("@user").updater + end +end \ No newline at end of file From a39bcb8b92c23d6b416b1c8dc92db2b5835df81f Mon Sep 17 00:00:00 2001 From: Josh Adams Date: Wed, 7 Jan 2009 22:50:51 -0600 Subject: [PATCH 5/7] fixed a couple of warnings for page and pageplugin controllers --- app/controllers/admin/page_plugins_controller.rb | 2 +- app/controllers/admin/pages_controller.rb | 2 +- public/themes/knewter/stylesheets/base.css | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/page_plugins_controller.rb b/app/controllers/admin/page_plugins_controller.rb index 0e923bf..84fccb9 100644 --- a/app/controllers/admin/page_plugins_controller.rb +++ b/app/controllers/admin/page_plugins_controller.rb @@ -48,7 +48,7 @@ def destroy def move_up @page_plugin.move_higher flash[:notice] = "Plugin was moved up by one" - redirect_to edit_admin_page_path @page_plugin.page + redirect_to edit_admin_page_path(@page_plugin.page) end def move_down diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index bafeaea..65fe2e4 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -38,7 +38,7 @@ def update @page_id = @page.id render :update do |page| page << "notify('Page has been updated');" - page[:sidebar].update (render :partial => 'admin/pages/edit_sidebar') + page[:sidebar].update(render(:partial => 'admin/pages/edit_sidebar')) page.call "ToggleContentBox.handle_toggle_content_boxes" end else diff --git a/public/themes/knewter/stylesheets/base.css b/public/themes/knewter/stylesheets/base.css index be2ef93..1f8e2fc 100644 --- a/public/themes/knewter/stylesheets/base.css +++ b/public/themes/knewter/stylesheets/base.css @@ -8,9 +8,12 @@ body{ #content_wrapper{ width: 920px; margin: 0 auto; + line-height: 145%; } #header h1{ font-size: 300%; + line-height: 100%; + margin-top: .25em; } #navigation{ width: 850px; @@ -74,5 +77,9 @@ body{ .blog_post h2{ color: black; font-size: 150%; +} +.blog_post h3.supplemental{ + font-size: 75%; margin-bottom: 10px; +} /* End Blog Posts */ From 9a725ed3a500a0fcd427852cfbbf240ce235e3d7 Mon Sep 17 00:00:00 2001 From: Josh Adams Date: Wed, 7 Jan 2009 23:09:17 -0600 Subject: [PATCH 6/7] got userstamp working --- app/controllers/application.rb | 1 + app/models/user.rb | 4 ++++ config/environment.rb | 2 +- vendor/plugins/ansuz_blog/app/models/blog_post.rb | 4 +++- .../ansuz_blog/app/views/articles/_article.html.erb | 2 +- .../db/migrate/003_add_userstamp_to_blog_posts.rb | 13 +++++++++++++ 6 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 vendor/plugins/ansuz_blog/db/migrate/003_add_userstamp_to_blog_posts.rb diff --git a/app/controllers/application.rb b/app/controllers/application.rb index c4f4d2c..2ba90b0 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -1,6 +1,7 @@ class ApplicationController < ActionController::Base include AuthenticatedSystem include SiteSettingsHelper + include Userstamp before_filter :login_from_cookie, :setup_plugin_nav, :set_layout_variables, :load_menu around_filter :inhibit_retardase diff --git a/app/models/user.rb b/app/models/user.rb index a212726..793d343 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -24,6 +24,10 @@ class User < ActiveRecord::Base # authorization plugin acts_as_authorized_user + # userstamp plugin + model_stamper + stampable + # Virtual attribute for the unencrypted password attr_accessor :password diff --git a/config/environment.rb b/config/environment.rb index 9545067..8a4249e 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -51,7 +51,7 @@ # Only load the plugins named here, in the order given. By default, all plugins # in vendor/plugins are loaded in alphabetical order. # :all can be used as a placeholder for all plugins not explicitly named - config.plugins = [ :has_settings, :stringex, :all ] + config.plugins = [ :has_settings, :stringex, :userstamp, :all ] # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) diff --git a/vendor/plugins/ansuz_blog/app/models/blog_post.rb b/vendor/plugins/ansuz_blog/app/models/blog_post.rb index 03c9780..81b73cc 100644 --- a/vendor/plugins/ansuz_blog/app/models/blog_post.rb +++ b/vendor/plugins/ansuz_blog/app/models/blog_post.rb @@ -3,9 +3,11 @@ module JAdams class BlogPost < ActiveRecord::Base acts_as_taggable acts_as_url :title + stampable + validates_uniqueness_of :url - belongs_to :author, :class_name => "User", :foreign_key => 'created_by' + #belongs_to :author, :class_name => "User", :foreign_key => 'created_by' has_many :blog_comments, :class_name => "Ansuz::JAdams::BlogComment", :order => "created_at DESC" def edit_path diff --git a/vendor/plugins/ansuz_blog/app/views/articles/_article.html.erb b/vendor/plugins/ansuz_blog/app/views/articles/_article.html.erb index 0e1ff8b..ef42d7e 100644 --- a/vendor/plugins/ansuz_blog/app/views/articles/_article.html.erb +++ b/vendor/plugins/ansuz_blog/app/views/articles/_article.html.erb @@ -1,6 +1,6 @@

      <%=h article.title -%>

      -

      Posted on <%= article.created_at.strftime("%B %e, %Y") %> by <%= article.author.login %>.

      +

      Posted on <%= article.created_at.strftime("%B %e, %Y") %> by <%= article.creator.login %>.

      <%= article.contents -%>
      diff --git a/vendor/plugins/ansuz_blog/db/migrate/003_add_userstamp_to_blog_posts.rb b/vendor/plugins/ansuz_blog/db/migrate/003_add_userstamp_to_blog_posts.rb new file mode 100644 index 0000000..0ee4787 --- /dev/null +++ b/vendor/plugins/ansuz_blog/db/migrate/003_add_userstamp_to_blog_posts.rb @@ -0,0 +1,13 @@ +class AddUserstampToBlogPosts < ActiveRecord::Migration + def self.up + %w(creator updater deleter).each do |field| + add_column :blog_posts, "#{field}_id", :integer + end + end + + def self.down + %w(creator updater deleter).each do |field| + remove_column :blog_posts, "#{field}_id" + end + end +end From da0c7b98527a26393998c65ee441ce23bf2a1483 Mon Sep 17 00:00:00 2001 From: Josh Adams Date: Thu, 8 Jan 2009 19:32:06 -0600 Subject: [PATCH 7/7] added files necessary to run google friendconnect --- public/canvas.html | 114 ++++++++++++++++++++++++++++++++++++++++++ public/rpc_relay.html | 1 + 2 files changed, 115 insertions(+) create mode 100644 public/canvas.html create mode 100644 public/rpc_relay.html diff --git a/public/canvas.html b/public/canvas.html new file mode 100644 index 0000000..ab642d0 --- /dev/null +++ b/public/canvas.html @@ -0,0 +1,114 @@ + + + + + + + +
      + + + + + +
      + + +
      + + \ No newline at end of file diff --git a/public/rpc_relay.html b/public/rpc_relay.html new file mode 100644 index 0000000..c602043 --- /dev/null +++ b/public/rpc_relay.html @@ -0,0 +1 @@ + \ No newline at end of file