зеркало из
https://github.com/rs-pro/activeadmin-quill_editor.git
synced 2026-09-05 11:15:51 +03:00
Add minimum specs
Этот коммит содержится в:
@@ -1,4 +1,49 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
ActiveAdmin.register Post do
|
ActiveAdmin.register Post do
|
||||||
|
permit_params :author_id, :title, :description, :category, :dt, :position, :published, tag_ids: []
|
||||||
|
|
||||||
|
index do
|
||||||
|
selectable_column
|
||||||
|
id_column
|
||||||
|
column :title
|
||||||
|
column :author
|
||||||
|
column :published
|
||||||
|
column :created_at
|
||||||
|
actions
|
||||||
|
end
|
||||||
|
|
||||||
|
show do
|
||||||
|
attributes_table do
|
||||||
|
row :author
|
||||||
|
row :title
|
||||||
|
row :description
|
||||||
|
row :category
|
||||||
|
row :dt
|
||||||
|
row :position
|
||||||
|
row :published
|
||||||
|
row :tags
|
||||||
|
row :created_at
|
||||||
|
row :updated_at
|
||||||
|
end
|
||||||
|
active_admin_comments
|
||||||
|
end
|
||||||
|
|
||||||
|
form do |f|
|
||||||
|
f.inputs 'Post' do
|
||||||
|
f.input :author
|
||||||
|
f.input :title
|
||||||
|
f.input :description, as: :quill_editor
|
||||||
|
f.input :category
|
||||||
|
f.input :dt
|
||||||
|
f.input :position
|
||||||
|
f.input :published
|
||||||
|
end
|
||||||
|
|
||||||
|
f.inputs 'Tags' do
|
||||||
|
f.input :tags
|
||||||
|
end
|
||||||
|
|
||||||
|
f.actions
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
//= require active_admin/base
|
//= require active_admin/base
|
||||||
|
|
||||||
|
//= require activeadmin/quill_editor/quill
|
||||||
|
//= require activeadmin/quill_editor_input
|
||||||
|
|||||||
@@ -8,8 +8,10 @@
|
|||||||
// $sidebar-width: 242px;
|
// $sidebar-width: 242px;
|
||||||
|
|
||||||
// Active Admin's got SASS!
|
// Active Admin's got SASS!
|
||||||
@import "active_admin/mixins";
|
@import 'active_admin/mixins';
|
||||||
@import "active_admin/base";
|
@import 'active_admin/base';
|
||||||
|
|
||||||
|
@import 'activeadmin/quill_editor_input';
|
||||||
|
|
||||||
// Overriding any non-variable SASS must be done after the fact.
|
// Overriding any non-variable SASS must be done after the fact.
|
||||||
// For example, to change the default status-tag color:
|
// For example, to change the default status-tag color:
|
||||||
|
|||||||
28
spec/system/quill_editor_spec.rb
Обычный файл
28
spec/system/quill_editor_spec.rb
Обычный файл
@@ -0,0 +1,28 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
RSpec.describe 'Quill editor', type: :system do
|
||||||
|
let(:author) { Author.create!(email: 'some_email@example.com', name: 'John Doe', age: 30) }
|
||||||
|
let(:post) { Post.create!(title: 'Test', author: author, description: 'Some content...') }
|
||||||
|
|
||||||
|
before do
|
||||||
|
post
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
post.destroy
|
||||||
|
author.destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with a Quill editor' do
|
||||||
|
it 'updates some HTML content' do
|
||||||
|
visit "/admin/posts/#{post.id}/edit"
|
||||||
|
|
||||||
|
expect(page).to have_css('#post_description_input .ql-editor', text: 'Some content...')
|
||||||
|
find('#post_description_input .ql-editor').base.send_keys('more text')
|
||||||
|
|
||||||
|
find('[type="submit"]').click
|
||||||
|
expect(page).to have_content('was successfully updated')
|
||||||
|
expect(post.reload.description).to eq '<p>Some content...more text</p>'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Ссылка в новой задаче
Block a user