~netlandish/links

4b4ccdfaf6e46b492626e5480f70227fa754de0c — Yader Velasquez 9 months ago f97bc9b
Remove PullOrgSlug from short and links
M cmd/links/main.go => cmd/links/main.go +2 -2
@@ 254,9 254,9 @@ func run() error {
	slack.NewService(slackService)
	mattermostService := e.Group("/mattermost")
	mattermost.NewService(mattermostService)
	shortService := e.Group("/short")
	shortService := e.Group("/:slug/short")
	short.NewService(shortService)
	listService := e.Group("/list")
	listService := e.Group("/:slug/list")
	list.NewService(listService)
	adminService := e.Group("/admin")
	admin.NewService(adminService)

M core/routes.go => core/routes.go +2 -2
@@ 1809,9 1809,9 @@ func (s *Service) QRManageDetail(c echo.Context) error {

	var backURL string
	if qrCode.CodeType == models.CodeTypeList && qrCode.ListID.Valid {
		backURL = c.Echo().Reverse("list:listing_qrcode_list", qrCode.ListID.Int64)
		backURL = c.Echo().Reverse("list:listing_qrcode_list", org.Slug, qrCode.ListID.Int64)
	} else if qrCode.CodeType == models.CodeTypeShort && qrCode.ShortID.Valid {
		backURL = c.Echo().Reverse("short:link_short_qrcode_list", qrCode.ShortID.Int64)
		backURL = c.Echo().Reverse("short:link_short_qrcode_list", org.Slug, qrCode.ShortID.Int64)
	}

	gmap := gobwebs.Map{

M list/routes.go => list/routes.go +65 -28
@@ 64,7 64,10 @@ func (s *Service) ListingLinksUpdate(c echo.Context) error {
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)

	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 138,7 141,8 @@ func (s *Service) ListingLinksUpdate(c echo.Context) error {
		"form":          form,
		"listingLinkID": listingLink.ID,
		"navFlag":       "listing",
		"back":          c.Echo().Reverse(s.RouteName("listing_links"), listing.ID),
		"back":          c.Echo().Reverse(s.RouteName("listing_links"), org.Slug, listing.ID),
		"org":           org,
	}
	req := c.Request()
	if req.Method == http.MethodPost {


@@ 186,7 190,7 @@ func (s *Service) ListingLinksUpdate(c echo.Context) error {

		messages.Success(c, lt.Translate("A link was successfully created."))
		return c.Redirect(http.StatusMovedPermanently,
			c.Echo().Reverse(s.RouteName("listing_links"), listing.ID))
			c.Echo().Reverse(s.RouteName("listing_links"), org.Slug, listing.ID))

	}
	return gctx.Render(http.StatusOK, "listing_link_create.html", gmap)


@@ 201,6 205,10 @@ func (s *Service) ListingLinksDelete(c echo.Context) error {
	if err != nil {
		return echo.NotFoundHandler(c)
	}
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	gctx := c.(*server.Context)
	lt := localizer.GetSessionLocalizer(c)
	pd := localizer.NewPageData(lt.Translate("Delete List"))


@@ 232,16 240,15 @@ func (s *Service) ListingLinksDelete(c echo.Context) error {
			messages.Error(c, lt.Translate("Something went wrong. The link could not be deleted."))
			redirect := c.Request().Header.Get("Referer")
			if redirect == "" {
				redirect = c.Echo().Reverse(s.RouteName("listing_links"), id)
				redirect = c.Echo().Reverse(s.RouteName("listing_links"), orgSlug, id)
			}
			return c.Redirect(http.StatusMovedPermanently, redirect)
		}

		messages.Success(c, lt.Translate("Link successfully deleted"))
		return c.Redirect(http.StatusMovedPermanently,
			c.Echo().Reverse(s.RouteName("listing_links"), id))
			c.Echo().Reverse(s.RouteName("listing_links"), orgSlug, id))
	}
	orgSlug := links.PullOrgSlug(c)
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 300,8 307,8 @@ func (s *Service) ListingLinksDelete(c echo.Context) error {
	pd.Data["message"] = lt.Translate("Do you really whant to delete this link")
	gmap := gobwebs.Map{
		"pd":   pd,
		"url":  c.Echo().Reverse(s.RouteName("listing_link_delete"), listing.ID, listingLink.ID),
		"back": c.Echo().Reverse(s.RouteName("listing_links"), listing.ID),
		"url":  c.Echo().Reverse(s.RouteName("listing_link_delete"), org.Slug, listing.ID, listingLink.ID),
		"back": c.Echo().Reverse(s.RouteName("listing_links"), org.Slug, listing.ID),
	}
	return gctx.Render(http.StatusOK, "element_delete.html", gmap)



@@ 315,7 322,10 @@ func (s *Service) ListingLinksCreate(c echo.Context) error {
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)

	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 367,6 377,7 @@ func (s *Service) ListingLinksCreate(c echo.Context) error {
		"listing": listing,
		"form":    form,
		"navFlag": "listing",
		"org":     org,
	}
	req := c.Request()
	if req.Method == http.MethodPost {


@@ 414,7 425,7 @@ func (s *Service) ListingLinksCreate(c echo.Context) error {

		messages.Success(c, lt.Translate("A link was successfully created."))
		return c.Redirect(http.StatusMovedPermanently,
			c.Echo().Reverse(s.RouteName("listing_links"), listing.ID))
			c.Echo().Reverse(s.RouteName("listing_links"), org.Slug, listing.ID))

	}
	return gctx.Render(http.StatusOK, "listing_link_create.html", gmap)


@@ 428,7 439,10 @@ func (s *Service) ListingLinksManage(c echo.Context) error {
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)

	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 543,6 557,7 @@ func (s *Service) ListingLinksManage(c echo.Context) error {
		"listingLinks": result.Listing.Links,
		"listing":      listing,
		"navFlag":      "listing",
		"org":          org,
	}
	if result.Listing.PageInfo.HasPrevPage {
		gmap["prevURL"] = links.GetPaginationParams("prev", "", "", result.Listing.PageInfo.Cursor)


@@ 562,7 577,10 @@ func (s *Service) ListingUpdate(c echo.Context) error {
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)

	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 728,7 746,9 @@ func (s *Service) ListingUpdate(c echo.Context) error {
			return err
		}
		messages.Success(c, lt.Translate("Listing successfully updated."))
		return c.Redirect(http.StatusMovedPermanently, c.Echo().Reverse(s.RouteName("listing_list")))
		return c.Redirect(
			http.StatusMovedPermanently,
			c.Echo().Reverse(s.RouteName("listing_list"), org.Slug))

	}
	form := &ListingForm{


@@ 758,7 778,10 @@ func (s *Service) ListingCreate(c echo.Context) error {
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)

	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 898,7 921,9 @@ func (s *Service) ListingCreate(c echo.Context) error {
		}

		messages.Success(c, lt.Translate("A list was successfully created."))
		return c.Redirect(http.StatusMovedPermanently, c.Echo().Reverse(s.RouteName("listing_list")))
		return c.Redirect(
			http.StatusMovedPermanently,
			c.Echo().Reverse(s.RouteName("listing_list"), org.Slug))
	}
	// NOTE should we include BillinStatusOpenSource?
	if links.BillingEnabled(gctx.Server.Config) && org.IsRestricted([]int{models.BillingStatusFree}) {


@@ 921,7 946,10 @@ func (s *Service) ListingList(c echo.Context) error {
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)

	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 1042,6 1070,10 @@ func (s *Service) ListingDelete(c echo.Context) error {
	if err != nil {
		return echo.NotFoundHandler(c)
	}
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	gctx := c.(*server.Context)
	lt := localizer.GetSessionLocalizer(c)
	pd := localizer.NewPageData(lt.Translate("Delete List"))


@@ 1072,19 1104,18 @@ func (s *Service) ListingDelete(c echo.Context) error {
			messages.Error(c, lt.Translate("Something went wrong. The link could not be deleted."))
			redirect := c.Request().Header.Get("Referer")
			if redirect == "" {
				redirect = c.Echo().Reverse(s.RouteName("listing_list"))
				redirect = c.Echo().Reverse(s.RouteName("listing_list"), orgSlug)
			}
			return c.Redirect(http.StatusMovedPermanently, redirect)
		}

		messages.Success(c, lt.Translate("List successfully deleted"))
		return c.Redirect(http.StatusMovedPermanently,
			c.Echo().Reverse(s.RouteName("listing_list")))
			c.Echo().Reverse(s.RouteName("listing_list"), orgSlug))
	}

	// NOTE: All these validations already happen in the resolver for the POST request
	user := gctx.User.(*models.User)
	orgSlug := links.PullOrgSlug(c)
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 1128,8 1159,8 @@ func (s *Service) ListingDelete(c echo.Context) error {
	pd.Data["message"] = lt.Translate("Do you really whant to delete this link")
	gmap := gobwebs.Map{
		"pd":   pd,
		"url":  c.Echo().Reverse(s.RouteName("listing_delete"), listing.ID),
		"back": c.Echo().Reverse(s.RouteName("listing_list")),
		"url":  c.Echo().Reverse(s.RouteName("listing_delete"), org.Slug, listing.ID),
		"back": c.Echo().Reverse(s.RouteName("listing_list"), org.Slug),
	}
	return gctx.Render(http.StatusOK, "element_delete.html", gmap)
}


@@ 1141,7 1172,10 @@ func (s *Service) ListingQRCodeCreate(c echo.Context) error {
	}
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)
	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 1188,7 1222,7 @@ func (s *Service) ListingQRCodeCreate(c echo.Context) error {
	gmap := gobwebs.Map{
		"pd":      pd,
		"listing": listing,
		"backURL": c.Echo().Reverse(s.RouteName("listing_qrcode_list"), listing.ID),
		"backURL": c.Echo().Reverse(s.RouteName("listing_qrcode_list"), orgSlug, listing.ID),
		"navFlag": "listing",
	}
	form := &ListingQRForm{}


@@ 1251,7 1285,7 @@ func (s *Service) ListingQRCodeCreate(c echo.Context) error {
		}
		messages.Success(c, lt.Translate("QR Code succesfully created"))
		gmap["qrCode"] = result.QRCode
		gmap["backURL"] = c.Echo().Reverse(s.RouteName("listing_qrcode_list"), listing.ID)
		gmap["backURL"] = c.Echo().Reverse(s.RouteName("listing_qrcode_list"), org.Slug, listing.ID)
	}
	return gctx.Render(http.StatusOK, "qrcode_detail.html", gmap)
}


@@ 1263,7 1297,10 @@ func (s *Service) ListingQRCodeList(c echo.Context) error {
	}
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)
	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 1346,9 1383,9 @@ func (s *Service) ListingQRCodeList(c echo.Context) error {
		"object":        listing,
		"qrList":        result.QRList,
		"showAddBtn":    len(result.QRList) < 5,
		"addURL":        c.Echo().Reverse(s.RouteName("listing_qrcode_create"), listing.ID),
		"nextDeleteURL": c.Echo().Reverse(s.RouteName("listing_qrcode_list"), listing.ID),
		"back":          c.Echo().Reverse(s.RouteName("listing_list")),
		"addURL":        c.Echo().Reverse(s.RouteName("listing_qrcode_create"), org.Slug, listing.ID),
		"nextDeleteURL": c.Echo().Reverse(s.RouteName("listing_qrcode_list"), org.Slug, listing.ID),
		"back":          c.Echo().Reverse(s.RouteName("listing_list"), org.Slug),
		"navFlag":       "listing",
	}
	return gctx.Render(http.StatusOK, "qrcodes_list.html", gmap)

M short/routes.go => short/routes.go +33 -14
@@ 47,7 47,10 @@ func (s *Service) RegisterRoutes() {
func (s *Service) LinkShortList(c echo.Context) error {
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)
	slug := links.PullOrgSlug(c)
	slug := c.Param("slug")
	if slug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": slug},


@@ 168,10 171,13 @@ func (s *Service) LinkShortList(c echo.Context) error {
func (s *Service) LinkShortCreate(c echo.Context) error {
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)
	slug := c.Param("slug")
	if slug == "" {
		return echo.NotFoundHandler(c)
	}

	orgSlug := links.PullOrgSlug(c)
	opts := &database.FilterOptions{
		Filter: sq.Expr("o.slug = ?", orgSlug),
		Filter: sq.Expr("o.slug = ?", slug),
	}
	orgs, err := models.GetOrganizations(c.Request().Context(), opts)
	if err != nil {


@@ 301,7 307,10 @@ func (s *Service) LinkShortUpdate(c echo.Context) error {
		return echo.NotFoundHandler(c)
	}

	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.Expr("o.slug = ?", orgSlug),
	}


@@ 465,6 474,10 @@ func (s *Service) LinkShortDelete(c echo.Context) error {
	if err != nil {
		return echo.NotFoundHandler(c)
	}
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	gctx := c.(*server.Context)
	lt := localizer.GetSessionLocalizer(c)
	pd := localizer.NewPageData(lt.Translate("Delete Short Link"))


@@ 495,14 508,14 @@ func (s *Service) LinkShortDelete(c echo.Context) error {
			messages.Error(c, lt.Translate("Something went wrong. The link could not be deleted."))
			redirect := c.Request().Header.Get("Referer")
			if redirect == "" {
				redirect = c.Echo().Reverse(s.RouteName("link_short_list"))
				redirect = c.Echo().Reverse(s.RouteName("link_short_list"), orgSlug)
			}
			return c.Redirect(http.StatusMovedPermanently, redirect)
		}

		messages.Success(c, lt.Translate("Short Link successfully deleted"))
		return c.Redirect(http.StatusMovedPermanently,
			c.Echo().Reverse(s.RouteName("link_short_list")))
			c.Echo().Reverse(s.RouteName("link_short_list"), orgSlug))
	}

	// NOTE: All these validations already happen in the resolver for the POST request


@@ 529,8 542,8 @@ func (s *Service) LinkShortDelete(c echo.Context) error {
	pd.Data["message"] = lt.Translate("Do you really whant to delete this link")
	gmap := gobwebs.Map{
		"pd":   pd,
		"url":  c.Echo().Reverse(s.RouteName("link_short_delete"), linkShort.ID),
		"back": c.Echo().Reverse(s.RouteName("link_short_list")),
		"url":  c.Echo().Reverse(s.RouteName("link_short_delete"), orgSlug, linkShort.ID),
		"back": c.Echo().Reverse(s.RouteName("link_short_list"), orgSlug),
	}
	return gctx.Render(http.StatusOK, "element_delete.html", gmap)
}


@@ 637,7 650,10 @@ func (s *Service) LinkShortQRCodeList(c echo.Context) error {
	}
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)
	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 720,10 736,10 @@ func (s *Service) LinkShortQRCodeList(c echo.Context) error {
		"object":        short,
		"qrList":        result.QRList,
		"showAddBtn":    len(result.QRList) < 5,
		"addURL":        c.Echo().Reverse(s.RouteName("link_short_qrcode_create"), short.ID),
		"nextDeleteURL": c.Echo().Reverse(s.RouteName("link_short_qrcode_list"), short.ID),
		"addURL":        c.Echo().Reverse(s.RouteName("link_short_qrcode_create"), orgSlug, short.ID),
		"nextDeleteURL": c.Echo().Reverse(s.RouteName("link_short_qrcode_list"), orgSlug, short.ID),
		"navFlag":       "short",
		"back":          c.Echo().Reverse(s.RouteName("link_short_list")),
		"back":          c.Echo().Reverse(s.RouteName("link_short_list"), orgSlug),
	}
	return gctx.Render(http.StatusOK, "qrcodes_list.html", gmap)
}


@@ 735,7 751,10 @@ func (s *Service) LinkShortQRCodeCreate(c echo.Context) error {
	}
	gctx := c.(*server.Context)
	user := gctx.User.(*models.User)
	orgSlug := links.PullOrgSlug(c)
	orgSlug := c.Param("slug")
	if orgSlug == "" {
		return echo.NotFoundHandler(c)
	}
	opts := &database.FilterOptions{
		Filter: sq.And{
			sq.Eq{"o.slug": orgSlug},


@@ 782,7 801,7 @@ func (s *Service) LinkShortQRCodeCreate(c echo.Context) error {
	gmap := gobwebs.Map{
		"pd":      pd,
		"short":   short,
		"backURL": c.Echo().Reverse(s.RouteName("link_short_qrcode_list"), short.ID),
		"backURL": c.Echo().Reverse(s.RouteName("link_short_qrcode_list"), orgSlug, short.ID),
		"navFlag": "short",
	}
	form := &ShortQRForm{}

M templates/link_short_create.html => templates/link_short_create.html +1 -1
@@ 5,7 5,7 @@
</section>

<section class="card shadow-card">
  <form id="link-form" action="{{if .linkShortID }}{{reverse "short:link_short_edit_post" .linkShortID}}{{else}}{{reverse "short:link_short_create_post" }}{{end}}" method="POST">
  <form id="link-form" action="{{if .linkShortID }}{{reverse "short:link_short_edit_post" .org.Slug .linkShortID}}{{else}}{{reverse "short:link_short_create_post" .org.Slug }}{{end}}" method="POST">
    <input type="hidden" name="csrf" value="{{ .CSRF }}">
    {{if .errors._global_ }}
    {{range .errors._global_}}

M templates/link_short_list.html => templates/link_short_list.html +4 -4
@@ 1,7 1,7 @@
{{template "base" .}}
<section class="app-header">
  <h1 class="app-header__title">{{ .org.Name }} {{.pd.Title}}</h1>
  <a class="button primary is-small" href="{{reverse "short:link_short_create"}}">{{.pd.Data.add}}</a>
  <a class="button primary is-small" href="{{reverse "short:link_short_create" .org.Slug}}">{{.pd.Data.add}}</a>
</section>

<section class="card shadow-card">


@@ 38,10 38,10 @@
                    <details class="dropdown">
                        <summary class="button outline is-small">{{$.pd.Data.actions}}</summary>
                        <div class="card dropdown-card">
                            <p><a class="mr-1" href="{{reverse "short:link_short_qrcode_list" .ID}}">{{$.pd.Data.manage_qr}}</a></p>
                            <p><a class="mr-1" href="{{reverse "short:link_short_qrcode_list" $.org.Slug .ID}}">{{$.pd.Data.manage_qr}}</a></p>
                            {{if eq .UserID $.currentUserID}}
                            <p><a class="mr-1" href="{{reverse "short:link_short_edit" .ID}}">{{$.pd.Data.edit}}</a></p>
                            <p><a class="mr-1" href="{{reverse "short:link_short_delete" .ID}}">{{$.pd.Data.delete}}</a></p>
                            <p><a class="mr-1" href="{{reverse "short:link_short_edit" $.org.Slug .ID}}">{{$.pd.Data.edit}}</a></p>
                            <p><a class="mr-1" href="{{reverse "short:link_short_delete" $.org.Slug .ID}}">{{$.pd.Data.delete}}</a></p>
                            <p><a class="mr-1" href="{{reverse "analytics:detail" "shorts" .ID}}">{{$.pd.Data.analytics}}</a></p>
                            {{end}}
                        </div>

M templates/listing_create.html => templates/listing_create.html +3 -3
@@ 1,11 1,11 @@
{{template "base" .}}
<section class="app-header">
  <h1 class="app-header__title">{{.pd.Title}} | {{.org.Name}}</h1>
  <a class="button primary is-small" href="{{reverse "list:listing_list"}}">{{.pd.Data.back}}</a>
  <a class="button primary is-small" href="{{reverse "list:listing_list" .org.Slug}}">{{.pd.Data.back}}</a>
</section>

<section class="card shadow-card">
  <form id="listing-form" action="{{if .listing.ID }}{{reverse "list:listing_edit_post" .listing.ID}}{{else}}{{reverse "list:listing_create_post" }}{{end}}" method="POST" enctype="multipart/form-data">
  <form id="listing-form" action="{{if .listing.ID }}{{reverse "list:listing_edit_post" .org.Slug .listing.ID}}{{else}}{{reverse "list:listing_create_post" .org.Slug }}{{end}}" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="csrf" value="{{ .CSRF }}">
    {{if .errors._global_ }}
    {{range .errors._global_}}


@@ 109,7 109,7 @@
  </form>
  <footer class="is-right">
    <button type="submit" form="listing-form" class="button dark">{{.pd.Data.save}}</button>
    <a href="{{reverse "list:listing_list"}}" class="button error">{{.pd.Data.cancel}}</a>
    <a href="{{reverse "list:listing_list" .org.Slug}}" class="button error">{{.pd.Data.cancel}}</a>
  </footer>
</section>
{{template "base_footer" .}}

M templates/listing_link_create.html => templates/listing_link_create.html +3 -3
@@ 1,11 1,11 @@
{{template "base" .}}
<section class="app-header">
  <h1 class="app-header__title">{{.pd.Title}} | {{.listing.Title}}</h1>
  <a class="button primary is-small" href="{{reverse "list:listing_links" .listing.ID}}">{{.pd.Data.back}}</a>
  <a class="button primary is-small" href="{{reverse "list:listing_links" .org.Slug .listing.ID}}">{{.pd.Data.back}}</a>
</section>

<section class="card shadow-card">
  <form id="listing-link-form" action="{{if .listingLinkID }}{{reverse "list:listing_link_update_post" .listing.ID .listingLinkID}}{{else}}{{reverse "list:listing_link_create_post" .listing.ID }}{{end}}" method="POST">
  <form id="listing-link-form" action="{{if .listingLinkID }}{{reverse "list:listing_link_update_post" .org.Slug .listing.ID .listingLinkID}}{{else}}{{reverse "list:listing_link_create_post" .org.Slug .listing.ID }}{{end}}" method="POST">
    <input type="hidden" name="csrf" value="{{ .CSRF }}">
    {{if .errors._global_ }}
    {{range .errors._global_}}


@@ 43,7 43,7 @@
  </form>
  <footer class="is-right">
    <button type="submit" form="listing-link-form" class="button dark">{{.pd.Data.save}}</button>
    <a href="{{reverse "list:listing_links" .listing.ID}}" class="button error">{{.pd.Data.cancel}}</a>
    <a href="{{reverse "list:listing_links" .org.Slug .listing.ID}}" class="button error">{{.pd.Data.cancel}}</a>
  </footer>
</section>
{{template "base_footer" .}}

M templates/listing_link_list.html => templates/listing_link_list.html +4 -4
@@ 2,8 2,8 @@
<section class="app-header">
  <h1 class="app-header__title">{{.listing.Title}} {{.pd.Title}}</h1>
  <div>
    <a class="button primary is-small" href="{{reverse "list:listing_list"}}">{{.pd.Data.back}}</a>
    <a class="button primary is-small" href="{{reverse "list:listing_link_create" .listing.ID}}">{{.pd.Data.add}}</a>
    <a class="button primary is-small" href="{{reverse "list:listing_list" .org.Slug}}">{{.pd.Data.back}}</a>
    <a class="button primary is-small" href="{{reverse "list:listing_link_create" .org.Slug .listing.ID}}">{{.pd.Data.add}}</a>
  </div>
</section>



@@ 29,8 29,8 @@
              <details class="dropdown">
                <summary class="button outline is-small">{{$.pd.Data.actions}}</summary>
                <div class="card dropdown-card">
                  <p><a class="mr-1" href="{{reverse "list:listing_link_update" $.listing.ID .ID}}">{{$.pd.Data.edit}}</a></p>
                  <p><a class="mr-1" href="{{reverse "list:listing_link_delete" $.listing.ID .ID}}">{{$.pd.Data.delete}}</a></p>
                  <p><a class="mr-1" href="{{reverse "list:listing_link_update" $.org.Slug $.listing.ID .ID}}">{{$.pd.Data.edit}}</a></p>
                  <p><a class="mr-1" href="{{reverse "list:listing_link_delete" $.org.Slug $.listing.ID .ID}}">{{$.pd.Data.delete}}</a></p>
                </div>
              </details>
          {{end}}

M templates/listing_list.html => templates/listing_list.html +5 -5
@@ 1,7 1,7 @@
{{template "base" .}}
<section class="app-header">
  <h1 class="app-header__title">{{.org.Name}} {{.pd.Title}}</h1>
  <a class="button primary is-small" href="{{reverse "list:listing_create"}}">{{.pd.Data.add}}</a>
  <a class="button primary is-small" href="{{reverse "list:listing_create" .org.Slug}}">{{.pd.Data.add}}</a>
</section>

<section class="card shadow-card">


@@ 38,11 38,11 @@
          <details class="dropdown">
            <summary class="button outline is-small">{{$.pd.Data.actions}}</summary>
            <div class="card dropdown-card">
              <p><a class="mr-1" href="{{reverse "list:listing_qrcode_list" .ID}}">{{$.pd.Data.manage_qr}}</a></p>
                <p><a class="mr-1" href="{{reverse "list:listing_qrcode_list" $.org.Slug .ID}}">{{$.pd.Data.manage_qr}}</a></p>
              {{if eq .UserID $.currentUserID}}
              <p><a class="mr-1" href="{{reverse "list:listing_links" .ID}}">{{$.pd.Data.manage_links}}</a></p>
              <p><a class="mr-1" href="{{reverse "list:listing_update" .ID}}">{{$.pd.Data.edit}}</a></p>
              <p><a class="mr-1" href="{{reverse "list:listing_delete" .ID}}">{{$.pd.Data.delete}}</a></p>
              <p><a class="mr-1" href="{{reverse "list:listing_links" $.org.Slug .ID}}">{{$.pd.Data.manage_links}}</a></p>
              <p><a class="mr-1" href="{{reverse "list:listing_update" $.org.Slug .ID}}">{{$.pd.Data.edit}}</a></p>
              <p><a class="mr-1" href="{{reverse "list:listing_delete" $.org.Slug .ID}}">{{$.pd.Data.delete}}</a></p>
              <p><a class="mr-1" href="{{reverse "analytics:detail" "lists" .ID}}">{{$.pd.Data.analytics}}</a></p>
              {{end}}
            </div>