website_builder_engine 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +173 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +260 -0
- data/Rakefile +26 -0
- data/app/assets/images/website_builder_engine/.gitkeep +0 -0
- data/app/assets/javascripts/website_builder_engine/application.js +9 -0
- data/app/assets/javascripts/website_builder_engine/articles.js.coffee +3 -0
- data/app/assets/javascripts/website_builder_engine/home.js.coffee +3 -0
- data/app/assets/javascripts/website_builder_engine/jqueryui.js +406 -0
- data/app/assets/javascripts/website_builder_engine/modernizr.js +4 -0
- data/app/assets/javascripts/website_builder_engine/offerpages.js.coffee +3 -0
- data/app/assets/javascripts/website_builder_engine/respond.js +2 -0
- data/app/assets/javascripts/website_builder_engine/settings.js.coffee +3 -0
- data/app/assets/javascripts/website_builder_engine/tabs.js +41 -0
- data/app/assets/stylesheets/website_builder_engine/application.css +33 -0
- data/app/assets/stylesheets/website_builder_engine/articles.css.scss +87 -0
- data/app/assets/stylesheets/website_builder_engine/base.css.scss +336 -0
- data/app/assets/stylesheets/website_builder_engine/home.css.scss +7 -0
- data/app/assets/stylesheets/website_builder_engine/layout.css.scss +64 -0
- data/app/assets/stylesheets/website_builder_engine/normalize.css.scss +413 -0
- data/app/assets/stylesheets/website_builder_engine/offerpages.css.scss +232 -0
- data/app/assets/stylesheets/website_builder_engine/scaffolds.css.scss +56 -0
- data/app/assets/stylesheets/website_builder_engine/settings.css.scss +7 -0
- data/app/assets/stylesheets/website_builder_engine/skeleton.css.scss +237 -0
- data/app/controllers/website_builder_engine/application_controller.rb +5 -0
- data/app/controllers/website_builder_engine/articles_controller.rb +113 -0
- data/app/controllers/website_builder_engine/home_controller.rb +7 -0
- data/app/controllers/website_builder_engine/offerpages_controller.rb +98 -0
- data/app/controllers/website_builder_engine/settings_controller.rb +85 -0
- data/app/helpers/website_builder_engine/application_helper.rb +4 -0
- data/app/models/article.rb +13 -0
- data/app/models/offerpage.rb +15 -0
- data/app/models/setting.rb +13 -0
- data/app/views/layouts/website_builder_engine/application.html.haml +22 -0
- data/app/views/layouts/website_builder_engine/home.html.haml +24 -0
- data/app/views/shared/_navigation.html.haml +3 -0
- data/app/views/website_builder_engine/articles/_form.html.haml +47 -0
- data/app/views/website_builder_engine/articles/edit.html.haml +7 -0
- data/app/views/website_builder_engine/articles/index.html.haml +16 -0
- data/app/views/website_builder_engine/articles/new.html.haml +5 -0
- data/app/views/website_builder_engine/articles/publish.html.haml +7 -0
- data/app/views/website_builder_engine/articles/show.html.haml +36 -0
- data/app/views/website_builder_engine/articles/template.html.haml +72 -0
- data/app/views/website_builder_engine/home/index.html.haml +26 -0
- data/app/views/website_builder_engine/offerpages/_form.html.haml +49 -0
- data/app/views/website_builder_engine/offerpages/edit.html.haml +7 -0
- data/app/views/website_builder_engine/offerpages/index.html.haml +16 -0
- data/app/views/website_builder_engine/offerpages/new.html.haml +5 -0
- data/app/views/website_builder_engine/offerpages/publish.html.haml +7 -0
- data/app/views/website_builder_engine/offerpages/show.html.haml +37 -0
- data/app/views/website_builder_engine/offerpages/template.html.haml +71 -0
- data/app/views/website_builder_engine/settings/_form.html.haml +40 -0
- data/app/views/website_builder_engine/settings/edit.html.haml +7 -0
- data/app/views/website_builder_engine/settings/index.html.haml +19 -0
- data/app/views/website_builder_engine/settings/new.html.haml +5 -0
- data/app/views/website_builder_engine/settings/show.html.haml +34 -0
- data/app/views/website_builder_engine/welcome/template.html.haml +66 -0
- data/config/routes.rb +19 -0
- data/db/seeds.rb +68 -0
- data/lib/tasks/website_builder_engine_tasks.rake +4 -0
- data/lib/website_builder_engine.rb +4 -0
- data/lib/website_builder_engine/engine.rb +5 -0
- data/script/rails +6 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +51 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +27 -0
- data/spec/dummy/config/environments/production.rb +51 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/mongoid.yml +20 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/seeds.rb +68 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/spec_helper.rb +41 -0
- data/version.rb +3 -0
- data/website_builder_engine.gemspec +31 -0
- metadata +381 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
module WebsiteBuilderEngine
|
2
|
+
class ArticlesController < ApplicationController
|
3
|
+
|
4
|
+
before_filter :get_settings, :only => [:publish, :index, :new, :destroy]
|
5
|
+
|
6
|
+
def publish
|
7
|
+
# create an article page
|
8
|
+
@article = Article.find(params[:id])
|
9
|
+
@related_items = Hash.new
|
10
|
+
if @article.related_items
|
11
|
+
@article.related_items.each do |id|
|
12
|
+
item = Article.find(id)
|
13
|
+
@related_items[item.title] = "#{item.filename}.html"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
@permalink = "http://#{@settings.domain}/#{@settings.articles_directory}/#{@article.filename}.html"
|
17
|
+
@content = RedCloth.new(@article.content).to_html.html_safe
|
18
|
+
@sidebar = RedCloth.new(@article.sidebar).to_html.html_safe if @article.sidebar
|
19
|
+
article_page = render_to_string(:template => "website_builder_engine/articles/template.html.haml", :layout => false )
|
20
|
+
FileUtils.makedirs(@file_path) unless File.exists?(@file_path)
|
21
|
+
File.open("#{@file_path + @article.filename}.html", 'w') {|f| f.write(article_page) }
|
22
|
+
@article.update_attribute(:published, true)
|
23
|
+
# create (or recreate) the welcome page
|
24
|
+
@articles = Article.where(published: true)
|
25
|
+
@welcome_sidebar = RedCloth.new(@settings.sidebar).to_html.html_safe if @settings.sidebar
|
26
|
+
welcome_page = render_to_string(:template => "website_builder_engine/welcome/template.html.haml", :layout => false )
|
27
|
+
File.open("#{@docroot_path}index.html", 'w') {|f| f.write(welcome_page) }
|
28
|
+
respond_to do |format|
|
29
|
+
format.html { redirect_to articles_path, notice: "Built a webpage for the article \"#{@article.title}\"" }
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def index
|
35
|
+
@articles = Article.all
|
36
|
+
|
37
|
+
respond_to do |format|
|
38
|
+
format.html # index.html.erb
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def show
|
43
|
+
@article = Article.find(params[:id])
|
44
|
+
respond_to do |format|
|
45
|
+
format.html # show.html.erb
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def new
|
50
|
+
@article = Article.new
|
51
|
+
@articles = Article.all
|
52
|
+
@article.related_items = []
|
53
|
+
@article.sidebar = @settings.sidebar if @settings.sidebar
|
54
|
+
respond_to do |format|
|
55
|
+
format.html # new.html.erb
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def edit
|
60
|
+
@article = Article.find(params[:id])
|
61
|
+
@articles = Article.all
|
62
|
+
end
|
63
|
+
|
64
|
+
def create
|
65
|
+
@article = Article.new(params[:article])
|
66
|
+
if params[:format] == 'html'
|
67
|
+
p1 = HTMLToTextileParser.new
|
68
|
+
p2 = HTMLToTextileParser.new
|
69
|
+
p1.feed(params[:offerpage][:content])
|
70
|
+
@offerpage.content = p1.to_textile
|
71
|
+
p2.feed(params[:offerpage][:sidebar])
|
72
|
+
@offerpage.sidebar = p2.to_textile
|
73
|
+
end
|
74
|
+
respond_to do |format|
|
75
|
+
if @article.save
|
76
|
+
format.html { redirect_to articles_path, notice: 'Article was successfully created.' }
|
77
|
+
else
|
78
|
+
format.html { render action: "new" }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def update
|
84
|
+
@article = Article.find(params[:id])
|
85
|
+
params[:article][:related_items] ||= []
|
86
|
+
respond_to do |format|
|
87
|
+
if @article.update_attributes(params[:article])
|
88
|
+
format.html { redirect_to articles_path, notice: 'Article was successfully updated.' }
|
89
|
+
else
|
90
|
+
format.html { render action: "edit" }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def destroy
|
96
|
+
@article = Article.find(params[:id])
|
97
|
+
@article.destroy
|
98
|
+
@settings = Setting.first
|
99
|
+
FileUtils.remove_file("#{@file_path + @article.filename}.html", force = true)
|
100
|
+
respond_to do |format|
|
101
|
+
format.html { redirect_to articles_url }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
protected
|
106
|
+
def get_settings
|
107
|
+
@settings = Setting.first
|
108
|
+
@docroot_path = "#{Rails.root}/public/"
|
109
|
+
@file_path = "#{@docroot_path}#{@settings.articles_directory}/"
|
110
|
+
@url_path = "/#{@settings.articles_directory}/"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module WebsiteBuilderEngine
|
2
|
+
class OfferpagesController < ApplicationController
|
3
|
+
|
4
|
+
before_filter :get_settings, :only => [:publish, :index, :new, :destroy]
|
5
|
+
|
6
|
+
def publish
|
7
|
+
@offerpage = Offerpage.find(params[:id])
|
8
|
+
@permalink = "http://#{@settings.domain}/#{@settings.offerpages_directory}/#{@offerpage.filename}.html"
|
9
|
+
offerpage_page = render_to_string(:template => "website_builder_engine/offerpages/template.html.haml", :layout => false )
|
10
|
+
FileUtils.makedirs(@file_path) unless File.exists?(@file_path)
|
11
|
+
File.open("#{@file_path + @offerpage.filename}.html", 'w') {|f| f.write(offerpage_page) }
|
12
|
+
@offerpage.update_attribute(:published, true)
|
13
|
+
respond_to do |format|
|
14
|
+
format.html { redirect_to offerpages_path, notice: "Built a webpage for the offer page \"#{@offerpage.title}\"" }
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def index
|
20
|
+
@offerpages = Offerpage.all
|
21
|
+
respond_to do |format|
|
22
|
+
format.html # index.html.erb
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def show
|
27
|
+
@offerpage = Offerpage.find(params[:id])
|
28
|
+
respond_to do |format|
|
29
|
+
format.html # show.html.erb
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def new
|
34
|
+
@offerpage = Offerpage.new
|
35
|
+
respond_to do |format|
|
36
|
+
format.html # new.html.erb
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def edit
|
41
|
+
@offerpage = Offerpage.find(params[:id])
|
42
|
+
end
|
43
|
+
|
44
|
+
def create
|
45
|
+
@offerpage = Offerpage.new(params[:offerpage])
|
46
|
+
if params[:format] == 'html'
|
47
|
+
p1 = HTMLToTextileParser.new
|
48
|
+
p2 = HTMLToTextileParser.new
|
49
|
+
p3 = HTMLToTextileParser.new
|
50
|
+
p4 = HTMLToTextileParser.new
|
51
|
+
p1.feed(params[:offerpage][:content_block1])
|
52
|
+
@offerpage.content_block1 = p1.to_textile
|
53
|
+
p2.feed(params[:offerpage][:content_block2])
|
54
|
+
@offerpage.content_block2 = p2.to_textile
|
55
|
+
p3.feed(params[:offerpage][:offer_block])
|
56
|
+
@offerpage.offer_block = p3.to_textile
|
57
|
+
p4.feed(params[:offerpage][:testimonials])
|
58
|
+
@offerpage.testimonials = p4.to_textile
|
59
|
+
end
|
60
|
+
respond_to do |format|
|
61
|
+
if @offerpage.save
|
62
|
+
format.html { redirect_to offerpages_path, notice: 'Offerpage was successfully created.' }
|
63
|
+
else
|
64
|
+
format.html { render action: "new" }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def update
|
70
|
+
@offerpage = Offerpage.find(params[:id])
|
71
|
+
respond_to do |format|
|
72
|
+
if @offerpage.update_attributes(params[:offerpage])
|
73
|
+
format.html { redirect_to offerpages_path, notice: 'Offerpage was successfully updated.' }
|
74
|
+
else
|
75
|
+
format.html { render action: "edit" }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def destroy
|
81
|
+
@offerpage = Offerpage.find(params[:id])
|
82
|
+
@offerpage.destroy
|
83
|
+
@settings = Setting.first
|
84
|
+
FileUtils.remove_file("#{@file_path + @offerpage.filename}.html", force = true)
|
85
|
+
respond_to do |format|
|
86
|
+
format.html { redirect_to offerpages_url }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
protected
|
91
|
+
def get_settings
|
92
|
+
@settings = Setting.first
|
93
|
+
@docroot_path = "#{Rails.root}/public/"
|
94
|
+
@file_path = "#{@docroot_path}#{@settings.offerpages_directory}/"
|
95
|
+
@url_path = "/#{@settings.offerpages_directory}/"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module WebsiteBuilderEngine
|
2
|
+
class SettingsController < ApplicationController
|
3
|
+
# GET /settings
|
4
|
+
# GET /settings.json
|
5
|
+
def index
|
6
|
+
@settings = Setting.all
|
7
|
+
|
8
|
+
respond_to do |format|
|
9
|
+
format.html # index.html.erb
|
10
|
+
format.json { render json: @settings }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /settings/1
|
15
|
+
# GET /settings/1.json
|
16
|
+
def show
|
17
|
+
@setting = Setting.find(params[:id])
|
18
|
+
|
19
|
+
respond_to do |format|
|
20
|
+
format.html # show.html.erb
|
21
|
+
format.json { render json: @setting }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# GET /settings/new
|
26
|
+
# GET /settings/new.json
|
27
|
+
def new
|
28
|
+
@setting = Setting.new
|
29
|
+
|
30
|
+
respond_to do |format|
|
31
|
+
format.html # new.html.erb
|
32
|
+
format.json { render json: @setting }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# GET /settings/1/edit
|
37
|
+
def edit
|
38
|
+
@setting = Setting.find(params[:id])
|
39
|
+
end
|
40
|
+
|
41
|
+
# POST /settings
|
42
|
+
# POST /settings.json
|
43
|
+
def create
|
44
|
+
@setting = Setting.new(params[:setting])
|
45
|
+
|
46
|
+
respond_to do |format|
|
47
|
+
if @setting.save
|
48
|
+
format.html { redirect_to @setting, notice: 'Setting was successfully created.' }
|
49
|
+
format.json { render json: @setting, status: :created, location: @setting }
|
50
|
+
else
|
51
|
+
format.html { render action: "new" }
|
52
|
+
format.json { render json: @setting.errors, status: :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /settings/1
|
58
|
+
# PUT /settings/1.json
|
59
|
+
def update
|
60
|
+
@setting = Setting.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @setting.update_attributes(params[:setting])
|
64
|
+
format.html { redirect_to @setting, notice: 'Setting was successfully updated.' }
|
65
|
+
format.json { head :ok }
|
66
|
+
else
|
67
|
+
format.html { render action: "edit" }
|
68
|
+
format.json { render json: @setting.errors, status: :unprocessable_entity }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# DELETE /settings/1
|
74
|
+
# DELETE /settings/1.json
|
75
|
+
def destroy
|
76
|
+
@setting = Setting.find(params[:id])
|
77
|
+
@setting.destroy
|
78
|
+
|
79
|
+
respond_to do |format|
|
80
|
+
format.html { redirect_to settings_url }
|
81
|
+
format.json { head :ok }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Article
|
2
|
+
include Mongoid::Document
|
3
|
+
field :title, :type => String
|
4
|
+
field :filename, :type => String
|
5
|
+
field :description, :type => String
|
6
|
+
field :keywords, :type => String
|
7
|
+
field :headline, :type => String
|
8
|
+
field :subhead, :type => String
|
9
|
+
field :content, :type => String
|
10
|
+
field :sidebar, :type => String
|
11
|
+
field :published, :type => Boolean
|
12
|
+
field :related_items, :type => Array
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Offerpage
|
2
|
+
include Mongoid::Document
|
3
|
+
field :title, :type => String
|
4
|
+
field :filename, :type => String
|
5
|
+
field :description, :type => String
|
6
|
+
field :keywords, :type => String
|
7
|
+
field :headline, :type => String
|
8
|
+
field :subhead, :type => String
|
9
|
+
field :content_block1, :type => String
|
10
|
+
field :content_block2, :type => String
|
11
|
+
field :offer_block, :type => String
|
12
|
+
field :testimonials, :type => String
|
13
|
+
field :video, :type => String
|
14
|
+
field :published, :type => Boolean
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Setting
|
2
|
+
include Mongoid::Document
|
3
|
+
field :site_name, :type => String
|
4
|
+
field :site_title, :type => String
|
5
|
+
field :site_tagline, :type => String
|
6
|
+
field :site_description, :type => String
|
7
|
+
field :site_keywords, :type => String
|
8
|
+
field :twitter_account, :type => String
|
9
|
+
field :domain, :type => String
|
10
|
+
field :articles_directory, :type => String
|
11
|
+
field :offerpages_directory, :type => String
|
12
|
+
field :sidebar, :type => String
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
- html_tag class: 'no-js' do
|
2
|
+
%head
|
3
|
+
%title testapp
|
4
|
+
%meta{:charset => "utf-8"}
|
5
|
+
%meta{"http-equiv" => "X-UA-Compatible", :content => "IE=edge,chrome=1"}
|
6
|
+
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1, maximum-scale=1"}
|
7
|
+
= stylesheet_link_tag "website_builder_engine/application"
|
8
|
+
= javascript_include_tag "website_builder_engine/application"
|
9
|
+
= csrf_meta_tags
|
10
|
+
%body{:class => params[:controller]}
|
11
|
+
#container.container
|
12
|
+
%header.sixteen.columns
|
13
|
+
%nav
|
14
|
+
%ul
|
15
|
+
= render 'shared/navigation'
|
16
|
+
%hr/
|
17
|
+
- flash.each do |name, msg|
|
18
|
+
= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String)
|
19
|
+
#main{:role => "main"}
|
20
|
+
= yield
|
21
|
+
%footer.sixteen.columns
|
22
|
+
%hr/
|
@@ -0,0 +1,24 @@
|
|
1
|
+
- html_tag class: 'no-js' do
|
2
|
+
%head
|
3
|
+
%title html5-website-builder
|
4
|
+
%meta{:charset => "utf-8"}/
|
5
|
+
%meta{:content => "", :name => "description"}
|
6
|
+
%meta{:content => "", :name => "author"}
|
7
|
+
%meta{:content => "width=device-width, initial-scale=1, maximum-scale=1", :name => "viewport"}/
|
8
|
+
= stylesheet_link_tag "website_builder_engine/application"
|
9
|
+
= javascript_include_tag "website_builder_engine/application"
|
10
|
+
= csrf_meta_tags
|
11
|
+
%body{:class => params[:controller]}
|
12
|
+
#container.container
|
13
|
+
%header.sixteen.columns
|
14
|
+
%h1.remove-bottom{:style => "margin-top: 40px"} Website Builder
|
15
|
+
%nav
|
16
|
+
%ul
|
17
|
+
= render 'shared/navigation'
|
18
|
+
%hr/
|
19
|
+
- flash.each do |name, msg|
|
20
|
+
= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String)
|
21
|
+
#main{:role => "main"}
|
22
|
+
= yield
|
23
|
+
%footer.sixteen.columns
|
24
|
+
%hr/
|
@@ -0,0 +1,47 @@
|
|
1
|
+
= form_for @article do |f|
|
2
|
+
-if @article.errors.any?
|
3
|
+
#error_explanation
|
4
|
+
%h2= "#{pluralize(@article.errors.count, "error")} prohibited this article from being saved:"
|
5
|
+
%ul
|
6
|
+
- @article.errors.full_messages.each do |msg|
|
7
|
+
%li= msg
|
8
|
+
|
9
|
+
.field
|
10
|
+
= f.label :title
|
11
|
+
= f.text_field :title
|
12
|
+
.field
|
13
|
+
= f.label :filename
|
14
|
+
= f.text_field :filename
|
15
|
+
.field
|
16
|
+
= f.label :description
|
17
|
+
= f.text_field :description
|
18
|
+
.field
|
19
|
+
= f.label :keywords
|
20
|
+
= f.text_field :keywords
|
21
|
+
.field
|
22
|
+
= f.label :headline
|
23
|
+
= f.text_field :headline
|
24
|
+
.field
|
25
|
+
= f.label :subhead
|
26
|
+
= f.text_field :subhead
|
27
|
+
.field
|
28
|
+
= radio_button_tag(:format, "textile")
|
29
|
+
= label_tag(:format_textile, "Textile")
|
30
|
+
= radio_button_tag(:format, "html")
|
31
|
+
= label_tag(:format_html, "Convert HTML to Textile")
|
32
|
+
.field
|
33
|
+
= f.label :content
|
34
|
+
= f.text_area :content
|
35
|
+
.field
|
36
|
+
= f.label :sidebar
|
37
|
+
= f.text_area :sidebar
|
38
|
+
.field
|
39
|
+
= f.label :related_item
|
40
|
+
= f.fields_for :related_item do |b|
|
41
|
+
- Article.all.each do |item|
|
42
|
+
%div
|
43
|
+
= check_box_tag "article[related_items][]", item.id,
|
44
|
+
(@article.related_items.include?(item._id.to_s) if @article.related_items)
|
45
|
+
= item.title
|
46
|
+
.actions
|
47
|
+
= f.submit 'Save'
|