comfy_blog 1.12.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -15
- data/Gemfile +7 -6
- data/LICENSE +1 -1
- data/README.md +14 -9
- data/Rakefile +1 -32
- data/app/controllers/comfy/admin/blog/posts_controller.rb +26 -22
- data/app/controllers/comfy/blog/posts_controller.rb +31 -38
- data/app/models/comfy/blog/post.rb +34 -36
- data/app/views/comfy/admin/blog/partials/_navigation.html.haml +4 -6
- data/app/views/comfy/admin/blog/posts/_form.html.haml +23 -11
- data/app/views/comfy/admin/blog/posts/edit.html.haml +2 -2
- data/app/views/comfy/admin/blog/posts/index.html.haml +29 -25
- data/app/views/comfy/admin/blog/posts/new.html.haml +2 -2
- data/app/views/comfy/blog/posts/index.html.haml +25 -10
- data/app/views/comfy/blog/posts/index.rss.builder +12 -12
- data/app/views/layouts/comfy/blog/application.html.erb +22 -0
- data/comfy_blog.gemspec +3 -1
- data/config/application.rb +13 -7
- data/config/blog_routes.rb +2 -2
- data/config/environments/development.rb +37 -4
- data/config/environments/test.rb +13 -4
- data/config/initializers/comfy_blog.rb +3 -7
- data/config/locales/cs.yml +38 -0
- data/config/locales/da.yml +38 -0
- data/config/locales/de.yml +38 -0
- data/config/locales/en.yml +38 -0
- data/config/locales/es.yml +38 -0
- data/config/locales/fr.yml +38 -0
- data/config/locales/it.yml +38 -0
- data/config/locales/ja.yml +38 -0
- data/config/locales/nb.yml +38 -0
- data/config/locales/nl.yml +38 -0
- data/config/locales/pl.yml +38 -0
- data/config/locales/pt-BR.yml +38 -0
- data/config/locales/ru.yml +38 -0
- data/config/locales/sv.yml +38 -0
- data/config/locales/tr.yml +38 -0
- data/config/locales/uk.yml +38 -0
- data/config/locales/zh-CN.yml +38 -0
- data/config/locales/zh-TW.yml +38 -0
- data/config/storage.yml +35 -0
- data/db/migrate/00_create_cms.rb +144 -116
- data/db/migrate/01_create_blog.rb +15 -43
- data/lib/comfy_blog/configuration.rb +9 -9
- data/lib/comfy_blog/engine.rb +7 -7
- data/lib/comfy_blog/routes/blog.rb +12 -13
- data/lib/comfy_blog/routes/blog_admin.rb +7 -12
- data/lib/comfy_blog/version.rb +1 -1
- data/lib/generators/comfy/blog/blog_generator.rb +16 -14
- data/test/controllers/comfy/admin/blog/posts_controller_test.rb +83 -59
- data/test/controllers/comfy/blog/posts_controller_test.rb +56 -42
- data/test/fixtures/comfy/blog/posts.yml +3 -4
- data/test/fixtures/comfy/cms/layouts.yml +10 -0
- data/test/fixtures/comfy/cms/sites.yml +1 -1
- data/test/fixtures/generators/blog/routes.rb +2 -3
- data/test/gemfiles/Gemfile.rails.5.2 +22 -0
- data/test/generators/blog_generator_test.rb +7 -7
- data/test/integration/i18n_test.rb +37 -0
- data/test/lib/configuration_test.rb +4 -5
- data/test/models/posts_test.rb +35 -30
- data/test/test_helper.rb +40 -29
- metadata +29 -35
- data/app/controllers/comfy/admin/blog/base_controller.rb +0 -12
- data/app/controllers/comfy/admin/blog/blogs_controller.rb +0 -51
- data/app/controllers/comfy/admin/blog/comments_controller.rb +0 -33
- data/app/controllers/comfy/blog/base_controller.rb +0 -33
- data/app/controllers/comfy/blog/comments_controller.rb +0 -33
- data/app/models/comfy/blog/blog.rb +0 -31
- data/app/models/comfy/blog/comment.rb +0 -29
- data/app/views/comfy/admin/blog/blogs/_form.html.haml +0 -11
- data/app/views/comfy/admin/blog/blogs/edit.html.haml +0 -5
- data/app/views/comfy/admin/blog/blogs/index.html.haml +0 -26
- data/app/views/comfy/admin/blog/blogs/new.html.haml +0 -5
- data/app/views/comfy/admin/blog/comments/_comment.html.haml +0 -17
- data/app/views/comfy/admin/blog/comments/index.html.haml +0 -17
- data/app/views/comfy/admin/blog/comments/toggle_publish.js.erb +0 -1
- data/app/views/comfy/blog/comments/_form.html.haml +0 -10
- data/app/views/comfy/blog/posts/show.html.haml +0 -18
- data/app/views/layouts/comfy/blog/application.html.haml +0 -7
- data/config/initializers/secret_token.rb +0 -15
- data/test/controllers/comfy/admin/blog/blogs_controller_test.rb +0 -94
- data/test/controllers/comfy/admin/blog/comments_controller_test.rb +0 -57
- data/test/controllers/comfy/blog/comments_controller_test.rb +0 -36
- data/test/fixtures/comfy/blog/blogs.yml +0 -7
- data/test/fixtures/comfy/blog/comments.yml +0 -6
- data/test/gemfiles/Gemfile.rails.4.0 +0 -10
- data/test/gemfiles/Gemfile.rails.4.1 +0 -10
- data/test/gemfiles/Gemfile.rails.4.2 +0 -10
- data/test/gemfiles/Gemfile.rails.master +0 -10
- data/test/models/blog_test.rb +0 -59
- data/test/models/comments_test.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beb0f6be4a487c3fb6f088c89205e007ceeebc5f
|
4
|
+
data.tar.gz: 4297e36e4134fa38c49027dfe00fd71612455f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cd0bccff29a6d2352149e5c33b149dbafd91b404d037b234abdbe2647a01b591386ea04bf851c15bebe8f4b3d79bd5860ab98e6fac6c7f9afba58ca473e9002
|
7
|
+
data.tar.gz: a579e9f83d27e048ef9a4fff230b73f9219352323dc6840abfde1abde8b938d58c0dc0596dc2bc1d665e3ab75c9372088ed032c5e56c1481f12ac37cc73f162b
|
data/.travis.yml
CHANGED
@@ -4,23 +4,13 @@ before_install:
|
|
4
4
|
before_script:
|
5
5
|
- rake db:migrate
|
6
6
|
script:
|
7
|
-
- rake
|
7
|
+
- rake test
|
8
8
|
rvm:
|
9
|
-
-
|
10
|
-
- 2.
|
11
|
-
- 2.
|
12
|
-
- 2.2.0
|
9
|
+
- 2.2.7
|
10
|
+
- 2.3.5
|
11
|
+
- 2.4.2
|
13
12
|
gemfile:
|
14
|
-
- test/gemfiles/Gemfile.rails.
|
15
|
-
- test/gemfiles/Gemfile.rails.4.1
|
16
|
-
- test/gemfiles/Gemfile.rails.4.2
|
13
|
+
- test/gemfiles/Gemfile.rails.5.2
|
17
14
|
branches:
|
18
15
|
only:
|
19
16
|
- master
|
20
|
-
matrix:
|
21
|
-
fast_finish: true
|
22
|
-
include:
|
23
|
-
- rvm: 2.2.0
|
24
|
-
gemfile: test/gemfiles/Gemfile.rails.master
|
25
|
-
allow_failures:
|
26
|
-
- gemfile: test/gemfiles/Gemfile.rails.master
|
data/Gemfile
CHANGED
@@ -5,13 +5,14 @@ gemspec
|
|
5
5
|
gem 'kaminari'
|
6
6
|
|
7
7
|
group :development do
|
8
|
-
gem '
|
9
|
-
gem '
|
10
|
-
gem
|
11
|
-
gem 'quiet_assets'
|
8
|
+
gem 'web-console'
|
9
|
+
gem 'listen'
|
10
|
+
gem "rubocop", "~> 0.51.0", require: false
|
12
11
|
end
|
13
12
|
|
14
13
|
group :test do
|
14
|
+
gem 'rails-controller-testing'
|
15
15
|
gem 'sqlite3'
|
16
|
-
gem '
|
17
|
-
|
16
|
+
gem 'mocha', require: false
|
17
|
+
gem 'coveralls', require: false
|
18
|
+
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,19 +1,24 @@
|
|
1
1
|
# ComfyBlog
|
2
|
-
[![Gem Version](https://img.shields.io/gem/v/comfy_blog.svg?style=flat)](http://rubygems.org/gems/comfy_blog) [![Gem Downloads](https://img.shields.io/gem/dt/comfy_blog.svg?style=flat)](http://rubygems.org/gems/comfy_blog) [![Build Status](https://img.shields.io/travis/comfy/comfy-blog.svg?style=flat)](https://travis-ci.org/comfy/comfy-blog) [![Dependency Status](https://img.shields.io/gemnasium/comfy/comfy-blog.svg?style=flat)](https://gemnasium.com/comfy/comfy-blog) [![Code Climate](https://img.shields.io/codeclimate/github/comfy/comfy-blog.svg?style=flat)](https://codeclimate.com/github/comfy/comfy-blog) [![Coverage Status](https://img.shields.io/coveralls/comfy/comfy-blog.svg?style=flat)](https://coveralls.io/r/comfy/comfy-blog?branch=master)
|
3
2
|
|
4
|
-
ComfyBlog is
|
3
|
+
ComfyBlog is a simple blog management engine for [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
|
5
4
|
|
6
|
-
|
5
|
+
[![Gem Version](https://img.shields.io/gem/v/comfy_blog.svg?style=flat)](http://rubygems.org/gems/comfy_blog)
|
6
|
+
[![Gem Downloads](https://img.shields.io/gem/dt/comfy_blog.svg?style=flat)](http://rubygems.org/gems/comfy_blog)
|
7
|
+
[![Build Status](https://img.shields.io/travis/comfy/comfy-blog.svg?style=flat)](https://travis-ci.org/comfy/comfy-blog)
|
8
|
+
[![Dependency Status](https://img.shields.io/gemnasium/comfy/comfy-blog.svg?style=flat)](https://gemnasium.com/comfy/comfy-blog)
|
9
|
+
[![Code Climate](https://img.shields.io/codeclimate/maintainability/comfy/comfy-blog.svg?style=flat)](https://codeclimate.com/github/comfy/comfy-blog)
|
10
|
+
[![Coverage Status](https://img.shields.io/coveralls/comfy/comfy-blog.svg?style=flat)](https://coveralls.io/r/comfy/comfy-blog?branch=master)
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
## Dependencies
|
13
|
+
|
14
|
+
Make sure that you have [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) installed first.
|
10
15
|
|
11
16
|
## Installation
|
12
17
|
|
13
18
|
Add gem definition to your Gemfile:
|
14
19
|
|
15
20
|
```ruby
|
16
|
-
gem 'comfy_blog', '~>
|
21
|
+
gem 'comfy_blog', '~> 2.0.0'
|
17
22
|
```
|
18
23
|
|
19
24
|
Then from the Rails project's root run:
|
@@ -25,12 +30,12 @@ Then from the Rails project's root run:
|
|
25
30
|
Take a look inside your `config/routes.rb` file and you should see following lines there:
|
26
31
|
|
27
32
|
```ruby
|
28
|
-
comfy_route :blog_admin, :
|
29
|
-
comfy_route :blog, :
|
33
|
+
comfy_route :blog_admin, path: 'admin'
|
34
|
+
comfy_route :blog, path: 'blog'
|
30
35
|
```
|
31
36
|
|
32
37
|
You should also find view templates in `/app/views/blog` folder. Feel free to adjust them as you see fit.
|
33
38
|
|
34
39
|
---
|
35
40
|
|
36
|
-
Copyright 2009-
|
41
|
+
Copyright 2009-2017 Oleg Khabarov
|
data/Rakefile
CHANGED
@@ -1,34 +1,3 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler.setup
|
3
|
-
|
4
|
-
require 'rake/testtask'
|
5
|
-
|
6
|
-
Rake::TestTask.new(:ci) do |t|
|
7
|
-
t.libs << 'test'
|
8
|
-
t.test_files = FileList['test/**/*_test.rb']
|
9
|
-
t.verbose = true
|
10
|
-
end
|
11
|
-
|
12
1
|
require_relative 'config/application'
|
13
|
-
ComfyBlog::Application.load_tasks
|
14
|
-
|
15
|
-
namespace :test do
|
16
|
-
|
17
|
-
Rake::TestTask.new(:lib) do |t|
|
18
|
-
t.libs << 'test'
|
19
|
-
t.pattern = 'test/lib/**/*_test.rb'
|
20
|
-
t.verbose = true
|
21
|
-
end
|
22
|
-
|
23
|
-
Rake::TestTask.new(:generators) do |t|
|
24
|
-
t.libs << 'test'
|
25
|
-
t.pattern = 'test/generators/**/*_test.rb'
|
26
|
-
t.verbose = true
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
2
|
|
31
|
-
|
32
|
-
Rake::Task['test:lib'].invoke
|
33
|
-
Rake::Task['test:generators'].invoke
|
34
|
-
end
|
3
|
+
Rails.application.load_tasks
|
@@ -1,26 +1,29 @@
|
|
1
|
-
class Comfy::Admin::Blog::PostsController < Comfy::Admin::
|
1
|
+
class Comfy::Admin::Blog::PostsController < Comfy::Admin::Cms::BaseController
|
2
2
|
|
3
|
-
before_action :
|
4
|
-
before_action :
|
5
|
-
before_action :
|
3
|
+
before_action :build_post, only: [:new, :create]
|
4
|
+
before_action :load_post, only: [:edit, :update, :destroy]
|
5
|
+
before_action :authorize
|
6
6
|
|
7
7
|
def index
|
8
|
-
|
8
|
+
return redirect_to action: :new if @site.blog_posts.count == 0
|
9
|
+
|
10
|
+
posts_scope = @site.blog_posts.
|
11
|
+
includes(:categories).for_category(params[:categories]).order(published_at: :desc)
|
12
|
+
@posts = comfy_paginate(posts_scope)
|
9
13
|
end
|
10
14
|
|
11
15
|
def new
|
12
|
-
@post.author = ComfyBlog.config.default_author
|
13
16
|
render
|
14
17
|
end
|
15
18
|
|
16
19
|
def create
|
17
20
|
@post.save!
|
18
|
-
flash[:success] = '
|
19
|
-
redirect_to :
|
21
|
+
flash[:success] = t('.created')
|
22
|
+
redirect_to action: :edit, id: @post
|
20
23
|
|
21
24
|
rescue ActiveRecord::RecordInvalid
|
22
|
-
flash.now[:
|
23
|
-
render :
|
25
|
+
flash.now[:danger] = t('.create_failure')
|
26
|
+
render action: :new
|
24
27
|
end
|
25
28
|
|
26
29
|
def edit
|
@@ -29,36 +32,37 @@ class Comfy::Admin::Blog::PostsController < Comfy::Admin::Blog::BaseController
|
|
29
32
|
|
30
33
|
def update
|
31
34
|
@post.update_attributes!(post_params)
|
32
|
-
flash[:success] = '
|
33
|
-
redirect_to :
|
35
|
+
flash[:success] = t('.updated')
|
36
|
+
redirect_to action: :edit, id: @post
|
34
37
|
|
35
38
|
rescue ActiveRecord::RecordInvalid
|
36
|
-
flash.now[:
|
37
|
-
render :
|
39
|
+
flash.now[:danger] = t('.update_failure')
|
40
|
+
render action: :edit
|
38
41
|
end
|
39
42
|
|
40
43
|
def destroy
|
41
44
|
@post.destroy
|
42
|
-
flash[:success] = '
|
43
|
-
redirect_to :
|
45
|
+
flash[:success] = t('.deleted')
|
46
|
+
redirect_to action: :index
|
44
47
|
end
|
45
48
|
|
46
49
|
protected
|
47
50
|
|
48
51
|
def load_post
|
49
|
-
@post = @
|
52
|
+
@post = @site.blog_posts.find(params[:id])
|
50
53
|
rescue ActiveRecord::RecordNotFound
|
51
|
-
flash[:
|
52
|
-
redirect_to :
|
54
|
+
flash[:danger] = t('.not_found')
|
55
|
+
redirect_to action: :index
|
53
56
|
end
|
54
57
|
|
55
58
|
def build_post
|
56
|
-
|
59
|
+
layout = (@site.blog_posts.order(:created_at).last.try(:layout) || @site.layouts.order(:created_at).first)
|
60
|
+
@post = @site.blog_posts.new(post_params)
|
57
61
|
@post.published_at ||= Time.zone.now
|
62
|
+
@post.layout ||= layout
|
58
63
|
end
|
59
64
|
|
60
65
|
def post_params
|
61
66
|
params.fetch(:post, {}).permit!
|
62
67
|
end
|
63
|
-
|
64
|
-
end
|
68
|
+
end
|
@@ -1,53 +1,46 @@
|
|
1
|
-
class Comfy::Blog::PostsController < Comfy::
|
1
|
+
class Comfy::Blog::PostsController < Comfy::Cms::BaseController
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
# due to fancy routing it's hard to say if we need show or index
|
6
|
-
# action. let's figure it out here.
|
7
|
-
def serve
|
8
|
-
# if there are more than one blog, blog_path is expected
|
9
|
-
if @cms_site.blogs.count >= 2
|
10
|
-
params[:blog_path] = params.delete(:slug) if params[:blog_path].blank?
|
11
|
-
end
|
12
|
-
|
13
|
-
load_blog
|
14
|
-
|
15
|
-
if params[:slug].present?
|
16
|
-
show && render(:show)
|
17
|
-
else
|
18
|
-
index && render(:index)
|
19
|
-
end
|
20
|
-
end
|
3
|
+
include Comfy::Paginate
|
21
4
|
|
22
5
|
def index
|
23
6
|
scope = if params[:year]
|
24
|
-
scope = @
|
7
|
+
scope = @cms_site.blog_posts.published.for_year(params[:year])
|
25
8
|
params[:month] ? scope.for_month(params[:month]) : scope
|
26
9
|
else
|
27
|
-
@
|
10
|
+
@cms_site.blog_posts.published
|
28
11
|
end
|
29
12
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
format.rss do
|
36
|
-
@posts = scope.limit(limit)
|
37
|
-
end
|
38
|
-
end
|
13
|
+
scope = scope.for_category(params[:category]) if params[:category]
|
14
|
+
|
15
|
+
@blog_posts = comfy_paginate(scope, per_page: ComfyBlog.config.posts_per_page)
|
16
|
+
render layout: ComfyBlog.config.app_layout
|
39
17
|
end
|
40
18
|
|
41
19
|
def show
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
@comment = @post.comments.new
|
20
|
+
load_post
|
21
|
+
|
22
|
+
render inline: @cms_post.content_cache,
|
23
|
+
layout: app_layout,
|
24
|
+
content_type: "text/html"
|
48
25
|
|
49
26
|
rescue ActiveRecord::RecordNotFound
|
50
|
-
render :
|
27
|
+
render cms_page: '/404', status: 404
|
51
28
|
end
|
52
29
|
|
53
|
-
|
30
|
+
private
|
31
|
+
|
32
|
+
def load_post
|
33
|
+
post_scope = @cms_site.blog_posts.published.where(slug: params[:slug])
|
34
|
+
@cms_post = if params[:year] && params[:month]
|
35
|
+
post_scope = post_scope.where(year: params[:year], month: params[:month]).first!
|
36
|
+
else
|
37
|
+
post_scope.first!
|
38
|
+
end
|
39
|
+
@cms_layout = @cms_post.layout
|
40
|
+
end
|
41
|
+
|
42
|
+
def app_layout
|
43
|
+
return false unless @cms_layout
|
44
|
+
@cms_layout.app_layout.present? ? @cms_layout.app_layout : false
|
45
|
+
end
|
46
|
+
end
|
@@ -1,52 +1,50 @@
|
|
1
1
|
class Comfy::Blog::Post < ActiveRecord::Base
|
2
|
-
|
2
|
+
|
3
3
|
self.table_name = 'comfy_blog_posts'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
|
5
|
+
include Comfy::Cms::WithFragments
|
6
|
+
include Comfy::Cms::WithCategories
|
7
|
+
|
8
|
+
# -- Relationships -----------------------------------------------------------
|
9
|
+
belongs_to :site,
|
10
|
+
class_name: 'Comfy::Cms::Site'
|
11
|
+
|
12
|
+
# -- Validations -------------------------------------------------------------
|
13
|
+
validates :title, :slug, :year, :month,
|
14
|
+
presence: true
|
14
15
|
validates :slug,
|
15
|
-
:
|
16
|
-
:
|
17
|
-
|
18
|
-
# -- Scopes
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
scope :for_year, -> year {
|
26
|
-
where(:year => year)
|
27
|
-
}
|
28
|
-
scope :for_month, -> month {
|
29
|
-
where(:month => month)
|
30
|
-
}
|
31
|
-
|
32
|
-
# -- Callbacks ------------------------------------------------------------
|
16
|
+
uniqueness: {scope: [:site_id, :year, :month]},
|
17
|
+
format: {with: /\A%*\w[a-z0-9_\-\%]*\z/i }
|
18
|
+
|
19
|
+
# -- Scopes ------------------------------------------------------------------
|
20
|
+
scope :published, -> {where(is_published: true)}
|
21
|
+
scope :for_year, -> year {where(year: year)}
|
22
|
+
scope :for_month, -> month {where(month: month)}
|
23
|
+
|
24
|
+
# -- Callbacks ---------------------------------------------------------------
|
33
25
|
before_validation :set_slug,
|
34
26
|
:set_published_at,
|
35
27
|
:set_date
|
36
|
-
|
28
|
+
|
29
|
+
# -- Instance Mathods --------------------------------------------------------
|
30
|
+
def url(relative: false)
|
31
|
+
public_blog_path = ComfyBlog.config.public_blog_path
|
32
|
+
post_path = ['/', public_blog_path, self.year, self.month, self.slug].join('/').squeeze('/')
|
33
|
+
[self.site.url(relative: relative), post_path].join
|
34
|
+
end
|
35
|
+
|
37
36
|
protected
|
38
|
-
|
37
|
+
|
39
38
|
def set_slug
|
40
|
-
self.slug ||= self.title.to_s.
|
39
|
+
self.slug ||= self.title.to_s.parameterize
|
41
40
|
end
|
42
|
-
|
41
|
+
|
43
42
|
def set_date
|
44
43
|
self.year = self.published_at.year
|
45
44
|
self.month = self.published_at.month
|
46
45
|
end
|
47
|
-
|
46
|
+
|
48
47
|
def set_published_at
|
49
48
|
self.published_at ||= Time.zone.now
|
50
49
|
end
|
51
|
-
|
52
|
-
end
|
50
|
+
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
- if @site
|
2
|
-
%li
|
3
|
-
|
4
|
-
|
5
|
-
%li= active_link_to 'Posts', comfy_admin_blog_posts_path(@site, @blog)
|
6
|
-
%li= active_link_to 'Comments', comfy_admin_blog_comments_path(@site, @blog)
|
1
|
+
- if @site && @site.persisted?
|
2
|
+
%li.nav-item
|
3
|
+
= active_link_to comfy_admin_blog_posts_path(@site), class: "nav-link" do
|
4
|
+
= t('comfy.admin.cms.base.posts')
|
@@ -1,11 +1,23 @@
|
|
1
|
-
=
|
2
|
-
|
3
|
-
= form.text_field :
|
4
|
-
= form.
|
5
|
-
|
6
|
-
|
7
|
-
= form.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
= comfy_admin_partial "comfy/admin/blog/partials/post_form_before", form: form
|
2
|
+
|
3
|
+
= form.text_field :title, data: {slugify: @post.new_record?}
|
4
|
+
= form.text_field :slug, data: {slug: true}
|
5
|
+
|
6
|
+
- if (options = ::Comfy::Cms::Layout.options_for_select(@site)).present?
|
7
|
+
= form.select :layout_id, options, {}, {data: {url: form_fragments_comfy_admin_cms_site_page_path(@site, @post.id.to_i)}, id: "fragments-toggle"}
|
8
|
+
|
9
|
+
= render "comfy/admin/cms/pages/form_fragments", form: form, record: @post
|
10
|
+
|
11
|
+
= render 'comfy/admin/cms/categories/form', form: form
|
12
|
+
|
13
|
+
= form.text_field :published_at, value: @post.published_at.try(:to_s, :db), data: {'cms-datetime' => true}
|
14
|
+
|
15
|
+
.row
|
16
|
+
.col-sm-10.ml-auto
|
17
|
+
= form.check_box :is_published
|
18
|
+
|
19
|
+
= comfy_admin_partial "comfy/admin/blog/partials/post_form_after", form: form
|
20
|
+
|
21
|
+
= form.form_actions do
|
22
|
+
= form.submit t(@post.new_record?? '.create' : '.update'), class: "btn btn-primary"
|
23
|
+
= link_to t('.cancel'), comfy_admin_blog_posts_path(@site, @blog), class: 'btn btn-link'
|