Compare commits

...

8 Commits

Author SHA1 Message Date
Chris Broadfoot 6220cba641 [release-branch.go1.7] static: don't use the jQuery func for looking up based on hash
$.find is safer.

Change-Id: I51893b64ce804ac5a70f780a1255af2c91413110
Reviewed-on: https://go-review.googlesource.com/35430
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/35431
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-01-18 20:19:12 +00:00
Chris Broadfoot ae17563914 [release-branch.go1.7] godoc/dl: change "All versions" to "Archived versions"
This change makes each release show only once on the whole page.
The current stable releases are not shown under the archive.

This change also fixes expandos to work correctly on IDs that are not
valid CSS selectors (i.e., "#go1.7.4") to ensure that the file listing
for a given version is expanded.

Updates golang/go#17574.

Change-Id: I7ff1041be3e0072286772ffa545a124764f81945
Reviewed-on: https://go-review.googlesource.com/34911
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/35096
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-01-10 19:12:26 +00:00
Chris Broadfoot 7771da7791 [release-branch.go1.7] godoc/dl: clean up display of stable versions
Under "Stable Versions", only show the latest minor versions of the most two
recent major versions.

Under each of those versions, move the downloads for primary ports to
the top of the table and the other downloads under a separate
"Other Ports" heading.

Add a listing for every stable Go version under "All versions",
collapsed by default.

Fixes golang/go#17574.
Updates golang/go#17018.

Change-Id: I7d74fef1b44a319a4bf65dedf24ffb27a7009f60
Reviewed-on: https://go-review.googlesource.com/34824
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/35095
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-01-10 19:11:07 +00:00
Chris Broadfoot 9d32829149 [release-branch.go1.7] godoc: allow nested toggles and toggles with <a name>
Toggles can now be nested within one another. They can also be
referenced using an <a> element with the name attribute, rather than
an element with the "id" attribute.

Updates golang/go#17574.

Change-Id: I43c17499a6879e983a79a74e14c99128296288e1
Reviewed-on: https://go-review.googlesource.com/34825
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/35094
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-01-10 19:10:08 +00:00
Chris Broadfoot 05ca1f09ae [release-branch.go1.7] godoc/dl: add instructions for unstable "go get"
Adds instructions for "go get golang.org/x/build/version/..."
for the unstable version.

Fixes golang/go#18337.

Change-Id: Iea5e8fab7f00a053e3b42ef355277307addb635b
Reviewed-on: https://go-review.googlesource.com/34823
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/34826
2017-01-06 03:58:00 +00:00
Russ Cox 46af848339 [release-branch.go1.7] cmd/godoc: add perf subrepo
For golang/go#14304.

Change-Id: Ia90193d3a9ad027231f977ffa6b66cf60ea40683
Reviewed-on: https://go-review.googlesource.com/34615
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/34661
2016-12-21 15:01:19 +00:00
Chris Broadfoot 26c35b4dcf [release-branch.go1.7] all: merge master into release-branch.go1.7
72064bd cmd/heapview: dowgrade to customelements v0
337c012 x/tools/cmd/heapview: add a heading to the page
7ef02fd cmd/heapview: add karma+jasmine TS unit testing config
bf0c35b tip/doc: update doc to match latest gcloud syntax
9e74590 x/tools/cmd/heapview: break out init code
053ddb9 x/tools/cmd/heapview: add basic client serving
1c6f639 imports: don't ignore GOPATH if GOROOT is a prefix of GOPATH
ed69e84 cmd/goimports, imports: add -local flag
f328430 cmd/goimports: permit complete filename for -srcdir
5b59ce8 cmd/bundle: More idiomatic flag.Usage.
682b241 imports: make filepath.Rel work on windows
55296b3 x/tools/cmd/heapview: rename heapdump to heapview
1634796 go/ssa: fix stale docs for CreateProgram and Build
5dbb806 x/tools/cmd/heapdump: add empty heapdump command
d4a8e58 imports: skip "node_modules" directories
edf8e6f cmd/goimports, imports: optimize directory scanning and other things
caebc7a imports: ignore case and hyphens when lexically filtering candidate dirs
b825d28 cmd/oracle: announce planned deletion in 2.5 months
f2932db cmd/guru: suppress failing test on plan9
29481a3 imports: skip test on plan9
681db09 godoc/static: use window scope for checking notesEnabled
6d32be8 imports: minor fixes
c550f66 go/gcimporter15: backport of https://golang.org/cl/23606/
3f933d4 go/gcimporter15: backport of https://golang.org/cl/23012/
ffe4e61 imports: add configuration mechanism to exclude directories
7c26c99 imports: do less I/O finding the package name of an import
ef6b6eb cmd/guru: what: include imported package names in sameids
92480e4 cmd/guru: update Emacs installation documentation
9c3986d refactor/rename: fix two bugs related to MS Windows' path separator
e047ae7 cmd/goimports, imports: make goimports great again
b3887f7 refactor/rename: fix spurious conflict report when renaming x/foo to y/foo
0835c73 imports: special case rand.Read, prevent math/rand by chance
cda5280 cmd/guru: fix quoting bug in Emacs binding
130914b tip: update package doc to refer to stable code
35c6e68 cmd/guru: update link to documentation
2b32496 cmd/guru: add menu to Emacs

Change-Id: I8d32f370464fa7af0dfcfefd8cd2f2650c5758d4
2016-08-15 13:25:14 -07:00
Andrew Gerrand a84e830bb0 [release-branch.go1.7] godoc/static: use window scope for checking notesEnabled
This prevents a JS error when the notes are not present.

Change-Id: Ib8875306027b7e43441310d4228c690e2249056e
Reviewed-on: https://go-review.googlesource.com/24963
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-on: https://go-review.googlesource.com/24987
2016-07-21 17:44:42 +00:00
7 changed files with 210 additions and 50 deletions

View File

@ -35,6 +35,7 @@ var xMap = map[string]xRepo{
"mobile": {"https://go.googlesource.com/mobile", "git"},
"net": {"https://go.googlesource.com/net", "git"},
"oauth2": {"https://go.googlesource.com/oauth2", "git"},
"perf": {"https://go.googlesource.com/perf", "git"},
"playground": {"https://go.googlesource.com/playground", "git"},
"review": {"https://go.googlesource.com/review", "git"},
"sync": {"https://go.googlesource.com/sync", "git"},

View File

@ -98,6 +98,22 @@ func (f File) PrettySize() string {
return fmt.Sprintf("%.0fMB", float64(f.Size)/mb)
}
var primaryPorts = map[string]bool{
"darwin/amd64": true,
"linux/386": true,
"linux/amd64": true,
"linux/armv6l": true,
"windows/386": true,
"windows/amd64": true,
}
func (f File) PrimaryPort() bool {
if f.Kind == "source" {
return true
}
return primaryPorts[f.OS+"/"+f.Arch]
}
func (f File) Highlight() bool {
switch {
case f.Kind == "source":
@ -122,10 +138,11 @@ func (f File) URL() string {
}
type Release struct {
Version string
Stable bool
Files []File
Visible bool // show files on page load
Version string
Stable bool
Files []File
Visible bool // show files on page load
SplitPortTable bool // whether files should be split by primary/other ports.
}
type Feature struct {
@ -164,9 +181,9 @@ var featuredFiles = []Feature{
// data to send to the template; increment cacheKey if you change this.
type listTemplateData struct {
Featured []Feature
Stable, Unstable []Release
LoginURL string
Featured []Feature
Stable, Unstable, Archive []Release
LoginURL string
}
var (
@ -196,7 +213,7 @@ func listHandler(w http.ResponseWriter, r *http.Request) {
log.Errorf(c, "error listing: %v", err)
return
}
d.Stable, d.Unstable = filesToReleases(fs)
d.Stable, d.Unstable, d.Archive = filesToReleases(fs)
if len(d.Stable) > 0 {
d.Featured = filesToFeatured(d.Stable[0].Files)
}
@ -229,7 +246,7 @@ func filesToFeatured(fs []File) (featured []Feature) {
return
}
func filesToReleases(fs []File) (stable, unstable []Release) {
func filesToReleases(fs []File) (stable, unstable, archive []Release) {
sort.Sort(fileOrder(fs))
var r *Release
@ -238,27 +255,53 @@ func filesToReleases(fs []File) (stable, unstable []Release) {
if r == nil {
return
}
if r.Stable {
if len(stable) == 0 {
// Display files for latest stable release.
stableMaj, stableMin, _ = parseVersion(r.Version)
r.Visible = len(stable) == 0
if !r.Stable {
if len(unstable) != 0 {
// Only show one (latest) unstable version.
return
}
stable = append(stable, *r)
maj, min, _ := parseVersion(r.Version)
if maj < stableMaj || maj == stableMaj && min <= stableMin {
// Display unstable version only if newer than the
// latest stable release.
return
}
unstable = append(unstable, *r)
}
// Reports whether the release is the most recent minor version of the
// two most recent major versions.
shouldAddStable := func() bool {
if len(stable) >= 2 {
// Show up to two stable versions.
return false
}
if len(stable) == 0 {
// Most recent stable version.
stableMaj, stableMin, _ = parseVersion(r.Version)
return true
}
if maj, _, _ := parseVersion(r.Version); maj == stableMaj {
// Older minor version of most recent major version.
return false
}
// Second most recent stable version.
return true
}
if !shouldAddStable() {
archive = append(archive, *r)
return
}
if len(unstable) != 0 {
// Only show one (latest) unstable version.
return
}
maj, min, _ := parseVersion(r.Version)
if maj < stableMaj || maj == stableMaj && min <= stableMin {
// Display unstable version only if newer than the
// latest stable release.
return
}
r.Visible = true
unstable = append(unstable, *r)
// Split the file list into primary/other ports for the stable releases.
// NOTE(cbro): This is only done for stable releases because maintaining the historical
// nature of primary/other ports for older versions is infeasible.
// If freebsd is considered primary some time in the future, we'd not want to
// mark all of the older freebsd binaries as "primary".
// It might be better if we set that as a flag when uploading.
r.SplitPortTable = true
r.Visible = true // Toggle open all stable releases.
stable = append(stable, *r)
}
for _, f := range fs {
if r == nil || f.Version != r.Version {

View File

@ -70,3 +70,68 @@ func TestFileOrder(t *testing.T) {
t.Errorf("sort order is\n%s\nwant:\n%s", got, want)
}
}
func TestFilesToReleases(t *testing.T) {
fs := []File{
{Version: "go1.7.4", OS: "darwin"},
{Version: "go1.7.4", OS: "windows"},
{Version: "go1.7", OS: "darwin"},
{Version: "go1.7", OS: "windows"},
{Version: "go1.6.2", OS: "darwin"},
{Version: "go1.6.2", OS: "windows"},
{Version: "go1.6", OS: "darwin"},
{Version: "go1.6", OS: "windows"},
{Version: "go1.5.2", OS: "darwin"},
{Version: "go1.5.2", OS: "windows"},
{Version: "go1.5", OS: "darwin"},
{Version: "go1.5", OS: "windows"},
{Version: "go1.5beta1", OS: "windows"},
}
stable, unstable, archive := filesToReleases(fs)
if got, want := len(stable), 2; want != got {
t.Errorf("len(stable): got %v, want %v", got, want)
} else {
if got, want := stable[0].Version, "go1.7.4"; want != got {
t.Errorf("stable[0].Version: got %v, want %v", got, want)
}
if got, want := stable[1].Version, "go1.6.2"; want != got {
t.Errorf("stable[1].Version: got %v, want %v", got, want)
}
}
if got, want := len(unstable), 0; want != got {
t.Errorf("len(unstable): got %v, want %v", got, want)
}
if got, want := len(archive), 4; want != got {
t.Errorf("len(archive): got %v, want %v", got, want)
}
}
func TestOldUnstableNotShown(t *testing.T) {
fs := []File{
{Version: "go1.7.4"},
{Version: "go1.7"},
{Version: "go1.7beta1"},
}
_, unstable, _ := filesToReleases(fs)
if len(unstable) != 0 {
t.Errorf("got unstable, want none")
}
}
func TestUnstableShown(t *testing.T) {
fs := []File{
{Version: "go1.8beta2"},
{Version: "go1.8rc1"},
{Version: "go1.7.4"},
{Version: "go1.7"},
{Version: "go1.7beta1"},
}
_, unstable, _ := filesToReleases(fs)
if got, want := len(unstable), 1; got != want {
t.Fatalf("len(unstable): got %v, want %v", got, want)
}
// show rcs ahead of betas.
if got, want := unstable[0].Version, "go1.8rc1"; got != want {
t.Fatalf("unstable[0].Version: got %v, want %v", got, want)
}
}

View File

@ -134,6 +134,18 @@ information about Go releases.
{{template "releases" .}}
{{end}}
{{with .Archive}}
<div class="toggle" id="archive">
<div class="collapsed">
<h3 class="toggleButton" title="Click to show versions">Archived versions</h3>
</div>
<div class="expanded">
<h3 class="toggleButton" title="Click to hide versions">Archived versions</h3>
{{template "releases" .}}
</div>
</div>
{{end}}
<!-- Disabled for now; there's no admin functionality yet.
<p>
@ -213,8 +225,13 @@ $(document).ready(function() {
<h2 class="toggleButton" title="Click to hide downloads for this version">{{.Version}} </h2>
{{if .Stable}}{{else}}
<p>This is an <b>unstable</b> version of Go. Use with caution.</p>
<p>If you already have Go installed, you can install this version by running:</p>
<pre>
go get golang.org/x/build/version/{{.Version}}
</pre>
<p>Then, use the <code>{{.Version}}</code> command instead of the <code>go</code> command to use {{.Version}}.</p>
{{end}}
{{template "files" .Files}}
{{template "files" .}}
</div>
</div>
{{end}}
@ -230,10 +247,22 @@ $(document).ready(function() {
<th>Arch</th>
<th>Size</th>
{{/* Use the checksum type of the first file for the column heading. */}}
<th>{{(index . 0).ChecksumType}} Checksum</th>
<th>{{(index .Files 0).ChecksumType}} Checksum</th>
</tr>
</thead>
{{range .}}
{{if .SplitPortTable}}
{{range .Files}}{{if .PrimaryPort}}{{template "file" .}}{{end}}{{end}}
{{/* TODO(cbro): add a link to an explanatory doc page */}}
<tr class="first"><th colspan="6" class="first">Other Ports</th></tr>
{{range .Files}}{{if not .PrimaryPort}}{{template "file" .}}{{end}}{{end}}
{{else}}
{{range .Files}}{{template "file" .}}{{end}}
{{end}}
</table>
{{end}}
{{define "file"}}
<tr{{if .Highlight}} class="highlight"{{end}}>
<td class="filename"><a class="download" href="{{.URL}}">{{.Filename}}</a></td>
<td>{{pretty .Kind}}</td>
@ -242,12 +271,6 @@ $(document).ready(function() {
<td>{{.PrettySize}}</td>
<td><tt>{{.PrettyChecksum}}</tt></td>
</tr>
{{else}}
<tr>
<td colspan="5">No downloads available.</td>
</tr>
{{end}}
</table>
{{end}}
{{define "download"}}

View File

@ -113,6 +113,11 @@ function generateTOC() {
function bindToggle(el) {
$('.toggleButton', el).click(function() {
if ($(this).closest(".toggle, .toggleVisible")[0] != el) {
// Only trigger the closest toggle header.
return;
}
if ($(el).is('.toggle')) {
$(el).addClass('toggleVisible').removeClass('toggle');
} else {
@ -120,6 +125,7 @@ function bindToggle(el) {
}
});
}
function bindToggles(selector) {
$(selector).each(function(i, el) {
bindToggle(el);
@ -239,10 +245,18 @@ function fixFocus() {
}
function toggleHash() {
var hash = $(window.location.hash);
if (hash.is('.toggle')) {
hash.find('.toggleButton').first().click();
// Open all of the toggles for a particular hash.
var els = $(document.getElementById(window.location.hash.substring(1)),
$.find("a[name='" + window.location.hash.substring(1) + "']"));
while (els.length) {
for (var i = 0; i < els.length; i++) {
var el = $(els[i]);
if (el.is('.toggle')) {
el.find('.toggleButton').first().click();
}
}
els = el.parent();
}
}
function personalizeInstallInstructions() {

View File

@ -683,6 +683,11 @@ function generateTOC() {
function bindToggle(el) {
$('.toggleButton', el).click(function() {
if ($(this).closest(".toggle, .toggleVisible")[0] != el) {
// Only trigger the closest toggle header.
return;
}
if ($(el).is('.toggle')) {
$(el).addClass('toggleVisible').removeClass('toggle');
} else {
@ -690,6 +695,7 @@ function bindToggle(el) {
}
});
}
function bindToggles(selector) {
$(selector).each(function(i, el) {
bindToggle(el);
@ -809,10 +815,18 @@ function fixFocus() {
}
function toggleHash() {
var hash = $(window.location.hash);
if (hash.is('.toggle')) {
hash.find('.toggleButton').first().click();
// Open all of the toggles for a particular hash.
var els = $(document.getElementById(window.location.hash.substring(1)),
$("a[name='" + window.location.hash.substring(1) + "']"));
while (els.length) {
for (var i = 0; i < els.length; i++) {
var el = $(els[i]);
if (el.is('.toggle')) {
el.find('.toggleButton').first().click();
}
}
els = el.parent();
}
}
function personalizeInstallInstructions() {
@ -3248,10 +3262,10 @@ div#blog .read {
}
.toggleButton { cursor: pointer; }
.toggle .collapsed { display: block; }
.toggle .expanded { display: none; }
.toggleVisible .collapsed { display: none; }
.toggleVisible .expanded { display: block; }
.toggle > .collapsed { display: block; }
.toggle > .expanded { display: none; }
.toggleVisible > .collapsed { display: none; }
.toggleVisible > .expanded { display: block; }
table.codetable { margin-left: auto; margin-right: auto; border-style: none; }
table.codetable td { padding-right: 10px; }

View File

@ -445,10 +445,10 @@ div#blog .read {
}
.toggleButton { cursor: pointer; }
.toggle .collapsed { display: block; }
.toggle .expanded { display: none; }
.toggleVisible .collapsed { display: none; }
.toggleVisible .expanded { display: block; }
.toggle > .collapsed { display: block; }
.toggle > .expanded { display: none; }
.toggleVisible > .collapsed { display: none; }
.toggleVisible > .expanded { display: block; }
table.codetable { margin-left: auto; margin-right: auto; border-style: none; }
table.codetable td { padding-right: 10px; }