我刚从Paperclip迁移到CarrierWave,无法显示Bootsy WYSIWYG编辑器。我的表单(及其文本字段,现在是<%= f.bootsy_area :text, rows: 12 %>
)看起来就像我安装Bootsy之前一样。关于如何让编辑器显示而不是单独使用旧文本区域的任何想法?感谢。
我已采取的措施:
的Gemfile:
`source 'https://rubygems.org'
ruby '2.3.0'
gem 'rails', '4.2.2'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
gem 'devise', '~> 3.5', '>= 3.5.6'
gem "font-awesome-rails"
gem 'paperclip', '~> 4.2'
gem 'aws-sdk', '~> 1.66'
gem 'figaro', '~> 1.1', '>= 1.1.1'
gem 'simple_form'
gem 'mail_form'
gem 'acts-as-taggable-on', '~> 3.4'
gem 'fog'
gem 'rmagick', '~> 2.15', '>= 2.15.4'
gem 'carrierwave'
gem "fog-aws"
gem 'bootsy', github: 'volmer/bootsy'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc`
article.rb
class Article < ActiveRecord::Base
include Bootsy::Container
mount_uploader :image, ImageUploader
has_many :comments, dependent: :destroy
has_attached_file :image, styles: { large: "900x900>", medium: "500x500>", thumb: "250x250>" }
belongs_to :user
validates :title, presence: true,
length: { minimum: 5 }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
acts_as_taggable_on :tags
end
articles_controller.rb
private
def article_params
params.require(:article).permit(:title, :text, :image, :user_id, :subtitle, :tag_list, :bootsy_image_gallery_id)
end
的application.js:
//= require jquery
//= require jquery_ujs
//= require bootstrap-sprockets
//= require bootstrap
//= require bootsy
//= require_tree .
application.scss:
@import "bootstrap";
@import "bootstrap-sprockets";
@import "bootsy";
@import "font-awesome";
@import url(https://fonts.googleapis.com/css?family=Delius+Swash+Caps);
@import url(https://fonts.googleapis.com/css?family=Reenie+Beanie);
@import url(https://fonts.googleapis.com/css?family=Special+Elite);
@import url(https://fonts.googleapis.com/css?family=Londrina+Shadow);
_form.html.erb:
<%= form_for @article, html: {multipart: true} do |f| %>
<% if @article.errors.any? %>
<div id="error_explanation">
<h2>
<%= pluralize(@article.errors.count, "error") %> prohibited
this article from being saved:
</h2>
<ul>
<% @article.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.label :image %>
<%= f.file_field :image %>
</p>
<p>
<%= f.label :title %>
<%= f.text_field :title %>
</p>
<p>
<%= f.label :subtitle %>
<%= f.text_field :subtitle %>
</p>
<%= f.label :text %>
<%= f.bootsy_area :text, rows: 12%>
<p>
<%= f.label :tags %>
<%= f.text_field :tag_list %>
</p>
<p>
<%= f.submit %>
</p>
new.html.erb:
<div class="container">
<div class="jumbotron">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1>New article</h1>
<%= render 'form' %>
<%= link_to 'Back', articles_path %>
</div>
</div>
</div>
</div>
assets.rb
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.precompile += %w( bootsy/gallery-loader.gif )
#CSS
Rails.application.config.assets.precompile += %w( bootstrap.min.css )
Rails.application.config.assets.precompile += %w( animate.css )
Rails.application.config.assets.precompile += %w( bootstrap.css )
Rails.application.config.assets.precompile += %w( bootstrapTheme.css )
Rails.application.config.assets.precompile += %w( custom.css )
Rails.application.config.assets.precompile += %w( general.css )
Rails.application.config.assets.precompile += %w( magnific-popup.css )
Rails.application.config.assets.precompile += %w( owl.carousel.css )
Rails.application.config.assets.precompile += %w( owl.theme.css )
Rails.application.config.assets.precompile += %w( style.css )
Rails.application.config.assets.precompile += %w( bootsy.css )
根据rails控制台的文章列标题
> Article.column_names
=> ["id", "title", "text", "created_at", "updated_at", "image_file_name", "image_content_type", "image_file_size", "image_updated_at", "user_id", "subtitle", "image"]
答案 0 :(得分:0)
我有类似的问题。我通过移动// = require tree解决了它。高于// =要求靴子。我无法解释为什么以及如何为我工作。
的application.js
`//= require jquery
//= require jquery_ujs
//= require jquery.turbolinks
//= require turbolinks
//= require_tree .
//= require bootsy`