Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #61 fix by adding an instruction link #176

Merged
merged 4 commits into from
Oct 21, 2017

Conversation

Dulya
Copy link
Contributor

@Dulya Dulya commented Oct 7, 2017

added instruction link to each alternative download version headings from 2.3 upwards

@lightbend-cla-validator
Copy link

Hi @Dulya,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement:

http://www.lightbend.com/contribute/cla

@Dulya Dulya changed the title Issue #66 fix by adding an instruction link Issue #61 fix by adding an instruction link Oct 7, 2017
@Dulya
Copy link
Contributor Author

Dulya commented Oct 7, 2017

pull request is to address issue #61 .

@Dulya
Copy link
Contributor Author

Dulya commented Oct 9, 2017

Signed the CLA

Copy link
Member

@gmethvin gmethvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Dulya.

I think the other piece to this issue is making sure in the documentation for 2.5.x, 2.4.x, etc., people know how to create a project with a previous Play version. For example in the 2.5.x new application docs, the sbt new command will use the default 2.6.x branch instead of 2.5.x. (Of course we also want to encourage people to always use the latest version and make sure they know they are deliberately using an older version.)

<th colspan="3">
<h4 class="previousVersionHeading">@group._1</h4>
@if(group._1 > "2.2"){
<a href="@{"https://www.playframework.com/documentation/" + group._1 + ".x/Installing"}" class="instructionLink">Instructions</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can call this "Setup Instructions" to be more clear.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right, I forgot this included 1.x versions.

Copy link
Member

@gmethvin gmethvin Oct 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code also won't work if we ever have major versions of 10 or greater.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes, due to the string comparison. I'll make the necessary changes

<tr>
<th colspan="3">
<h4 class="previousVersionHeading">@group._1</h4>
@if(group._1 > "2.2"){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this check. The Installing page exists and is useful in older versions too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes since there's documentation for each version we can point to them. But 1.x.x modules uses "install" while 2.x.x uses "Installing" as pages. Maybe I can add a separate route in controllers/documentation/Router resolving them to the correct places.

@Dulya
Copy link
Contributor Author

Dulya commented Oct 10, 2017

Then we can add a separate column in the "Alternative downloads" section for the documentation of each version.
Without getting the documentation URL dynamically, we can add a documentation url in the conf/playRelease.json file. Is that okay?

@gmethvin
Copy link
Member

I think it would be fine to have something like:

@{if (group._1 > "1") "Installing" else "install"}

updated installation link for older versions and used documentation router to route to the corresponding documentation page
@Dulya
Copy link
Contributor Author

Dulya commented Oct 11, 2017

@gmethvin made the requested changes

In case of any mismatch (but won't happen)
Copy link
Contributor Author

@Dulya Dulya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

<a href="@{
if(group._1.toDouble >= 1.2) {
controllers.documentation.ReverseRouter.page(None, group._1 + ".x", if(group._1.toDouble >= 2.0) "Installing" else "install")
}else if(group._1=="1.1") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually let's just remove the cases for the older 1.x versions. I didn't realize we needed to hack the version numbers like this.

<th colspan="3">
<h4 class="previousVersionHeading">@group._1</h4>
<a href="@{
if(group._1.toDouble >= 1.2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to double is not a nice way to compare versions. I would write something like:

// check if version v1 >= v2
def versionAtLeast(v1: String, v2: String): Boolean = {
  import math.Ordering.Implicits._
  v1.split('.').toSeq > v2.split('.').toSeq
}

The imported ordering lets us compare versions as lists of string numbers.

@@ -107,7 +108,22 @@ <h3 id="older-versions">Previous releases</h3>
<table class="releases">
@releases.previous.groupBy(_.version.slice(0, 3)).toSeq.sortBy(_._1).reverse.map { group =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the version.slice(0, 3) is technically broken too. It's really trying to get the first two version components, but it assumes version numbers are one digit. I think what we really want is something like _.version.split('.').take(2).mkString(".").

@Dulya
Copy link
Contributor Author

Dulya commented Oct 18, 2017

@gmethvin yes, found that double conversion is not a good solution so made some changes to the code as you proposed.

@gmethvin gmethvin merged commit 3237fc5 into playframework:master Oct 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants