manifest-rails 0.0.1

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.
Files changed (50) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +37 -0
  3. data/Rakefile +29 -0
  4. data/app/assets/images/manifest/grid.png +0 -0
  5. data/app/assets/javascripts/manifest/manifest.js +7 -0
  6. data/app/assets/stylesheets/manifest/_forms.css.scss +40 -0
  7. data/app/assets/stylesheets/manifest/_tables.css.scss +26 -0
  8. data/app/assets/stylesheets/manifest/login.css.scss +89 -0
  9. data/app/assets/stylesheets/manifest/manifest.css.scss +141 -0
  10. data/app/controllers/manifest/content_blocks_controller.rb +44 -0
  11. data/app/controllers/manifest/editors_controller.rb +3 -0
  12. data/app/controllers/manifest/manifest_controller.rb +14 -0
  13. data/app/controllers/manifest/pages_controller.rb +44 -0
  14. data/app/controllers/manifest/sessions_controller.rb +23 -0
  15. data/app/controllers/pages_controller.rb +12 -0
  16. data/app/models/content_block.rb +15 -0
  17. data/app/models/editor.rb +8 -0
  18. data/app/models/page.rb +32 -0
  19. data/app/models/user.rb +8 -0
  20. data/app/views/layouts/manifest.html.erb +34 -0
  21. data/app/views/manifest/content_blocks/_form.html.erb +40 -0
  22. data/app/views/manifest/content_blocks/edit.html.erb +11 -0
  23. data/app/views/manifest/content_blocks/index.html.erb +27 -0
  24. data/app/views/manifest/content_blocks/new.html.erb +3 -0
  25. data/app/views/manifest/pages/_form.html.erb +21 -0
  26. data/app/views/manifest/pages/edit.html.erb +11 -0
  27. data/app/views/manifest/pages/index.html.erb +11 -0
  28. data/app/views/manifest/pages/new.html.erb +3 -0
  29. data/app/views/manifest/sessions/new.html.erb +15 -0
  30. data/config/initializers/manifest.rb +23 -0
  31. data/config/routes.rb +14 -0
  32. data/lib/active_record/base/acts_as_manifest.rb +8 -0
  33. data/lib/generators/manifest/data_type/USAGE +11 -0
  34. data/lib/generators/manifest/data_type/data_type_generator.rb +46 -0
  35. data/lib/generators/manifest/data_type/templates/controller.rb +11 -0
  36. data/lib/generators/manifest/data_type/templates/index.html.erb +1 -0
  37. data/lib/generators/manifest/data_type/templates/migration.rb +9 -0
  38. data/lib/generators/manifest/data_type/templates/model.rb +3 -0
  39. data/lib/generators/manifest/install/USAGE +11 -0
  40. data/lib/generators/manifest/install/install_generator.rb +25 -0
  41. data/lib/generators/manifest/install/templates/add_index_to_content_blocks.rb +5 -0
  42. data/lib/generators/manifest/install/templates/add_index_to_pages.rb +5 -0
  43. data/lib/generators/manifest/install/templates/create_content_blocks.rb +13 -0
  44. data/lib/generators/manifest/install/templates/create_editors.rb +10 -0
  45. data/lib/generators/manifest/install/templates/create_pages.rb +11 -0
  46. data/lib/manifest/engine.rb +7 -0
  47. data/lib/manifest/version.rb +3 -0
  48. data/lib/manifest.rb +13 -0
  49. data/lib/tasks/manifest_tasks.rake +4 -0
  50. metadata +267 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Jonathan Clem
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Manifest
2
+
3
+ Manifest is a Rails Engine content management system. It's goal is to keep the content management and creation of new data types as "Rails-like" as possible.
4
+
5
+ ## Installation
6
+
7
+ ### In your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'manifest-rails'
11
+ ```
12
+
13
+ ### Run the install generator:
14
+
15
+ ```bash
16
+ rails g manifest:install Page
17
+ ```
18
+
19
+ *The "Page" argument can be literally anything, it only satisfies an internal ActiveRecord generator requirement. You could write `rails g manifest:install Cats` and it wouldn't matter.*
20
+
21
+ ### Run the migrations:
22
+
23
+ ```bash
24
+ rake db:migrate
25
+ ```
26
+
27
+ ### Create your first editor account in the console:
28
+
29
+ ```bash
30
+ rails console production
31
+ ```
32
+
33
+ ```ruby
34
+ Editor.create(email: 'user@example.com', password: 'password')
35
+ ```
36
+
37
+ ### Visit http://localhost/manifest for content management.
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Manifest'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
Binary file
@@ -0,0 +1,7 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require tinymce-jquery
4
+
5
+ $(function() {
6
+ $('.tinymce').tinymce({ });
7
+ });
@@ -0,0 +1,40 @@
1
+ form {
2
+
3
+ }
4
+
5
+ fieldset {
6
+ margin-bottom: 10px;
7
+ }
8
+
9
+ input[type='text'], textarea {
10
+ padding: 10px 20px;
11
+ @include border-radius(4px);
12
+ border: 1px solid #aaa;
13
+ @include box-shadow(0 2px 2px rgba(0, 0, 0, 0.2) inset);
14
+ }
15
+
16
+ label {
17
+ margin-top: 10px;
18
+ width: 120px;
19
+ display: block;
20
+ float: left;
21
+ }
22
+
23
+ textarea { line-height: 1.428571429; }
24
+
25
+ input[type='submit'] {
26
+ @include pretty_button;
27
+ font-size: 1em;
28
+ }
29
+
30
+ .form_coach_photo {
31
+ margin: 10px 0 15px 125px;
32
+ }
33
+
34
+ .alert, .errors {
35
+ margin-bottom: 20px;
36
+ padding: 10px;
37
+ background: #fdd;
38
+ border: 1px solid #faa;
39
+ line-height: 1.428571429;
40
+ }
@@ -0,0 +1,26 @@
1
+ table.resource_table {
2
+ width: 100%;
3
+
4
+ thead {
5
+ background: #346;
6
+ @include background(linear-gradient(#346, #346 - 25));
7
+ color: $copy-on-dark;
8
+ }
9
+
10
+ th, td {
11
+ padding: 10px 20px;
12
+ }
13
+
14
+ tbody tr:nth-child(even) {
15
+ background: #ccc;
16
+ }
17
+
18
+ tbody tr:hover {
19
+ background: $accent + 25;
20
+ cursor: pointer;
21
+ color: $copy-on-dark;
22
+
23
+ a { color: $copy-on-dark; }
24
+ }
25
+ }
26
+
@@ -0,0 +1,89 @@
1
+ @import 'compass/reset';
2
+ @import 'compass/css3';
3
+
4
+ $accent: #346;
5
+ $copy-on-dark: #eee;
6
+ $copy-on-light: #333;
7
+ $shadow: #ccc;
8
+
9
+ @mixin pretty-button($bg: $accent, $copy: $copy-on-dark) {
10
+ margin: 20px 0;
11
+ padding: 10px 20px;
12
+ background: $accent;
13
+ border: none;
14
+ @include background(linear-gradient($bg + 30, $bg));
15
+ @include border-radius(5px);
16
+ @include box-shadow(0 1px 0 $bg + 60 inset, 0 -1px 0 $bg - 30 inset);
17
+ color: $copy + 30;
18
+ text-decoration: none;
19
+ text-shadow: 0 -1px 1px $bg - 30;
20
+
21
+ &:hover,
22
+ &:focus {
23
+ background: $bg + 10;
24
+ @include background(linear-gradient($bg + 40, $bg + 10));
25
+ }
26
+
27
+ &:active {
28
+ background: $bg - 30;
29
+ @include background(linear-gradient($bg, $bg - 30));
30
+ @include box-shadow(4px 4px 4px $bg - 40 inset);
31
+ }
32
+ }
33
+
34
+ body {
35
+ padding-top: 60px;
36
+ background: image-url('grid.png');
37
+ color: #333;
38
+ font-family: Cabin;
39
+ font-size: 14px;
40
+ }
41
+
42
+ h1 {
43
+ color: #346;
44
+ font-family: Oswald;
45
+ font-size: 4em;
46
+ text-align: center;
47
+ text-transform: uppercase;
48
+ text-shadow: 0 2px 0px #345 - 50, 0 4px 4px rgba(0, 0, 0, 0.4);
49
+ }
50
+
51
+ a { color: $accent; }
52
+
53
+ #login_container {
54
+ margin: 40px auto 40px auto;
55
+ padding: 40px;
56
+ width: 320px;
57
+ background: #fefefe;
58
+ border: 1px solid #ccc;
59
+ @include box-shadow(0 4px 4px rgba(0, 0, 0, 0.1));
60
+ }
61
+
62
+ fieldset { margin-bottom: 10px; }
63
+
64
+ input[type='text'], input[type='email'], input[type='password'], textarea {
65
+ padding: 10px 20px;
66
+ @include border-radius(4px);
67
+ border: 1px solid #aaa;
68
+ @include box-shadow(0 2px 2px rgba(0, 0, 0, 0.2) inset);
69
+ }
70
+
71
+ label {
72
+ margin-top: 10px;
73
+ width: 120px;
74
+ display: block;
75
+ float: left;
76
+ }
77
+
78
+ textarea { line-height: 1.428571429; }
79
+
80
+ input[type='submit'] {
81
+ @include pretty_button;
82
+ font-size: 1em;
83
+ }
84
+
85
+ .alert {
86
+ padding: 10px;
87
+ background: #fdd;
88
+ border: 1px solid #faa;
89
+ }
@@ -0,0 +1,141 @@
1
+ // Place all the styles related to the manifest controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
4
+
5
+ @import 'compass/reset';
6
+ @import 'compass/css3';
7
+
8
+ $accent: #08c;
9
+ $base: 20px;
10
+ $copy-on-dark: #eee;
11
+ $copy-on-light: #333;
12
+ $shadow: #ccc;
13
+
14
+ @mixin gradient($bg: #eee, $reverse: false) {
15
+ @include background(linear-gradient(top, $bg, darken($bg, 13.5)));
16
+ text-shadow: 0 1px 0 lighten($bg, 6.75);
17
+
18
+ @if $reverse == true {
19
+ @include background(linear-gradient(top, darken($bg, 13.5), $bg));
20
+ }
21
+ }
22
+
23
+ @mixin pretty-button($bg: $accent, $copy: $copy-on-dark) {
24
+ @include background(linear-gradient(top, lighten($bg, 13.5), darken($bg, 13.5)));
25
+ background-size: 200%;
26
+ background-position: 0 50%;
27
+ border: 1px solid darken($bg, 13.5);
28
+ padding: $base / 2 $base;
29
+ @include border-radius(4px);
30
+ @include box-shadow(0 2px 2px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255,255,255, 0.2) inset);
31
+ color: #fff;
32
+ font-size: inherit;
33
+ text-decoration: none;
34
+ @include transition-property(background-position);
35
+ @include transition-duration(0.2s);
36
+
37
+ &:hover,
38
+ &:focus { background-position: 0 0; }
39
+
40
+ &:active {
41
+ @include gradient($bg: darken($bg, 3.375), $reverse: true);
42
+ @include box-shadow(4px 4px 6px rgba(0,0,0,0.2) inset, 0 -1px 1px rgba(0,0,0,0.2));
43
+ border-color: darken($bg, 20.25);
44
+ text-shadow: none;
45
+ }
46
+ }
47
+
48
+ body {
49
+ background: #efefef;
50
+ background-image: image-url('manifest/grid.png');
51
+ color: $copy-on-light;
52
+ font-family: Cabin, Arial, Verdana, sans-serif;
53
+ font-size: 14px;
54
+ }
55
+
56
+ h1 {
57
+ margin: 15px 40px 0 0;
58
+ float: left;
59
+ font-size: 1.5em;
60
+ font-weight: 700;
61
+
62
+ a {
63
+ color: white;
64
+ text-decoration: none;
65
+ }
66
+ }
67
+
68
+ header {
69
+ padding: 0 20px;
70
+ overflow: hidden;
71
+ background: $accent - 75;
72
+ @include background(linear-gradient($accent - 50, $accent - 75));
73
+ @include box-shadow(0 4px 4px rgba(0, 0, 0, 0.2));
74
+
75
+ li {
76
+ float: left;
77
+
78
+ a {
79
+ margin: 10px 10px 10px 0;
80
+ @include pretty-button;
81
+ display: block;
82
+ color: white;
83
+ text-decoration: none;
84
+
85
+ &.delete {
86
+ position: absolute;
87
+ right: 20px;
88
+ @include pretty-button(#634 - 30, $copy-on-dark);
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ #manifest_content {
95
+ margin: 40px auto;
96
+ padding: 40px;
97
+ width: 80%;
98
+ max-width: 720px;
99
+ background: #fefefe;
100
+ border: 1px solid #ccc;
101
+ @include box-shadow(0 4px 4px rgba(0, 0, 0, 0.1));
102
+
103
+ ul {
104
+ list-style: disc;
105
+ }
106
+
107
+ li {
108
+ margin-left: 20px;
109
+ line-height: 1.428571429;
110
+ }
111
+ }
112
+
113
+ h2 {
114
+ margin-bottom: 20px;
115
+ padding-bottom: 10px;
116
+ border-bottom: 2px solid $copy-on-light;
117
+ font-size: 1.5em;
118
+ font-weight: bold;
119
+ }
120
+
121
+ h3 {
122
+ margin-top: 20px;
123
+ margin-bottom: 10px;
124
+ padding-bottom: 5px;
125
+ border-bottom: 1px dashed $copy-on-light;
126
+ font-size: 1.2em;
127
+ font-weight: bold;
128
+ line-height: 1.428571429;
129
+ }
130
+
131
+ .model_actions { margin-top: 40px; }
132
+
133
+ .model_actions a {
134
+ @include pretty_button;
135
+ &.delete { @include pretty-button(#634 + 10, $copy-on-dark); }
136
+ }
137
+
138
+ a { color: $accent; }
139
+
140
+ @import 'forms';
141
+ @import 'tables';
@@ -0,0 +1,44 @@
1
+ class Manifest::ContentBlocksController < Manifest::ManifestController
2
+ before_filter :authorize
3
+
4
+ layout 'manifest'
5
+
6
+ def index
7
+ @content_blocks = ContentBlock.all
8
+ end
9
+
10
+ def new
11
+ @content_block = ContentBlock.new
12
+ end
13
+
14
+ def create
15
+ @content_block = ContentBlock.new(params[:content_block])
16
+
17
+ if @content_block.save
18
+ redirect_to manifest_content_blocks_path
19
+ else
20
+ render 'new'
21
+ end
22
+ end
23
+
24
+ def edit
25
+ @content_block = ContentBlock.find(params[:id])
26
+ end
27
+
28
+ def update
29
+ @content_block = ContentBlock.find(params[:id])
30
+
31
+ if @content_block.update_attributes(params[:content_block])
32
+ redirect_to manifest_content_blocks_path
33
+ else
34
+ render 'edit'
35
+ end
36
+ end
37
+
38
+ def destroy
39
+ @content_block = ContentBlock.find(params[:id])
40
+ @content_block.delete
41
+
42
+ redirect_to manifest_content_blocks_path
43
+ end
44
+ end
@@ -0,0 +1,3 @@
1
+ class Manifest::EditorsController < Manifest::ManifestController
2
+ before_filter :authorize
3
+ end
@@ -0,0 +1,14 @@
1
+ class Manifest::ManifestController < ApplicationController
2
+
3
+ private
4
+
5
+ def current_editor
6
+ @current_editor ||= Editor.find(session[:editor_id]) if session[:editor_id]
7
+ end
8
+
9
+ def authorize
10
+ redirect_to manifest_login_url, alert: 'Not authorized' if current_editor.nil?
11
+ end
12
+
13
+ helper_method :current_editor
14
+ end
@@ -0,0 +1,44 @@
1
+ class Manifest::PagesController < Manifest::ManifestController
2
+ before_filter :authorize
3
+
4
+ layout 'manifest'
5
+
6
+ def index
7
+ @pages = Page.all
8
+ end
9
+
10
+ def new
11
+ @page = Page.new
12
+ end
13
+
14
+ def create
15
+ @page = Page.new(params[:page])
16
+
17
+ if @page.save
18
+ redirect_to manifest_pages_path
19
+ else
20
+ render 'new'
21
+ end
22
+ end
23
+
24
+ def edit
25
+ @page = Page.find(params[:id])
26
+ end
27
+
28
+ def update
29
+ @page = Page.find(params[:id])
30
+
31
+ if @page.update_attributes(params[:page])
32
+ redirect_to manifest_pages_path
33
+ else
34
+ render 'edit'
35
+ end
36
+ end
37
+
38
+ def destroy
39
+ @page = Page.find(params[:id])
40
+ @page.delete
41
+
42
+ redirect_to manifest_pages_path
43
+ end
44
+ end
@@ -0,0 +1,23 @@
1
+ class Manifest::SessionsController < Manifest::ManifestController
2
+ layout 'manifest'
3
+
4
+ def new
5
+ end
6
+
7
+ def create
8
+ editor = Editor.find_by_email(params[:email])
9
+
10
+ if editor && editor.authenticate(params[:password])
11
+ session[:editor_id] = editor.id
12
+ redirect_to manifest_path, notice: 'Logged in!'
13
+ else
14
+ flash.now.alert = 'Email or password is invalid'
15
+ render 'new'
16
+ end
17
+ end
18
+
19
+ def destroy
20
+ session[:editor_id] = nil
21
+ redirect_to new_manifest_session_path
22
+ end
23
+ end
@@ -0,0 +1,12 @@
1
+ class PagesController < ApplicationController
2
+ layout 'public'
3
+
4
+ def show
5
+ if @page = Page.find_by_slug(params[:slug])
6
+ @content_blocks = @page.content_blocks
7
+ render @page.slug
8
+ else
9
+ raise ActiveRecord::RecordNotFound
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ class ContentBlock < ActiveRecord::Base
2
+ extend FriendlyId
3
+ friendly_id :title, use: :slugged
4
+
5
+ validates :title, :slug, uniqueness: true, presence: true
6
+ validates :page_id, presence: true
7
+
8
+ belongs_to :page
9
+
10
+ default_scope includes(:page).order('pages.title')
11
+
12
+ def render
13
+ self.content.html_safe
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ class Editor < ActiveRecord::Base
2
+ has_secure_password
3
+
4
+ attr_accessible :email, :password, :password_confirmation
5
+
6
+ validates_uniqueness_of :email
7
+ validates_format_of :email, with: /^[a-zA-Z0-9_\.]+((\+)*[a-zA-Z0-9_\.]+)*@([a-zA-Z0-9_\-]+.)+[a-zA-Z0-9_\-]+$/
8
+ end
@@ -0,0 +1,32 @@
1
+ class Page < ActiveRecord::Base
2
+ extend FriendlyId
3
+ friendly_id :title, use: :slugged
4
+
5
+ before_save :set_template_path
6
+ after_create :create_template_file
7
+ after_update :move_template_file
8
+ after_destroy :remove_template_file
9
+
10
+ validates :title, :slug, uniqueness: true, presence: true
11
+
12
+ has_many :content_blocks
13
+
14
+ private
15
+
16
+ def set_template_path
17
+ @old_template_path = attribute_was(:template_path)
18
+ self.template_path = "#{Rails.root}/app/views/pages/#{self.slug}.html.erb"
19
+ end
20
+
21
+ def create_template_file
22
+ %x(touch #{self.template_path})
23
+ end
24
+
25
+ def move_template_file
26
+ %x(mv #{@old_template_path} #{self.template_path})
27
+ end
28
+
29
+ def remove_template_file
30
+ %x(rm #{self.template_path})
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ class User < ActiveRecord::Base
2
+ has_secure_password
3
+
4
+ attr_accessible :email, :password, :password_confirmation
5
+
6
+ validates_uniqueness_of :email
7
+ validates_format_of :email, :with => /^[a-zA-Z0-9_\.]+((\+)*[a-zA-Z0-9_\.]+)*@([a-zA-Z0-9_\-]+.)+[a-zA-Z0-9_\-]+$/
8
+ end
@@ -0,0 +1,34 @@
1
+ <!doctype html>
2
+
3
+ <html>
4
+ <head>
5
+ <title>Manifest</title>
6
+ <%= stylesheet_link_tag 'manifest/manifest' %>
7
+ <%= javascript_include_tag 'manifest/manifest' %>
8
+ <%= csrf_meta_tags %>
9
+
10
+ <!-- Google Webfonts -->
11
+ <link href='http://fonts.googleapis.com/css?family=Cabin:700,400' rel='stylesheet' type='text/css'>
12
+ </head>
13
+
14
+ <body>
15
+ <header>
16
+ <h1><%= link_to 'Manifest', manifest_path %></h1>
17
+ <nav>
18
+ <ul>
19
+ <% Manifest::DATA_TYPES.each do |d| %>
20
+ <li><%= link_to d[:nav_name], eval("#{d[:route]}") %></li>
21
+ <% end %>
22
+ </ul>
23
+ </nav>
24
+ </header>
25
+
26
+ <div id='manifest_content'>
27
+ <% flash.each do |name, msg| %>
28
+ <%= content_tag :div, msg, id: "flash_#{name}" %>
29
+ <% end %>
30
+
31
+ <%= yield %>
32
+ </div>
33
+ </body>
34
+ </html>
@@ -0,0 +1,40 @@
1
+ <% if @content_block.errors.any? %>
2
+ <div class='errors'>
3
+ <h6>This from could not be sumbmitted:</h6>
4
+ <ul>
5
+ <% @content_block.errors.full_messages.each do |msg| %>
6
+ <li><%= msg %></li>
7
+ <% end %>
8
+ </ul>
9
+ </div>
10
+ <% end %>
11
+
12
+ <%= form_for [:manifest, @content_block] do |f| %>
13
+ <fieldset>
14
+ <%= f.label :title %>
15
+ <%= f.text_field :title %>
16
+ </fieldset>
17
+
18
+ <fieldset>
19
+ <%= f.label :page_id %>
20
+ <%= f.select :page_id, Page.all.collect { |p| [p.title, p.id] }, :include_blank => true %>
21
+ </fieldset>
22
+
23
+ <fieldset>
24
+ <%= f.label :allow_html, 'Allow HTML' %>
25
+ <%= f.check_box :allow_html %>
26
+ </fieldset>
27
+
28
+ <fieldset>
29
+ <%= f.label :content %>
30
+ <% if @content_block.allow_html %>
31
+ <%= f.text_area :content, :class => 'tinymce' %>
32
+ <% else %>
33
+ <%= f.text_area :content %>
34
+ <% end %>
35
+ </fieldset>
36
+
37
+ <fieldset>
38
+ <%= f.submit %>
39
+ </fieldset>
40
+ <% end %>