Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
0aec2076
Commit
0aec2076
authored
3 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
simple, but not working fully
parent
f721d207
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/application_record.rb
+8
-7
8 additions, 7 deletions
app/models/application_record.rb
app/models/communication/website/post.rb
+1
-1
1 addition, 1 deletion
app/models/communication/website/post.rb
with
9 additions
and
8 deletions
app/models/application_record.rb
+
8
−
7
View file @
0aec2076
...
...
@@ -7,26 +7,27 @@ class ApplicationRecord < ActiveRecord::Base
def
self
.
has_summernote
(
name
)
class_eval
<<-
CODE
,
__FILE__
,
__LINE__
+
1
def
#{
name
}
# TODO hydrate action-text-attachment
attributes['
#{
name
}
'].gsub('</action', 'coucou</action')
value = attributes['
#{
name
}
']
actiontext = ActionText::Content.new value
actiontext.to_s
end
def
#{
name
}
=(value)
# TODO dehydrate a
ction
-t
ext
-attachment
attributes['
#{
name
}
'] =
value
actiontext = A
ction
T
ext
::Content.new value
self.
attributes['
#{
name
}
'] =
actiontext.to_html
end
CODE
end
# TODO Remove everything below after migration, please
def
self
.
summernote
(
*
args
)
def
self
.
convert_fields_to_
summernote
(
*
args
)
@@summernote_fields
=
args
end
before_validation
:summernote
#
before_validation :
convert_to_
summernote
def
summernote
def
convert_to_
summernote
@@summernote_fields
.
each
do
|
field
|
self
[
"
#{
field
}
_new"
]
=
send
(
field
).
body
.
to_html
.
gsub
(
'<div>'
,
'<p>'
)
...
...
This diff is collapsed.
Click to expand it.
app/models/communication/website/post.rb
+
1
−
1
View file @
0aec2076
...
...
@@ -41,7 +41,7 @@ class Communication::Website::Post < ApplicationRecord
has_rich_text
:text
has_summernote
:text_new
summernote
:text
convert_fields_to_
summernote
:text
has_one
:imported_post
,
class_name:
'Communication::Website::Imported::Post'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment