diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 69 |
1 files changed, 42 insertions, 27 deletions
| @@ -713,8 +713,6 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 713 | /* generates the top controls */ | 713 | /* generates the top controls */ |
| 714 | { | 714 | { |
| 715 | char *_tmpl = | 715 | char *_tmpl = |
| 716 | "<div class=\"snac-top-controls\">\n" | ||
| 717 | |||
| 718 | "<div class=\"snac-note\">\n" | 716 | "<div class=\"snac-note\">\n" |
| 719 | "<details><summary>%s</summary>\n" | 717 | "<details><summary>%s</summary>\n" |
| 720 | "<form autocomplete=\"off\" method=\"post\" " | 718 | "<form autocomplete=\"off\" method=\"post\" " |
| @@ -752,21 +750,6 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 752 | "</details>\n" | 750 | "</details>\n" |
| 753 | "</div>\n"; | 751 | "</div>\n"; |
| 754 | 752 | ||
| 755 | char *_tmpl2 = | ||
| 756 | "<div class=\"snac-top-controls-more\">\n" | ||
| 757 | "<details><summary>%s</summary>\n" | ||
| 758 | |||
| 759 | "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" /** follow **/ | ||
| 760 | "<input type=\"text\" name=\"actor\" required=\"required\" placeholder=\"bob@example.com\">\n" | ||
| 761 | "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n" | ||
| 762 | "</form><p>\n" | ||
| 763 | |||
| 764 | "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" /** boost **/ | ||
| 765 | "<input type=\"text\" name=\"id\" required=\"required\" placeholder=\"https://fedi.example.com/bob/...\">\n" | ||
| 766 | "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n" | ||
| 767 | "</form><p>\n" | ||
| 768 | "</details>\n"; | ||
| 769 | |||
| 770 | char *_tmpl3 = | 753 | char *_tmpl3 = |
| 771 | "<details><summary>%s</summary>\n" | 754 | "<details><summary>%s</summary>\n" |
| 772 | 755 | ||
| @@ -820,9 +803,7 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 820 | "</form>\n" | 803 | "</form>\n" |
| 821 | 804 | ||
| 822 | "</div>\n" | 805 | "</div>\n" |
| 823 | "</details>\n" | 806 | "</details>\n"; |
| 824 | "</div>\n" | ||
| 825 | "</div>\n"; | ||
| 826 | 807 | ||
| 827 | const char *email = "[disabled by admin]"; | 808 | const char *email = "[disabled by admin]"; |
| 828 | 809 | ||
| @@ -879,6 +860,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 879 | metadata = xs_str_cat(metadata, kp); | 860 | metadata = xs_str_cat(metadata, kp); |
| 880 | } | 861 | } |
| 881 | 862 | ||
| 863 | xs_str_cat(s, "<div class=\"snac-top-controls\">\n"); | ||
| 864 | |||
| 882 | xs *s1 = xs_fmt(_tmpl, | 865 | xs *s1 = xs_fmt(_tmpl, |
| 883 | L("New Post..."), | 866 | L("New Post..."), |
| 884 | snac->actor, | 867 | snac->actor, |
| @@ -900,14 +883,46 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 900 | 883 | ||
| 901 | L("Post")); | 884 | L("Post")); |
| 902 | 885 | ||
| 903 | xs *s2 = xs_fmt(_tmpl2, | 886 | xs *s2 = NULL; |
| 904 | L("Operations..."), | ||
| 905 | 887 | ||
| 906 | snac->actor, | 888 | { |
| 907 | L("Follow"), L("(by URL or user@host)"), | 889 | xs *ops_action = xs_fmt("%s/admin/action", snac->actor); |
| 890 | xs_html *ops = xs_html_tag("details", | ||
| 891 | xs_html_tag("summary", | ||
| 892 | xs_html_text(L("Operations..."))), | ||
| 893 | xs_html_tag("form", | ||
| 894 | xs_html_attr("autocomplete", "off"), | ||
| 895 | xs_html_attr("method", "post"), | ||
| 896 | xs_html_attr("action", ops_action), | ||
| 897 | xs_html_sctag("input", | ||
| 898 | xs_html_attr("type", "text"), | ||
| 899 | xs_html_attr("name", "actor"), | ||
| 900 | xs_html_attr("required", "required"), | ||
| 901 | xs_html_attr("placeholder", "bob@example.com")), | ||
| 902 | xs_html_sctag("input", | ||
| 903 | xs_html_attr("type", "submit"), | ||
| 904 | xs_html_attr("name", "action"), | ||
| 905 | xs_html_attr("value", L("Follow"))), | ||
| 906 | xs_html_text(L("(by URL or user@host)"))), | ||
| 907 | xs_html_tag("p", NULL), | ||
| 908 | xs_html_tag("form", | ||
| 909 | xs_html_attr("autocomplete", "off"), | ||
| 910 | xs_html_attr("method", "post"), | ||
| 911 | xs_html_attr("action", ops_action), | ||
| 912 | xs_html_sctag("input", | ||
| 913 | xs_html_attr("type", "text"), | ||
| 914 | xs_html_attr("name", "id"), | ||
| 915 | xs_html_attr("required", "required"), | ||
| 916 | xs_html_attr("placeholder", "https:/" "/fedi.example.com/bob/...")), | ||
| 917 | xs_html_sctag("input", | ||
| 918 | xs_html_attr("type", "submit"), | ||
| 919 | xs_html_attr("name", "action"), | ||
| 920 | xs_html_attr("value", L("Boost"))), | ||
| 921 | xs_html_text(L("(by URL)"))), | ||
| 922 | xs_html_tag("p", NULL)); | ||
| 908 | 923 | ||
| 909 | snac->actor, | 924 | s2 = xs_html_render(ops); |
| 910 | L("Boost"), L("(by URL)")); | 925 | } |
| 911 | 926 | ||
| 912 | xs *s3 = xs_fmt(_tmpl3, | 927 | xs *s3 = xs_fmt(_tmpl3, |
| 913 | L("User Settings..."), | 928 | L("User Settings..."), |
| @@ -942,7 +957,7 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 942 | L("Update user info") | 957 | L("Update user info") |
| 943 | ); | 958 | ); |
| 944 | 959 | ||
| 945 | s = xs_str_cat(s, s1, s2, s3); | 960 | s = xs_str_cat(s, s1, s2, s3, "</div><!-- snac-top-controls -->\n"); |
| 946 | 961 | ||
| 947 | return s; | 962 | return s; |
| 948 | } | 963 | } |