Git Product home page Git Product logo

page_versioning's Introduction

WARNING!!! For the RadiantCMS < v0.7.0 please use 0.6.9 tag, for the RadiantCMS v0.7.x use 0.7 tag.

== Page Versioning
 
This extension creates versioning for pages, snippets and layouts.
 
== Features:
 
 * All revisions are saved in separate tables, without affecting the 'pages', 
   'layouts' and 'snippets' tables.
 * Pages save their state with page parts.
 * You can set the fields you want to version in a config file.
   (vendor/extensions/page_versioning/config/config.yml)
 
== Installation
 
(from the radiant application root)
  
  git clone git://github.com/astashov/page_versioning.git vendor/extensions/page_versioning
  rake RAILS_ENV=production db:migrate:extensions
 
== Configuration
 
When you update any of the fields on Pages, Layouts or Snippets, they will create a new
revision.
This behavior can be configured in vendor/extensions/page_versioning/config/config.yml
 
There are two types of settings:
1. something_attributes - if user changes this attribute, new revision will be 
   created
2. something_specific_attributes - these attributes will not be replaced by 
   revisioned attributes after initializing
 
== Using the extension
 
To enable versioning you should install the plugin. Then, when you add changes to a Page, Snippet or Layout,
there will be 3 additional controls:
 
1. Revision select box - you can change revision you want to see.
2. Published revision select box - you can set what revision you want to use as 
   published. Published revision will be shown to visitors. You can set publish
   new revision by default or not in vendor/extensions/page_versioning/config/config.yml
3. Preview button - if you want to look at changes, but don't want to publish 
   them, you can press the Preview button. A new revision will be created, and you will
   be redirected to the homepage where you can see your changes, but this revision will not
   be published and visitors will not see your changes.
 
On the Snippet Edit Page or Layout Edit Page, you can see the Preview button with its select box. To preview a
snippet, the snippet should be inserted in a Layout or Page Part. With the select box
you can select a page or layout and preview changes of that snippet in the selected page/layout.
The same goes for layouts -- you can preview the changes by specifying the page to use for viewing.
 
== Screenshots

Here you can see screenshot of the plugin: http://astashov.net/images/radiant_page_versioning.png

== Additional info
 
Sometimes you might need to disable the after_initialize hook, which changes attributes 
to attributes of published revision. You can do this by setting a flag 
PageVersioning.enable_versioning = false (default is false for testing environment,
others are true).

== Bugreporting

Please, post bugs on Github Issues tracker: http://github.com/astashov/page_versioning/issues
 
== Authors and Credits
 
Written by Anton Astashov, with Brenton Cheng, for Astrology.com (a division of iVillage Inc.)

page_versioning's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

page_versioning's Issues

Extension does not work with Radiant 0.8.0

Hi,

There are a couple of issues with the page_versioning plugin with Radiant 0.8.0.

Firstly, Rails no longer uses 'application.rb' so the require in page_versioning_extension needs to be for 'application_controller'. This was the easiest issue to resolve.

Once 'application_controller' is required the migration works fine and when I create a page everything works as it should, I see the revision controls at the top. However, if I try to edit a page I get a 500 error and the following trace is outputted in the production log.

    Processing Admin::PagesController#edit (for 76.9.192.146 at 2009-08-11 11:11:12) [GET]
      Parameters: {"action"=>"edit", "id"=>"18", "controller"=>"admin/pages"}
    Rendering template within layouts/application
    Rendering admin/pages/edit
    Completed in 264ms (View: 256, DB: 4) | 200 OK [http://dev.fatbox.ca/admin/pages/18/edit]


    Processing Admin::PagesController#update (for 76.9.192.146 at 2009-08-11 11:11:20) [PUT]
      Parameters: {"commit"=>"Save Changes", "action"=>"update", "_method"=>"put", "authenticity_token"=>"2G0dsl4sv8/T6IJCGqPO65F1ryEcjLHsh08b4J3Dg1Y=", "id"=>"18", "page"=>{"class_name"=>"", "slug"=>"test", "parts"=>[{"id"=>"34"}, {"id"=>"35"}], "title"=>"Test", "parts_attributes"=>{"0"=>{"name"=>"body", "filter_id"=>"", "_delete"=>"false", "id"=>"34", "content"=>"Test"}, "1"=>{"name"=>"extended", "filter_id"=>"", "_delete"=>"false", "id"=>"35", "content"=>""}}, "lock_version"=>"0", "breadcrumb"=>"Test", "parent_id"=>"1", "published_revision_number"=>"0", "status_id"=>"100", "description"=>"", "layout_id"=>"", "keywords"=>""}, "controller"=>"admin/pages"}

    ActiveRecord::AssociationTypeMismatch (PagePart(#-78810898) expected, got HashWithIndifferentAccess(#-76176928)):
      radiant (0.8.0) app/controllers/admin/resource_controller.rb:65:in `update_without_preview'
      vendor/extensions/page_versioning/lib/page_versioning/resource_controller_extensions.rb:20:in `update'
      radiant (0.8.0) vendor/plugins/haml/rails/./lib/sass/plugin/rails.rb:19:in `process'
      /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:91:in `process_request'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:206:in `main_loop'
      /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:376:in `start_request_handler'
      /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:334:in `handle_spawn_application'
      /usr/lib/ruby/1.8/phusion_passenger/utils.rb:182:in `safe_fork'
      /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:332:in `handle_spawn_application'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:351:in `__send__'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:351:in `main_loop'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:195:in `start_synchronously'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:162:in `start'
      /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
      /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:261:in `spawn_rails_application'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
      /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
      /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:254:in `spawn_rails_application'
      /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:153:in `spawn_application'
      /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:286:in `handle_spawn_application'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:351:in `__send__'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:351:in `main_loop'
      /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:195:in `start_synchronously'
      /usr/lib/phusion_passenger/passenger-spawn-server:61

Let me know if you need anymore info.

Page Parts missing

Installed page_versioning extension with Radiant 0.9.1, page parts disappear after making versioned changes. Problem persists after using "script/extension uninstall page_versioning".

Add page_part_id to page_part_revision_specific_attributes (at least in 0.8)

This originally came up while trying to get digitalpulp's 0.8 branch to work, but it may be applicable here too. There, page_part_revisions has a page_part_id column. Since the default config does not exclude it as a revision-specific attribute, it causes explosions when loading PageParts:

ActiveRecord::UnknownAttributeError: unknown attribute: page_part_id
from /opt/local/lib/ruby/gems/1.8/gems/radiant-0.8.0/vendor/rails/activerecord/lib/active_record/base.rb:2745:in attributes=' from /opt/local/lib/ruby/gems/1.8/gems/radiant-0.8.0/vendor/rails/activerecord/lib/active_record/base.rb:2741:ineach'
from /opt/local/lib/ruby/gems/1.8/gems/radiant-0.8.0/vendor/rails/activerecord/lib/active_record/base.rb:2741:in attributes=' from .../can_has_version/vendor/extensions/page_versioning/lib/page_versioning/common_revision_extensions.rb:29:inset_to_revision'
from .../can_has_version/vendor/extensions/page_versioning/lib/page_versioning/page_part_extensions.rb:13:in after_initialize' from /opt/local/lib/ruby/gems/1.8/gems/radiant-0.8.0/vendor/rails/activerecord/lib/active_record/callbacks.rb:347:insend'

textarea doesn't update with selected version

I just upgraded my site from 0.7.1 - 0.8.1 and upgraded page_versioning as well. (rake db:migrate:extensions)

It runs now without error, but when I select an old version and click "switch", the page refreshes, the revision number at the top is the correct one, it also says "This is not the published version", but all the page parts are still the latest version.

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.