diff --git a/app/assets/javascripts/filters/filters.coffee b/app/assets/javascripts/filters/filters.coffee index 9b6334d91..3d6ef0be3 100644 --- a/app/assets/javascripts/filters/filters.coffee +++ b/app/assets/javascripts/filters/filters.coffee @@ -98,10 +98,25 @@ Application.Filters.filter "humanize", [ -> Humanize.truncate(element, param, null) ] +## +# This filter will convert ASCII carriage-return character to the HTML break-line tag +## Application.Filters.filter "breakFilter", [ -> (text) -> if text != undefined - text.replace(/\n/g, '
') + text.replace(/\n+/g, '
') +] + +## +# This filter will take a HTML text as input and will return it without the html tags +## +Application.Filters.filter "simpleText", [ -> + (text) -> + if text != undefined + text = text.replace(//g, '\n') + text.replace(/<\/?\w+[^>]*>/g, '') + else + "" ] Application.Filters.filter "toTrusted", [ "$sce", ($sce) -> diff --git a/app/assets/templates/admin/trainings/_form.html.erb b/app/assets/templates/admin/trainings/_form.html.erb index b4715c238..b10ad2647 100644 --- a/app/assets/templates/admin/trainings/_form.html.erb +++ b/app/assets/templates/admin/trainings/_form.html.erb @@ -57,16 +57,10 @@
- +
- + + {{ 'description_is_required' }}
diff --git a/app/assets/templates/trainings/index.html.erb b/app/assets/templates/trainings/index.html.erb index 4766a9f20..4d8923fc5 100644 --- a/app/assets/templates/trainings/index.html.erb +++ b/app/assets/templates/trainings/index.html.erb @@ -30,7 +30,9 @@

{{training.name}}

-

{{training.description | humanize : 140 }}

+
+

+