diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-27 08:09:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 08:09:14 +0100 |
commit | 4b54b62fff725d6cc840b2d714157338d517528f (patch) | |
tree | f7f967dcd5e66dc2e0e399ab02c3d641fa826db9 | |
parent | 9178e8c678c9952073bbfbacda41a4af28fd260c (diff) | |
parent | ad49425bd8e4ccd7eeef229d9ddf3c30ec0d7ed0 (diff) |
Merge pull request #35604 from Calinou/editor-help-hide-tutorials-if-none
Don't show an Online Tutorials section if the class has no tutorials
-rw-r--r-- | editor/editor_help.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index d3c50423b7..556dbcbfc4 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -468,39 +468,31 @@ void EditorHelp::_update_doc() { } // Online tutorials - { + if (cd.tutorials.size()) { class_desc->push_color(title_color); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Online Tutorials")); class_desc->pop(); class_desc->pop(); - class_desc->push_indent(1); + class_desc->push_indent(1); class_desc->push_font(doc_code_font); - class_desc->add_newline(); - // class_desc->add_newline(); - - if (cd.tutorials.size() != 0) { - for (int i = 0; i < cd.tutorials.size(); i++) { - String link = cd.tutorials[i]; - String linktxt = link; - int seppos = linktxt.find("//"); - if (seppos != -1) { - linktxt = link.right(seppos + 2); - } - - class_desc->push_color(symbol_color); - class_desc->append_bbcode("[url=" + link + "]" + linktxt + "[/url]"); - class_desc->pop(); - class_desc->add_newline(); + for (int i = 0; i < cd.tutorials.size(); i++) { + const String link = cd.tutorials[i]; + String linktxt = link; + const int seppos = linktxt.find("//"); + if (seppos != -1) { + linktxt = link.right(seppos + 2); } - } else { - class_desc->push_color(comment_color); - class_desc->append_bbcode(TTR("There are currently no tutorials for this class, you can [color=$color][url=$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/url][/color].").replace("$url2", REQUEST_URL).replace("$url", CONTRIBUTE2_URL).replace("$color", link_color_text)); + + class_desc->push_color(symbol_color); + class_desc->append_bbcode("[url=" + link + "]" + linktxt + "[/url]"); class_desc->pop(); + class_desc->add_newline(); } + class_desc->pop(); class_desc->pop(); class_desc->add_newline(); |