1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

Merge remote-tracking branch 'origin/machines' into dev

This commit is contained in:
Sylvain 2016-07-13 16:03:12 +02:00
commit 3d7b0bbdfc
4 changed files with 20 additions and 5 deletions

View File

@ -98,10 +98,23 @@ 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, '')
]
Application.Filters.filter "toTrusted", [ "$sce", ($sce) ->

View File

@ -46,7 +46,8 @@
<div class="form-group m-b-xl" ng-class="{'has-error': machineForm['machine[description]'].$dirty && machineForm['machine[description]'].$invalid}">
<label for="description" class="col-sm-2 control-label">{{ 'description' | translate }} *</label>
<div class="col-sm-10">
<textarea ng-model="machine.description" class="form-control" rows="12" id="machine_description" placeholder="" name="machine[description]" required></textarea>
<input type="hidden" name="machine[description]" ng-value="machine.description" />
<summernote ng-model="machine.description" id="machine_description" placeholder="" config="summernoteOpts" name="machine[description]" required></summernote>
<span class="help-block" ng-show="machineForm['machine[description]'].$dirty && machineForm['machine[description]'].$error.required" translate>{{ 'description_is_required' }}</span>
</div>
</div>
@ -54,7 +55,8 @@
<div class="form-group m-b-xl" ng-class="{'has-error': machineForm['machine[spec]'].$dirty && machineForm['machine[spec]'].$invalid}">
<label for="spec" class="col-sm-2 control-label">{{ 'technical_specifications' | translate }} *</label>
<div class="col-sm-10">
<textarea ng-model="machine.spec" class="form-control" rows="12" id="machine_spec" placeholder="" name="machine[spec]" required></textarea>
<input type="hidden" name="machine[spec]" ng-value="machine.spec" />
<summernote ng-model="machine.spec" id="machine_spec" placeholder="" config="summernoteOpts" name="machine[spec]" required></summernote>
<span class="help-block" ng-show="machineForm['machine[spec]'].$dirty && machineForm['machine[spec]'].$error.required" translate>{{ 'technical_specifications_are_required' }}</span>
</div>
</div>

View File

@ -35,7 +35,7 @@
</div>
<div class="panel-body" style="heigth:170px;">
<h1 class="m-b">{{machine.name}}</h1>
<p>{{machine.description | humanize : 140 }}</p>
<p ng-bind-html="machine.description | simpleText | humanize : 140 | breakFilter"></p>
</div>
<div class="panel-footer no-padder">

View File

@ -48,7 +48,7 @@
</div>
<div class="widget-content no-bg wrapper">
<h3></h3>
<p><pre>{{machine.spec}}</pre></p>
<p ng-bind-html="machine.spec"></p>
</div>
</div>