Skip to content

Commit 08be586

Browse files
mmahroussfda-odoo
authored andcommitted
[IMP] server: add wiki link to html repr
1 parent 2c4563c commit 08be586

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

server/src/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,5 @@ pub const BUILT_IN_LIBS: &[&str] = &["string", "re", "difflib", "textwrap", "un
120120
"cgi", "cgitb", "chunk", "crypt", "imghdr", "imp", "mailcap", "msilib", "nis", "nntplib", "optparse", "ossaudiodev",
121121
"pipes", "smtpd", "sndhdr", "spwd", "sunau", "telnetlib", "uu", "xdrlib", "struct", "codecs"];
122122

123-
pub const DEFAULT_PYTHON: &str = "python3";
123+
pub const DEFAULT_PYTHON: &str = "python3";
124+
pub const CONFIG_WIKI_URL: &str = "https://github.com/odoo/odoo-ls/wiki/Configuration-files";

server/src/core/config.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use ruff_python_ast::{Expr, Mod};
1010
use ruff_python_parser::{Mode, ParseOptions};
1111
use serde::{Deserialize, Deserializer, Serialize, Serializer};
1212

13-
use crate::constants::DEFAULT_PYTHON;
13+
use crate::constants::{DEFAULT_PYTHON, CONFIG_WIKI_URL};
1414
use crate::core::diagnostics::{DiagnosticCode, DiagnosticSetting};
1515
use crate::utils::{fill_validate_path, has_template, is_addon_path, is_odoo_path, is_python_path, PathSanitizer};
1616
use crate::S;
@@ -215,10 +215,20 @@ impl ConfigFile {
215215
color: #888;
216216
font-size: 0.9em;
217217
}
218+
.config-wiki-link {
219+
margin-bottom: 10px;
220+
display: block;
221+
font-family: sans-serif;
222+
font-size: 1em;
223+
color: #2d5fa4;
224+
text-decoration: none;
225+
font-weight: bold;
226+
}
218227
</style>
219-
<div class="toml-table">
220-
"#,
221-
);
228+
<a class="config-wiki-link" href=""#);
229+
html.push_str(CONFIG_WIKI_URL);
230+
html.push_str("\" target=\"_blank\" rel=\"noopener\">Configuration file documentation &rarr;</a>\n");
231+
html.push_str("<div class=\"toml-table\">\n");
222232
let entry_htmls: Vec<String> = self.config.iter().map(|entry| {
223233
let entry_val = serde_json::to_value(entry).unwrap_or(serde_json::Value::Null);
224234
let mut entry_html = String::new();

0 commit comments

Comments
 (0)