diff options
Diffstat (limited to 'web')
41 files changed, 158 insertions, 116 deletions
diff --git a/web/react/components/access_history_modal.jsx b/web/react/components/access_history_modal.jsx index 9c8e7c6c3..a080150dd 100644 --- a/web/react/components/access_history_modal.jsx +++ b/web/react/components/access_history_modal.jsx @@ -89,7 +89,10 @@ export default class AccessHistoryModal extends React.Component { } accessList[i] = ( - <div className='access-history__table'> + <div + key={'accessHistoryEntryKey' + i} + className='access-history__table' + > <div className='access__date'>{newDate}</div> <div className='access__report'> <div className='report__time'>{newHistoryDate.toLocaleTimeString(navigator.language, {hour: '2-digit', minute: '2-digit'})}</div> diff --git a/web/react/components/activity_log_modal.jsx b/web/react/components/activity_log_modal.jsx index 2a83b3c40..7cbd4021e 100644 --- a/web/react/components/activity_log_modal.jsx +++ b/web/react/components/activity_log_modal.jsx @@ -102,7 +102,10 @@ export default class ActivityLogModal extends React.Component { } activityList[i] = ( - <div className='activity-log__table'> + <div + key={'activityLogEntryKey' + i} + className='activity-log__table' + > <div className='activity-log__report'> <div className='report__platform'><i className={devicePicture} />{currentSession.props.platform}</div> <div className='report__info'> diff --git a/web/react/components/email_verify.jsx b/web/react/components/email_verify.jsx index f2e91dd98..396e201f8 100644 --- a/web/react/components/email_verify.jsx +++ b/web/react/components/email_verify.jsx @@ -1,6 +1,8 @@ // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. +import {config} from '../utils/config.js'; + export default class EmailVerify extends React.Component { constructor(props) { super(props); diff --git a/web/react/components/file_attachment_list.jsx b/web/react/components/file_attachment_list.jsx index 33643de73..d93f461e8 100644 --- a/web/react/components/file_attachment_list.jsx +++ b/web/react/components/file_attachment_list.jsx @@ -8,8 +8,14 @@ var Constants = require('../utils/constants.jsx'); export default class FileAttachmentList extends React.Component { constructor(props) { super(props); + + this.handleImageClick = this.handleImageClick.bind(this); + this.state = {startImgId: 0}; } + handleImageClick(e) { + this.setState({startImgId: parseInt($(e.target.parentNode).attr('data-img-id'), 10)}); + } render() { var filenames = this.props.filenames; var modalId = this.props.modalId; @@ -40,9 +46,6 @@ export default class FileAttachmentList extends React.Component { </div> ); } - handleImageClick(e) { - this.setState({startImgId: parseInt($(e.target.parentNode).attr('data-img-id'), 10)}); - } } FileAttachmentList.propTypes = { diff --git a/web/react/components/file_upload.jsx b/web/react/components/file_upload.jsx index c91d03599..dcb938cbf 100644 --- a/web/react/components/file_upload.jsx +++ b/web/react/components/file_upload.jsx @@ -18,6 +18,21 @@ export default class FileUpload extends React.Component { }; } + fileUploadSuccess(channelId, data) { + var parsedData = $.parseJSON(data); + this.props.onFileUpload(parsedData.filenames, parsedData.client_ids, channelId); + + var requests = this.state.requests; + for (var j = 0; j < parsedData.client_ids.length; j++) { + delete requests[parsedData.client_ids[j]]; + } + this.setState({requests: requests}); + } + + fileUploadFail(clientId, err) { + this.props.onUploadError(err, clientId); + } + handleChange() { var element = $(React.findDOMNode(this.refs.fileInput)); var files = element.prop('files'); @@ -57,19 +72,8 @@ export default class FileUpload extends React.Component { formData.append('client_ids', clientId); var request = client.uploadFile(formData, - function success(data) { - var parsedData = $.parseJSON(data); - this.props.onFileUpload(parsedData.filenames, parsedData.client_ids, channelId); - - var requests = this.state.requests; - for (var j = 0; j < parsedData.client_ids.length; j++) { - delete requests[parsedData.client_ids[j]]; - } - this.setState({requests: requests}); - }.bind(this), - function fail(err) { - this.props.onUploadError(err, clientId); - }.bind(this) + this.fileUploadSuccess.bind(this, channelId), + this.fileUploadFail.bind(this, clientId) ); var requests = this.state.requests; @@ -122,19 +126,8 @@ export default class FileUpload extends React.Component { formData.append('client_ids', clientId); var request = client.uploadFile(formData, - function success(data) { - var parsedData = $.parseJSON(data); - this.props.onFileUpload(parsedData.filenames, parsedData.client_ids, channelId); - - var requests = this.state.requests; - for (var j = 0; j < parsedData.client_ids.length; j++) { - delete requests[parsedData.client_ids[j]]; - } - this.setState({requests: requests}); - }.bind(this), - function fail(err) { - this.props.onUploadError(err, clientId); - }.bind(this) + this.fileUploadSuccess.bind(this, channelId), + this.fileUploadFail.bind(this, clientId) ); var requests = this.state.requests; @@ -248,19 +241,8 @@ export default class FileUpload extends React.Component { formData.append('client_ids', clientId); var request = client.uploadFile(formData, - function(data) { - var parsedData = $.parseJSON(data); - self.props.onFileUpload(parsedData.filenames, parsedData.client_ids, channelId); - - var requests = self.state.requests; - for (var j = 0; j < parsedData.client_ids.length; j++) { - delete requests[parsedData.client_ids[j]]; - } - self.setState({requests: requests}); - }, - function(err) { - self.props.onUploadError(err, clientId); - } + self.fileUploadSuccess.bind(self, channelId), + self.fileUploadFail.bind(self, clientId) ); var requests = self.state.requests; diff --git a/web/react/components/find_team.jsx b/web/react/components/find_team.jsx index bb1c6c7ea..4040a771d 100644 --- a/web/react/components/find_team.jsx +++ b/web/react/components/find_team.jsx @@ -3,6 +3,7 @@ var utils = require('../utils/utils.jsx'); var client = require('../utils/client.jsx'); +import {strings} from '../utils/config.js'; export default class FindTeam extends React.Component { constructor(props) { diff --git a/web/react/components/get_link_modal.jsx b/web/react/components/get_link_modal.jsx index fc32d946b..1f25ea0b7 100644 --- a/web/react/components/get_link_modal.jsx +++ b/web/react/components/get_link_modal.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. var UserStore = require('../stores/user_store.jsx'); +import {strings} from '../utils/config.js'; export default class GetLinkModal extends React.Component { constructor(props) { diff --git a/web/react/components/invite_member_modal.jsx b/web/react/components/invite_member_modal.jsx index 2ef42a993..c1cfa7800 100644 --- a/web/react/components/invite_member_modal.jsx +++ b/web/react/components/invite_member_modal.jsx @@ -6,6 +6,7 @@ var ConfigStore = require('../stores/config_store.jsx'); var Client = require('../utils/client.jsx'); var UserStore = require('../stores/user_store.jsx'); var ConfirmModal = require('./confirm_modal.jsx'); +import {config} from '../utils/config.js'; export default class InviteMemberModal extends React.Component { constructor(props) { diff --git a/web/react/components/login.jsx b/web/react/components/login.jsx index f87e77ff7..b20c62833 100644 --- a/web/react/components/login.jsx +++ b/web/react/components/login.jsx @@ -6,6 +6,7 @@ const Client = require('../utils/client.jsx'); const UserStore = require('../stores/user_store.jsx'); const BrowserStore = require('../stores/browser_store.jsx'); const Constants = require('../utils/constants.jsx'); +import {config, strings} from '../utils/config.js'; export default class Login extends React.Component { constructor(props) { diff --git a/web/react/components/member_list_item.jsx b/web/react/components/member_list_item.jsx index d244939f5..bfce0f49f 100644 --- a/web/react/components/member_list_item.jsx +++ b/web/react/components/member_list_item.jsx @@ -44,7 +44,7 @@ export default class MemberListItem extends React.Component { var self = this; let makeAdminOption = null; - if (makeAdminOption) { + if (this.props.handleMakeAdmin) { makeAdminOption = ( <li role='presentation'> <a @@ -56,7 +56,7 @@ export default class MemberListItem extends React.Component { } let handleRemoveOption = null; - if (handleRemoveOption) { + if (this.props.handleRemove) { handleRemoveOption = ( <li role='presentation'> <a diff --git a/web/react/components/navbar.jsx b/web/react/components/navbar.jsx index d6cf4f9d6..2258bf2b3 100644 --- a/web/react/components/navbar.jsx +++ b/web/react/components/navbar.jsx @@ -274,6 +274,7 @@ export default class Navbar extends React.Component { if (currentId == null) { buttons.push( <button + key='navbar-toggle-collapse' type='button' className='navbar-toggle' data-toggle='collapse' @@ -288,6 +289,7 @@ export default class Navbar extends React.Component { } else { buttons.push( <button + key='navbar-toggle-sidebar' type='button' className='navbar-toggle' data-toggle='collapse' @@ -304,6 +306,7 @@ export default class Navbar extends React.Component { buttons.push( <button + key='navbar-toggle-menu' type='button' className='navbar-toggle menu-toggle pull-right' data-toggle='collapse' diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index e818a5c92..a949205da 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -7,6 +7,7 @@ var UserStore = require('../stores/user_store.jsx'); var TeamStore = require('../stores/team_store.jsx'); var Constants = require('../utils/constants.jsx'); +import {config} from '../utils/config.js'; function getStateFromStores() { return {teams: UserStore.getTeams(), currentTeam: TeamStore.getCurrent()}; diff --git a/web/react/components/password_reset_form.jsx b/web/react/components/password_reset_form.jsx index 7acd2d1f7..1b579efbc 100644 --- a/web/react/components/password_reset_form.jsx +++ b/web/react/components/password_reset_form.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. var client = require('../utils/client.jsx'); +import {config} from '../utils/config.js'; export default class PasswordResetForm extends React.Component { constructor(props) { diff --git a/web/react/components/post.jsx b/web/react/components/post.jsx index e284f4b6a..5f4aeb961 100644 --- a/web/react/components/post.jsx +++ b/web/react/components/post.jsx @@ -136,7 +136,7 @@ export default class Post extends React.Component { } var profilePic = null; - if (this.props.hideProfilePic) { + if (!this.props.hideProfilePic) { profilePic = ( <div className='post-profile-img__container'> <img diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx index 62925b9c5..c5db3956d 100644 --- a/web/react/components/post_list.jsx +++ b/web/react/components/post_list.jsx @@ -15,6 +15,8 @@ var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var Constants = require('../utils/constants.jsx'); var ActionTypes = Constants.ActionTypes; +import {strings} from '../utils/config.js'; + export default class PostList extends React.Component { constructor() { super(); @@ -516,7 +518,7 @@ export default class PostList extends React.Component { var postCtl = ( <Post - key={post.id} + key={post.id + 'postKey'} ref={post.id} sameUser={sameUser} sameRoot={sameRoot} diff --git a/web/react/components/rhs_thread.jsx b/web/react/components/rhs_thread.jsx index dbb16872e..d99177bda 100644 --- a/web/react/components/rhs_thread.jsx +++ b/web/react/components/rhs_thread.jsx @@ -191,7 +191,7 @@ export default class RhsThread extends React.Component { return ( <Comment ref={comPost.id} - key={comPost.id} + key={comPost.id + 'commentKey'} post={comPost} selected={(comPost.id === selectedPost.id)} /> diff --git a/web/react/components/setting_picture.jsx b/web/react/components/setting_picture.jsx index 33c3b650a..6eaa4a96e 100644 --- a/web/react/components/setting_picture.jsx +++ b/web/react/components/setting_picture.jsx @@ -1,6 +1,8 @@ // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. +import {config} from '../utils/config.js'; + export default class SettingPicture extends React.Component { constructor(props) { super(props); diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx index ef23f5bc2..983260187 100644 --- a/web/react/components/sidebar.jsx +++ b/web/react/components/sidebar.jsx @@ -387,13 +387,13 @@ export default class Sidebar extends React.Component { this.setState({loadingDMChannel: -1}); AsyncClient.getChannel(data.id); Utils.switchChannel(data); - }, + }.bind(this), function error() { this.setState({loadingDMChannel: -1}); window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/' + channel.name; - } + }.bind(this) ); - }; + }.bind(this); } } diff --git a/web/react/components/sidebar_header.jsx b/web/react/components/sidebar_header.jsx index 6e219cc6c..fb79f8b1e 100644 --- a/web/react/components/sidebar_header.jsx +++ b/web/react/components/sidebar_header.jsx @@ -3,6 +3,7 @@ var NavbarDropdown = require('./navbar_dropdown.jsx'); var UserStore = require('../stores/user_store.jsx'); +import {config} from '../utils/config.js'; export default class SidebarHeader extends React.Component { constructor(props) { diff --git a/web/react/components/sidebar_right_menu.jsx b/web/react/components/sidebar_right_menu.jsx index fea889b33..9c5733799 100644 --- a/web/react/components/sidebar_right_menu.jsx +++ b/web/react/components/sidebar_right_menu.jsx @@ -4,6 +4,7 @@ var UserStore = require('../stores/user_store.jsx'); var client = require('../utils/client.jsx'); var utils = require('../utils/utils.jsx'); +import {config} from '../utils/config.js'; export default class SidebarRightMenu extends React.Component { constructor(props) { @@ -128,4 +129,4 @@ export default class SidebarRightMenu extends React.Component { SidebarRightMenu.propTypes = { teamType: React.PropTypes.string, teamDisplayName: React.PropTypes.string -};
\ No newline at end of file +}; diff --git a/web/react/components/signup_user_complete.jsx b/web/react/components/signup_user_complete.jsx index 67e85d4de..f078f6169 100644 --- a/web/react/components/signup_user_complete.jsx +++ b/web/react/components/signup_user_complete.jsx @@ -6,6 +6,7 @@ var client = require('../utils/client.jsx'); var UserStore = require('../stores/user_store.jsx'); var BrowserStore = require('../stores/browser_store.jsx'); var Constants = require('../utils/constants.jsx'); +import {config} from '../utils/config.js'; export default class SignupUserComplete extends React.Component { constructor(props) { diff --git a/web/react/components/team_general_tab.jsx b/web/react/components/team_general_tab.jsx index 2966a8a9a..25139bb95 100644 --- a/web/react/components/team_general_tab.jsx +++ b/web/react/components/team_general_tab.jsx @@ -6,6 +6,7 @@ const SettingItemMax = require('./setting_item_max.jsx'); const Client = require('../utils/client.jsx'); const Utils = require('../utils/utils.jsx'); +import {strings} from '../utils/config.js'; export default class GeneralTab extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_allowed_domains_page.jsx b/web/react/components/team_signup_allowed_domains_page.jsx index aee5afd23..721fa142a 100644 --- a/web/react/components/team_signup_allowed_domains_page.jsx +++ b/web/react/components/team_signup_allowed_domains_page.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. var Client = require('../utils/client.jsx'); +import {strings} from '../utils/config.js'; export default class TeamSignupAllowedDomainsPage extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_choose_auth.jsx b/web/react/components/team_signup_choose_auth.jsx index 92ade5d24..71780c677 100644 --- a/web/react/components/team_signup_choose_auth.jsx +++ b/web/react/components/team_signup_choose_auth.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. var Constants = require('../utils/constants.jsx'); +import {strings} from '../utils/config.js'; export default class ChooseAuthPage extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_display_name_page.jsx b/web/react/components/team_signup_display_name_page.jsx index de756f4d5..5d0e4c7b3 100644 --- a/web/react/components/team_signup_display_name_page.jsx +++ b/web/react/components/team_signup_display_name_page.jsx @@ -3,6 +3,7 @@ var utils = require('../utils/utils.jsx'); var client = require('../utils/client.jsx'); +import {strings} from '../utils/config.js'; export default class TeamSignupDisplayNamePage extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_password_page.jsx b/web/react/components/team_signup_password_page.jsx index 4088c7cef..aa402846b 100644 --- a/web/react/components/team_signup_password_page.jsx +++ b/web/react/components/team_signup_password_page.jsx @@ -4,6 +4,7 @@ var Client = require('../utils/client.jsx'); var BrowserStore = require('../stores/browser_store.jsx'); var UserStore = require('../stores/user_store.jsx'); +import {strings, config} from '../utils/config.js'; export default class TeamSignupPasswordPage extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_send_invites_page.jsx b/web/react/components/team_signup_send_invites_page.jsx index 6d9b0ec03..35d2441c5 100644 --- a/web/react/components/team_signup_send_invites_page.jsx +++ b/web/react/components/team_signup_send_invites_page.jsx @@ -5,6 +5,7 @@ var EmailItem = require('./team_signup_email_item.jsx'); var Utils = require('../utils/utils.jsx'); var ConfigStore = require('../stores/config_store.jsx'); var Client = require('../utils/client.jsx'); +import {strings, config} from '../utils/config.js'; export default class TeamSignupSendInvitesPage extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_url_page.jsx b/web/react/components/team_signup_url_page.jsx index 6911ba871..ffe9d9fe8 100644 --- a/web/react/components/team_signup_url_page.jsx +++ b/web/react/components/team_signup_url_page.jsx @@ -4,6 +4,7 @@ const Utils = require('../utils/utils.jsx'); const Client = require('../utils/client.jsx'); const Constants = require('../utils/constants.jsx'); +import {strings, config} from '../utils/config.js'; export default class TeamSignupUrlPage extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_username_page.jsx b/web/react/components/team_signup_username_page.jsx index 8efcd87e1..b5c8b14df 100644 --- a/web/react/components/team_signup_username_page.jsx +++ b/web/react/components/team_signup_username_page.jsx @@ -3,6 +3,7 @@ var Utils = require('../utils/utils.jsx'); var Client = require('../utils/client.jsx'); +import {strings} from '../utils/config.js'; export default class TeamSignupUsernamePage extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_welcome_page.jsx b/web/react/components/team_signup_welcome_page.jsx index e742cba2f..e4374fa28 100644 --- a/web/react/components/team_signup_welcome_page.jsx +++ b/web/react/components/team_signup_welcome_page.jsx @@ -4,6 +4,7 @@ var Utils = require('../utils/utils.jsx'); var Client = require('../utils/client.jsx'); var BrowserStore = require('../stores/browser_store.jsx'); +import {config} from '../utils/config.js'; export default class TeamSignupWelcomePage extends React.Component { constructor(props) { diff --git a/web/react/components/team_signup_with_email.jsx b/web/react/components/team_signup_with_email.jsx index c0bbb7da9..d75736bd3 100644 --- a/web/react/components/team_signup_with_email.jsx +++ b/web/react/components/team_signup_with_email.jsx @@ -3,6 +3,7 @@ const Utils = require('../utils/utils.jsx'); const Client = require('../utils/client.jsx'); +import {strings} from '../utils/config.js'; export default class EmailSignUpPage extends React.Component { constructor() { diff --git a/web/react/components/team_signup_with_sso.jsx b/web/react/components/team_signup_with_sso.jsx index 96a216005..521c21733 100644 --- a/web/react/components/team_signup_with_sso.jsx +++ b/web/react/components/team_signup_with_sso.jsx @@ -4,6 +4,7 @@ var utils = require('../utils/utils.jsx'); var client = require('../utils/client.jsx'); var Constants = require('../utils/constants.jsx'); +import {strings} from '../utils/config.js'; export default class SSOSignUpPage extends React.Component { constructor(props) { diff --git a/web/react/components/user_profile.jsx b/web/react/components/user_profile.jsx index fbdcdca59..739084053 100644 --- a/web/react/components/user_profile.jsx +++ b/web/react/components/user_profile.jsx @@ -3,6 +3,7 @@ var Utils = require('../utils/utils.jsx'); var UserStore = require('../stores/user_store.jsx'); +import {config} from '../utils/config.js'; var id = 0; diff --git a/web/react/components/user_settings_appearance.jsx b/web/react/components/user_settings_appearance.jsx index 878ec42fc..3afdd7349 100644 --- a/web/react/components/user_settings_appearance.jsx +++ b/web/react/components/user_settings_appearance.jsx @@ -6,6 +6,7 @@ var SettingItemMin = require('./setting_item_min.jsx'); var SettingItemMax = require('./setting_item_max.jsx'); var Client = require('../utils/client.jsx'); var Utils = require('../utils/utils.jsx'); +import {config} from '../utils/config.js'; export default class UserSettingsAppearance extends React.Component { constructor(props) { @@ -89,6 +90,7 @@ export default class UserSettingsAppearance extends React.Component { for (var i = 0; i < config.ThemeColors.length; i++) { themeButtons.push( <button + key={config.ThemeColors[i] + 'key' + i} ref={config.ThemeColors[i]} type='button' className='btn btn-lg color-btn' @@ -101,7 +103,10 @@ export default class UserSettingsAppearance extends React.Component { var inputs = []; inputs.push( - <li className='setting-list-item'> + <li + key='themeColorSetting' + className='setting-list-item' + > <div className='btn-group' data-toggle='buttons-radio' diff --git a/web/react/components/user_settings_notifications.jsx b/web/react/components/user_settings_notifications.jsx index b97f29e29..84a7b62c7 100644 --- a/web/react/components/user_settings_notifications.jsx +++ b/web/react/components/user_settings_notifications.jsx @@ -9,6 +9,7 @@ var client = require('../utils/client.jsx'); var AsyncClient = require('../utils/async_client.jsx'); var utils = require('../utils/utils.jsx'); var assign = require('object-assign'); +import {config} from '../utils/config.js'; function getNotificationsStateFromStores() { var user = UserStore.getCurrentUser(); diff --git a/web/react/components/user_settings_security.jsx b/web/react/components/user_settings_security.jsx index a9f62097a..d83151cd8 100644 --- a/web/react/components/user_settings_security.jsx +++ b/web/react/components/user_settings_security.jsx @@ -113,7 +113,10 @@ export default class SecurityTab extends React.Component { if (this.props.user.auth_service === '') { inputs.push( - <div className='form-group'> + <div + key='currentPasswordUpdateForm' + className='form-group' + > <label className='col-sm-5 control-label'>Current Password</label> <div className='col-sm-7'> <input @@ -126,7 +129,10 @@ export default class SecurityTab extends React.Component { </div> ); inputs.push( - <div className='form-group'> + <div + key='newPasswordUpdateForm' + className='form-group' + > <label className='col-sm-5 control-label'>New Password</label> <div className='col-sm-7'> <input @@ -139,7 +145,10 @@ export default class SecurityTab extends React.Component { </div> ); inputs.push( - <div className='form-group'> + <div + key='retypeNewPasswordUpdateForm' + className='form-group' + > <label className='col-sm-5 control-label'>Retype New Password</label> <div className='col-sm-7'> <input @@ -155,7 +164,10 @@ export default class SecurityTab extends React.Component { submit = this.submitPassword; } else { inputs.push( - <div className='form-group'> + <div + key='oauthPasswordInfo' + className='form-group' + > <label className='col-sm-12'>Log in occurs through GitLab. Please see your GitLab account settings page to update your password.</label> </div> ); diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx index 6e61ab156..ed88c3df4 100644 --- a/web/react/components/view_image.jsx +++ b/web/react/components/view_image.jsx @@ -3,6 +3,7 @@ var Client = require('../utils/client.jsx'); var Utils = require('../utils/utils.jsx'); +import {config} from '../utils/config.js'; export default class ViewImageModal extends React.Component { constructor(props) { diff --git a/web/react/utils/config.js b/web/react/utils/config.js new file mode 100644 index 000000000..c7d1aa2bc --- /dev/null +++ b/web/react/utils/config.js @@ -0,0 +1,48 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +export var config = { + + // Loggly configs + LogglyWriteKey: '', + LogglyConsoleErrors: true, + + // Segment configs + SegmentWriteKey: '', + + // Feature switches + AllowPublicLink: true, + AllowInviteNames: true, + RequireInviteNames: false, + AllowSignupDomainsWizard: false, + + // Google Developer Key (for Youtube API links) + // Leave blank to disable + GoogleDeveloperKey: '', + + // Privacy switches + ShowEmail: true, + + // Links + TermsLink: '/static/help/configure_links.html', + PrivacyLink: '/static/help/configure_links.html', + AboutLink: '/static/help/configure_links.html', + HelpLink: '/static/help/configure_links.html', + ReportProblemLink: '/static/help/configure_links.html', + HomeLink: '', + + // Toggle whether or not users are shown a message about agreeing to the Terms of Service during the signup process + ShowTermsDuringSignup: false, + + ThemeColors: ['#2389d7', '#008a17', '#dc4fad', '#ac193d', '#0072c6', '#d24726', '#ff8f32', '#82ba00', '#03b3b2', '#008299', '#4617b4', '#8c0095', '#004b8b', '#004b8b', '#570000', '#380000', '#585858', '#000000'] +}; + +// Flavor strings +export var strings = { + Team: 'team', + TeamPlural: 'teams', + Company: 'company', + CompanyPlural: 'companies' +}; + +global.window.config = config; diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 6267ebd8f..dc229bd36 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -9,6 +9,7 @@ var ActionTypes = Constants.ActionTypes; var AsyncClient = require('./async_client.jsx'); var client = require('./client.jsx'); var Autolinker = require('autolinker'); +import {config} from '../utils/config.js'; export function isEmail(email) { var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; @@ -564,7 +565,7 @@ export function textToJsx(textin, options) { key={word + i + z + '_hash'} className={'theme ' + mClass + highlightSearchClass} href='#' - onClick={() => searchForTerm(trimWord)} //eslint-disable-line no-loop-func + onClick={searchForTerm.bind(this, trimWord)} //eslint-disable-line no-loop-func > {trimWord} </a> diff --git a/web/static/config/config.js b/web/static/config/config.js deleted file mode 100644 index 00cae7ab2..000000000 --- a/web/static/config/config.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. -// See License.txt for license information. - -var config = { - - // Loggly configs - LogglyWriteKey: "", - LogglyConsoleErrors: true, - - // Segment configs - SegmentWriteKey: "", - - // Feature switches - AllowPublicLink: true, - AllowInviteNames: true, - RequireInviteNames: false, - AllowSignupDomainsWizard: false, - - // Google Developer Key (for Youtube API links) - // Leave blank to disable - GoogleDeveloperKey: "", - - // Privacy switches - ShowEmail: true, - - // Links - TermsLink: "/static/help/configure_links.html", - PrivacyLink: "/static/help/configure_links.html", - AboutLink: "/static/help/configure_links.html", - HelpLink: "/static/help/configure_links.html", - ReportProblemLink: "/static/help/configure_links.html", - HomeLink: "", - - // Toggle whether or not users are shown a message about agreeing to the Terms of Service during the signup process - ShowTermsDuringSignup: false, - - ThemeColors: ["#2389d7", "#008a17", "#dc4fad", "#ac193d", "#0072c6", "#d24726", "#ff8f32", "#82ba00", "#03b3b2", "#008299", "#4617b4", "#8c0095", "#004b8b", "#004b8b", "#570000", "#380000", "#585858", "#000000"] -}; - -// Flavor strings -var strings = { - Team: "team", - TeamPlural: "teams", - Company: "company", - CompanyPlural: "companies" -}; diff --git a/web/templates/head.html b/web/templates/head.html index 6b6b7f09d..76ee70ced 100644 --- a/web/templates/head.html +++ b/web/templates/head.html @@ -37,8 +37,8 @@ <script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['annotationchart']}]}"></script> <script type="text/javascript" src="https://cloudfront.loggly.com/js/loggly.tracker.js" async></script> - <script id="config" type="text/javascript" src="/static/config/config.js"></script> <style id="antiClickjack">body{display:none !important;}</style> + <script src="/static/js/bundle.js"></script> <script type="text/javascript"> if (self === top) { var blocker = document.getElementById("antiClickjack"); @@ -46,30 +46,29 @@ } </script> <script> - if (config == null) { - config = {}; + if (window.config == null) { + window.config = {}; } - config.SiteName = '{{ .SiteName }}'; - config.ProfileWidth = '{{ .Props.ProfileWidth }}' - config.ProfileHeight = '{{ .Props.ProfileHeight }}' + window.config.SiteName = '{{ .SiteName }}'; + window.config.ProfileWidth = '{{ .Props.ProfileWidth }}' + window.config.ProfileHeight = '{{ .Props.ProfileHeight }}' </script> - <script src="/static/js/bundle.js"></script> <script> - if (config.LogglyWriteKey != null && config.LogglyWriteKey !== "") { + if (window.config.LogglyWriteKey != null && window.config.LogglyWriteKey !== "") { var LTracker = LTracker || []; window.LTracker = LTracker; - LTracker.push({'logglyKey': config.LogglyWriteKey, 'sendConsoleErrors' : config.LogglyConsoleErrors }); + LTracker.push({'logglyKey': window.config.LogglyWriteKey, 'sendConsoleErrors' : window.config.LogglyConsoleErrors }); } else { window.LTracker = []; console.warn("config.js missing LogglyWriteKey, Loggly analytics is not reporting"); } </script> <script type="text/javascript"> - if (config.SegmentWriteKey != null && config.SegmentWriteKey !== "") { + if (window.config.SegmentWriteKey != null && window.config.SegmentWriteKey !== "") { !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.0.1"; - analytics.load(config.SegmentWriteKey); + analytics.load(window.config.SegmentWriteKey); var user = window.UserStore.getCurrentUser(true); if (user) { analytics.identify(user.id, { |