comatose 2.0.1 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,22 @@
1
+ - version: 2.0.5 (beta)
2
+ - Added configuration option for importing/exporting pages from admin: `config.allow_import_export = true|false`, `true` is the default at the moment
3
+ - Reworked the UI for import/export a little bit
4
+ - Added LINK option to `test_harness` rake task to symlink the comatose plugin directory instead of copying it
5
+ - Updated manifest and gemspec
6
+
7
+ - version: 2.0.4 (beta)
8
+ - Added a rake task to generate a test_harness (for use in development). From the comatose directory, run: `rake test_harness TARGET=../comatose_test_harness`. This will create an empty rails app, copy this working folder over to vendor/plugins/comatose, install acts_as_list and acts_as_tree, and run any setup needed, like script/generate comatose_migration and rake db:migrate.
9
+ - Bugfix in tasks/comatose.rake
10
+ - Comatose migration generator now adds the default comatose routes (`map.comatose_admin` and `map.comatose_root ''`) to the top of the routes.rb file. POSSIBLE GOTCHA: `map.comatose_root` should be moved to the bottom of the routes file!
11
+
12
+ - version: 2.0.3 (beta)
13
+ - Moving from alpha to beta!
14
+ - staugaard: Added import and export of pages in admin controller
15
+
16
+ - version: 2.0.2 (alpha)
17
+ - staugaard: Added "unloadable" to ComatoseController (problems with ActsAsAuthenticated-integration similar to http://tinyurl.com/6caz5r)
18
+ - jcnetdev: Tweaking gemspec
19
+
1
20
  - version: 2.0.1 (alpha)
2
21
  - Merged changes from andreas (http://github.com/andreas)...
3
22
  - andreas: Fixed comatose:admin:customize raketask (seems plugin_path was wrong, and made use of mkdir_p to avoid "File exists"-errors.)
data/INSTALL CHANGED
@@ -3,17 +3,18 @@
3
3
  Welcome to Comatose!
4
4
  ======================
5
5
 
6
+ Be sure and install the acts_as_tree and acts_as_list plugins!
7
+
6
8
  From here you'll want to run:
7
9
 
8
10
  $ ./script/generate comatose_migration
11
+
12
+ NOTE: The generator will add the default comatose routes to the top of your routes.rb file. You'll want to move `map.comatose_root ''` to the bottom of your routes block.
9
13
 
10
14
  When that's finished, run:
11
15
 
12
16
  $ rake db:migrate
13
17
 
14
- That's it for the Comatose setup! Now just add the following line to the bottom of your config/routes.rb file:
15
-
16
- map.comatose_admin
17
- map.comatose_root ''
18
+ That's it for the Comatose setup!
18
19
 
19
20
  Be sure to read the README file, and the 'Getting Started' guide. They are located at vendor/plugins/comatose/README and http://comatose.rubyforge.org/getting-started-guide respectively.
data/MANIFEST CHANGED
@@ -55,7 +55,7 @@ LICENSE
55
55
  MANIFEST
56
56
  rails/init.rb
57
57
  Rakefile
58
- README.rdoc
58
+ README.markdown
59
59
  resources/layouts/comatose_admin_template.html.erb
60
60
  resources/public/images/collapsed.gif
61
61
  resources/public/images/expanded.gif
data/README.markdown ADDED
@@ -0,0 +1,159 @@
1
+ # Comatose
2
+
3
+ * Version: 2.0.5 (beta)
4
+ * Author: M@ McCray
5
+ * Website: comatose.rubyforge.org
6
+ * Email: matt at elucidata dot net
7
+
8
+
9
+ *Comatose* is a micro CMS designed for being embedded into existing Rails
10
+ applications.
11
+
12
+ It's intended for simple CMS support. Comatose supports
13
+
14
+ * Nested pages
15
+ * Versioning
16
+ * Page markup in Textile, Markdown, RDoc, or easily add your own
17
+ * Page processing through Liquid or ERb
18
+ * Generators for easy installation/migration
19
+ * Completely self-contained within plugin folder
20
+
21
+ It's meant to be lean, mean, easily embedded, and easy to re-skin for
22
+ existing applications. If you need something more, I would recommend
23
+ looking into Radiant.
24
+
25
+ For more information, see the [Getting Started][] guide.
26
+
27
+ ### Requirements
28
+
29
+ * Rails 2+ (2.1)
30
+ * `acts_as_list` and `acts_as_tree` plugins are required (at the moment)
31
+
32
+
33
+ ### Development Notes
34
+
35
+ *NOTE*: This is an active branch of Comatose that is built specifically for Rails 2.1.
36
+ I will *probably* remove any legacy support.
37
+
38
+ * Make comatose fully self-contained, which means removing `acts_as_(tree|list)`
39
+ * Improve `ComatoseAdminController` to reduce number of DB calls for building the page tree
40
+ * Move to gem plugin
41
+ * `Comatose.configure` needs to be an initializer (update docs)
42
+ * Go through bugs on 1x branch from google code and ensure they are fixed
43
+ * Give access to all the default rails helpers to Comatose Pages by default?
44
+ * UI refresh (nothing major, just some cleanup).
45
+ * RESTful goodness.
46
+ * Support XML/JSON responses from `ComatoseController` and `ComatoseAdminController`.
47
+ * Support for static rendering (for generating sites like this blog).
48
+
49
+ ### Installation
50
+
51
+ *Note*: See the 'Upgrading' section if you already have an older version of
52
+ the comatose plugin installed.
53
+
54
+ $ ./script/plugin install git://github.com/darthapo/comatose.git
55
+ $ ./script/generate comatose_migration
56
+ $ rake db:migrate
57
+
58
+ Open your `routes.rb` and move the following comatose route to the
59
+ bottom:
60
+
61
+ map.comatose_root ''
62
+
63
+ That's it, you're ready to go! You should be able to browse to
64
+ http://127.0.0.1:3000/**comatose_admin** and start adding pages to your CMS.
65
+ Browsing to http://127.0.0.1:3000/ will render your comatose pages if
66
+ routing doesn't match any of your controllers.
67
+
68
+
69
+ ### Upgrading
70
+
71
+ *NOTE*: This is an experimental 2.0 branch, so upgrading is possible at
72
+ the moment, but these instructions may not work for much longer.
73
+
74
+ If you are upgrading from an older version of Comatose (version 0.3,
75
+ 0.4, 0.5, or 0.6), then you will need to re-install the comatose
76
+ plugin and run:
77
+
78
+ $ ./script/plugin remove comatose
79
+ $ ./script/plugin install comatose
80
+ $ ./script/generate comatose_migration --upgrade --from=VERSION
81
+ $ rake migrate
82
+
83
+ *Note*: Be sure to set the `--from` parameter to the version of
84
+ Comatose you last had installed. Also, you only need to first two digits,
85
+ including the dot, of the version you are upgrading from. For example, if
86
+ you're upgrading from version 0.6.9 you can use:
87
+
88
+ $ ./script/generate comatose_migration --upgrade --from=0.6
89
+
90
+ This will create the upgrade migration(s) for you. It just adds the new
91
+ fields, so you can keep the original migration comatose created.
92
+
93
+
94
+ ### Configuration
95
+
96
+ You configure Comatose in your `config/environment.rb` file. Here is an example
97
+ configuration block:
98
+
99
+ Comatose.configure do |config|
100
+ # Sets the text in the Admin UI's title area
101
+ config.admin_title = "Site Content"
102
+ config.admin_sub_title = "Content for the rest of us..."
103
+ end
104
+
105
+ Here's an example that uses the `AuthenticationSystem` as generated by the
106
+ `restful_authentication` plugin:
107
+
108
+ Comatose.configure do |config|
109
+ # Includes AuthenticationSystem in the ComatoseController
110
+ config.includes << :authenticated_system
111
+
112
+ # admin
113
+ config.admin_title = "Comatose - TESTING"
114
+ config.admin_sub_title = "Content for the rest of us..."
115
+
116
+ # Includes AuthenticationSystem in the ComatoseAdminController
117
+ config.admin_includes << :authenticated_system
118
+
119
+ # Calls :login_required as a before_filter
120
+ config.admin_authorization = :login_required
121
+ # Returns the author name (login, in this case) for the current user
122
+ config.admin_get_author do
123
+ current_user.login
124
+ end
125
+ end
126
+
127
+
128
+ ### Extra Credit
129
+
130
+ This plugin includes the work of many wonderful contributors to the Railsphere.
131
+ Following are the specific libraries that are distributed with Comatose. If I've
132
+ missed someone/something please let me know.
133
+
134
+ * [Liquid][] by [Tobias Luetke][]
135
+ * [RedCloth][] by [_why][]
136
+ * [Acts as Versioned][] by [Rick Olsen][]
137
+ * [Behaviors][] by Atomic Object LLC -- very nice BDD-like testing library
138
+
139
+ ### Feedback
140
+
141
+ I’ve released Comatose under the MIT license. Which basically means you
142
+ can use it however you want.
143
+
144
+ Don't forget to read the [Getting Started][] guide located on the RubyForge
145
+ project site.
146
+
147
+ If you like it, hate it, or have some ideas for new features, let me know!
148
+
149
+ matt at elucidata dot net
150
+
151
+
152
+ [Getting Started]: http://comatose.rubyforge.org/getting-started-guide
153
+ [Liquid]: http://home.leetsoft.com/liquid
154
+ [Tobias Luetke]: http://blog.leetsoft.com
155
+ [RedCloth]: http://whytheluckystiff.net/ruby/redcloth
156
+ [_why]: http://whytheluckystiff.net
157
+ [Acts as Versioned]: http://ar-versioned.rubyforge.org
158
+ [Rick Olsen]: http://weblog.techno-weenie.net
159
+ [Behaviors]: http://behaviors.rubyforge.org
data/Rakefile CHANGED
@@ -77,7 +77,7 @@ EOGS
77
77
  puts "Update GEMSPEC"
78
78
  end
79
79
 
80
- desc "Builds the admin costumizable layout, the embedded layout have the JS and CSS inlined"
80
+ desc "Builds the admin customizable layout, the embedded layout have the JS and CSS inlined"
81
81
  task :build do
82
82
  require 'erb'
83
83
 
@@ -120,3 +120,57 @@ task :build do
120
120
  # That's it -- we're done.
121
121
  puts "Finished."
122
122
  end
123
+
124
+
125
+ desc "Creates an empty rails application for use as a test harness"
126
+ task :test_harness do
127
+ target = ENV['TARGET']
128
+ sym_link = (ENV['LINK'].to_s == 'true')
129
+ if target.nil?
130
+ puts "You must specify a TARGET for the test harness"
131
+ exit(1)
132
+ else
133
+ target = File.expand_path target
134
+ if target == File.expand_path(File.dirname(__FILE__))
135
+ puts "You must specify a folder other than this one."
136
+ exit(1)
137
+ end
138
+ end
139
+ comatose_plugin_path = target / 'vendor' / 'plugins' / 'comatose'
140
+
141
+ puts "Creating test harness at #{ target }"
142
+ run_sh "rails -d sqlite3 #{target}"
143
+ if sym_link
144
+ run_sh "ln -s #{ File.dirname(__FILE__) } #{ comatose_plugin_path }"
145
+ else
146
+ run_sh "cp -r #{ File.dirname(__FILE__) }/ #{ comatose_plugin_path }"
147
+ end
148
+ run_sh "ruby #{ comatose_plugin_path / 'install.rb' }"
149
+ run_sh "ruby #{ target / 'script' / 'generate' } comatose_migration"
150
+ run_sh "ruby #{ comatose_plugin_path / 'bin' / 'comatose' } --plugin #{ target }"
151
+ run_sh "cd #{ target } && rake db:migrate"
152
+
153
+ run_sh "cp #{ target / 'db' / 'development.sqlite3' } #{target / 'db' / 'test.sqlite3'}"
154
+ run_sh "rm #{ target / 'public' / 'index.html' }"
155
+ run_sh "cp #{ comatose_plugin_path / 'views' / 'layouts' / 'comatose_content.html.erb' } #{ target / 'app' / 'views' / 'layouts' / 'comatose_content.html.erb' }"
156
+
157
+ # Remove me soon!
158
+ run_sh "cd #{ target } && ruby #{ target / 'script' / 'plugin' } install acts_as_tree"
159
+ run_sh "cd #{ target } && ruby #{ target / 'script' / 'plugin' } install acts_as_list"
160
+
161
+ puts "Done."
162
+ end
163
+
164
+ class String
165
+ def /(str)
166
+ File.join(self, str)
167
+ end
168
+ end
169
+
170
+ def run_sh(command)
171
+ puts "-------------------------------------------------------------------------------"
172
+ puts "Running `#{command}`:"
173
+ sh command
174
+ puts
175
+ puts
176
+ end
data/about.yml CHANGED
@@ -3,5 +3,5 @@ summary: A micro CMS for embedding in Rails applications.
3
3
  homepage: http://comatose.rubyforge.org
4
4
  plugin: git://github.com/darthapo/comatose.git
5
5
  license: MIT
6
- version: 2.0.1
6
+ version: 2.0.5
7
7
  rails_version: 2+
data/bin/comatose CHANGED
@@ -13,21 +13,21 @@ begin
13
13
 
14
14
  opts.on("-g", "--gem", "Initialize to run from gem (DEFAULT)") do |s|
15
15
  options[:action] = :gem
16
- puts "GEM"
16
+ puts "Configuring to run from GEM..."
17
17
  end
18
18
 
19
19
  opts.on("-p", "--plugin", "Install as plugin") do |s|
20
20
  options[:action] = :plugin
21
- puts "PLUGIN"
21
+ puts "Configuring to run from PLUGIN..."
22
22
  end
23
23
 
24
- opts.on("-u", "--update", "Update current installation (CURRENTLY UNIMPLEMENTED)") do |s|
25
- options[:action] = :update
26
- puts "UPDATE"
27
- end
24
+ # opts.on("-u", "--update", "Update current installation (CURRENTLY UNIMPLEMENTED)") do |s|
25
+ # options[:action] = :update
26
+ # puts "UPDATE"
27
+ # end
28
28
 
29
29
  opts.separator ""
30
- opts.separator "Common options:"
30
+ opts.separator "Common options:"
31
31
 
32
32
  # No argument, shows at tail. This will print an options summary.
33
33
  # Try it and see!
@@ -71,34 +71,37 @@ comatose_initializer_path = RAILS_ROOT / 'config' / 'initializers' / 'comatose.r
71
71
  unless File.exists?( comatose_initializer_path )
72
72
  File.open(comatose_initializer_path, 'w') do |f|
73
73
  f.write <<-EOT
74
- require 'comatose'
75
-
76
- # 1.) You should add the following snippet to your environment.rb too, probably...
77
- #
78
- # gem 'comatose'
79
- #
80
- # 2.) Following is an example configuration block for Comatose:
81
- #
82
- Comatose.configure do |config|
83
- # Includes AuthenticationSystem in the ComatoseController
84
- #config.includes << :authenticated_system
85
-
86
- # admin
87
- #config.admin_title = "My Content"
88
- #config.admin_sub_title = "Content for the rest of us..."
89
-
90
- # Includes AuthenticationSystem in the ComatoseAdminController
91
- #config.admin_includes << :authenticated_system
92
-
93
- # Calls :login_required as a before_filter
94
- #config.admin_authorization = :login_required
95
- # Returns the author name (login, in this case) for the current user
96
- #config.admin_get_author do
97
- # current_user.login
98
- #end
99
-
100
- # See the getting started guide at http://comatose.rubyforge.org for more...
101
- end
74
+ require 'comatose'
75
+
76
+ # 1.) You should add the following snippet to your environment.rb too, probably...
77
+ #
78
+ # gem 'comatose'
79
+ #
80
+ # 2.) Following is an example configuration block for Comatose:
81
+ #
82
+ Comatose.configure do |config|
83
+ # Includes AuthenticationSystem in the ComatoseController
84
+ #config.includes << :authenticated_system
85
+
86
+ # admin
87
+ #config.admin_title = "My Content"
88
+ #config.admin_sub_title = "Content for the rest of us..."
89
+
90
+ # Includes AuthenticationSystem in the ComatoseAdminController
91
+ #config.admin_includes << :authenticated_system
92
+
93
+ # Calls :login_required as a before_filter
94
+ #config.admin_authorization = :login_required
95
+ # Returns the author name (login, in this case) for the current user
96
+ #config.admin_get_author do
97
+ # current_user.login
98
+ #end
99
+
100
+ # Allows users to import and export pages (in YAML format)
101
+ #config.allow_import_export = true
102
+
103
+ # See the getting started guide at http://comatose.rubyforge.org for more...
104
+ end
102
105
  EOT
103
106
  end
104
107
  else
data/comatose.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  # Generated on Tue May 20 20:13:12 -0500 2008
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "comatose"
4
- s.version = "2.0.1"
5
- s.date = "2008-09-15" # 2008-05-20
4
+ s.version = "2.0.5"
5
+ s.date = "2008-10-31" # 2008-05-20
6
6
  s.summary = "Micro CMS designed for being embedded into existing Rails applications"
7
7
  s.email = "matt@elucidata.net"
8
8
  s.rubyforge_project = 'comatose'
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  "INSTALL",
18
18
  "LICENSE",
19
19
  "MANIFEST",
20
- "README.rdoc",
20
+ "README.markdown",
21
21
  "Rakefile",
22
22
  "SPECS",
23
23
  "about.yml",
@@ -107,7 +107,7 @@ Gem::Specification.new do |s|
107
107
  "test/unit/processing_context_test.rb",
108
108
  "test/unit/text_filters_test.rb"]
109
109
 
110
- s.rdoc_options = ["--main", "README.rdoc"]
111
- s.extra_rdoc_files = %w(README.rdoc CHANGELOG SPECS LICENSE)
110
+ s.rdoc_options = ["--main", "README.markdown"]
111
+ s.extra_rdoc_files = %w(README.markdown CHANGELOG SPECS LICENSE)
112
112
  #s.add_dependency("mime-types", ["> 0.0.0"])
113
113
  end
@@ -1,3 +1,15 @@
1
+ class Rails::Generator::Commands::Create
2
+ def new_route(name, options='')
3
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
4
+ logger.route "map.#{name} #{options}"
5
+ unless options[:pretend]
6
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
7
+ "#{match}\n map.#{name} #{options}\n"
8
+ end
9
+ end
10
+ end
11
+ end
12
+
1
13
  class ComatoseMigrationGenerator < Rails::Generator::Base
2
14
 
3
15
 
@@ -38,6 +50,8 @@ class ComatoseMigrationGenerator < Rails::Generator::Base
38
50
  case @mode
39
51
  when :new
40
52
  m.migration_template 'migration.rb', 'db/migrate', :migration_file_name=>'add_comatose_support', :assigns=>{:class_name=>'AddComatoseSupport'}
53
+ m.new_route 'comatose_root', "''"
54
+ m.new_route 'comatose_admin'
41
55
 
42
56
  when :upgrade
43
57
  from = @upgrade_from
@@ -57,3 +71,4 @@ class ComatoseMigrationGenerator < Rails::Generator::Base
57
71
  end
58
72
  end
59
73
  end
74
+
data/install.rb CHANGED
@@ -1,5 +1,7 @@
1
+ require 'fileutils'
2
+
1
3
  # Copy the images (*.gif) into RAILS_ROOT/public/images/comatose
2
- RAILS_ROOT = File.join(File.dirname(__FILE__), '../../../')
4
+ RAILS_ROOT = File.expand_path( File.join(File.dirname(__FILE__), '../../../') )
3
5
 
4
6
  unless FileTest.exist? File.join(RAILS_ROOT, 'public', 'images', 'comatose')
5
7
  FileUtils.mkdir( File.join(RAILS_ROOT, 'public', 'images', 'comatose') )
@@ -36,6 +36,7 @@ module Comatose
36
36
  attr_accessor_with_default :hidden_meta_fields, []
37
37
  attr_accessor_with_default :helpers, []
38
38
  attr_accessor_with_default :includes, []
39
+ attr_accessor_with_default :allow_import_export, true
39
40
 
40
41
  # 'Blockable' setters
41
42
  blockable_attr_accessor :authorization
@@ -1,4 +1,4 @@
1
1
  module Comatose
2
- VERSION = "2.0"
3
- VERSION_STRING = "#{VERSION} (uber-alpha)"
2
+ VERSION = "2.0.5"
3
+ VERSION_STRING = "#{VERSION} (beta)"
4
4
  end
@@ -140,6 +140,25 @@ class ComatoseAdminController < ActionController::Base
140
140
  redirect_to :controller=>self.controller_name, :action=>'index'
141
141
  end
142
142
 
143
+ def export
144
+ if Comatose.config.allow_import_export
145
+ send_data(page_to_hash(ComatosePage.root).to_yaml, :disposition => 'attachment', :type => 'text/yaml', :filename => "comatose-pages.yml")
146
+ else
147
+ flash[:notice] = "Export is not allowed"
148
+ redirect_to :controller=>self.controller_name, :action=>'index'
149
+ end
150
+ end
151
+
152
+ def import
153
+ if Comatose.config.allow_import_export
154
+ data = YAML::load(params[:import_file])
155
+ hash_to_page_tree(data, ComatosePage.root)
156
+ flash[:notice] = "Pages Imported Successfully"
157
+ else
158
+ flash[:notice] = "Import isn't allowed"
159
+ end
160
+ redirect_to :controller=>self.controller_name, :action=>'index'
161
+ end
143
162
 
144
163
  protected
145
164
 
@@ -345,5 +364,32 @@ protected
345
364
  end
346
365
  end
347
366
 
367
+ private
368
+
369
+ def page_to_hash(page)
370
+ data = page.attributes.clone
371
+ # Pull out the specific, or unnecessary fields
372
+ %w(id parent_id updated_on author position version created_on full_path).each {|key| data.delete(key)}
373
+ if !page.children.empty?
374
+ data['children'] = []
375
+ page.children.each do |child|
376
+ data['children'] << page_to_hash(child)
377
+ end
378
+ end
379
+ data
380
+ end
348
381
 
382
+ def hash_to_page_tree(hsh, page)
383
+ child_ary = hsh.delete 'children'
384
+ page.update_attributes(hsh)
385
+ page.save
386
+ child_ary.each do |child_hsh|
387
+ if child_pg = page.children.find_by_slug( child_hsh['slug'] )
388
+ hash_to_page_tree( child_hsh, child_pg )
389
+ else
390
+ hash_to_page_tree( child_hsh, page.children.create )
391
+ end
392
+ end if child_ary
393
+ end
394
+
349
395
  end
@@ -1,5 +1,6 @@
1
1
  # The controller for serving cms content...
2
2
  class ComatoseController < ActionController::Base
3
+ unloadable
3
4
 
4
5
  before_filter :handle_authorization, :set_content_type
5
6
  after_filter :cache_cms_page
@@ -83,11 +84,7 @@ protected
83
84
  # Returns a path to plugin layout, if it's unspecified, otherwise
84
85
  # a path to an application layout...
85
86
  def get_page_layout
86
- if params[:layout] == 'comatose_content'
87
- File.join(plugin_layout_path, params[:layout])
88
- else
89
- params[:layout]
90
- end
87
+ params[:layout]
91
88
  end
92
89
 
93
90
  # An after_filter implementing page caching if it's enabled, globally,
@@ -111,8 +108,8 @@ protected
111
108
  response.headers["Content-Type"] = "text/html; charset=#{Comatose.config.content_type}" unless Comatose.config.content_type.nil? or response.headers['Status'] == '404 Not Found'
112
109
  end
113
110
 
114
- # Path to layouts within the plugin... Assumes the plugin directory name is 'comatose'
115
- define_option :plugin_layout_path, File.join( '..', '..', '..', 'vendor', 'plugins', 'comatose', 'views', 'layouts' )
111
+ COMATOSE_VIEW_PATH = File.join(RAILS_ROOT, 'vendor', 'plugins', 'comatose', 'views')
112
+ ActionController::Base.append_view_path(COMATOSE_VIEW_PATH) unless ActionController::Base.view_paths.include?(COMATOSE_VIEW_PATH)
116
113
 
117
114
  # Include any, well, includes...
118
115
  Comatose.config.includes.each do |mod|
@@ -60,8 +60,9 @@ BODY {
60
60
  #content .action A {
61
61
  font-weight: bold;
62
62
  text-decoration: none;
63
- color: darkgreen;
64
- border-bottom: 1px solid black;
63
+ color: navy;
64
+ border-bottom: 1px solid blue;
65
+ margin-left: 15px;
65
66
  }
66
67
  #content .action A:hover {
67
68
  color: red;
@@ -70,6 +71,28 @@ BODY {
70
71
  #content .page-header {
71
72
  color: gray;
72
73
  }
74
+ #import_form {
75
+ position: fixed;
76
+ right: 75px;
77
+ border: 3px solid gray !important;
78
+ -webkit-border-radius: 10px;
79
+ -moz-border-radius: 10px;
80
+ background: #FFF;
81
+ padding: 15px;
82
+ }
83
+ #import_form FORM {
84
+ display: inline;
85
+ margin: 0px;
86
+ padding: 0px;
87
+ }
88
+ #import_form A {
89
+ color: maroon !important;
90
+ border-bottom: 1px solid gray !important;
91
+ }
92
+ #import_form A:hover {
93
+ color: red !important;
94
+ border-bottom: 1px solid red !important;
95
+ }
73
96
 
74
97
  /* Page Listing */
75
98
  #content .tree-controller {
data/tasks/comatose.rake CHANGED
@@ -1,5 +1,5 @@
1
1
  begin
2
- require 'comatose'
2
+ require 'comatose/version'
3
3
  rescue LoadError
4
4
  $: << File.join(File.dirname(__FILE__), '..', 'lib')
5
5
  end
@@ -16,6 +16,8 @@ class ComatoseAdminControllerTest < Test::Unit::TestCase
16
16
  @controller = ComatoseAdminController.new
17
17
  @request = ActionController::TestRequest.new
18
18
  @response = ActionController::TestResponse.new
19
+ Comatose.config.admin_get_author = nil
20
+ Comatose.config.admin_authorization = nil
19
21
  end
20
22
 
21
23
  should "show the index action" do
@@ -1,5 +1,16 @@
1
1
  <div class="action">
2
2
  <%= link_to 'Clear Page Cache', :controller=>controller.controller_name, :action=>'expire_page_cache' %>
3
+ <% if Comatose.config.allow_import_export %>
4
+ <%= link_to 'Import', '#', :id => 'import_link2', :onclick => "$('import_form').setStyle({display: 'inline'}); return false;" %>
5
+ <%= link_to 'Export', :controller=>controller.controller_name, :action=>'export' %>
6
+ <div id="import_form" style="display: none;">
7
+ <% form_tag(url_for(:action => 'import'), :multipart => true) do %>
8
+ <%= file_field_tag 'import_file' %>
9
+ <%= submit_tag 'Upload and Import' %>
10
+ <a href="#" onclick="$('import_form').hide(); return false;">Cancel</a>
11
+ <% end %>
12
+ </div>
13
+ <% end %>
3
14
  </div>
4
15
 
5
16
  <h1>
@@ -67,8 +67,9 @@ BODY {
67
67
  #content .action A {
68
68
  font-weight: bold;
69
69
  text-decoration: none;
70
- color: darkgreen;
71
- border-bottom: 1px solid black;
70
+ color: navy;
71
+ border-bottom: 1px solid blue;
72
+ margin-left: 15px;
72
73
  }
73
74
  #content .action A:hover {
74
75
  color: red;
@@ -77,6 +78,28 @@ BODY {
77
78
  #content .page-header {
78
79
  color: gray;
79
80
  }
81
+ #import_form {
82
+ position: fixed;
83
+ right: 75px;
84
+ border: 3px solid gray !important;
85
+ -webkit-border-radius: 10px;
86
+ -moz-border-radius: 10px;
87
+ background: #FFF;
88
+ padding: 15px;
89
+ }
90
+ #import_form FORM {
91
+ display: inline;
92
+ margin: 0px;
93
+ padding: 0px;
94
+ }
95
+ #import_form A {
96
+ color: maroon !important;
97
+ border-bottom: 1px solid gray !important;
98
+ }
99
+ #import_form A:hover {
100
+ color: red !important;
101
+ border-bottom: 1px solid red !important;
102
+ }
80
103
 
81
104
  /* Page Listing */
82
105
  #content .tree-controller {
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 0
8
- - 1
9
- version: 2.0.1
8
+ - 5
9
+ version: 2.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - M@ McCray
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2008-09-15 00:00:00 +10:00
17
+ date: 2008-10-31 00:00:00 +11:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -25,7 +25,7 @@ executables:
25
25
  extensions: []
26
26
 
27
27
  extra_rdoc_files:
28
- - README.rdoc
28
+ - README.markdown
29
29
  - CHANGELOG
30
30
  - SPECS
31
31
  - LICENSE
@@ -34,7 +34,7 @@ files:
34
34
  - INSTALL
35
35
  - LICENSE
36
36
  - MANIFEST
37
- - README.rdoc
37
+ - README.markdown
38
38
  - Rakefile
39
39
  - SPECS
40
40
  - about.yml
@@ -118,7 +118,7 @@ licenses: []
118
118
  post_install_message:
119
119
  rdoc_options:
120
120
  - --main
121
- - README.rdoc
121
+ - README.markdown
122
122
  require_paths:
123
123
  - lib
124
124
  required_ruby_version: !ruby/object:Gem::Requirement
data/README.rdoc DELETED
@@ -1,148 +0,0 @@
1
- = Comatose
2
-
3
- Version:: 2.0 (uber-alpha)
4
- Author:: M@ McCray
5
- Website:: comatose.rubyforge.org
6
- Email:: matt at elucidata dot net
7
-
8
-
9
- *Comatose* is a micro CMS designed for being embedded into existing Rails
10
- applications.
11
-
12
- It's intended for simple CMS support. Comatose supports
13
-
14
- * Nested pages
15
- * Versioning
16
- * Page markup in Textile, Markdown, RDoc, or easily add your own
17
- * Page processing through Liquid or ERb
18
- * Generators for easy installation/migration
19
- * Completely self-contained within plugin folder
20
-
21
- It's meant to be lean, mean, easily embedded, and easy to re-skin for
22
- existing applications. If you need something more, I would recommend
23
- looking into Radiant.
24
-
25
- For more information, see the 'Getting Started' guide: http://comatose.rubyforge.org
26
-
27
- === Requirements
28
-
29
- * Rails 2+ (2.1)
30
- * <tt>acts_as_list</tt> and <tt>acts_as_tree</tt> plugins are required
31
-
32
-
33
- === Development Notes
34
-
35
- *NOTE*: This is an active branch of Comatose that is built specifically for Rails 2.1.
36
- I will *probably* remove any legacy support.
37
-
38
- * Make comatose fully self-contained, which means removing acts_as_(tree|list)
39
- * Move to gem plugin
40
- * Comatose.configure needs to be an initializer (update docs)
41
- * Go through bugs on 1x branch from google code and ensure they are fixed
42
- * Give access to all the default rails helpers to Comatose Pages by default?
43
-
44
-
45
- == Installation
46
-
47
- *Note*: See the 'Upgrading' section if you already have an older version of
48
- the comatose plugin installed.
49
-
50
- $ ./script/plugin source http://mattmccray.com/svn/rails/plugins
51
- $ ./script/plugin install comatose
52
- $ ./script/generate comatose_migration
53
- $ rake migrate
54
-
55
- Open your <tt>routes.rb</tt> and add the comatose root route at the
56
- bottom:
57
-
58
- map.comatose_admin
59
- map.comatose_root ''
60
-
61
- That's it, you're ready to go! You should be able to browse to
62
- http://127.0.0.1:3000/comatose_admin and start adding pages to your CMS.
63
- Browsing to http://127.0.0.1:3000/ will render your comatose pages if
64
- routing doesn't match any of your controllers.
65
-
66
-
67
- == Upgrading
68
-
69
- *NOTE*: This is an experimental 2.0 branch, so upgrading is possible at
70
- the moment, but these instructions may not work for much longer.
71
-
72
- If you are upgrading from an older version of Comatose (version 0.3,
73
- 0.4, 0.5, or 0.6), then you will need to re-install the comatose
74
- plugin and run:
75
-
76
- $ ./script/plugin remove comatose
77
- $ ./script/plugin install comatose
78
- $ ./script/generate comatose_migration --upgrade --from=VERSION
79
- $ rake migrate
80
-
81
- *Note*: Be sure to set the <tt>--from</tt> parameter to the version of
82
- Comatose you last had installed. Also, you only need to first two digits,
83
- including the dot, of the version you are upgrading from. For example, if
84
- you're upgrading from version 0.6.9 you can use:
85
-
86
- $ ./script/generate comatose_migration --upgrade --from=0.6
87
-
88
- This will create the upgrade migration(s) for you. It just adds the new
89
- fields, so you can keep the original migration comatose created.
90
-
91
-
92
- == Configuration
93
-
94
- You configure Comatose in your `config/environment.rb` file. Here is an example
95
- configuration block:
96
-
97
- Comatose.configure do |config|
98
- # Sets the text in the Admin UI's title area
99
- config.admin_title = "Site Content"
100
- config.admin_sub_title = "Content for the rest of us..."
101
- end
102
-
103
- Here's an example that uses the AuthentiationSystem as generated by the
104
- restful_authentication plugin:
105
-
106
- Comatose.configure do |config|
107
- # Includes AuthenticationSystem in the ComatoseController
108
- config.includes << :authenticated_system
109
-
110
- # admin
111
- config.admin_title = "Comatose - TESTING"
112
- config.admin_sub_title = "Content for the rest of us..."
113
-
114
- # Includes AuthenticationSystem in the ComatoseAdminController
115
- config.admin_includes << :authenticated_system
116
-
117
- # Calls :login_required as a before_filter
118
- config.admin_authorization = :login_required
119
- # Returns the author name (login, in this case) for the current user
120
- config.admin_get_author do
121
- current_user.login
122
- end
123
- end
124
-
125
-
126
- == Extra Credit
127
-
128
- This plugin includes the work of many wonderful contributors to the Railsphere.
129
- Following are the specific libraries that are distributed with Comatose. If I've
130
- missed someone/something please let me know.
131
-
132
- * Liquid (http://home.leetsoft.com/liquid) by Tobias Luetke (http://blog.leetsoft.com)
133
- * RedCloth (http://whytheluckystiff.net/ruby/redcloth) by why the lucky stiff (http://whytheluckystiff.net)
134
- * Acts as Versioned (http://ar-versioned.rubyforge.org) by Rick Olsen (http://weblog.techno-weenie.net)
135
- * Behaviors (http://behaviors.rubyforge.org) by Atomic Object LLC -- very nice BDD-like testing library
136
-
137
- == Feedback
138
-
139
- I’ve released Comatose under the MIT license. Which basically means you
140
- can use it however you want.
141
-
142
- Don't forget to read the 'Getting Started' guide located on the RubyForge
143
- project site: http://comatose.rubyforge.org/getting-started-guide
144
-
145
- If you like it, hate it, or have some ideas for new features, let me know!
146
-
147
- darthapo at gmail dot com
148
-