This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from ggalmazor/new_version_notice
Add note warning about a new Aggregate version
- Loading branch information
Showing
8 changed files
with
82 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/org/opendatakit/aggregate/client/LayoutUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.opendatakit.aggregate.client; | ||
|
||
import static org.opendatakit.aggregate.buildconfig.BuildConfig.VERSION; | ||
|
||
import com.google.gwt.dom.client.Style; | ||
import com.google.gwt.user.client.ui.HTML; | ||
|
||
public class LayoutUtils { | ||
private static String latestVersion; | ||
|
||
static native String getLatestVersion() /*-{ | ||
var req = new XMLHttpRequest(); | ||
req.open('GET', 'https://api.github.com/repos/opendatakit/aggregate/releases/latest', false); | ||
req.send(null); | ||
if (req.readyState === 4 && req.status === 200) | ||
return JSON.parse(req.responseText).tag_name; | ||
}-*/; | ||
|
||
static HTML buildVersionNote() { | ||
if (latestVersion == null) | ||
latestVersion = getLatestVersion(); | ||
String shortVersion = VERSION.contains("-") ? VERSION.substring(0, VERSION.indexOf("-")) : VERSION; | ||
String versionNote = shortVersion.equals(latestVersion) | ||
? "You're up to date!" | ||
: "<a href=\"https://github.com/opendatakit/aggregate/releases/latest\" target=\"_blank\">Update available</a>"; | ||
HTML html = new HTML("<small>" + shortVersion + " - " + versionNote + "</small>"); | ||
Style style = html.getElement().getStyle(); | ||
style.setProperty("position", "fixed"); | ||
style.setProperty("bottom", "0"); | ||
style.setProperty("left", "0"); | ||
style.setProperty("padding", "5px 10px"); | ||
style.setProperty("backgroundColor", "rgba(255,255,255,.9)"); | ||
return html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters