Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Use github.com/gobuffalo/helpers #1652

Merged
merged 19 commits into from
May 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more work on helpers
markbates committed Apr 17, 2019
commit 5413284a5aa3da901cc012b66262dec7d3e49adb
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@ GO_BIN ?= go

install: deps
make tidy
packr2
$(GO_BIN) install -tags ${TAGS} -v ./buffalo
make tidy

tidy:
packr2
ifeq ($(GO111MODULE),on)
$(GO_BIN) mod tidy
else
8 changes: 0 additions & 8 deletions genny/assets/webpack/webpack-packr.go

This file was deleted.

8 changes: 0 additions & 8 deletions genny/build/build-packr.go

This file was deleted.

4 changes: 2 additions & 2 deletions genny/resource/_fixtures/default/templates/widgets/edit.html
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<h1>Edit Widget</h1>
</div>

<%= form_for(widget, {action: widgetPath({ widget_id: widget.ID }), method: "PUT"}) { %>
<%= formFor(widget, {action: widgetPath({ widget_id: widget.ID }), method: "PUT"}) { %>
<%= partial("widgets/form.html") %>
<a href="<%= widgetPath({ widget_id: widget.ID }) %>" class="btn btn-warning" data-confirm="Are you sure?">Cancel</a>
<%= linkTo(widgetPath({ widget_id: widget.ID }), {class: "btn btn-warning", "data-confirm": "Are you sure?", body: "Cancel"}) %>
<% } %>
12 changes: 8 additions & 4 deletions genny/resource/_fixtures/default/templates/widgets/index.html
Original file line number Diff line number Diff line change
@@ -2,7 +2,11 @@
<h1>Widgets</h1>
</div>
<ul class="list-unstyled list-inline">
<li><a href="<%= newWidgetsPath() %>" class="btn btn-primary">Create New Widget</a></li>
<li>
<%= linkTo(newWidgetsPath(), {class: "btn btn-primary"}) { %>
Create New Widget
<% } %>
</li>
</ul>

<table class="table table-striped">
@@ -16,9 +20,9 @@ <h1>Widgets</h1>
<td><%= widget.Name %></td>
<td>
<div class="pull-right">
<a href="<%= widgetPath({ widget_id: widget.ID }) %>" class="btn btn-info">View</a>
<a href="<%= editWidgetPath({ widget_id: widget.ID }) %>" class="btn btn-warning">Edit</a>
<a href="<%= widgetPath({ widget_id: widget.ID }) %>" data-method="DELETE" data-confirm="Are you sure?" class="btn btn-danger">Destroy</a>
<%= linkTo(widgetPath({ widget_id: widget.ID }), {class: "btn btn-info", body: "View"}) %>
<%= linkTo(editWidgetPath({ widget_id: widget.ID }), {class: "btn btn-warning", body: "Edit"}) %>
<%= linkTo(widgetPath({ widget_id: widget.ID }), {class: "btn btn-danger", "data-method": "DELETE", "data-confirm": "Are you sure?", body: "Destroy"}) %>
</div>
</td>
</tr>
4 changes: 2 additions & 2 deletions genny/resource/_fixtures/default/templates/widgets/new.html
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<h1>New Widget</h1>
</div>

<%= form_for(widget, {action: widgetsPath(), method: "POST"}) { %>
<%= formFor(widget, {action: widgetsPath(), method: "POST"}) { %>
<%= partial("widgets/form.html") %>
<a href="<%= widgetsPath() %>" class="btn btn-warning" data-confirm="Are you sure?">Cancel</a>
<%= linkTo(widgetsPath(), {class: "btn btn-warning", "data-confirm": "Are you sure?", body: "Cancel"}) %>
<% } %>
14 changes: 11 additions & 3 deletions genny/resource/_fixtures/default/templates/widgets/show.html
Original file line number Diff line number Diff line change
@@ -3,9 +3,17 @@ <h1>Widget#Show</h1>
</div>

<ul class="list-unstyled list-inline">
<li class="list-inline-item"><a href="<%= widgetsPath() %>" class="btn btn-info">Back to all Widgets</a></li>
<li class="list-inline-item"><a href="<%= editWidgetPath({ widget_id: widget.ID })%>" class="btn btn-warning">Edit</a></li>
<li class="list-inline-item"><a href="<%= widgetPath({ widget_id: widget.ID })%>" data-method="DELETE" data-confirm="Are you sure?" class="btn btn-danger">Destroy</a>
<li class="list-inline-item">
<%= linkTo(widgetsPath(), {class: "btn btn-info"}) { %>
Back to all Widgets
<% } %>
</li>
<li class="list-inline-item">
<%= linkTo(editWidgetPath({ widget_id: widget.ID }), {class: "btn btn-warning", body: "Edit"}) %>
</li>
<li class="list-inline-item">
<%= linkTo(widgetPath({ widget_id: widget.ID }), {class: "btn btn-danger", "data-method": "DELETE", "data-confirm": "Are you sure?", body: "Destroy"}) %>
</li>
</ul>

<p>
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<h1>Edit Widget</h1>
</div>

<%= form_for(widget, {action: adminWidgetPath({ admin_widget_id: widget.ID }), method: "PUT"}) { %>
<%= formFor(widget, {action: adminWidgetPath({ admin_widget_id: widget.ID }), method: "PUT"}) { %>
<%= partial("admin/widgets/form.html") %>
<a href="<%= adminWidgetPath({ admin_widget_id: widget.ID }) %>" class="btn btn-warning" data-confirm="Are you sure?">Cancel</a>
<%= linkTo(adminWidgetPath({ admin_widget_id: widget.ID }), {class: "btn btn-warning", "data-confirm": "Are you sure?", body: "Cancel"}) %>
<% } %>
Original file line number Diff line number Diff line change
@@ -2,7 +2,11 @@
<h1>Widgets</h1>
</div>
<ul class="list-unstyled list-inline">
<li><a href="<%= newAdminWidgetsPath() %>" class="btn btn-primary">Create New Widget</a></li>
<li>
<%= linkTo(newAdminWidgetsPath(), {class: "btn btn-primary"}) { %>
Create New Widget
<% } %>
</li>
</ul>

<table class="table table-striped">
@@ -16,9 +20,9 @@ <h1>Widgets</h1>
<td><%= widget.Name %></td>
<td>
<div class="pull-right">
<a href="<%= adminWidgetPath({ admin_widget_id: widget.ID }) %>" class="btn btn-info">View</a>
<a href="<%= editAdminWidgetPath({ admin_widget_id: widget.ID }) %>" class="btn btn-warning">Edit</a>
<a href="<%= adminWidgetPath({ admin_widget_id: widget.ID }) %>" data-method="DELETE" data-confirm="Are you sure?" class="btn btn-danger">Destroy</a>
<%= linkTo(adminWidgetPath({ admin_widget_id: widget.ID }), {class: "btn btn-info", body: "View"}) %>
<%= linkTo(editAdminWidgetPath({ admin_widget_id: widget.ID }), {class: "btn btn-warning", body: "Edit"}) %>
<%= linkTo(adminWidgetPath({ admin_widget_id: widget.ID }), {class: "btn btn-danger", "data-method": "DELETE", "data-confirm": "Are you sure?", body: "Destroy"}) %>
</div>
</td>
</tr>
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<h1>New Widget</h1>
</div>

<%= form_for(widget, {action: adminWidgetsPath(), method: "POST"}) { %>
<%= formFor(widget, {action: adminWidgetsPath(), method: "POST"}) { %>
<%= partial("admin/widgets/form.html") %>
<a href="<%= adminWidgetsPath() %>" class="btn btn-warning" data-confirm="Are you sure?">Cancel</a>
<%= linkTo(adminWidgetsPath(), {class: "btn btn-warning", "data-confirm": "Are you sure?", body: "Cancel"}) %>
<% } %>
14 changes: 11 additions & 3 deletions genny/resource/_fixtures/nested/templates/admin/widgets/show.html
Original file line number Diff line number Diff line change
@@ -3,9 +3,17 @@ <h1>Widget#Show</h1>
</div>

<ul class="list-unstyled list-inline">
<li class="list-inline-item"><a href="<%= adminWidgetsPath() %>" class="btn btn-info">Back to all Widgets</a></li>
<li class="list-inline-item"><a href="<%= editAdminWidgetPath({ admin_widget_id: widget.ID })%>" class="btn btn-warning">Edit</a></li>
<li class="list-inline-item"><a href="<%= adminWidgetPath({ admin_widget_id: widget.ID })%>" data-method="DELETE" data-confirm="Are you sure?" class="btn btn-danger">Destroy</a>
<li class="list-inline-item">
<%= linkTo(adminWidgetsPath(), {class: "btn btn-info"}) { %>
Back to all Widgets
<% } %>
</li>
<li class="list-inline-item">
<%= linkTo(editAdminWidgetPath({ admin_widget_id: widget.ID }), {class: "btn btn-warning", body: "Edit"}) %>
</li>
<li class="list-inline-item">
<%= linkTo(adminWidgetPath({ admin_widget_id: widget.ID }), {class: "btn btn-danger", "data-method": "DELETE", "data-confirm": "Are you sure?", body: "Destroy"}) %>
</li>
</ul>

<p>
2 changes: 1 addition & 1 deletion genny/resource/resource_test.go
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ func Test_New(t *testing.T) {
r.NoError(err)
}

exp := packr.New(tt.Name, filepath.Join("_fixtures", tt.Name))
exp := packr.Folder(filepath.Join("_fixtures", tt.Name))
gentest.CompareFiles(exp.List(), res.Files)

for _, n := range exp.List() {
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<h1>Edit {{.opts.Model.Proper}}</h1>
</div>

<%= form_for({{.opts.Model.VarCaseSingle}}, {action: {{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }), method: "PUT"}) { %>
<%= formFor({{.opts.Model.VarCaseSingle}}, {action: {{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }), method: "PUT"}) { %>
<%= partial("{{.folder}}/form.html") %>
<a href="<%= {{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }) %>" class="btn btn-warning" data-confirm="Are you sure?">Cancel</a>
<%= linkTo({{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }), {class: "btn btn-warning", "data-confirm": "Are you sure?", body: "Cancel"}) %>
<% } %>
Original file line number Diff line number Diff line change
@@ -2,7 +2,11 @@
<h1>{{.opts.Model.Group}}</h1>
</div>
<ul class="list-unstyled list-inline">
<li><a href="<%= new{{.opts.Name.Resource}}Path() %>" class="btn btn-primary">Create New {{.opts.Model.Proper}}</a></li>
<li>
<%= linkTo(new{{.opts.Name.Resource}}Path(), {class: "btn btn-primary"}) { %>
Create New {{.opts.Model.Proper}}
<% } %>
</li>
</ul>

<table class="table table-striped">
@@ -24,9 +28,9 @@
{{ end -}}
<td>
<div class="pull-right">
<a href="<%= {{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }) %>" class="btn btn-info">View</a>
<a href="<%= edit{{.opts.Name.Proper}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }) %>" class="btn btn-warning">Edit</a>
<a href="<%= {{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }) %>" data-method="DELETE" data-confirm="Are you sure?" class="btn btn-danger">Destroy</a>
<%= linkTo({{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }), {class: "btn btn-info", body: "View"}) %>
<%= linkTo(edit{{.opts.Name.Proper}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }), {class: "btn btn-warning", body: "Edit"}) %>
<%= linkTo({{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }), {class: "btn btn-danger", "data-method": "DELETE", "data-confirm": "Are you sure?", body: "Destroy"}) %>
</div>
</td>
</tr>
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<h1>New {{.opts.Model.Proper}}</h1>
</div>

<%= form_for({{.opts.Model.VarCaseSingle}}, {action: {{.opts.Name.VarCasePlural}}Path(), method: "POST"}) { %>
<%= formFor({{.opts.Model.VarCaseSingle}}, {action: {{.opts.Name.VarCasePlural}}Path(), method: "POST"}) { %>
<%= partial("{{.folder}}/form.html") %>
<a href="<%= {{.opts.Name.VarCasePlural}}Path() %>" class="btn btn-warning" data-confirm="Are you sure?">Cancel</a>
<%= linkTo({{.opts.Name.VarCasePlural}}Path(), {class: "btn btn-warning", "data-confirm": "Are you sure?", body: "Cancel"}) %>
<% } %>
14 changes: 11 additions & 3 deletions genny/resource/templates/core/templates/folder-name/show.html.tmpl
Original file line number Diff line number Diff line change
@@ -3,9 +3,17 @@
</div>

<ul class="list-unstyled list-inline">
<li class="list-inline-item"><a href="<%= {{.opts.Name.VarCasePlural}}Path() %>" class="btn btn-info">Back to all {{.opts.Model.Group}}</a></li>
<li class="list-inline-item"><a href="<%= edit{{.opts.Name.Proper}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID })%>" class="btn btn-warning">Edit</a></li>
<li class="list-inline-item"><a href="<%= {{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID })%>" data-method="DELETE" data-confirm="Are you sure?" class="btn btn-danger">Destroy</a>
<li class="list-inline-item">
<%= linkTo({{.opts.Name.VarCasePlural}}Path(), {class: "btn btn-info"}) { %>
Back to all {{.opts.Model.Group}}
<% } %>
</li>
<li class="list-inline-item">
<%= linkTo(edit{{.opts.Name.Proper}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }), {class: "btn btn-warning", body: "Edit"}) %>
</li>
<li class="list-inline-item">
<%= linkTo({{.opts.Name.VarCaseSingle}}Path({ {{.opts.Name.ParamID}}: {{.opts.Model.VarCaseSingle}}.ID }), {class: "btn btn-danger", "data-method": "DELETE", "data-confirm": "Are you sure?", body: "Destroy"}) %>
</li>
</ul>

{{ range $p := .opts.Attrs -}}
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -13,11 +13,11 @@ require (
github.com/gobuffalo/envy v1.7.0
github.com/gobuffalo/events v1.3.1
github.com/gobuffalo/fizz v1.7.0 // indirect
github.com/gobuffalo/flect v0.1.2
github.com/gobuffalo/flect v0.1.3
github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e
github.com/gobuffalo/github_flavored_markdown v1.0.7
github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5
github.com/gobuffalo/helpers v0.0.0-20190416160246-6350ad7fbd74
github.com/gobuffalo/helpers v0.0.0-20190417150032-8fc906a4e88f
github.com/gobuffalo/httptest v1.2.0
github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2
github.com/gobuffalo/makr v1.1.5 // indirect
@@ -26,7 +26,7 @@ require (
github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0
github.com/gobuffalo/packr v1.25.0
github.com/gobuffalo/packr/v2 v2.2.0
github.com/gobuffalo/plush v3.7.34+incompatible
github.com/gobuffalo/plush v3.8.0+incompatible
github.com/gobuffalo/plushgen v0.0.0-20190329152458-0555238fe0d9
github.com/gobuffalo/pop v4.10.0+incompatible
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754
@@ -51,6 +51,6 @@ require (
github.com/stretchr/testify v1.3.0
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a
golang.org/x/sync v0.0.0-20190412183630-56d357773e84
golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421
golang.org/x/tools v0.0.0-20190417005754-4ca4b55e2050
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
)
Loading