Skip to content

Commit

Permalink
show anchor link in command detailed content
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop committed Jun 11, 2024
1 parent aad554c commit e49c04c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
6 changes: 6 additions & 0 deletions include/ejabberd_web_admin.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,9 @@
[?XC(<<"h1">>, Name), ?GL(Ref, Title), ?BR]).
-define(H1GL(Name, RefConf, Title),
?H1GLraw(Name, <<"admin/configuration/", RefConf/binary>>, Title)).

-define(ANCHORL(Ref),
?XAE(<<"div">>, [{<<"class">>, <<"anchorlink">>}],
[?XAE(<<"a">>,
[{<<"href">>, <<"#", Ref/binary>>}],
[?C(<<"<=">>)])])).
19 changes: 13 additions & 6 deletions priv/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -223,22 +223,29 @@ h3 {
padding-top: 25px;
width: 70%;
}
div.anchorlink {
display: inline-block;
float: right;
margin-top: 1em;
margin-right: 1em;
}
div.anchorlink a {
padding: 3px;
background: #cae7e4;
font-size: 0.75em;
color: black;
}
div.guidelink,
p[dir=ltr] {
display: inline-block;
float: right;

margin: 0;
margin-top: 1em;
margin-right: 1em;
}
div.guidelink a,
p[dir=ltr] a {
display: inline-block;
border-radius: 3px;
padding: 3px;

background: #3eaffa;

font-size: 0.75em;
color: #fff;
}
Expand Down
6 changes: 5 additions & 1 deletion src/ejabberd_web_admin.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,7 @@ make_command_presentation(Name, Tags) ->
NameBin = misc:atom_to_binary(Name),
NiceNameBin = nice_this(Name),
Text = ejabberd_ctl:get_usage_command(atom_to_list(Name), 100, false, 1000000),
AnchorLink = [?ANCHORL(NameBin)],
MaybeDocsLink =
case lists:member(internal, Tags) of
true ->
Expand All @@ -1777,8 +1778,11 @@ make_command_presentation(Name, Tags) ->
[?GL(<<"developer/ejabberd-api/admin-api/#", NameBin/binary>>, NameBin)]
end,
[?XE(<<"details">>,
[?XE(<<"summary">>, [?XC(<<"strong">>, NiceNameBin)])]
[?XAE(<<"summary">>,
[{<<"id">>, NameBin}],
[?XC(<<"strong">>, NiceNameBin)])]
++ MaybeDocsLink
++ AnchorLink
++ [?XC(<<"pre">>, list_to_binary(Text))])].

nice_this(This, integer) ->
Expand Down

0 comments on commit e49c04c

Please sign in to comment.