Class: Decidim::EnhancedTextwork::ParagraphCreator
- Inherits:
-
Admin::Import::Creator
- Object
- Admin::Import::Creator
- Decidim::EnhancedTextwork::ParagraphCreator
- Defined in:
- lib/decidim/enhanced_textwork/paragraph_creator.rb
Overview
This class is responsible for creating the imported paragraphs and must be included in paragraphs component's import manifest.
Class Method Summary collapse
-
.resource_klass ⇒ Object
Retuns the resource class to be created with the provided data.
Instance Method Summary collapse
-
#finish! ⇒ Object
Saves the paragraph.
-
#produce ⇒ Object
Produces a paragraph from parsed data.
Class Method Details
.resource_klass ⇒ Object
Retuns the resource class to be created with the provided data.
9 10 11 |
# File 'lib/decidim/enhanced_textwork/paragraph_creator.rb', line 9 def self.resource_klass Decidim::EnhancedTextwork::Paragraph end |
Instance Method Details
#finish! ⇒ Object
Saves the paragraph
23 24 25 26 27 |
# File 'lib/decidim/enhanced_textwork/paragraph_creator.rb', line 23 def finish! super # resource.save! notify(resource) publish(resource) end |
#produce ⇒ Object
Produces a paragraph from parsed data
Returns a paragraph
16 17 18 19 20 |
# File 'lib/decidim/enhanced_textwork/paragraph_creator.rb', line 16 def produce resource.(context[:current_user], user_group: context[:user_group]) resource end |