fuel 0.3.3 → 0.3.20

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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/app/assets/images/fuel/icon-test.png +0 -0
  4. data/app/assets/images/fuel/icons/application-icons.svg +1 -0
  5. data/app/assets/images/fuel/icons/calendar-icon.svg +1 -0
  6. data/app/assets/images/fuel/icons/dropdown-arrow-icon.svg +10 -0
  7. data/app/assets/images/fuel/icons/navigation-icons.svg +1 -0
  8. data/app/assets/javascripts/fuel/admin.js.erb +17 -17
  9. data/app/assets/javascripts/fuel/application.js +8 -0
  10. data/app/assets/javascripts/fuel/datepicker.js +11 -0
  11. data/app/assets/javascripts/fuel/facebook.js +12 -0
  12. data/app/assets/javascripts/fuel/posts.js.erb +16 -0
  13. data/app/assets/javascripts/fuel/rich-text.js +9 -0
  14. data/app/assets/javascripts/fuel/sliding-panel.js +11 -0
  15. data/app/assets/stylesheets/fuel/_page-layout.scss +61 -0
  16. data/app/assets/stylesheets/fuel/_post-list.scss +70 -0
  17. data/app/assets/stylesheets/fuel/application.css.scss +27 -2
  18. data/app/assets/stylesheets/fuel/base/_base.scss +5 -0
  19. data/app/assets/stylesheets/fuel/base/_layout.scss +54 -0
  20. data/app/assets/stylesheets/fuel/base/_typography.scss +102 -0
  21. data/app/assets/stylesheets/fuel/components/_alerts.scss +27 -0
  22. data/app/assets/stylesheets/fuel/components/_animations.scss +26 -0
  23. data/app/assets/stylesheets/fuel/components/_application-icons.scss +42 -0
  24. data/app/assets/stylesheets/fuel/components/_buttons.scss +106 -0
  25. data/app/assets/stylesheets/fuel/components/_card.scss +39 -0
  26. data/app/assets/stylesheets/fuel/components/_components.scss +13 -0
  27. data/app/assets/stylesheets/fuel/components/_forms.scss +90 -0
  28. data/app/assets/stylesheets/fuel/components/_navbar.scss +45 -0
  29. data/app/assets/stylesheets/fuel/components/_navigation-icons.scss +41 -0
  30. data/app/assets/stylesheets/fuel/components/_page-sidebar.scss +60 -0
  31. data/app/assets/stylesheets/fuel/components/_sliding-panel.scss +59 -0
  32. data/app/assets/stylesheets/fuel/settings/_reset.scss +46 -0
  33. data/app/assets/stylesheets/fuel/settings/_settings.scss +19 -0
  34. data/app/assets/stylesheets/fuel/settings/mixins/_layout.scss +20 -0
  35. data/app/assets/stylesheets/fuel/settings/mixins/_misc.scss +27 -0
  36. data/app/assets/stylesheets/fuel/settings/mixins/_rem.scss +46 -0
  37. data/app/assets/stylesheets/fuel/settings/mixins/_typography.scss +64 -0
  38. data/app/assets/stylesheets/fuel/settings/variables/_alerts.scss +9 -0
  39. data/app/assets/stylesheets/fuel/settings/variables/_buttons.scss +8 -0
  40. data/app/assets/stylesheets/fuel/settings/variables/_colors.scss +55 -0
  41. data/app/assets/stylesheets/fuel/settings/variables/_typography.scss +25 -0
  42. data/app/controllers/fuel/admin/admin_controller.rb +7 -0
  43. data/app/controllers/fuel/admin/authors_controller.rb +80 -0
  44. data/app/controllers/fuel/admin/posts_controller.rb +68 -54
  45. data/app/controllers/fuel/fuel_controller.rb +5 -0
  46. data/app/controllers/fuel/posts_controller.rb +13 -7
  47. data/app/controllers/fuel_controller.rb +5 -0
  48. data/app/helpers/fuel/posts_helper.rb +28 -1
  49. data/app/models/fuel.rb +5 -0
  50. data/app/models/fuel/author.rb +18 -0
  51. data/app/models/fuel/post.rb +32 -2
  52. data/app/views/fuel/admin/authors/_authors.html.erb +24 -0
  53. data/app/views/fuel/admin/authors/_form.html.erb +52 -0
  54. data/app/views/fuel/admin/authors/edit.html.erb +9 -0
  55. data/app/views/fuel/admin/authors/index.html.erb +7 -0
  56. data/app/views/fuel/admin/authors/new.html.erb +6 -0
  57. data/app/views/fuel/admin/posts/_content.html.erb +5 -0
  58. data/app/views/fuel/admin/posts/_form.html.erb +56 -0
  59. data/app/views/fuel/admin/posts/_post_preview.html.erb +12 -0
  60. data/app/views/fuel/admin/posts/_posts.html.erb +23 -0
  61. data/app/views/fuel/admin/posts/edit.html.erb +11 -0
  62. data/app/views/fuel/admin/posts/index.html.erb +6 -0
  63. data/app/views/fuel/admin/posts/new.html.erb +9 -0
  64. data/app/views/fuel/components/_navbar.html.erb +22 -0
  65. data/app/views/fuel/posts/_additional_info.html.erb +7 -0
  66. data/app/views/fuel/posts/_facebook_sdk.html.erb +17 -0
  67. data/app/views/fuel/posts/_tweet.html.erb +1 -1
  68. data/app/views/fuel/posts/index.html.erb +27 -6
  69. data/app/views/fuel/posts/show.html.erb +19 -2
  70. data/app/views/layouts/fuel/application.html.erb +19 -12
  71. data/config/routes.rb +18 -10
  72. data/db/migrate/20141114201953_add_featured_image_field.rb +5 -0
  73. data/db/migrate/20141118162158_add_teaser_to_posts.rb +5 -0
  74. data/db/migrate/20141217174229_add_featured_image_to_posts.rb +10 -0
  75. data/db/migrate/20150414220732_add_seo_fields_to_post.rb +6 -0
  76. data/db/migrate/20150529201715_add_posted_at_to_posts.rb +5 -0
  77. data/db/migrate/20150529202105_create_fuel_authors.rb +13 -0
  78. data/db/migrate/20150530180444_add_author_id_to_posts.rb +5 -0
  79. data/db/migrate/20150603205232_add_contact_methods_to_authors.rb +8 -0
  80. data/db/migrate/20150604155028_add_published_at_to_fuel_posts.rb +5 -0
  81. data/db/migrate/20150604161900_remove_posted_at_from_fuel_posts.rb +5 -0
  82. data/lib/blog_importer.rb +82 -0
  83. data/lib/example_author.rb +108 -0
  84. data/lib/fuel.rb +7 -1
  85. data/lib/fuel/configuration.rb +16 -1
  86. data/lib/fuel/engine.rb +13 -1
  87. data/lib/fuel/version.rb +1 -1
  88. data/lib/generators/fuel/install_generator.rb +4 -0
  89. data/lib/generators/fuel/views_generator.rb +1 -1
  90. data/lib/generators/templates/fuel.rb +22 -0
  91. data/lib/kaminari/helpers/tag.rb +16 -0
  92. data/lib/tasks/fuel_tasks.rake +35 -4
  93. data/test/fixtures/fuel/authors.yml +11 -0
  94. data/test/models/fuel/author_test.rb +7 -0
  95. metadata +191 -15
  96. data/app/assets/stylesheets/fuel/admin.css.sass +0 -91
  97. data/app/assets/stylesheets/fuel/posts.css.sass +0 -23
  98. data/app/controllers/fuel/application_controller.rb +0 -4
  99. data/app/helpers/fuel/application_helper.rb +0 -34
  100. data/app/views/fuel/admin/posts/_content.html.slim +0 -3
  101. data/app/views/fuel/admin/posts/_form.html.slim +0 -28
  102. data/app/views/fuel/admin/posts/edit.html.slim +0 -4
  103. data/app/views/fuel/admin/posts/index.html.slim +0 -18
  104. data/app/views/fuel/admin/posts/new.html.slim +0 -4
  105. data/app/views/fuel/posts/_post.html.erb +0 -19
@@ -1,72 +1,86 @@
1
1
  module Fuel
2
- class Admin::PostsController < ApplicationController
3
- http_basic_authenticate_with name: Fuel.configuration.username, password: Fuel.configuration.password
4
- layout "fuel/application"
2
+ module Admin
3
+ class PostsController < AdminController
4
+ layout "fuel/application"
5
+ before_filter :find_posts
6
+ before_filter :find_post, only: [:edit, :update, :destroy]
7
+ before_filter :set_url, only: [:new, :create, :edit, :update]
5
8
 
6
- def index
7
- @posts = Fuel::Post.all
8
- end
9
+ def index
10
+ end
9
11
 
10
- def new
11
- @post = Fuel::Post.new
12
- end
12
+ def new
13
+ @post = Fuel::Post.new
14
+ end
15
+
16
+ def create
17
+ @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_post] : post_params
18
+ @post = Fuel::Post.new(@params_hash)
19
+ update_published
13
20
 
14
- def create
15
- @post = Fuel::Post.new
16
- @post.tag = post_params["tag"]
17
- @post.author = post_params["author"]
18
- @post.content = post_params["content"]
19
- @post.title = post_params["title"]
20
- update_published
21
-
22
- if @post.save
23
- redirect_to admin_posts_path, notice: "Your blog post was successfully #{@message}."
24
- else
25
- render action: "new"
21
+ if @post.save
22
+ redirect_to fuel.admin_posts_path, notice: "Your blog post was successfully #{@message}."
23
+ else
24
+ render action: "new"
25
+ end
26
26
  end
27
- end
28
27
 
29
- def edit
30
- @post = Fuel::Post.find_by_slug(params[:id])
31
- end
28
+ def edit
32
29
 
33
- def update
34
- @post = Fuel::Post.find_by_slug(params[:id])
35
- @post.tag = post_params["tag"]
36
- @post.author = post_params["author"]
37
- @post.content = post_params["content"]
38
- @post.title = post_params["title"]
39
- update_published
40
- if @post.save
41
- redirect_to admin_posts_path, notice: "Post was updated and #{@message}"
42
- else
43
- render action: "edit"
44
30
  end
45
- end
46
31
 
47
- def destroy
48
- @post = Fuel::Post.find_by_slug(params[:id])
49
- @post.destroy
50
- redirect_to admin_posts_path, notice: "Post was successfully deleted"
51
- end
32
+ def update
33
+ @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_post] : post_params
34
+ @post.attributes = @params_hash
35
+ update_published
52
36
 
53
- def preview
54
- @content = params[:post][:content]
55
- respond_to do |format|
56
- format.js
37
+ if @post.save
38
+ redirect_to fuel.edit_admin_post_path(@post), notice: "Post was updated and #{@message}"
39
+ else
40
+ render "edit"
41
+ end
57
42
  end
58
- end
59
43
 
60
- private
44
+ def destroy
45
+ @post.destroy
46
+ redirect_to fuel.admin_posts_path, notice: "Post was successfully deleted"
47
+ end
61
48
 
62
- def post_params
63
- params.require(:post).permit(:tag, :author, :content, :title)
49
+ def preview
50
+ @content = params[:fuel_post][:content]
51
+ respond_to do |format|
52
+ format.js
53
+ end
64
54
  end
65
55
 
66
- def update_published
67
- @post.published = params[:commit] == "Save Draft" ? false : true
68
- @message = @post.published ? "posted" : "saved"
56
+ def show
69
57
  end
70
58
 
59
+ private
60
+
61
+ def post_params
62
+ params.require(:fuel_post).permit(:tag, :author_id, :content, :title, :teaser, :featured_image, :published, :published_at)
63
+ end
64
+
65
+ def update_published
66
+ published_at_string = @params_hash[:published_at]
67
+ published_at_datetime = DateTime.strptime(published_at_string, "%m/%d/%Y")
68
+ @post.published_at = published_at_datetime if published_at_datetime
69
+ @message = @post.published ? "posted" : "saved"
70
+ end
71
+
72
+ def find_post
73
+ @post = Fuel::Post.find_by_slug(params[:id])
74
+ end
75
+
76
+ def find_posts
77
+ @posts = Fuel::Post.order("created_at DESC")
78
+ end
79
+
80
+ def set_url
81
+ @url = ["new", "create"].include?(action_name) ? fuel.admin_posts_path : fuel.admin_post_path(@post)
82
+ end
83
+
84
+ end
71
85
  end
72
- end
86
+ end
@@ -0,0 +1,5 @@
1
+ module Fuel
2
+ class FuelController < ::FuelController
3
+
4
+ end
5
+ end
@@ -1,7 +1,5 @@
1
- require_dependency "fuel/application_controller"
2
-
3
1
  module Fuel
4
- class PostsController < ApplicationController
2
+ class PostsController < FuelController
5
3
  include ActionView::Helpers::TextHelper
6
4
  layout Fuel.configuration.layout if Fuel.configuration.layout
7
5
  before_filter :define_title
@@ -12,12 +10,14 @@ module Fuel
12
10
 
13
11
  def index
14
12
  @posts = Fuel::Post.recent_published_posts.page(params[:page])
13
+ @title = Fuel.configuration.blog_title
14
+ @description = Fuel.configuration.blog_description
15
15
  end
16
16
 
17
17
  def show
18
- # delete || Fuel::Post.find_by_id(params[:id]) once done testing pagination
19
- @post = Fuel::Post.find_by_slug(params[:id]) || Fuel::Post.find_by_id(params[:id])
20
- @title = truncate_on_space(@post.title, 70)
18
+ @post = Fuel::Post.find_by_slug(params[:id]) || Fuel::Post.find_by_id(params[:id]) || not_found
19
+ @title = truncate_on_space(@post.seo_title, 70)
20
+ @description = @post.seo_description
21
21
  @disqus_name = Fuel.configuration.disqus_name
22
22
  end
23
23
 
@@ -28,10 +28,16 @@ module Fuel
28
28
  end
29
29
  end
30
30
 
31
+ def redirect
32
+ post = Fuel::Post.find_by_slug(params[:id]) || Fuel::Post.find_by_id(params[:id])
33
+ return redirect_to fuel.post_path(post)
34
+ end
35
+
31
36
  private
32
37
 
33
- def truncate_on_space(text, length)
38
+ def truncate_on_space(text = "", length)
34
39
  truncate(text, length: length, separator: ' ')
35
40
  end
41
+
36
42
  end
37
43
  end
@@ -0,0 +1,5 @@
1
+ class FuelController < ApplicationController
2
+ def not_found
3
+ raise ActionController::RoutingError.new('Not Found')
4
+ end
5
+ end
@@ -1,5 +1,32 @@
1
1
  module Fuel
2
2
  module PostsHelper
3
+ Fuel.configuration.helpers.each do |helper|
4
+ include "::#{helper}".constantize
5
+ end
6
+
7
+ def markdown(text)
8
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
9
+ :autolink => true, :space_after_headers => true)
10
+ raw markdown.render(text)
11
+ end
12
+
13
+ def method_missing method, *args, &block
14
+ fuel.send(method, *args)
15
+ end
16
+
17
+ def embedded_svg filename, options={}
18
+ file = File.read(Rails.root.join('app', 'assets', 'images', filename))
19
+ doc = Nokogiri::HTML::DocumentFragment.parse file
20
+ svg = doc.at_css 'svg'
21
+ if options[:class].present?
22
+ svg['class'] = options[:class]
23
+ end
24
+ doc.to_html.html_safe
25
+ end
26
+
27
+ def hide_published_at(post)
28
+ @post.is_published ? '' : 'display:none;'
29
+ end
3
30
 
4
31
  end
5
- end
32
+ end
@@ -0,0 +1,5 @@
1
+ module Fuel
2
+ def self.table_name_prefix
3
+ 'fuel_'
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ module Fuel
2
+ class Author < ActiveRecord::Base
3
+
4
+ has_many :posts
5
+
6
+ if Rails.version[0].to_i < 4
7
+ attr_accessible :first_name, :last_name, :title, :bio, :avatar, :email, :twitter, :github, :dribbble
8
+ end
9
+
10
+ def full_name
11
+ [first_name, last_name].compact.join(" ")
12
+ end
13
+
14
+ has_attached_file :avatar, :styles => { :medium => Fuel.configuration.avatar_settings[:styles][:medium], :thumb => Fuel.configuration.avatar_settings[:styles][:thumb] }, :default_url => "/images/:style/missing.png"
15
+ validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
16
+
17
+ end
18
+ end
@@ -1,16 +1,32 @@
1
1
  module Fuel
2
2
  class Post < ActiveRecord::Base
3
+ include ActionView::Helpers::OutputSafetyHelper
4
+
3
5
  extend FriendlyId
4
6
  friendly_id :title, use: :slugged
5
7
 
8
+ belongs_to :author
9
+
6
10
  if Rails.version[0].to_i < 4
7
- attr_accessible :tag, :author, :content, :title
11
+ attr_accessible :tag, :author_id, :content, :title, :teaser, :featured_image, :seo_title, :seo_description, :published_at
8
12
  end
9
13
 
10
- validates_presence_of :title, :content, :author, if: :is_published
14
+ has_attached_file :featured_image, :styles => { :medium => Fuel.configuration.featured_image_settings[:styles][:medium], :thumb => Fuel.configuration.featured_image_settings[:styles][:thumb] }, :default_url => "/images/:style/missing.png"
15
+ validates_attachment_content_type :featured_image, :content_type => /\Aimage\/.*\Z/
16
+
17
+ validates_presence_of :title, :content, :author_id, if: :is_published
11
18
  paginates_per Fuel.configuration.paginates_per.to_i
12
19
 
13
20
  scope :recent_published_posts, -> { where(published: true).order("created_at DESC") }
21
+ scope :recent, -> { order("created_at DESC") }
22
+
23
+ def next
24
+ self.class.recent.where("created_at <= ? AND id != ?", created_at, id).first
25
+ end
26
+
27
+ def previous
28
+ self.class.recent.where("created_at >= ? AND id != ?", created_at, id).last
29
+ end
14
30
 
15
31
  def should_generate_new_friendly_id?
16
32
  new_record? #Don't generate new id on edit
@@ -24,5 +40,19 @@ module Fuel
24
40
  self.published
25
41
  end
26
42
 
43
+ def prioritized_featured_image_url(type = :original)
44
+ featured_image_file_name.present? ? featured_image.url(type) : featured_image_url
45
+ end
46
+
47
+ def teaser_content
48
+ teaser.present? ? teaser : content
49
+ end
50
+
51
+ def to_html
52
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
53
+ :autolink => true, :space_after_headers => true)
54
+ raw markdown.render(content)
55
+ end
56
+
27
57
  end
28
58
  end
@@ -0,0 +1,24 @@
1
+ <aside class="page-sidebar author-sidebar">
2
+ <header class="page-sidebar--header">
3
+ <div class="header-container--left">
4
+ <h5 class="header--title">Authors</h5>
5
+ </div>
6
+ <div class="header-container--right">
7
+ <ul class="header-container--right__actions">
8
+ <!-- <li><i class="search-icon">Search</i></li> -->
9
+ <li><%= link_to 'New Author', fuel.new_admin_author_path, class: 'add-icon' %></li>
10
+ </ul>
11
+ </div>
12
+ </header>
13
+ <ul class="resource-list author-list">
14
+ <% @authors.each do |author| %>
15
+ <%= link_to fuel.edit_admin_author_path(author) do %>
16
+ <li class="resource-item author-item <%= 'active' if @author && @author == author %>">
17
+ <%= image_tag author.avatar.url, class: 'author-avatar' %>
18
+ <p class="author-item--title"><%= author.title.html_safe %></p>
19
+ <h5 class="author-item--name"><%= author.full_name %></h5>
20
+ </li>
21
+ <% end %>
22
+ <% end %>
23
+ </ul>
24
+ </aside>
@@ -0,0 +1,52 @@
1
+ <%= form_for @author, url: @url, html: { multipart: true } do |f| %>
2
+ <div class="form-container--left">
3
+ <fieldset>
4
+ <div class="form-group-half">
5
+ <%= f.label :first_name %>
6
+ <%= f.text_field :first_name %>
7
+ </div>
8
+ <div class="form-group-half">
9
+ <%= f.label :last_name %>
10
+ <%= f.text_field :last_name %>
11
+ </div>
12
+ </fieldset>
13
+ <fieldset>
14
+ <%= f.label :title %>
15
+ <%= f.text_field :title %>
16
+ </fieldset>
17
+ <fieldset>
18
+ <%= f.label :bio, 'Author Bio' %>
19
+ <%= f.text_area :bio %>
20
+ </fieldset>
21
+ <fieldset>
22
+ <div class="form-group-half">
23
+ <%= f.label :email %>
24
+ <%= f.email_field :email, placeholder: "ryan@example.com" %>
25
+ </div>
26
+ <div class="form-group-half">
27
+ <%= f.label :twitter %>
28
+ <%= f.text_field :twitter, placeholder: "ryan_p_francis" %>
29
+ </div>
30
+ </fieldset>
31
+ <fieldset>
32
+ <div class="form-group-half">
33
+ <%= f.label :github %>
34
+ <%= f.text_field :github, placeholder: "francirp" %>
35
+ </div>
36
+ <div class="form-group-half">
37
+ <%= f.label :dribbble %>
38
+ <%= f.text_field :dribbble, placeholder: "ryan_p_francis" %>
39
+ </div>
40
+ </fieldset>
41
+ <fieldset class="fieldset">
42
+ <%= f.submit class: 'button button--secondary' %>
43
+ </fieldset>
44
+ </div>
45
+ <div class="form-container--right card">
46
+ <%= f.label :avatar, 'Updated Author Picture' %>
47
+ <div class="card-image card-image--avatar">
48
+ <%= image_tag @author.avatar.url if @author.avatar.present? %>
49
+ </div>
50
+ <%= f.file_field :avatar %>
51
+ </div>
52
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= render "authors" %>
2
+ <section class="page">
3
+ <header class="page-header">
4
+ <h5 class="page-header--title"><span>Author</span>: <%= @author.full_name %></h5>
5
+ </header>
6
+ <div class="page-area">
7
+ <%= render "form" %>
8
+ </div>
9
+ </section>
@@ -0,0 +1,7 @@
1
+ <%= render "authors" %>
2
+ <section class="page-area">
3
+ <div class="no-content-container">
4
+ <p class="no-content-message">Select an author from the list on the left or <%= link_to 'add', new_admin_author_path, class: 'link-primary' %> a new author.</p>
5
+ </div>
6
+ <p></p>
7
+ </section>
@@ -0,0 +1,6 @@
1
+ <%= render "authors" %>
2
+
3
+ <div class="page-area">
4
+ <h2>New Author</h2>
5
+ <%= render "form" %>
6
+ </div>
@@ -0,0 +1,5 @@
1
+ <div id="render-content">
2
+ <div class="fuel-posts">
3
+ <%= (content || "").try(:html_safe) %>
4
+ </div>
5
+ </div>
@@ -0,0 +1,56 @@
1
+ <%= form_for @post, url: @url, html: { multipart: true } do |f| %>
2
+ <% if @post.errors.any? %>
3
+ <div class="alert alert--warning">
4
+ <p class="alert--content"><%= @post.errors.full_messages.to_sentence %></h2></p>
5
+ <%= link_to '#', class: 'alert--trigger' do %>
6
+ <%= embedded_svg 'icons/alert-icon.svg', class: 'alert--close-icon' %>
7
+ <% end %>
8
+ </div>
9
+ <% end %>
10
+ <div class="form-container--left">
11
+ <fieldset>
12
+ <%= f.label :title %>
13
+ <%= f.text_field :title %>
14
+ </fieldset>
15
+ <fieldset>
16
+ <div class="form-group-half">
17
+ <%= f.label :author_id %>
18
+ <%= f.select :author_id, options_from_collection_for_select(Fuel::Author.all, :id, :full_name, @post.author_id) %>
19
+ </div>
20
+ <div class="form-group-half">
21
+ <%= f.label :tag %>
22
+ <%= f.select :tag, options_for_select(Fuel.configuration.tags, @post.tag) %>
23
+ </div>
24
+ </fieldset>
25
+ <fieldset>
26
+ <div class="half-group">
27
+ <%= f.label :published, 'Published' %>
28
+ <%= f.select :published, options_for_select({"Yes" => true, "No" => false}, @post.is_published) %>
29
+ </div>
30
+ <div class="half-group" id="publishedAtGroup" style="<%= hide_published_at(@post) %>">
31
+ <%= f.label :published_at, 'Published At' %>
32
+ <%= f.text_field :published_at, data: { value: (@post.published_at || DateTime.now).strftime("%m/%d/%Y") }, class: 'datepicker', disabled: !@post.is_published %>
33
+ </div>
34
+ </fieldset>
35
+ <fieldset>
36
+ <%= f.label :teaser, 'Post Tease' %>
37
+ <%= f.text_area :teaser, class: 'tease' %>
38
+ </fieldset>
39
+ </div>
40
+ <div class="form-container--right card">
41
+ <%= f.label :featured_image, 'Featured Image' %>
42
+ <div class="card-image card-image--featured_image">
43
+ <%= image_tag @post.featured_image.url(:medium) if @post.featured_image.present? %>
44
+ </div>
45
+ <%= f.file_field :featured_image %>
46
+ </div>
47
+ <div class="form-container--full">
48
+ <fieldset>
49
+ <%= f.label :content, 'Your Post' %>
50
+ <%= f.text_area :content, class: 'post' %>
51
+ </fieldset>
52
+ <fieldset>
53
+ <%= f.submit (action_name == "edit" ? "Update Post" : "Create Post"), class: 'button button--secondary' %>
54
+ </fieldset>
55
+ </div>
56
+ <% end %>