Web: Files: added new translations, added a choice of access settings
This commit is contained in:
parent
28508119b6
commit
2b66e3d72d
@ -21,7 +21,7 @@ if (process.env.NODE_ENV === "production") {
|
||||
useSuspense: true
|
||||
},
|
||||
backend: {
|
||||
loadPath: `${config.homepage}/locales/EmptyTrashDialog/{{lng}}/{{ns}}.json`
|
||||
loadPath: `${config.homepage}/locales/DeleteDialog/{{lng}}/{{ns}}.json`
|
||||
}
|
||||
});
|
||||
} else if (process.env.NODE_ENV === "development") {
|
||||
|
@ -259,9 +259,13 @@ class SectionHeaderContent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({ selectedUsers: newArray });
|
||||
this.onSetUsers(newArray);
|
||||
};
|
||||
|
||||
onSetUsers = users => {
|
||||
this.setState({ selectedUsers: users });
|
||||
}
|
||||
|
||||
onFullAccessClick = some => {
|
||||
console.log("onFullAccessClick", some);
|
||||
this.setState({
|
||||
@ -556,6 +560,8 @@ class SectionHeaderContent extends React.Component {
|
||||
accessRight={accessRight}
|
||||
users={selectedUsers}
|
||||
onRemoveUserClick={this.onRemoveUserClick}
|
||||
onSetUsers={this.onSetUsers}
|
||||
t={t}
|
||||
/>
|
||||
|
||||
<AddUsersPanel
|
||||
|
@ -15,6 +15,9 @@ import {
|
||||
Icons,
|
||||
utils
|
||||
} from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { utils as commonUtils } from "asc-web-common";
|
||||
import i18n from "./i18n";
|
||||
import {
|
||||
StyledPanel,
|
||||
StyledContent,
|
||||
@ -23,10 +26,14 @@ import {
|
||||
StyledSharingBody
|
||||
} from "./StyledPanels";
|
||||
|
||||
class SharingPanel extends React.Component {
|
||||
const { changeLanguage } = commonUtils;
|
||||
|
||||
class SharingPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = {
|
||||
showActionPanel: false,
|
||||
isNotifyUsers: false
|
||||
@ -61,22 +68,61 @@ class SharingPanel extends React.Component {
|
||||
};
|
||||
|
||||
onFullAccessClick = item => {
|
||||
console.log("ITEM", item);
|
||||
const newUsers = this.props.users;
|
||||
const elementIndex = newUsers.findIndex(x => x.id === item.id);
|
||||
if (newUsers[elementIndex].rights.rights !== "FullAccess") {
|
||||
newUsers[elementIndex].rights = {
|
||||
icon: "AccessEditIcon",
|
||||
rights: "FullAccess"
|
||||
};
|
||||
this.props.onSetUsers(newUsers);
|
||||
}
|
||||
};
|
||||
onReadOnlyClick = item => {
|
||||
console.log("ITEM", item);
|
||||
const newUsers = this.props.users;
|
||||
const elementIndex = newUsers.findIndex(x => x.id === item.id);
|
||||
if (newUsers[elementIndex].rights.rights !== "ReadOnly") {
|
||||
newUsers[elementIndex].rights = { icon: "EyeIcon", rights: "ReadOnly" };
|
||||
this.props.onSetUsers(newUsers);
|
||||
}
|
||||
};
|
||||
onReviewClick = item => {
|
||||
console.log("ITEM", item);
|
||||
/*const newUsers = this.props.users;
|
||||
const elementIndex = newUsers.findIndex(x => x.id === item.id);
|
||||
newUsers[elementIndex].rights = {
|
||||
icon: "AccessReviewIcon",
|
||||
rights: "Review"
|
||||
};
|
||||
this.props.onSetUsers(newUsers);*/
|
||||
};
|
||||
onCommentClick = item => {
|
||||
console.log("ITEM", item);
|
||||
/*const newUsers = this.props.users;
|
||||
const elementIndex = newUsers.findIndex(x => x.id === item.id);
|
||||
newUsers[elementIndex].rights = {
|
||||
icon: "AccessCommentIcon",
|
||||
rights: "Comment"
|
||||
};
|
||||
this.props.onSetUsers(newUsers);*/
|
||||
};
|
||||
onFormFillingClick = item => {
|
||||
console.log("ITEM", item);
|
||||
/*const newUsers = this.props.users;
|
||||
const elementIndex = newUsers.findIndex(x => x.id === item.id);
|
||||
newUsers[elementIndex].rights = {
|
||||
icon: "AccessFormIcon",
|
||||
rights: "FormFilling"
|
||||
};
|
||||
this.props.onSetUsers(newUsers);*/
|
||||
};
|
||||
onDenyAccessClick = item => {
|
||||
console.log("ITEM", item);
|
||||
const newUsers = this.props.users;
|
||||
const elementIndex = newUsers.findIndex(x => x.id === item.id);
|
||||
if (newUsers[elementIndex].rights.rights !== "DenyAccess") {
|
||||
newUsers[elementIndex].rights = {
|
||||
icon: "AccessNoneIcon",
|
||||
rights: "DenyAccess"
|
||||
};
|
||||
this.props.onSetUsers(newUsers);
|
||||
}
|
||||
};
|
||||
|
||||
/*shouldComponentUpdate(nextProps, nextState) {
|
||||
@ -115,7 +161,7 @@ class SharingPanel extends React.Component {
|
||||
const addGroupTranslationLabel = "Add group";
|
||||
const sharingHeaderText = "Sharing settings";
|
||||
|
||||
const { onClose, visible, users, onRemoveUserClick } = this.props;
|
||||
const { onClose, visible, users, onRemoveUserClick, t } = this.props;
|
||||
const { showActionPanel, isNotifyUsers } = this.state;
|
||||
|
||||
const zIndex = 310;
|
||||
@ -165,6 +211,7 @@ class SharingPanel extends React.Component {
|
||||
</StyledSharingHeaderContent>
|
||||
<StyledSharingBody>
|
||||
{users.map((item, index) => {
|
||||
const isOwner = index === 0;
|
||||
const advancedOptions = (
|
||||
<>
|
||||
<DropDownItem
|
||||
@ -221,7 +268,16 @@ class SharingPanel extends React.Component {
|
||||
return (
|
||||
<Row
|
||||
key={index}
|
||||
element={embeddedComponent}
|
||||
element={
|
||||
isOwner ? (
|
||||
<Icons.AccessEditIcon
|
||||
size="medium"
|
||||
className="sharing_panel-owner-icon"
|
||||
/>
|
||||
) : (
|
||||
embeddedComponent
|
||||
)
|
||||
}
|
||||
contextButtonSpacerWidth="0px"
|
||||
>
|
||||
<Text truncate>
|
||||
@ -231,12 +287,12 @@ class SharingPanel extends React.Component {
|
||||
? item.name
|
||||
: item.displayName}
|
||||
</Text>
|
||||
{index === 0 ? (
|
||||
{isOwner ? (
|
||||
<Text
|
||||
className="sharing_panel-remove-icon"
|
||||
//color="#A3A9AE"
|
||||
>
|
||||
Owner
|
||||
{t("Owner")}
|
||||
</Text>
|
||||
) : (
|
||||
<IconButton
|
||||
@ -271,7 +327,7 @@ class SharingPanel extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
SharingPanel.propTypes = {
|
||||
SharingPanelComponent.propTypes = {
|
||||
onClose: PropTypes.func,
|
||||
visible: PropTypes.bool,
|
||||
onShowUsersPanel: PropTypes.func,
|
||||
@ -280,4 +336,12 @@ SharingPanel.propTypes = {
|
||||
users: PropTypes.array
|
||||
};
|
||||
|
||||
const SharingPanelContainerTranslated = withTranslation()(
|
||||
SharingPanelComponent
|
||||
);
|
||||
|
||||
const SharingPanel = props => (
|
||||
<SharingPanelContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
|
||||
export default SharingPanel;
|
||||
|
@ -106,6 +106,10 @@ const StyledSharingBody = styled.div`
|
||||
}
|
||||
}
|
||||
|
||||
.sharing_panel-owner-icon {
|
||||
padding: 0px 24px 0px 8px;
|
||||
}
|
||||
|
||||
.sharing_panel-remove-icon {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
54
products/ASC.Files/Client/src/components/panels/i18n.js
Normal file
54
products/ASC.Files/Client/src/components/panels/i18n.js
Normal file
@ -0,0 +1,54 @@
|
||||
import i18n from "i18next";
|
||||
import Backend from "i18next-xhr-backend";
|
||||
import config from "../../../package.json";
|
||||
import { constants } from 'asc-web-common';
|
||||
const { LANGUAGE } = constants;
|
||||
|
||||
const newInstance = i18n.createInstance();
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
newInstance
|
||||
.use(Backend)
|
||||
.init({
|
||||
lng: localStorage.getItem(LANGUAGE) || 'en',
|
||||
fallbackLng: "en",
|
||||
|
||||
interpolation: {
|
||||
escapeValue: false, // not needed for react as it escapes by default
|
||||
},
|
||||
|
||||
react: {
|
||||
useSuspense: true
|
||||
},
|
||||
backend: {
|
||||
loadPath: `${config.homepage}/locales/SharingPanel/{{lng}}/{{ns}}.json`
|
||||
}
|
||||
});
|
||||
} else if (process.env.NODE_ENV === "development") {
|
||||
|
||||
const resources = {
|
||||
en: {
|
||||
translation: require("./locales/en/translation.json")
|
||||
},
|
||||
ru: {
|
||||
translation: require("./locales/ru/translation.json")
|
||||
},
|
||||
};
|
||||
|
||||
newInstance.init({
|
||||
resources: resources,
|
||||
lng: localStorage.getItem(LANGUAGE) || 'en',
|
||||
fallbackLng: "en",
|
||||
debug: true,
|
||||
|
||||
interpolation: {
|
||||
escapeValue: false, // not needed for react as it escapes by default
|
||||
},
|
||||
|
||||
react: {
|
||||
useSuspense: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default newInstance;
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Owner": "Owner"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Owner": "Владелец"
|
||||
}
|
@ -31,6 +31,13 @@
|
||||
"ConfirmationTitle"
|
||||
]
|
||||
}
|
||||
},
|
||||
"panels": {
|
||||
"SharingPanel": {
|
||||
"Resource": [
|
||||
"Owner"
|
||||
]
|
||||
}
|
||||
},
|
||||
"pages": {
|
||||
"Profile": {
|
||||
|
Loading…
Reference in New Issue
Block a user