luci-base: add L.media() URL construction helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
8c860a1d9c
commit
b60b4790d1
2 changed files with 23 additions and 0 deletions
|
@ -1750,6 +1750,28 @@
|
||||||
return this.path(this.env.resource, arguments);
|
return this.path(this.env.resource, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct an URL path relative to the media resource path of the
|
||||||
|
* LuCI ui (usually `/luci-static/$theme_name`).
|
||||||
|
*
|
||||||
|
* The resulting URL is guaranteed to only contain the characters
|
||||||
|
* `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
|
||||||
|
* as `/` for the path separator.
|
||||||
|
*
|
||||||
|
* @instance
|
||||||
|
* @memberof LuCI
|
||||||
|
*
|
||||||
|
* @param {string[]} [parts]
|
||||||
|
* An array of parts to join into an URL path. Parts may contain
|
||||||
|
* slashes and any of the other characters mentioned above.
|
||||||
|
*
|
||||||
|
* @return {string}
|
||||||
|
* Returns the resulting URL path.
|
||||||
|
*/
|
||||||
|
media: function() {
|
||||||
|
return this.path(this.env.media, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the complete URL path to the current view.
|
* Return the complete URL path to the current view.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
L = new LuCI(<%= luci.http.write_json({
|
L = new LuCI(<%= luci.http.write_json({
|
||||||
token = token,
|
token = token,
|
||||||
|
media = media,
|
||||||
resource = resource,
|
resource = resource,
|
||||||
scriptname = luci.http.getenv("SCRIPT_NAME"),
|
scriptname = luci.http.getenv("SCRIPT_NAME"),
|
||||||
pathinfo = luci.http.getenv("PATH_INFO"),
|
pathinfo = luci.http.getenv("PATH_INFO"),
|
||||||
|
|
Loading…
Reference in a new issue