Skip to content

Commit

Permalink
Merge pull request #275 from himdel/bz1415235-sanitize-long-description
Browse files Browse the repository at this point in the history
ServiceTemplate - html-sanitize long_description
(cherry picked from commit 60fe875)

https://bugzilla.redhat.com/show_bug.cgi?id=1419694
  • Loading branch information
martinpovolny authored and simaishi committed Mar 3, 2017
1 parent fac4a2f commit 96617ae
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/angular_modules/module_helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
miqHttpInject(angular.module('miq.helpers', ['ngSanitize']));
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//= require_tree ./angular_modules/
//= require_tree ./controllers/
//= require_tree ./directives/
//= require_tree ./components/
//= require_tree ./services/
//= require d3
//= require c3
Expand Down
7 changes: 7 additions & 0 deletions app/assets/javascripts/components/sanitize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
angular.module('miq.helpers')
.component('miqSanitize', {
bindings: {
value: '@',
},
template: '<span ng-bind-html="$ctrl.value"></span>',
});
6 changes: 4 additions & 2 deletions app/views/catalog/_sandt_tree_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
.form-group
%label.col-md-2.control-label
= _('Long Description')
.col-md-8
= @record.long_description.to_s.html_safe
.col-md-8#long_description
%miq-sanitize{:value => @record.long_description}
- if @record.composite?
= miq_tab_content('resources') do
Expand Down Expand Up @@ -175,5 +175,7 @@
:show => true}
- else
%span{:style => "color:red"}= @no_wf_msg

:javascript
miq_tabs_init("#st_tabs");
miq_bootstrap('#long_description', 'miq.helpers');
10 changes: 7 additions & 3 deletions app/views/catalog/_svccat_tree_show.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.maincontent{:xmlns => "http://www.w3.org/1999/html"}
.maincontent
= render :partial => "layouts/flash_msg"
.form-horizontal.static
.form-group
Expand Down Expand Up @@ -26,8 +26,9 @@
%label.col-md-2.control-label
= _('Long Description')
.col-md-8
%p.form-control-static
= @record.long_description.to_s.html_safe
%p.form-control-static#long_description
%miq-sanitize{:value => @record.long_description}

.form-group
.col-md-1{:align => "center"}
#buttons
Expand All @@ -38,3 +39,6 @@
:onclick => "miqAjaxButton('#{url_for(:action => "svc_catalog_provision",
:id => @record.id,
:button => "order")}');")

:javascript
miq_bootstrap('#long_description', 'miq.helpers');

0 comments on commit 96617ae

Please sign in to comment.