-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
95 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SANITIZED_ALLOWED_TAGS="strong em ul ol li" | ||
SANITIZED_ALLOWED_ATTRIBUTES="style" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
class Answer < ApplicationRecord | ||
include ActionView::Helpers::SanitizeHelper | ||
belongs_to :pia, inverse_of: :answers | ||
validates :reference_to, presence: true | ||
after_initialize :overwrite_to_safety_values | ||
|
||
private | ||
|
||
def overwrite_to_safety_values | ||
self.data['text'] = sanitize self.data['text'] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
class Comment < ApplicationRecord | ||
include ActionView::Helpers::SanitizeHelper | ||
belongs_to :pia, inverse_of: :comments | ||
validates :reference_to, presence: true | ||
after_initialize :overwrite_to_safety_values | ||
|
||
private | ||
|
||
def overwrite_to_safety_values | ||
self.description = sanitize read_attribute(:description) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
class Evaluation < ApplicationRecord | ||
include ActionView::Helpers::SanitizeHelper | ||
belongs_to :pia, inverse_of: :evaluations | ||
validates :reference_to, presence: true | ||
after_initialize :overwrite_to_safety_values | ||
|
||
private | ||
|
||
def overwrite_to_safety_values | ||
self.action_plan_comment = sanitize read_attribute(:action_plan_comment) | ||
self.evaluation_comment = sanitize read_attribute(:evaluation_comment) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
class Knowledge < ApplicationRecord | ||
include ActionView::Helpers::SanitizeHelper | ||
belongs_to :knowledge_base | ||
|
||
validates :name, presence: true | ||
validates :knowledge_base, presence: true | ||
after_initialize :overwrite_to_safety_values | ||
|
||
private | ||
|
||
def overwrite_to_safety_values | ||
self.name = sanitize read_attribute(:name) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
class KnowledgeBase < ApplicationRecord | ||
include ActionView::Helpers::SanitizeHelper | ||
validates :name, presence: true | ||
validates :author, presence: true | ||
validates :contributors, presence: true | ||
has_many :knowledges, dependent: :destroy | ||
after_initialize :overwrite_to_safety_values | ||
|
||
private | ||
|
||
def overwrite_to_safety_values | ||
self.name = sanitize read_attribute(:name) | ||
self.author = sanitize read_attribute(:author) | ||
self.contributors = sanitize read_attribute(:contributors) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
class Measure < ApplicationRecord | ||
include ActionView::Helpers::SanitizeHelper | ||
belongs_to :pia, inverse_of: :measures | ||
after_initialize :overwrite_to_safety_values | ||
|
||
private | ||
|
||
def overwrite_to_safety_values | ||
self.title = sanitize read_attribute(:title) | ||
self.content = sanitize read_attribute(:content) | ||
self.placeholder = sanitize read_attribute(:placeholder) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
class Structure < ApplicationRecord | ||
include ActionView::Helpers::SanitizeHelper | ||
has_many :pias, dependent: :nullify | ||
after_initialize :overwrite_to_safety_values | ||
|
||
private | ||
|
||
def overwrite_to_safety_values | ||
self.name = sanitize read_attribute(:name) | ||
self.sector_name = sanitize read_attribute(:sector_name) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters