mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-30 11:24:21 +01:00
allow usage of HTML in trainings description
This commit is contained in:
parent
45ab06c73c
commit
0be80ac729
@ -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, '<br />')
|
||||
text.replace(/\n+/g, '<br />')
|
||||
]
|
||||
|
||||
##
|
||||
# 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(/<br\s*\/?>/g, '\n')
|
||||
text.replace(/<\/?\w+[^>]*>/g, '')
|
||||
else
|
||||
""
|
||||
]
|
||||
|
||||
Application.Filters.filter "toTrusted", [ "$sce", ($sce) ->
|
||||
|
@ -57,16 +57,10 @@
|
||||
|
||||
|
||||
<div class="form-group m-b-xl" ng-class="{'has-error': trainingForm['training[description]'].$dirty && trainingForm['training[description]'].$invalid}">
|
||||
<label for="description" class="col-sm-2 control-label">{{ 'description' | translate }} *</label>
|
||||
<label for="training_description" class="col-sm-2 control-label">{{ 'description' | translate }} *</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea ng-model="training.description"
|
||||
class="form-control"
|
||||
rows="12"
|
||||
id="training_description"
|
||||
placeholder=""
|
||||
name="training[description]"
|
||||
required>
|
||||
</textarea>
|
||||
<input type="hidden" name="training[description]" ng-value="training.description" />
|
||||
<summernote ng-model="training.description" id="training_description" placeholder="" config="summernoteOpts" name="training[description]" required></summernote>
|
||||
<span class="help-block" ng-show="trainingForm['training[description]'].$dirty && trainingForm['training[description]'].$error.required" translate>{{ 'description_is_required' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,7 +30,9 @@
|
||||
</div>
|
||||
<div class="panel-body" style="heigth:170px;">
|
||||
<h1 class="m-b">{{training.name}}</h1>
|
||||
<p ng-show="training.description">{{training.description | humanize : 140 }}</p>
|
||||
<div ng-if="training.description">
|
||||
<p ng-bind-html="training.description | simpleText | humanize : 140 | breakFilter"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer no-padder">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user