diff options
author | Corey Hulen <corey@hulen.com> | 2015-06-16 13:18:41 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-06-16 13:18:41 -0800 |
commit | f937fa0d9cc5fb8e63c95b53ceea8665c35a8125 (patch) | |
tree | 5c8836e535e01d9ce5076104f0db6a4a0c82e313 /web | |
parent | dae0340d7de308d2e6bc7145fb158635b5cdf0ca (diff) | |
parent | d927e2ba69dd355c01878afc0ec57cca6889b8e1 (diff) | |
download | chat-f937fa0d9cc5fb8e63c95b53ceea8665c35a8125.tar.gz chat-f937fa0d9cc5fb8e63c95b53ceea8665c35a8125.tar.bz2 chat-f937fa0d9cc5fb8e63c95b53ceea8665c35a8125.zip |
Merge pull request #14 from mattermost/mm-1294
MM-1294 - Parsing homelink from URL instead of using config setting.
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/login.jsx | 4 | ||||
-rw-r--r-- | web/react/utils/utils.jsx | 12 | ||||
-rw-r--r-- | web/static/config/config.js | 2 |
3 files changed, 15 insertions, 3 deletions
diff --git a/web/react/components/login.jsx b/web/react/components/login.jsx index 685e1b058..103a93bc6 100644 --- a/web/react/components/login.jsx +++ b/web/react/components/login.jsx @@ -74,7 +74,7 @@ var FindTeamDomain = React.createClass({ <br/> <br/> <div> - <span>{"Want to create your own " + strings.Team + "?"} <a href={config.HomeLink} className="signup-team-login">Sign up now</a></span> + <span>{"Want to create your own " + strings.Team + "?"} <a href={utils.getHomeLink()} className="signup-team-login">Sign up now</a></span> </div> </form> </div> @@ -188,7 +188,7 @@ module.exports = React.createClass({ <a href="/reset_password">I forgot my password</a> </div> <div className="external-link"> - <span>{"Want to create your own " + strings.Team + "?"} <a href={config.HomeLink} className="signup-team-login">Sign up now</a></span> + <span>{"Want to create your own " + strings.Team + "?"} <a href={utils.getHomeLink()} className="signup-team-login">Sign up now</a></span> </div> </form> </div> diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 72ed48faf..628d92342 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -730,3 +730,15 @@ Image.prototype.load = function(url, progressCallback) { }; Image.prototype.completedPercentage = 0; + +module.exports.getHomeLink = function() { + if (config.HomeLink != "") { + return config.HomeLink; + } + var parts = window.location.host.split("."); + if (parts.length <= 1) { + return window.location.protocol + "//" + window.location.host; + } + parts[0] = "www"; + return window.location.protocol + "//" + parts.join("."); +} diff --git a/web/static/config/config.js b/web/static/config/config.js index 080f16a30..5a12942c8 100644 --- a/web/static/config/config.js +++ b/web/static/config/config.js @@ -24,7 +24,7 @@ var config = { AboutLink: "/static/help/configure_links.html", HelpLink: "/static/help/configure_links.html", ReportProblemLink: "/static/help/configure_links.html", - HomeLink: "http://localhost:8065", + HomeLink: "", ThemeColors: ["#2389d7", "#008a17", "#dc4fad", "#ac193d", "#0072c6", "#d24726", "#ff8f32", "#82ba00", "#03b3b2", "#008299", "#4617b4", "#8c0095", "#004b8b", "#004b8b", "#570000", "#380000", "#585858", "#000000"] }; |