From 9c2c941449c387b2407d10c101f39a2266a2e65a Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 22 Jul 2016 10:53:57 -0400 Subject: PLT-1866/PLT-3509 Added links to download the native apps (#3651) * PLT-1866 Added configurable links for native app downloads * PLT-1866 Added native app download link to main menu * PLT-3509 Added native app link to tutorial * PLT-3509 Added native app link to welcome email * PLT-3509 Made link to apps in welcome email conditional on being set --- api/user.go | 5 + config/config.json | 5 + i18n/en.json | 4 + model/config.go | 22 +++++ templates/welcome_body.html | 11 +++ utils/config.go | 4 + webapp/components/admin_console/admin_sidebar.jsx | 10 ++ .../admin_console/native_app_link_settings.jsx | 104 +++++++++++++++++++++ webapp/components/navbar_dropdown.jsx | 22 +++++ webapp/components/sidebar_right_menu.jsx | 20 ++++ .../components/tutorial/tutorial_intro_screens.jsx | 46 ++++++++- webapp/i18n/en.json | 11 +++ webapp/images/appIcons.png | Bin 0 -> 10107 bytes webapp/routes/route_admin_console.jsx | 5 + webapp/sass/components/_tutorial.scss | 6 +- webapp/webpack.config.js | 3 +- 16 files changed, 274 insertions(+), 4 deletions(-) create mode 100644 webapp/components/admin_console/native_app_link_settings.jsx create mode 100644 webapp/images/appIcons.png diff --git a/api/user.go b/api/user.go index 8cc4ed8dd..fa643007f 100644 --- a/api/user.go +++ b/api/user.go @@ -362,6 +362,11 @@ func sendWelcomeEmail(c *Context, userId string, email string, siteURL string, v bodyPage.Props["Info3"] = c.T("api.templates.welcome_body.info3") bodyPage.Props["SiteURL"] = siteURL + if *utils.Cfg.NativeAppSettings.AppDownloadLink != "" { + bodyPage.Props["AppDownloadInfo"] = c.T("api.templates.welcome_body.app_download_info") + bodyPage.Props["AppDownloadLink"] = *utils.Cfg.NativeAppSettings.AppDownloadLink + } + if !verified { link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId), url.QueryEscape(email)) bodyPage.Props["VerifyUrl"] = link diff --git a/config/config.json b/config/config.json index 745be73e3..8f1bea3ca 100644 --- a/config/config.json +++ b/config/config.json @@ -195,5 +195,10 @@ "NicknameAttribute": "", "LocaleAttribute": "", "LoginButtonText": "With SAML" + }, + "NativeAppSettings": { + "AppDownloadLink": "https://about.mattermost.com/downloads/", + "AndroidAppDownloadLink": "https://about.mattermost.com/mattermost-android-app/", + "IosAppDownloadLink": "https://about.mattermost.com/mattermost-ios-app/" } } \ No newline at end of file diff --git a/i18n/en.json b/i18n/en.json index 426b1ec1b..d91fea61c 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1571,6 +1571,10 @@ "id": "api.templates.verify_subject", "translation": "[{{ .SiteName }}] Email Verification" }, + { + "id": "api.templates.welcome_body.app_download_info", + "translation": "For the best experience, download the apps for PC, Mac, iOS and Android from:" + }, { "id": "api.templates.welcome_body.button", "translation": "Verify Email" diff --git a/model/config.go b/model/config.go index 4767378fb..b38179cf1 100644 --- a/model/config.go +++ b/model/config.go @@ -268,6 +268,12 @@ type SamlSettings struct { LoginButtonText *string } +type NativeAppSettings struct { + AppDownloadLink *string + AndroidAppDownloadLink *string + IosAppDownloadLink *string +} + type Config struct { ServiceSettings ServiceSettings TeamSettings TeamSettings @@ -285,6 +291,7 @@ type Config struct { ComplianceSettings ComplianceSettings LocalizationSettings LocalizationSettings SamlSettings SamlSettings + NativeAppSettings NativeAppSettings } func (o *Config) ToJson() string { @@ -792,6 +799,21 @@ func (o *Config) SetDefaults() { o.SamlSettings.LocaleAttribute = new(string) *o.SamlSettings.LocaleAttribute = "" } + + if o.NativeAppSettings.AppDownloadLink == nil { + o.NativeAppSettings.AppDownloadLink = new(string) + *o.NativeAppSettings.AppDownloadLink = "https://about.mattermost.com/downloads/" + } + + if o.NativeAppSettings.AndroidAppDownloadLink == nil { + o.NativeAppSettings.AndroidAppDownloadLink = new(string) + *o.NativeAppSettings.AndroidAppDownloadLink = "https://about.mattermost.com/mattermost-android-app/" + } + + if o.NativeAppSettings.IosAppDownloadLink == nil { + o.NativeAppSettings.IosAppDownloadLink = new(string) + *o.NativeAppSettings.IosAppDownloadLink = "https://about.mattermost.com/mattermost-ios-app/" + } } func (o *Config) IsValid() *AppError { diff --git a/templates/welcome_body.html b/templates/welcome_body.html index 8dee99cf5..22867e64b 100644 --- a/templates/welcome_body.html +++ b/templates/welcome_body.html @@ -33,6 +33,17 @@

{{.Props.Info3}}

+ {{if .Props.AppDownloadLink}} + + +

{{.Props.AppDownloadInfo}}

+ +

{{.Props.AppDownloadLink}}

+ +
+ + + {{end}} diff --git a/utils/config.go b/utils/config.go index cbae0e2cb..39dbca4d8 100644 --- a/utils/config.go +++ b/utils/config.go @@ -264,6 +264,10 @@ func getClientConfig(c *model.Config) map[string]string { props["RestrictCustomEmojiCreation"] = *c.ServiceSettings.RestrictCustomEmojiCreation props["MaxFileSize"] = strconv.FormatInt(*c.FileSettings.MaxFileSize, 10) + props["AppDownloadLink"] = *c.NativeAppSettings.AppDownloadLink + props["AndroidAppDownloadLink"] = *c.NativeAppSettings.AndroidAppDownloadLink + props["IosAppDownloadLink"] = *c.NativeAppSettings.IosAppDownloadLink + if IsLicensed { if *License.Features.CustomBrand { props["EnableCustomBrand"] = strconv.FormatBool(*c.TeamSettings.EnableCustomBrand) diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx index 49df8f820..5c02f419e 100644 --- a/webapp/components/admin_console/admin_sidebar.jsx +++ b/webapp/components/admin_console/admin_sidebar.jsx @@ -581,6 +581,16 @@ export default class AdminSidebar extends React.Component { /> } /> + + + } + /> + + + ); + } + + renderSettings() { + return ( + + + } + helpText={ + + } + value={this.state.appDownloadLink} + onChange={this.handleChange} + /> + + } + helpText={ + + } + value={this.state.androidAppDownloadLink} + onChange={this.handleChange} + /> + + } + helpText={ + + } + value={this.state.iosAppDownloadLink} + onChange={this.handleChange} + /> + + ); + } +} diff --git a/webapp/components/navbar_dropdown.jsx b/webapp/components/navbar_dropdown.jsx index 4912b8ebf..81bd31269 100644 --- a/webapp/components/navbar_dropdown.jsx +++ b/webapp/components/navbar_dropdown.jsx @@ -332,6 +332,26 @@ export default class NavbarDropdown extends React.Component { ); } + let nativeAppDivider = null; + let nativeAppLink = null; + if (global.window.mm_config.AppDownloadLink) { + nativeAppDivider =
  • ; + nativeAppLink = ( +
  • + + + +
  • + ); + } + return (
    • + {nativeAppDivider} + {nativeAppLink} this.setState({showUserSettingsModal: false})} diff --git a/webapp/components/sidebar_right_menu.jsx b/webapp/components/sidebar_right_menu.jsx index 25136e8bc..27e7c25d4 100644 --- a/webapp/components/sidebar_right_menu.jsx +++ b/webapp/components/sidebar_right_menu.jsx @@ -295,6 +295,25 @@ export default class SidebarRightMenu extends React.Component { this.openRightSidebar(); } + let nativeAppLink = null; + if (global.window.mm_config.AppDownloadLink && !Utils.isMobileApp()) { + nativeAppLink = ( +
    • + + + + +
    • + ); + } + return (
      + {nativeAppLink}
    + + + ) + }} + /> + ); + + appDownloadImage = ( + + + + ); + } + return (
    Communication happens in public discussion channels, private groups and direct messages.

    Everything is archived and searchable from any web-enabled desktop, laptop or phone.

    ' /> + {appDownloadLink} + {appDownloadImage} {circles}
    ); diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index ab7406d45..ad1c1d363 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -146,10 +146,17 @@ "admin.connectionSecurityTitle": "Connection Security:", "admin.connectionSecurityTls": "TLS", "admin.connectionSecurityTlsDescription": "Encrypts the communication between Mattermost and your server.", + "admin.customization.appDownloadLinkDesc": "Add a link to a download page for the Mattermost apps. When a link is present, an option to \"Download Mattermost Apps\" will be added in the Main Menu so users can find the download page. Leave this field blank to hide the option from the Main Menu.", + "admin.customization.appDownloadLinkTitle": "Mattermost Apps Download Page Link:", + "admin.customization.androidAppDownloadLinkDesc": "Add a link to download the Android app. Users who access the site on a mobile web browser will be prompted with a page giving them the option to download the app. Leave this field blank to prevent the page from appearing.", + "admin.customization.androidAppDownloadLinkTitle": "Android App Download Link:", "admin.customization.customBrand": "Custom Branding", "admin.customization.customEmoji": "Custom Emoji", "admin.customization.enableCustomEmojiDesc": "Enable users to create custom emoji for use in messages. When enabled, Custom Emoji settings can be accessed by switching to a team and clicking the three dots above the channel sidebar, and selecting \"Custom Emoji\".", "admin.customization.enableCustomEmojiTitle": "Enable Custom Emoji:", + "admin.customization.iosAppDownloadLinkDesc": "Add a link to download the iOS app. Users who access the site on a mobile web browser will be prompted with a page giving them the option to download the app. Leave this field blank to prevent the page from appearing.", + "admin.customization.iosAppDownloadLinkTitle": "iOS App Download Link:", + "admin.customization.nativeAppLinks": "Native App Links", "admin.customization.restrictCustomEmojiCreationAdmin": "Allow System and Team Admins to create custom emoji", "admin.customization.restrictCustomEmojiCreationAll": "Allow everyone to create custom emoji", "admin.customization.restrictCustomEmojiCreationDesc": "Restrict the creation of custom emoji to certain users.", @@ -1229,6 +1236,7 @@ "navbar_dropdown.leave": "Leave Team", "navbar_dropdown.logout": "Logout", "navbar_dropdown.manageMembers": "Manage Members", + "navbar_dropdown.nativeApps": "Download Native Apps", "navbar_dropdown.viewMembers": "View Members", "navbar_dropdown.report": "Report a Problem", "navbar_dropdown.switchTeam": "Switch to {team}", @@ -1358,6 +1366,7 @@ "sidebar_right_menu.inviteNew": "Invite New Member", "sidebar_right_menu.logout": "Logout", "sidebar_right_menu.manageMembers": "Manage Members", + "sidebar_right_menu.nativeApps": "Download Native App", "sidebar_right_menu.recentMentions": "Recent Mentions", "sidebar_right_menu.report": "Report a Problem", "sidebar_right_menu.switch_team": "Team Selection", @@ -1457,6 +1466,8 @@ "tutorial_intro.allSet": "You’re all set", "tutorial_intro.end": "Click “Next” to enter {channel}. This is the first channel teammates see when they sign up. Use it for posting updates everyone needs to know.", "tutorial_intro.invite": "Invite teammates", + "tutorial_intro.mobileApps": "Install the apps for {link} for easy access and notifications on the go.", + "tutorial_intro.mobileAppsLinkText": "PC, Mac, iOS and Android", "tutorial_intro.next": "Next", "tutorial_intro.screenOne": "

    Welcome to:

    Mattermost

    Your team communication all in one place, instantly searchable and available anywhere

    Keep your team connected to help them achieve what matters most.

    ", "tutorial_intro.screenTwo": "

    How Mattermost works:

    Communication happens in public discussion channels, private groups and direct messages.

    Everything is archived and searchable from any web-enabled desktop, laptop or phone.

    ", diff --git a/webapp/images/appIcons.png b/webapp/images/appIcons.png new file mode 100644 index 000000000..ce38166fb Binary files /dev/null and b/webapp/images/appIcons.png differ diff --git a/webapp/routes/route_admin_console.jsx b/webapp/routes/route_admin_console.jsx index 9fde948c2..1465bfa6b 100644 --- a/webapp/routes/route_admin_console.jsx +++ b/webapp/routes/route_admin_console.jsx @@ -31,6 +31,7 @@ import ImageSettings from 'components/admin_console/image_settings.jsx'; import CustomBrandSettings from 'components/admin_console/custom_brand_settings.jsx'; import CustomEmojiSettings from 'components/admin_console/custom_emoji_settings.jsx'; import LegalAndSupportSettings from 'components/admin_console/legal_and_support_settings.jsx'; +import NativeAppLinkSettings from 'components/admin_console/native_app_link_settings.jsx'; import ComplianceSettings from 'components/admin_console/compliance_settings.jsx'; import RateSettings from 'components/admin_console/rate_settings.jsx'; import DeveloperSettings from 'components/admin_console/developer_settings.jsx'; @@ -166,6 +167,10 @@ export default ( path='legal_and_support' component={LegalAndSupportSettings} /> + diff --git a/webapp/sass/components/_tutorial.scss b/webapp/sass/components/_tutorial.scss index e4aff1785..a8d3ffdf6 100644 --- a/webapp/sass/components/_tutorial.scss +++ b/webapp/sass/components/_tutorial.scss @@ -183,7 +183,7 @@ display: inline-block; margin-bottom: 50px; max-width: 310px; - min-height: 370px; + min-height: 410px; position: relative; text-align: left; } @@ -234,3 +234,7 @@ } } } + +.tutorial__app-icons { + margin: 2em 0; +} \ No newline at end of file diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js index 4f33eaf84..8b1f4b21a 100644 --- a/webapp/webpack.config.js +++ b/webapp/webpack.config.js @@ -92,7 +92,8 @@ var config = { {from: 'images/emoji', to: 'emoji'}, {from: 'images/logo-email.png', to: 'images'}, {from: 'images/circles.png', to: 'images'}, - {from: 'images/favicon', to: 'images/favicon'} + {from: 'images/favicon', to: 'images/favicon'}, + {from: 'images/appIcons.png', to: 'images'} ]), new webpack.LoaderOptionsPlugin({ minimize: !DEV, -- cgit v1.2.3-1-g7c22