diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 55 |
1 files changed, 25 insertions, 30 deletions
| @@ -709,27 +709,25 @@ xs_str *html_user_header(snac *snac, xs_str *s, int local) | |||
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | 711 | ||
| 712 | xs_str *html_top_controls(snac *snac, xs_str *s) | 712 | xs_html *html_top_controls(snac *snac) |
| 713 | /* generates the top controls */ | 713 | /* generates the top controls */ |
| 714 | { | 714 | { |
| 715 | xs_str_cat(s, "<div class=\"snac-top-controls\">\n"); | 715 | xs *ops_action = xs_fmt("%s/admin/action", snac->actor); |
| 716 | 716 | ||
| 717 | xs_html *new_note = html_note(snac, L("New Post..."), | 717 | xs_html *top_controls = xs_html_tag("div", |
| 718 | "new_post_div", "new_post_form", | 718 | xs_html_attr("class", "snac-top-controls"), |
| 719 | L("What's on your mind?"), "", | ||
| 720 | NULL, NULL, | ||
| 721 | xs_stock_false, "", | ||
| 722 | xs_stock_false, NULL, | ||
| 723 | NULL, 1); | ||
| 724 | 719 | ||
| 725 | xs *s1 = xs_html_render(new_note); | 720 | /** new post **/ |
| 721 | html_note(snac, L("New Post..."), | ||
| 722 | "new_post_div", "new_post_form", | ||
| 723 | L("What's on your mind?"), "", | ||
| 724 | NULL, NULL, | ||
| 725 | xs_stock_false, "", | ||
| 726 | xs_stock_false, NULL, | ||
| 727 | NULL, 1), | ||
| 726 | 728 | ||
| 727 | xs *s2 = NULL; | 729 | /** operations **/ |
| 728 | 730 | xs_html_tag("details", | |
| 729 | /** operations form **/ | ||
| 730 | { | ||
| 731 | xs *ops_action = xs_fmt("%s/admin/action", snac->actor); | ||
| 732 | xs_html *ops = xs_html_tag("details", | ||
| 733 | xs_html_tag("summary", | 731 | xs_html_tag("summary", |
| 734 | xs_html_text(L("Operations..."))), | 732 | xs_html_text(L("Operations..."))), |
| 735 | xs_html_tag("p", NULL), | 733 | xs_html_tag("p", NULL), |
| @@ -762,12 +760,9 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 762 | xs_html_attr("name", "action"), | 760 | xs_html_attr("name", "action"), |
| 763 | xs_html_attr("value", L("Boost"))), | 761 | xs_html_attr("value", L("Boost"))), |
| 764 | xs_html_text(L("(by URL)"))), | 762 | xs_html_text(L("(by URL)"))), |
| 765 | xs_html_tag("p", NULL)); | 763 | xs_html_tag("p", NULL))); |
| 766 | 764 | ||
| 767 | s2 = xs_html_render(ops); | 765 | /** user settings **/ |
| 768 | } | ||
| 769 | |||
| 770 | /** user settings form **/ | ||
| 771 | 766 | ||
| 772 | char *email = "[disabled by admin]"; | 767 | char *email = "[disabled by admin]"; |
| 773 | 768 | ||
| @@ -818,7 +813,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 818 | 813 | ||
| 819 | xs *user_setup_action = xs_fmt("%s/admin/user-setup", snac->actor); | 814 | xs *user_setup_action = xs_fmt("%s/admin/user-setup", snac->actor); |
| 820 | 815 | ||
| 821 | xs_html *user_settings = xs_html_tag("details", | 816 | xs_html_add(top_controls, |
| 817 | xs_html_tag("details", | ||
| 822 | xs_html_tag("summary", | 818 | xs_html_tag("summary", |
| 823 | xs_html_text(L("User Settings..."))), | 819 | xs_html_text(L("User Settings..."))), |
| 824 | xs_html_tag("div", | 820 | xs_html_tag("div", |
| @@ -946,13 +942,9 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 946 | xs_html_tag("input", | 942 | xs_html_tag("input", |
| 947 | xs_html_attr("type", "submit"), | 943 | xs_html_attr("type", "submit"), |
| 948 | xs_html_attr("class", "button"), | 944 | xs_html_attr("class", "button"), |
| 949 | xs_html_attr("value", L("Update user info")))))); | 945 | xs_html_attr("value", L("Update user info"))))))); |
| 950 | 946 | ||
| 951 | xs *s3 = xs_html_render(user_settings); | 947 | return top_controls; |
| 952 | |||
| 953 | s = xs_str_cat(s, s1, s2, s3, "</div><!-- snac-top-controls -->\n"); | ||
| 954 | |||
| 955 | return s; | ||
| 956 | } | 948 | } |
| 957 | 949 | ||
| 958 | 950 | ||
| @@ -1717,8 +1709,11 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local, | |||
| 1717 | else | 1709 | else |
| 1718 | s = html_instance_header(s, tag); | 1710 | s = html_instance_header(s, tag); |
| 1719 | 1711 | ||
| 1720 | if (user && !local) | 1712 | if (user && !local) { |
| 1721 | s = html_top_controls(user, s); | 1713 | xs_html *h = html_top_controls(user); |
| 1714 | xs *s1 = xs_html_render(h); | ||
| 1715 | s = xs_str_cat(s, s1); | ||
| 1716 | } | ||
| 1722 | 1717 | ||
| 1723 | s = xs_str_cat(s, "<a name=\"snac-posts\"></a>\n"); | 1718 | s = xs_str_cat(s, "<a name=\"snac-posts\"></a>\n"); |
| 1724 | s = xs_str_cat(s, "<div class=\"snac-posts\">\n"); | 1719 | s = xs_str_cat(s, "<div class=\"snac-posts\">\n"); |