diff --git a/muranodashboard/local/_50_murano.py b/muranodashboard/local/_50_murano.py index 80d89e7e9..2724b59ea 100644 --- a/muranodashboard/local/_50_murano.py +++ b/muranodashboard/local/_50_murano.py @@ -20,4 +20,5 @@ ADD_JS_FILES = [ 'muranodashboard/js/murano.service.js', 'muranodashboard/js/upload_form.js', 'muranodashboard/js/import_bundle_form.js', + 'muranodashboard/js/more-less.js', ] diff --git a/muranodashboard/static/muranodashboard/css/catalog.css b/muranodashboard/static/muranodashboard/css/catalog.css index 7be4606ea..eaa8ffcf6 100644 --- a/muranodashboard/static/muranodashboard/css/catalog.css +++ b/muranodashboard/static/muranodashboard/css/catalog.css @@ -527,3 +527,10 @@ h3 .wizard_title { color: #d93c27; font-weight: bold; } + +.more_content_dynamicui span { + display: none; +} +.more_link_dynamicui { + display: block; +} \ No newline at end of file diff --git a/muranodashboard/static/muranodashboard/js/more-less.js b/muranodashboard/static/muranodashboard/js/more-less.js new file mode 100644 index 000000000..5d00b12ee --- /dev/null +++ b/muranodashboard/static/muranodashboard/js/more-less.js @@ -0,0 +1,42 @@ +$(function() { + "use strict"; + + horizon.modals.addModalInitFunction(muranoMoreLess); + + function muranoMoreLess(modal) { + var showChar = 150; + var ellipsestext = "..."; + var moretext = gettext("Show more"); + var lesstext = gettext("Show less"); + + $(modal).find('.more_dynamicui_description').each(function() { + var content = $(this).html(); + + if (content.length > showChar) { + + var c = content.substr(0, showChar); + var h = content.substr(showChar, content.length - showChar); + + var html = c + '' + ellipsestext + + ' ' + h + + ' ' + moretext + + ''; + + $(this).html(html); + } + }); + + $(modal).find(".more_link_dynamicui").click(function() { + if ($(this).hasClass("less_dynamicui")) { + $(this).removeClass("less_dynamicui"); + $(this).html(moretext); + } else { + $(this).addClass("less_dynamicui"); + $(this).html(lesstext); + } + $(this).parent().prev().toggle(); + $(this).prev().toggle(); + return false; + }); + } +}); diff --git a/muranodashboard/templates/services/_wizard_create.html b/muranodashboard/templates/services/_wizard_create.html index 11c671064..7f29da295 100644 --- a/muranodashboard/templates/services/_wizard_create.html +++ b/muranodashboard/templates/services/_wizard_create.html @@ -53,7 +53,9 @@ {{ title }}: {% endif %} - {{ description|linebreaksbr }} +