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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -15
  3. data/Gemfile +7 -6
  4. data/LICENSE +1 -1
  5. data/README.md +14 -9
  6. data/Rakefile +1 -32
  7. data/app/controllers/comfy/admin/blog/posts_controller.rb +26 -22
  8. data/app/controllers/comfy/blog/posts_controller.rb +31 -38
  9. data/app/models/comfy/blog/post.rb +34 -36
  10. data/app/views/comfy/admin/blog/partials/_navigation.html.haml +4 -6
  11. data/app/views/comfy/admin/blog/posts/_form.html.haml +23 -11
  12. data/app/views/comfy/admin/blog/posts/edit.html.haml +2 -2
  13. data/app/views/comfy/admin/blog/posts/index.html.haml +29 -25
  14. data/app/views/comfy/admin/blog/posts/new.html.haml +2 -2
  15. data/app/views/comfy/blog/posts/index.html.haml +25 -10
  16. data/app/views/comfy/blog/posts/index.rss.builder +12 -12
  17. data/app/views/layouts/comfy/blog/application.html.erb +22 -0
  18. data/comfy_blog.gemspec +3 -1
  19. data/config/application.rb +13 -7
  20. data/config/blog_routes.rb +2 -2
  21. data/config/environments/development.rb +37 -4
  22. data/config/environments/test.rb +13 -4
  23. data/config/initializers/comfy_blog.rb +3 -7
  24. data/config/locales/cs.yml +38 -0
  25. data/config/locales/da.yml +38 -0
  26. data/config/locales/de.yml +38 -0
  27. data/config/locales/en.yml +38 -0
  28. data/config/locales/es.yml +38 -0
  29. data/config/locales/fr.yml +38 -0
  30. data/config/locales/it.yml +38 -0
  31. data/config/locales/ja.yml +38 -0
  32. data/config/locales/nb.yml +38 -0
  33. data/config/locales/nl.yml +38 -0
  34. data/config/locales/pl.yml +38 -0
  35. data/config/locales/pt-BR.yml +38 -0
  36. data/config/locales/ru.yml +38 -0
  37. data/config/locales/sv.yml +38 -0
  38. data/config/locales/tr.yml +38 -0
  39. data/config/locales/uk.yml +38 -0
  40. data/config/locales/zh-CN.yml +38 -0
  41. data/config/locales/zh-TW.yml +38 -0
  42. data/config/storage.yml +35 -0
  43. data/db/migrate/00_create_cms.rb +144 -116
  44. data/db/migrate/01_create_blog.rb +15 -43
  45. data/lib/comfy_blog/configuration.rb +9 -9
  46. data/lib/comfy_blog/engine.rb +7 -7
  47. data/lib/comfy_blog/routes/blog.rb +12 -13
  48. data/lib/comfy_blog/routes/blog_admin.rb +7 -12
  49. data/lib/comfy_blog/version.rb +1 -1
  50. data/lib/generators/comfy/blog/blog_generator.rb +16 -14
  51. data/test/controllers/comfy/admin/blog/posts_controller_test.rb +83 -59
  52. data/test/controllers/comfy/blog/posts_controller_test.rb +56 -42
  53. data/test/fixtures/comfy/blog/posts.yml +3 -4
  54. data/test/fixtures/comfy/cms/layouts.yml +10 -0
  55. data/test/fixtures/comfy/cms/sites.yml +1 -1
  56. data/test/fixtures/generators/blog/routes.rb +2 -3
  57. data/test/gemfiles/Gemfile.rails.5.2 +22 -0
  58. data/test/generators/blog_generator_test.rb +7 -7
  59. data/test/integration/i18n_test.rb +37 -0
  60. data/test/lib/configuration_test.rb +4 -5
  61. data/test/models/posts_test.rb +35 -30
  62. data/test/test_helper.rb +40 -29
  63. metadata +29 -35
  64. data/app/controllers/comfy/admin/blog/base_controller.rb +0 -12
  65. data/app/controllers/comfy/admin/blog/blogs_controller.rb +0 -51
  66. data/app/controllers/comfy/admin/blog/comments_controller.rb +0 -33
  67. data/app/controllers/comfy/blog/base_controller.rb +0 -33
  68. data/app/controllers/comfy/blog/comments_controller.rb +0 -33
  69. data/app/models/comfy/blog/blog.rb +0 -31
  70. data/app/models/comfy/blog/comment.rb +0 -29
  71. data/app/views/comfy/admin/blog/blogs/_form.html.haml +0 -11
  72. data/app/views/comfy/admin/blog/blogs/edit.html.haml +0 -5
  73. data/app/views/comfy/admin/blog/blogs/index.html.haml +0 -26
  74. data/app/views/comfy/admin/blog/blogs/new.html.haml +0 -5
  75. data/app/views/comfy/admin/blog/comments/_comment.html.haml +0 -17
  76. data/app/views/comfy/admin/blog/comments/index.html.haml +0 -17
  77. data/app/views/comfy/admin/blog/comments/toggle_publish.js.erb +0 -1
  78. data/app/views/comfy/blog/comments/_form.html.haml +0 -10
  79. data/app/views/comfy/blog/posts/show.html.haml +0 -18
  80. data/app/views/layouts/comfy/blog/application.html.haml +0 -7
  81. data/config/initializers/secret_token.rb +0 -15
  82. data/test/controllers/comfy/admin/blog/blogs_controller_test.rb +0 -94
  83. data/test/controllers/comfy/admin/blog/comments_controller_test.rb +0 -57
  84. data/test/controllers/comfy/blog/comments_controller_test.rb +0 -36
  85. data/test/fixtures/comfy/blog/blogs.yml +0 -7
  86. data/test/fixtures/comfy/blog/comments.yml +0 -6
  87. data/test/gemfiles/Gemfile.rails.4.0 +0 -10
  88. data/test/gemfiles/Gemfile.rails.4.1 +0 -10
  89. data/test/gemfiles/Gemfile.rails.4.2 +0 -10
  90. data/test/gemfiles/Gemfile.rails.master +0 -10
  91. data/test/models/blog_test.rb +0 -59
  92. data/test/models/comments_test.rb +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09145ea32c2a6b0cfd5b35c66dfa9d59af182c04
4
- data.tar.gz: 0efe6fd8ebed393e88d9f255448e54d7ca8fc9d3
3
+ metadata.gz: beb0f6be4a487c3fb6f088c89205e007ceeebc5f
4
+ data.tar.gz: 4297e36e4134fa38c49027dfe00fd71612455f84
5
5
  SHA512:
6
- metadata.gz: 93531bcfed2ee3d3c2cffce8a90503e487ae7e49aa7f0c9269f0f02f6791ca913faef0ec93e628adf2a6b8fe4d4d125b2d561ebe60434473885e52114c0c55b3
7
- data.tar.gz: 5f16da3322937f76771c5b2a94b21348db82bbf7470fe2955f6e03b52967dd965b6023a62350cac483789667190637e0c64986d3d8bc661a3df0a72286c92d9f
6
+ metadata.gz: 2cd0bccff29a6d2352149e5c33b149dbafd91b404d037b234abdbe2647a01b591386ea04bf851c15bebe8f4b3d79bd5860ab98e6fac6c7f9afba58ca473e9002
7
+ data.tar.gz: a579e9f83d27e048ef9a4fff230b73f9219352323dc6840abfde1abde8b938d58c0dc0596dc2bc1d665e3ab75c9372088ed032c5e56c1481f12ac37cc73f162b
@@ -4,23 +4,13 @@ before_install:
4
4
  before_script:
5
5
  - rake db:migrate
6
6
  script:
7
- - rake ci
7
+ - rake test
8
8
  rvm:
9
- - 1.9.3
10
- - 2.0.0
11
- - 2.1.5
12
- - 2.2.0
9
+ - 2.2.7
10
+ - 2.3.5
11
+ - 2.4.2
13
12
  gemfile:
14
- - test/gemfiles/Gemfile.rails.4.0
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 'awesome_print'
9
- gem 'better_errors'
10
- gem 'binding_of_caller'
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 'coveralls', :require => false
17
- end
16
+ gem 'mocha', require: false
17
+ gem 'coveralls', require: false
18
+ end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2013 Oleg Khabarov
1
+ Copyright 2013-2017 Oleg Khabarov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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 an simple blog management engine for [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
3
+ ComfyBlog is a simple blog management engine for [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
5
4
 
6
- ## Features
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
- * Ability to set up multiple blogs per site
9
- * User defined layout per blog
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', '~> 1.12.0'
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, :path => 'admin'
29
- comfy_route :blog, :path => '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-2014 Oleg Khabarov
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
- Rake::Task[:test].enhance do
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::Blog::BaseController
1
+ class Comfy::Admin::Blog::PostsController < Comfy::Admin::Cms::BaseController
2
2
 
3
- before_action :load_blog
4
- before_action :build_post, :only => [:new, :create]
5
- before_action :load_post, :only => [:edit, :update, :destroy]
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
- @posts = comfy_paginate(@blog.posts.order(:published_at))
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] = 'Blog Post created'
19
- redirect_to :action => :edit, :id => @post
21
+ flash[:success] = t('.created')
22
+ redirect_to action: :edit, id: @post
20
23
 
21
24
  rescue ActiveRecord::RecordInvalid
22
- flash.now[:error] = 'Failed to create Blog Post'
23
- render :action => :new
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] = 'Blog Post updated'
33
- redirect_to :action => :edit, :id => @post
35
+ flash[:success] = t('.updated')
36
+ redirect_to action: :edit, id: @post
34
37
 
35
38
  rescue ActiveRecord::RecordInvalid
36
- flash.now[:error] = 'Failed to update Blog Post'
37
- render :action => :edit
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] = 'Blog Post removed'
43
- redirect_to :action => :index
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 = @blog.posts.find(params[:id])
52
+ @post = @site.blog_posts.find(params[:id])
50
53
  rescue ActiveRecord::RecordNotFound
51
- flash[:error] = 'Blog Post not found'
52
- redirect_to :action => :index
54
+ flash[:danger] = t('.not_found')
55
+ redirect_to action: :index
53
56
  end
54
57
 
55
58
  def build_post
56
- @post = @blog.posts.new(post_params)
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::Blog::BaseController
1
+ class Comfy::Blog::PostsController < Comfy::Cms::BaseController
2
2
 
3
- skip_before_action :load_blog, :only => [:serve]
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 = @blog.posts.published.for_year(params[:year])
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
- @blog.posts.published
10
+ @cms_site.blog_posts.published
28
11
  end
29
12
 
30
- limit = ComfyBlog.config.posts_per_page
31
- respond_to do |format|
32
- format.html do
33
- @posts = comfy_paginate(scope, limit)
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
- @post = if params[:slug] && params[:year] && params[:month]
43
- @blog.posts.published.where(:year => params[:year], :month => params[:month], :slug => params[:slug]).first!
44
- else
45
- @blog.posts.published.where(:slug => params[:slug]).first!
46
- end
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 :cms_page => '/404', :status => 404
27
+ render cms_page: '/404', status: 404
51
28
  end
52
29
 
53
- end
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
- # -- Relationships --------------------------------------------------------
6
- belongs_to :blog
7
-
8
- has_many :comments,
9
- :dependent => :destroy
10
-
11
- # -- Validations ----------------------------------------------------------
12
- validates :blog_id, :title, :slug, :year, :month, :content,
13
- :presence => true
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
- :uniqueness => { :scope => [:blog_id, :year, :month] },
16
- :format => { :with => /\A%*\w[a-z0-9_\-\%]*\z/i }
17
-
18
- # -- Scopes ---------------------------------------------------------------
19
- default_scope -> {
20
- order('published_at DESC')
21
- }
22
- scope :published, -> {
23
- where(:is_published => true)
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.downcase.slugify
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.present? && @site.persisted?
2
- %li= active_link_to 'Blogs', comfy_admin_blogs_path(@site)
3
- - if @blog.present? && @blog.persisted?
4
- %ul
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
- = form.text_field :title, :data => {:slugify => @post.new_record?}
2
- = form.text_field :slug, :data => {:slug => true}
3
- = form.text_field :author
4
- = form.text_area :content, :data => {'cms-rich-text' => true}
5
- = form.text_area :excerpt, :class => 'short'
6
- = form.text_field :published_at, :value => @post.published_at.try(:to_s, :db), :data => {'cms-datetime' => true}
7
- = form.form_group :is_published do
8
- = form.check_box :is_published
9
-
10
- = form.form_group :class => 'form-actions' do
11
- = form.submit :class => 'btn btn-primary'
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'