Don't show an Online Tutorials section if the class has no tutorials

This commit is contained in:
Hugo Locurcio 2020-01-27 00:58:53 +01:00
parent 9daaa12bae
commit ad49425bd8
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
1 changed files with 13 additions and 21 deletions

View File

@ -468,25 +468,21 @@ void EditorHelp::_update_doc() {
} }
// Online tutorials // Online tutorials
{ if (cd.tutorials.size()) {
class_desc->push_color(title_color); class_desc->push_color(title_color);
class_desc->push_font(doc_title_font); class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Online Tutorials")); class_desc->add_text(TTR("Online Tutorials"));
class_desc->pop(); class_desc->pop();
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->push_font(doc_code_font);
class_desc->add_newline(); class_desc->add_newline();
// class_desc->add_newline();
if (cd.tutorials.size() != 0) {
for (int i = 0; i < cd.tutorials.size(); i++) { for (int i = 0; i < cd.tutorials.size(); i++) {
String link = cd.tutorials[i]; const String link = cd.tutorials[i];
String linktxt = link; String linktxt = link;
int seppos = linktxt.find("//"); const int seppos = linktxt.find("//");
if (seppos != -1) { if (seppos != -1) {
linktxt = link.right(seppos + 2); linktxt = link.right(seppos + 2);
} }
@ -496,11 +492,7 @@ void EditorHelp::_update_doc() {
class_desc->pop(); class_desc->pop();
class_desc->add_newline(); class_desc->add_newline();
} }
} 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->pop();
}
class_desc->pop(); class_desc->pop();
class_desc->pop(); class_desc->pop();
class_desc->add_newline(); class_desc->add_newline();