diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb index 75ce1cefb3d..ad805ae8d9b 100644 --- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb +++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb @@ -22,545 +22,24 @@ module DiscourseNarrativeBot def new_user_track width = 538.583 # Default width for the SVG - - svg = <<~SVG - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #{I18n.t('discourse_narrative_bot.new_user_narrative.title')} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #{I18n.t('discourse_narrative_bot.new_user_narrative.cert_title')} - - - #{@discobot_user.username} - - - #{@date} - - - - - - - - - #{name} - - #{logo_group(40, width, 280)} - - - - - - - - - - - - - - SVG + ApplicationController.render(inline: File.read(File.expand_path('../templates/new_user.svg.erb', __FILE__)), + assigns: { width: width, + discobot_user: @discobot_user, + date: @date, + avatar_url: base64_image_link(avatar_url), + logo_group: logo_group(55, width, 350), + name: name }) end def advanced_user_track width = 722.8 # Default width for the SVG - - <<~SVG - - - - - - - - - - - - - - - - - - - #{I18n.t('discourse_narrative_bot.advanced_user_narrative.cert_title')} - - - - - - - - - - - - - - #{@date} - - - - - - - - - #{@discobot_user.username} - - - #{name} - - #{logo_group(55, width, 350)} - - - - - - - - SVG + ApplicationController.render(inline: File.read(File.expand_path('../templates/advanced_user.svg.erb', __FILE__)), + assigns: { width: width, + discobot_user: @discobot_user, + date: @date, + avatar_url: base64_image_link(avatar_url), + logo_group: logo_group(40, width, 280), + name: name }) end private diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/templates/advanced_user.svg.erb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/templates/advanced_user.svg.erb new file mode 100644 index 00000000000..e5bccc08237 --- /dev/null +++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/templates/advanced_user.svg.erb @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + <%= I18n.t('discourse_narrative_bot.advanced_user_narrative.cert_title') %> + + + + + + + + + + + + + + <%= @date %> + + + + + + /> + + + <%= @discobot_user.username %> + + + <%= @name %> + + <%= @logo_group %> + + + + + + + diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/templates/new_user.svg.erb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/templates/new_user.svg.erb new file mode 100644 index 00000000000..298f6119c7a --- /dev/null +++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/templates/new_user.svg.erb @@ -0,0 +1,473 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%= I18n.t('discourse_narrative_bot.new_user_narrative.title') %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%= I18n.t('discourse_narrative_bot.new_user_narrative.cert_title') %> + + + <%= @discobot_user.username %> + + + <%= @date %> + + + + + + /> + + + <%= @name %> + + <%= @logo_group %> + + + + + + + + + + + + +