{% import "strconv" %} {% import "fmt" %} {% import "github.com/bakape/meguca/config" %} {% import "github.com/bakape/meguca/common" %} {% import "github.com/bakape/meguca/lang" %} {% import "github.com/bakape/meguca/imager/assets" %} {% import ass "github.com/bakape/meguca/assets" %} {% func renderBoard(threadHTML []byte, id, title string, conf config.BoardConfContainer, page, total int, pos common.ModerationLevel, catalog bool) %}{% stripspace %} {% code ln := lang.Get() %} {% code bannerID, mime, ok := ass.Banners.Random(conf.ID) %} {% if ok %}

{%= asset(fmt.Sprintf("/assets/banners/%s/%d", conf.ID, bannerID), mime) %}

{% endif %}

{%s= title %}

{%= catalogLink(catalog) %} {% if !catalog %} {%= pagination(page, total) %} {% endif %} {%= hoverReveal("aside", conf.Notice, ln.Common.UI["showNotice"]) %} {%= hoverReveal("aside", conf.Rules, ln.Common.UI["rules"]) %} {% if catalog %} {% endif %}
{%z= threadHTML %}
{%= catalogLink(catalog) %} {% if !catalog %} {%= pagination(page, total) %} {% endif %} {%= loadingImage(conf.ID) %} {% endstripspace %}{% endfunc %} CatalogThreads renders thread content for a catalog page. Separate function to allow caching of generated posts. {% func CatalogThreads(b []common.Thread, json []byte) %}{% stripspace %}
{% for _, t := range b %} {% code boardConfig := config.GetBoardConfigs(t.Board) %} {% code idStr:= strconv.FormatUint(t.ID, 10) %} {% code hasImage := t.Image != nil && t.Image.ThumbType != common.NoFile %}
{%= deletedToggle() %} {% if hasImage %}
{% code img := *t.Image %} {% if img.Spoiler %} {% else %} {% endif %}
{% endif %} /{%s= t.Board %}/ {%s= strconv.FormatUint(uint64(t.PostCount), 10) %} / {%s= strconv.FormatUint(uint64(t.ImageCount), 10) %} {% if !hasImage %} {%= expandLink(t.Board, idStr) %} {% endif %} {%= last100Link(t.Board, idStr) %} {%= threadWatcherToggle(t.ID) %}

「{%s t.Subject %}」

{%= body(t.Post, t.ID, t.Board, false, boardConfig.RbText, boardConfig.Pyu) %}
{% endfor %}
{% endstripspace %}{% endfunc %} IndexThreads renders abbreviated threads for display on board index pages {% func IndexThreads(threads []common.Thread, json []byte) %}{% stripspace %} {% code root := config.Get().RootURL %} {% code bls :=extractBacklinks(15*6, threads...) %}
{% for _, t := range threads %} {% code idStr := strconv.FormatUint(t.ID, 10) %}
{%= deletedToggle() %} {%= renderThreadPosts(t, bls, root, true) %}
{% endfor %} {%= encodeBacklinks(bls) %}
{% endstripspace %}{% endfunc %} Render noscript-specific post creation fields {% func noscriptPostCreationFields(pos common.ModerationLevel) %}{% stripspace %} {% code ln := lang.Get() %} {% if pos > common.NotStaff %} {%= input(staffTitleSpec.wrap(), ln) %} {% endif %} {% for _, s := range specs["noscriptPostCreation"] %} {%= input(s, ln) %} {% endfor %} {% endstripspace %}{% endfunc %} Render image upload form {% func uploadForm() %}{% stripspace %}

{% endstripspace %}{% endfunc %} Link to catalog or board page {% func catalogLink(catalog bool) %}{% stripspace %} {% code ln := lang.Get().Common.UI %} {% endstripspace %}{% endfunc %} Links to different pages of the board index {% func pagination(page, total int) %}{% stripspace %} {% endstripspace %}{% endfunc %} Link to a different paginated board page {% func pageLink(i int, text string) %}{% stripspace %} {%s= text %} {% endstripspace %}{% endfunc %}