...
 
Commits (5)
window.env = {
// MEDIA
// Online Simcaa.it
"PathImages": "http://www.simcaa.it/media/symbols/",
"WaterImages": "http://www.simcaa.it/media/specialchar/",
"CustomImage": "http://www.simcaa.it/demo/media/custom/",
"ApiImageUpload": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/imageupload",
"ApiSymbolUpload": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/imageuploadtmp",
"MediaImage": "http://www.simcaa.it/demo/media/images/",
"TmpImage": "http://www.simcaa.it/demo/media/tmp/",
// "PathImages": "http://www.simcaa.it/media/symbols/",
// "WaterImages": "http://www.simcaa.it/media/specialchar/",
// "CustomImage": "http://www.simcaa.it/scuole/media/custom/",
// "ApiImageUpload": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/imageupload",
// "ApiSymbolUpload": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/imageuploadtmp",
// "MediaImage": "http://www.simcaa.it/scuole/media/images/",
// "TmpImage": "http://www.simcaa.it/scuole/media/tmp/",
// Local
// "PathImages": "http://10.0.0.132/media/symbols/",
// "WaterImages": "http://10.0.0.132/media/watermark/",
// "CustomImage": "http://10.0.0.132/media/custom/",
// "ApiImageUpload": "http://10.0.0.132:8085/graphql/imageupload",
// "ApiSymbolUpload": "http://10.0.0.132:8085/graphql/imageuploadtmp",
// "MediaImage": "http://10.0.0.132/media/images/",
// "TmpImage": "http://10.0.0.132/media/tmp/",
"PathImages": "http://10.0.0.132/media/symbols/",
"WaterImages": "http://10.0.0.132/media/watermark/",
"CustomImage": "http://10.0.0.132/media/custom/",
"ApiImageUpload": "http://10.0.0.132:8085/graphql/imageupload",
"ApiSymbolUpload": "http://10.0.0.132:8085/graphql/imageuploadtmp",
"MediaImage": "http://10.0.0.132/media/images/",
"TmpImage": "http://10.0.0.132/media/tmp/",
// API SERVER
// Online Simcaa.it
"GraphQLServer": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/query",
"GraphQLServerNoAuth": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/query/noauth",
"GraphQLLogin": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/login",
"GraphQLCurrentUser": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/me",
"GraphQLRefreshToken": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/jwtrefresh",
"RestApiCard": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/card",
"RestApiDuplicateProject": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/duplicateproject",
"RestApiDuplicateChapter": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/duplicatechapter",
// "GraphQLServer": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/query",
// "GraphQLServerNoAuth": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/query/noauth",
// "GraphQLLogin": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/login",
// "GraphQLCurrentUser": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/me",
// "GraphQLRefreshToken": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/jwtrefresh",
// "RestApiCard": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/card",
// "RestApiDuplicateProject": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/duplicateproject",
// "RestApiDuplicateChapter": "http://www.simcaa.it/scuole/apisimcaa-graphql/public/graphql/duplicatechapter",
// Local
// "GraphQLServer": "http://10.0.0.132:8085/graphql/query",
// "GraphQLServerNoAuth": "http://10.0.0.132:8085/graphql/query/noauth",
// "GraphQLLogin": "http://10.0.0.132:8085/graphql/login",
// "GraphQLCurrentUser": "http://10.0.0.132:8085/graphql/me",
// "GraphQLRefreshToken": "http://10.0.0.132:8085/graphql/jwtrefresh",
// "RestApiCard": "http://10.0.0.132:8085/graphql/card",
// "RestApiDuplicateProject": "http://10.0.0.132:8085/graphql/duplicateproject",
// "RestApiDuplicateChapter": "http://10.0.0.132:8085/graphql/duplicatechapter",
"GraphQLServer": "http://10.0.0.132:8085/graphql/query",
"GraphQLServerNoAuth": "http://10.0.0.132:8085/graphql/query/noauth",
"GraphQLLogin": "http://10.0.0.132:8085/graphql/login",
"GraphQLCurrentUser": "http://10.0.0.132:8085/graphql/me",
"GraphQLRefreshToken": "http://10.0.0.132:8085/graphql/jwtrefresh",
"RestApiCard": "http://10.0.0.132:8085/graphql/card",
"RestApiDuplicateProject": "http://10.0.0.132:8085/graphql/duplicateproject",
"RestApiDuplicateChapter": "http://10.0.0.132:8085/graphql/duplicatechapter",
// CSS - remote
// "SemanticCSS": "http://10.0.0.132/includes/css/semantic.min.css",
......
This diff is collapsed.
......@@ -119,6 +119,7 @@
body {
background-color: #f6f6f6;
height: 100%;
}
/* Fix for display inline if in component, ONLY WORKS ON FIRST CHILD (look at RootComponent for Example) */
......@@ -140,14 +141,20 @@ body {
/* Fix for autoexpand of the card */
.ui.card {
width: auto;
/* Font-Size for the input of the card */
font-size: 12px;
/* font-size: 12px; */
}
.cardUI {
margin: var(--margin-card) !important;
min-width: 50% !important;
text-align: center;
font-size: 12px;
}
/* Minify card */
.cardUI .content, .uicardlayout .content {
padding: 2px !important;
border-top: 0px !important;
}
/* Center the lemma inside the input of the card */
......@@ -170,6 +177,7 @@ body {
/* Typo rules */
.uicardlayout {
min-height: 100% !important;
font-size: 12px;
}
/* width 100% for the container DIV of the input */
......@@ -192,6 +200,16 @@ body {
text-align: center !important;
}
/* Save message in Edit */
.saveMessage {
top: 100px;
position: fixed !important;
z-index: 1000;
text-align: center;
max-width: 30%;
margin: 20px !important;
}
/* Print mode rules */
@media print {
.no-print {
......@@ -284,15 +302,6 @@ img {
pointer-events: none;
}
/* Per allineare centralmente la login form */
/* TODO: DA RIATTIVARE UNA VOLTA TOLTO IL MESSAGE NELLA LOGIN*/
/* body > div,
body > div > div,
body > div > div > div,
body > div > div div > div.login-form { */
/* height: 100%;
} */
/* fix per bug modale causato dalla regola sopra */
.ui.modal {
height: auto;
......@@ -315,12 +324,6 @@ body > div > div div > div.login-form { */
.ui.huge.image { width: 600px; }
.ui.massive.image { width: 800px; }
/* Minify card */
.ui.card > .content {
padding: 2px;
border-top: 0px;
}
/* Fix Dimmer Loader on semantic 0.82 */
.ui.dimmer>.content>* {
display: inline;
......@@ -370,3 +373,8 @@ input {
.no-margin {
margin: 0px !important;
}
/* utils full height (100%) */
.full-height {
height: 100% !important;
}
......@@ -20,7 +20,7 @@ class App extends Component {
render() {
return (
<HashRouter>
<div>
<div className='full-height'>
<Route exact path="/" render={() => (<Redirect to="/home" />)}/>
<Route path="/home" component={ReloginModal(RootComponent)}/>
<Route path="/basic/:mode?/:projectid?/:chapterid?" component={ReloginModal(BasicProject)} />
......
......@@ -5,6 +5,7 @@ import { Redirect } from 'react-router-dom'
import { connect } from 'react-redux'
import { compose } from 'redux'
import { jwtFetchData, jwtExpiredOrInvalid } from '../store/actions/JWTActions'
import { userHasErrored } from '../store/actions/UserActions'
import LoginForm from '../components/LoginForm'
......@@ -25,6 +26,7 @@ const ReloginModal = (WrappedComponent) => {
toLogin() {
sessionStorage.removeItem('state')
this.props.resetUserError(false)
this.setState({toLogin: true})
}
......@@ -78,6 +80,7 @@ const mapDispatchToProps = (dispatch) => {
return {
fetchJWT: (url, user, password, reLogin) => dispatch(jwtFetchData(url, user, password, reLogin)),
openModal: (value) => dispatch(jwtExpiredOrInvalid(value)),
resetUserError: (value) => dispatch(userHasErrored(value)),
}
}
......
import React, { Component } from 'react'
import { Button, Segment, Dropdown } from 'semantic-ui-react'
import { Button, Segment, Dropdown, Flag } from 'semantic-ui-react'
import { translate } from 'react-i18next'
class LanguageSwitcher extends Component {
......@@ -14,8 +14,8 @@ class LanguageSwitcher extends Component {
return (
<Dropdown item text={t("HOME_NAVBAR_LANGUAGE")}>
<Dropdown.Menu>
<Dropdown.Item onClick={() => changeLanguage('it')}>Italiano</Dropdown.Item>
<Dropdown.Item onClick={() => changeLanguage('en')}>English</Dropdown.Item>
<Dropdown.Item onClick={() => changeLanguage('it')}><Flag name='it' />Italiano</Dropdown.Item>
<Dropdown.Item onClick={() => changeLanguage('en')}><Flag name='us' />English</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
)
......@@ -23,8 +23,8 @@ class LanguageSwitcher extends Component {
return (
<Segment basic>
<Button onClick={() => changeLanguage('it')}>Italiano</Button>
<Button onClick={() => changeLanguage('en')}>English</Button>
<Button onClick={() => changeLanguage('it')}><Flag name='it' />Italiano</Button>
<Button onClick={() => changeLanguage('en')}><Flag name='us' />English</Button>
</Segment>
)
}
......
......@@ -26,7 +26,7 @@ class AddUserModal extends Component {
mutation updateUser {
createCaaUserTeam(
iduser: ${this.state.userToAdd},
idteam: ${this.state.team}
idteam: ${this.props.curTeam}
){
id
}
......
......@@ -45,7 +45,7 @@ class EditUserParamsModal extends Component {
this.setState({link_web: e.target.value, somethingModded: true})
}
roleChange(e,data){
this.setState({role: data.value, somethingModded: true})
this.setState({role_id: data.value, somethingModded: true})
}
oldPassChange(e){
this.setState({old_password: e.target.value})
......@@ -132,7 +132,7 @@ class EditUserParamsModal extends Component {
const editPermissionsForm = <EditPermissionsForm permissions={this.props.toUser.user_permissions}/>
const panes=[
{menuItem: 'Parametri', render: ()=><Tab.Pane>{editParamsForm}</Tab.Pane>},
{menuItem: 'Permessi', render: ()=><Tab.Pane>{editPermissionsForm}</Tab.Pane>}
// {menuItem: 'Permessi', render: ()=><Tab.Pane>{editPermissionsForm}</Tab.Pane>}
]
return(
<Modal closeIcon="close" open={this.props.openModal} onClose={this.props.closeModal}>
......
......@@ -134,3 +134,8 @@ LoginForm.propTypes = {
}
export default LoginForm
// WEBPACK FOOTER //
// ./src/components/LoginForm.js
......@@ -4,6 +4,7 @@ import { Table, Icon } from 'semantic-ui-react'
import { translate } from 'react-i18next'
import NewProfileForm from '../../containers/homepage/NewProfileForm'
import Can from '../../containers/Permission'
class HomepageLayoutTable extends Component {
......@@ -32,13 +33,13 @@ class HomepageLayoutTable extends Component {
id={item.id}
disabled={item.profile_user_id === this.props.user.id ? false : true}
/>
<div style={{display: 'inline-block'}}>
<Can perform='can_manage_profile' or='can_delete_profile'>
<Icon name='trash' color='red' size='big'
className='icon-pointer'
disabled={item.profile_user_id === this.props.user.id ? false : true}
onClick={this.confirmDeleteProfile.bind(this, item.id)}
/>
</div>
</Can>
</Table.Cell>
</Table.Row>
)
......
......@@ -8,12 +8,14 @@ import UploadSymbol from '../../containers/UploadSymbol'
import LanguageSwitcher from '../../LanguageSwitcher'
import NewProfileForm from '../../containers/homepage/NewProfileForm'
import TeamSwitcher from '../../containers/switcher/TeamSwitcher'
import Can from '../../containers/Permission'
class HomepageProject extends Component {
constructor(props) {
super(props)
this.beforeUnloadFunction = this.beforeUnloadFunction.bind(this)
}
// Logout...cancella il jwt dal session storage e redirige sulla login
Logout() {
window.removeEventListener("beforeunload", this.beforeUnloadFunction)
......@@ -35,10 +37,10 @@ class HomepageProject extends Component {
render() {
const { t } = this.props
let dropdownOptions = ''
if (this.props.user.role_id === 1) {
dropdownOptions = <Dropdown.Item as={Link} to="/admin">Admin</Dropdown.Item>
}
// let dropdownOptions = ''
// if (this.props.user.role_id === 1) {
// dropdownOptions = <Dropdown.Item as={Link} to="/admin">Admin</Dropdown.Item>
// }
return (
<Menu>
......@@ -46,12 +48,16 @@ class HomepageProject extends Component {
<LanguageSwitcher type='dropdown' />
<Dropdown item text={t("HOME_NAVBAR_MANAGE")}>
<Dropdown.Menu>
<UploadSymbol type='dropdown' user={this.props.user} />
<NewProfileForm
className='icon-pointer'
size='big'
type='dropdown'
/>
<Can perform='can_upload_symbol' or='can_manage_preload'>
<UploadSymbol type='dropdown' user={this.props.user} />
</Can>
<Can perform='can_manage_profile' or='can_create_profile'>
<NewProfileForm
className='icon-pointer'
size='big'
type='dropdown'
/>
</Can>
</Dropdown.Menu>
</Dropdown>
<TeamSwitcher type='menu' />
......@@ -59,8 +65,11 @@ class HomepageProject extends Component {
<Dropdown.Menu>
{
// <Dropdown.Item>{t("HOME_NAVBAR_USER_PROFILE")}</Dropdown.Item>
// {dropdownOptions}
}
{dropdownOptions}
<Can perform='can_access_admin'>
<Dropdown.Item as={Link} to="/admin">Admin</Dropdown.Item>
</Can>
<Dropdown.Item onClick={this.Logout.bind(this)}>{t("HOME_NAVBAR_USER_LOGOUT")}</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
......
......@@ -5,6 +5,7 @@ import { translate } from 'react-i18next'
import { Link } from 'react-router-dom'
import NewProjectForm from '../../containers/homepage/NewProjectForm'
import Can from '../../containers/Permission'
class HomepageProjectTable extends Component {
constructor(props) {
......@@ -34,6 +35,9 @@ class HomepageProjectTable extends Component {
if (this.props.project !== prevProps.project) {
this.setState({ projects: this.props.project })
}
if (this.props.total !== prevProps.total) {
this.componentDidMount()
}
}
// Sort the Project Table
......@@ -73,7 +77,7 @@ class HomepageProjectTable extends Component {
// Toggle the display list filter
handleDisplayFilter() {
this.setState({displayFilter: !this.state.displayFilter })
this.setState({displayFilter: !this.state.displayFilter})
}
// Toggle radio filter
......@@ -99,7 +103,7 @@ class HomepageProjectTable extends Component {
<Table.Cell collapsing>{item.proj_id}</Table.Cell>
<Table.Cell collapsing><Link to={'/project/' + item.proj_id}>{item.proj_name}</Link></Table.Cell>
<Table.Cell>{item.updated_at}</Table.Cell>
<Table.Cell collapsing>{item.proj_share === 1 ? t("MAIN_TBL_PRIVATE") : t("MAIN_TBL_PUBLIC")}</Table.Cell>
<Table.Cell collapsing>{item.proj_share === -1 ? t("MAIN_TBL_PRIVATE") : t("MAIN_TBL_PUBLIC")}</Table.Cell>
<Table.Cell collapsing textAlign='center'>{item.user_name}</Table.Cell>
<Table.Cell collapsing textAlign='center'>{item.team_name}</Table.Cell>
<Table.Cell collapsing textAlign='right' className='fix-display'>
......@@ -107,7 +111,7 @@ class HomepageProjectTable extends Component {
size='big'
className='icon-pointer'
onClick={this.props.duplicateProject.bind(this, item)}
/>
/>
<NewProjectForm
className='icon-pointer'
size='big'
......@@ -117,13 +121,13 @@ class HomepageProjectTable extends Component {
optionsLayouts={this.props.optionsLayouts}
disabled={this.props.user.id !== item.proj_owner ? true : false}
/>
<div style={{display: 'inline-block'}}>
<Can perform='can_delete_project' or='can_manage_project'>
<Icon name='trash' color='red' size='big'
className='icon-pointer'
disabled={this.props.user.id !== item.proj_owner ? true : false}
onClick={this.confirmDeleteProject.bind(this, item.proj_id)}
/>
</div>
</Can>
</Table.Cell>
</Table.Row>
)
......@@ -141,24 +145,26 @@ class HomepageProjectTable extends Component {
<Table.Header>
<Table.Row>
<Table.HeaderCell colSpan={numColumnsTable}>
<Input type='text' placeholder={t("BTN_SEARCH") + '...'} action>
<input
onChange={this.handleSearchValue.bind(this)}
value={this.state.valueSearch}
onKeyDown={(e) => e.key === 'Enter' ? this.projectSearch() : null}
/>
<Button onClick={this.projectSearch.bind(this)}>{t("BTN_SEARCH")}</Button>
<Input type='text' placeholder={t("BTN_SEARCH") + '...'} action>
<input
onChange={this.handleSearchValue.bind(this)}
value={this.state.valueSearch}
onKeyDown={(e) => e.key === 'Enter' ? this.projectSearch() : null}
/>
<Button onClick={this.projectSearch.bind(this)}>{t("BTN_SEARCH")}</Button>
<Button onClick={this.resetSearch.bind(this)}>{t("BTN_RESET")}</Button>
</Input>
<Button icon
labelPosition='right'
floated='right'
color='blue'
onClick={this.handleDisplayFilter.bind(this)}
>
{t("FLT_FILTER")}
<Icon name='filter' />
</Button>
</Input>
<Can perform='can_show_filter'>
<Button icon
labelPosition='right'
floated='right'
color='blue'
onClick={this.handleDisplayFilter.bind(this)}
>
{t("FLT_FILTER")}
<Icon name='filter' />
</Button>
</Can>
</Table.HeaderCell>
</Table.Row>
<Table.Row style={{'display': this.state.displayFilter ? 'table-row' : 'none'}}>
......@@ -176,14 +182,12 @@ class HomepageProjectTable extends Component {
onChange={this.handleRadioFilter.bind(this, 'team')}
/>
</List.Item>
{
// <List.Item>
// <Radio label={t("FLT_PUBLIC")}
// checked={this.props.checkedRadioFilter === 'public'}
// onChange={this.handleRadioFilter.bind(this, 'public')}
// />
// </List.Item>
}
<List.Item>
<Radio label={t("FLT_SHARED")}
checked={this.props.checkedRadioFilter === 'shared'}
onChange={this.handleRadioFilter.bind(this, 'shared')}
/>
</List.Item>
</List>
</Table.HeaderCell>
</Table.Row>
......
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Form, Dropdown, Input, Radio } from 'semantic-ui-react'
import { translate } from 'react-i18next'
import { isValidJSON } from '../../store/functionUtils'
class MarginOptions extends Component {
constructor(props) {
super(props)
this.state = {
layout: JSON.stringify(props.layout),
optionsLayouts: [],
maxMargin: 1000,
}
}
componentDidMount() {
let localMargins, localLayout = this.props.optionsLayouts
if (!localLayout[0].hasOwnProperty('value') && !localLayout[0].hasOwnProperty('text')) {
localLayout = localLayout.map((item, index) => {
let singleLayout = {}
singleLayout.key = index
singleLayout.text = item.layout_name
singleLayout.value = JSON.stringify(item)
localMargins = item.layout_margins
return singleLayout
})
this.setState({optionsLayouts: localLayout, lineSpacing: localMargins})
}
}
componentDidUpdate(prevProps, prevState) {
if (prevState.layout !== this.state.layout) {
let localLayout = JSON.parse(this.state.layout)
if (isValidJSON(localLayout.layout_margins)) {
localLayout.layout_margins = JSON.parse(localLayout.layout_margins)
this.props.updateLayout(localLayout)
} else {
this.props.updateLayout(localLayout)
}
}
}
// Handel change mode of the layout (0 = portrait, 1 = landscape)
handleChangeMode(e, data) {
let localLayout = Object.assign({}, JSON.parse(this.state.layout))
localLayout.layout_mode = data.value
let max = Math.max(localLayout.width, localLayout.height)
let min = Math.min(localLayout.width, localLayout.height)
if (data.value === 0) {
localLayout.width = min
localLayout.height = max
} else {
localLayout.width = max
localLayout.height = min
}
this.setState({layout: JSON.stringify(localLayout)})
}
// Handle dropdown layout change
handleDropdownChange(e, data) {
this.setState({layout: data.value})
}
// Handle change new line/paragraph
handleChangeMargins(type, e, data) {
let margin = data === undefined || data === null ? parseInt(e.target.value, 10) : parseInt(data.value, 10)
let localLayout = JSON.parse(this.state.layout)
if (!isNaN(margin) && margin >= 0 && margin <= 1000) {
if (isValidJSON(localLayout.layout_margins)) {
localLayout.layout_margins = JSON.parse(localLayout.layout_margins)
}
localLayout.layout_margins[type] = Math.floor(margin)
} else if (!isNaN(margin) && margin < 0) {
if (isValidJSON(localLayout.layout_margins)) {
localLayout.layout_margins = JSON.parse(localLayout.layout_margins)
}
localLayout.layout_margins[type] = 0
} else if (!isNaN(margin) && margin > 1000) {
if (isValidJSON(localLayout.layout_margins)) {
localLayout.layout_margins = JSON.parse(localLayout.layout_margins)
}
localLayout.layout_margins[type] = 1000
}
this.setState({layout: JSON.stringify(localLayout)})
}
// Parse margins for input
parseMargin() {
let localMargin = JSON.parse(this.state.layout).layout_margins
if (localMargin !== null && typeof localMargin === 'object') {
return localMargin
} else if (isValidJSON(localMargin)) {
localMargin = JSON.parse(localMargin)
return localMargin
}
}
// MAIN RENDER
render() {
const { t } = this.props
if (this.state.optionsLayouts.length === 0) {
return <div></div>
}
let layoutIndex = this.state.optionsLayouts.map(e => JSON.parse(e.value).layout_name).indexOf(this.props.layout.layout_name)
let localMargin = this.parseMargin()
return (
<Form>
<Form.Field width={8}>
<label>{t("MAIN_FRM_LAYOUT")}</label>
<Dropdown selection options={this.state.optionsLayouts}
placeholder={t("MAIN_FRM_PLACEHOLDER_LAYOUT")}
defaultValue={this.state.optionsLayouts.length > 0 ? this.state.optionsLayouts[layoutIndex].value : null}
onChange={this.handleDropdownChange.bind(this)}
/>
</Form.Field>
<Form.Field>
<Radio
label={this.props.t("OPT_LBL_PORTRAIT")}
value={0}
checked={parseInt(JSON.parse(this.state.layout).layout_mode) === 0 ? true : false}
onChange={this.handleChangeMode.bind(this)}
/>
</Form.Field>
<Form.Field>
<Radio
label={this.props.t("OPT_LBL_LANDSCAPE")}
value={1}
checked={parseInt(JSON.parse(this.state.layout).layout_mode) === 1 ? true : false}
onChange={this.handleChangeMode.bind(this)}
/>
</Form.Field>
<Form.Group widths='equal'>
<Form.Field>
<Form.Group widths='equal'>
<Form.Field>
<label>{t("OPT_LBL_MARGINTOP")}</label>
<input type="number" min="0" max={this.state.maxMargin}
onChange={this.handleChangeMargins.bind(this, 'top')}
value={localMargin.top}
/>
</Form.Field>
<Form.Field>
<label>{t("OPT_LBL_MARGINLEFT")}</label>
<input type="number" min="0" max={this.state.maxMargin}
onChange={this.handleChangeMargins.bind(this, 'left')}
value={localMargin.left}
/>
</Form.Field>
<Form.Field>
<label>{t("OPT_LBL_MARGINBOTTOM")}</label>
<input type="number" min="0" max={this.state.maxMargin}
onChange={this.handleChangeMargins.bind(this, 'bottom')}
value={localMargin.bottom}
/>
</Form.Field>
<Form.Field>
<label>{t("OPT_LBL_MARGINRIGHT")}</label>
<input type="number" min="0" max={this.state.maxMargin}
onChange={this.handleChangeMargins.bind(this, 'right')}
value={localMargin.right}
/>
</Form.Field>
</Form.Group>
</Form.Field>
<Form.Field>
<Form.Group widths='equal'>
<Form.Field>
<label>{t("OPT_LBL_LINESPACINGTOP")}</label>
<input type="number" min="0" max={this.state.maxMargin}
onChange={this.handleChangeMargins.bind(this, 'line_spacing_top')}
value={localMargin.line_spacing_top}
/>
</Form.Field>
<Form.Field>
<label>{t("OPT_LBL_LINESPACINGLEFT")}</label>
<input type="number" min="0" max={this.state.maxMargin}
onChange={this.handleChangeMargins.bind(this, 'line_spacing_left')}
value={localMargin.line_spacing_left}
/>
</Form.Field>
</Form.Group>
</Form.Field>
</Form.Group>
<Form.Group widths='equal'>
<Form.Field>
<label>{t("OPT_LBL_NEWLINE")}</label>
<input type="number" min="0" max={this.state.maxMargin}
onChange={this.handleChangeMargins.bind(this, 'new_line')}
value={localMargin.new_line}
/>
</Form.Field>
<Form.Field>
<label>{t("OPT_LBL_PARAGRAPH")}</label>
<input type="number" min="0" max={this.state.maxMargin}
value={localMargin.new_paragraph}
onChange={this.handleChangeMargins.bind(this, 'new_paragraph')}
/>
</Form.Field>
</Form.Group>
</Form>
)
}
}
MarginOptions.propTypes = {
optionsLayouts: PropTypes.array.isRequired,
layout: PropTypes.object.isRequired,
updateLayout: PropTypes.func.isRequired,
}
export default translate('translations')(MarginOptions)
import React, { Component } from 'react'
import { Form, Dropdown, Segment, Icon } from 'semantic-ui-react'
import { translate } from 'react-i18next'
import { withApolloFetch } from '../../withApolloFetch'
import PropTypes from 'prop-types'
class ImageOptions extends Component {
......@@ -11,9 +10,16 @@ class ImageOptions extends Component {
imageType: [{type: 'imgtype', value: 0, text: 'random'},
{type: 'imgtype', value: 1, text: props.t("OPT_FRM_BLACKANDWHITE")},
{type: 'imgtype', value: 2, text: props.t("OPT_FRM_COLOR")}],
fetchFinished: false,
checkbox: []
}
}
componentDidMount() {
let localCheckbox = [{checked: this.props.queryParams.preload_private, text: this.props.t("OPT_LBL_QUERYPARAM_PRIVATE"), param: 'preload_private'},
{checked: this.props.queryParams.preload_team, text: this.props.t("OPT_LBL_QUERYPARAM_TEAM"), param: 'preload_team'},
{checked: this.props.queryParams.preload_community, text: this.props.t("OPT_LBL_QUERYPARAM_COMMUNITY"), param: 'preload_community'},
{checked: this.props.queryParams.global, text: this.props.t("OPT_LBL_QUERYPARAM_GLOBAL"), param: 'global'}]
this.setState({checkbox: localCheckbox})
}
changePriority(item, direction, event) {
......@@ -37,6 +43,16 @@ class ImageOptions extends Component {
this.props.changeOtions(data)
}
onChangeCheckbox(query_param, event, data) {
this.props.changeQueryParams(query_param)
}
componentDidUpdate(prevProps) {
if (prevProps.queryParams !== this.props.queryParams) {
this.componentDidMount()
}
}
render() {
const { t } = this.props
......@@ -46,13 +62,25 @@ class ImageOptions extends Component {
<Segment key={index}>
<Icon name='arrow circle down' size='large' className='icon-pointer'
onClick={this.changePriority.bind(this, item, 'down')}/>
<Icon name='arrow circle up' size='large' className='icon-pointer'
<Icon name='arrow circle up' size='large' className='icon-pointer'
onClick={this.changePriority.bind(this, item, 'up')}/>
{item.text}
</Segment>
)
})
let query_params = this.state.checkbox.slice()
query_params = query_params.map((item, index) => {
return (
<Form.Checkbox toggle
key={index}
onChange={this.onChangeCheckbox.bind(this, item.param)}
label={item.text}
checked={item.checked}
/>
)
})
return (
<div>
<Segment.Group horizontal>
......@@ -82,6 +110,15 @@ class ImageOptions extends Component {
</Segment.Group>
</Segment>
</Segment.Group>
<Segment>
<Form>
<Form.Field>
<label> {t("OPT_LBL_QUERYPARAM_SYMBOL")} </label>
<br />
{query_params}
</Form.Field>
</Form>
</Segment>
</div>
)
}
......@@ -90,10 +127,12 @@ class ImageOptions extends Component {
ImageOptions.propTypes = {
changeOtions: PropTypes.func.isRequired,
changeOrder: PropTypes.func.isRequired,
changeQueryParams: PropTypes.func.isRequired,
order: PropTypes.array.isRequired,
imgType: PropTypes.number.isRequired,
SymStyle: PropTypes.array.isRequired,
selectedSymStyle: PropTypes.number.isRequired,
queryParams: PropTypes.object.isRequired,
}
export default translate('translations')(withApolloFetch(ImageOptions))
export default translate('translations')(ImageOptions)
......@@ -17,7 +17,11 @@ class CustomImgsDnDUpload extends Component{
}
}
componentWillMount() {
componentDidMount() {
this.getOldFiles(false)
}
getOldFiles(closeModal = false) {
let projectid = this.props.match.params.projectid
let chapterid = this.props.match.params.chapterid
let url = window.env.ApiImageUpload + '/' + projectid + '/' + chapterid + '/list'
......@@ -35,7 +39,11 @@ class CustomImgsDnDUpload extends Component{
}
})
.then((data) => {
this.setState({filesOld: Object.values(data)})
this.setState({filesOld: Object.values(data)}, () => {
if (closeModal) {
this.handleOpenCloseModal()
}
})
})
.catch((error) => {
console.log(error);
......@@ -65,7 +73,7 @@ class CustomImgsDnDUpload extends Component{
//ricevo la risposta, tutto ok aggiungo il file alla lista
this.setState({message: "MODAL_IMGS_DND_UPLOADED", files: this.state.files.concat(file), loading: false})
this.props.handler(file)
this.handleOpenCloseModal()
this.getOldFiles(true)
}).catch((error) => {
//errore, lo comunico all'utente
console.log('errore di upload ->' + error)
......@@ -118,8 +126,7 @@ class CustomImgsDnDUpload extends Component{
style={{display: 'inline-block'}}
className='icon-pointer'
>
<Image size='small' src={window.env.MediaImage + this.props.match.params.projectid + '/' + item}
/>
<Image size='small' src={window.env.MediaImage + this.props.match.params.projectid + '/' + item} />
</div>
)
})
......
import React, { Component } from 'react'
import { Message, Menu, Loader, Dimmer } from 'semantic-ui-react'
import { Message, Menu, Loader, Dimmer, Transition, Icon } from 'semantic-ui-react'
import NavBarEdit from './edit/NavBarEdit'
import BasicProjectNavBar from './edit/BasicProjectNavBar'
......@@ -20,8 +20,9 @@ class BasicProject extends Component {
super(props)
this.state = {
mode: this.props.match.params.mode === 'edit' ? true : false,
rowStyle: {},
// Unsaved Card Variables
cardStyle: { 'top': '0px', 'width': '100%' },
cardStyle: {},
posInput: 'bottom',
sizeInput: 'small',
styleInput: 'normal',
......@@ -48,6 +49,7 @@ class BasicProject extends Component {
Verbo: {color: '',size: '1',type: ''},
Altro: {color: '',size: '1',type: ''}
},
layout: {},
urlRest: window.env.GraphQLServer,
urlImg: window.env.PathImages,
firstMount: true,
......@@ -55,14 +57,6 @@ class BasicProject extends Component {
this.handleMode = this.handleMode.bind(this)
}
componentWillMount() {
// let index = this.props.project.findIndex(x => x.proj_id === parseInt(this.props.match.params.projectid))
// if (this.props.project[index].proj_profile) {
// let data = JSON.parse(this.props.project[index].proj_profile)
// this.setState({...data})
// }
}
componentDidMount() {
// Setto i dati del profilo
let index = this.props.project.findIndex(x => x.proj_id === parseInt(this.props.match.params.projectid, 10))
......@@ -94,6 +88,7 @@ class BasicProject extends Component {
caa_project_id
chapt_title
chapt_content
chapt_row
chapt_typo
chapt_user_block
}
......@@ -107,8 +102,8 @@ class BasicProject extends Component {
// Setta la distanza della card dai menù
let navMenu = document.getElementById('navbar')
let navbarHeight = navMenu.offsetHeight + 10
let style = { 'top': navbarHeight + 'px'}
this.setState({cardStyle: style, firstMount: false})
let style = { 'marginTop': navbarHeight + 'px'}
this.setState({rowStyle: style, firstMount: false})
// Setta la navbar card di default
this.props.setNavbarCard(0)
clearInterval(navbarInterval)
......@@ -152,7 +147,7 @@ class BasicProject extends Component {
checked={this.state.mode}
projName={this.props.project[index].proj_name}
chaptName={chapterName}
/>
/>
</Menu.Item>
<BasicProjectNavBar mode={this.state.mode} />
<Menu.Item className='navbar-speak fix-display viewMode' id='navbar-speak'>
......@@ -174,16 +169,21 @@ class BasicProject extends Component {
return (
<div>
{menu}
<Message
positive
compact={true}
hidden={saveMessageHidden}
style={this.state.cardStyle}
icon={'save'}
header='Projet Saved'
/>
<Transition animation='fly right' duration={1500} visible={!saveMessageHidden}>
<Message icon
className='saveMessage'
positive
compact={true}
hidden={saveMessageHidden}
>
<Icon name='save' style={{margin: '0px'}} />
<Message.Content>
<Message.Header>{this.props.t("EDIT_CHAPT_SAVED")}</Message.Header>
</Message.Content>
</Message>
</Transition>
<CardUI
Style={this.state.cardStyle}
rowStyle={this.state.rowStyle}
saveComplete={this.savedSuccessfully}
mode={!this.state.mode}
transparent={this.state.styleInput}
......@@ -203,7 +203,8 @@ class BasicProject extends Component {
urlRest={this.state.urlRest}
urlImg={this.state.urlImg}
priorityOrder={this.state.priorityOrder}
/>
margins={this.state.layout.layout_margins}
/>
</div>
)
}
......
......@@ -14,6 +14,7 @@ import { userTeamDataFetchData } from '../store/actions/UserTeamFetchActions'
import { watermarkDataFetchData } from '../store/actions/WatermarkFetchActions'
import { userToHome } from '../store/actions/UserActions'
import { filterSetValue } from '../store/actions/FilterActions'
import { membersTeamDataFetchData } from '../store/actions/UserTeamFetchActions'
class InitProgress extends Component {
constructor(props) {
......@@ -50,10 +51,12 @@ class InitProgress extends Component {
this.props.fetchStyle()
this.props.fetchSymStyle()
this.props.fetchWatermark()
this.props.memberTeam()
}
componentDidUpdate(prevProps) {
// push to next page
// push to home page
if (this.props.user.length !== 0 && this.state.listProgress.every((x => x.loading === false)) && prevProps === this.props) {
if (this.props.team.length > 1) {
setTimeout(() => {
......@@ -152,6 +155,7 @@ const mapDispatchToProps = (dispatch) => {
fetchUserTeam: (query) => dispatch(userTeamDataFetchData(query)),
fetchWatermark: (query) => dispatch(watermarkDataFetchData(query)),
changeFilter: (value) => dispatch(filterSetValue(value)),
memberTeam: (query) => dispatch(membersTeamDataFetchData(query)),
}
}
......
......@@ -47,3 +47,8 @@ const mapDispatchToProps = (dispatch) => {
}
export default connect(mapStateToProps, mapDispatchToProps)(withRouter(Login))
// WEBPACK FOOTER //
// ./src/containers/Login.js
import React, { Component, Fragment } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
class Can extends Component {
render() {
// Check for multiple permission check with 'and' and 'or'
let controller, multiple = null
if (this.props.and) {
controller = 'and'
multiple = this.props.permission[this.props.and]
} else if (this.props.or) {
controller = 'or'
multiple = this.props.permission[this.props.or]
}
// MAIN RENDER RETURN
return (
<Fragment>
{Permission(!this.props.not, this.props.permission[this.props.perform], controller, multiple) ? this.props.children : null}
</Fragment>
)
}
}
const mapStateToProps = (state) => {
return {
permission: state.user.user_permissions,
}
}
const mapDispatchToProps = (dispatch) => {
return {
}
}
Can.propTypes = {
children: PropTypes.element.isRequired,
perform: PropTypes.string.isRequired,
not: PropTypes.bool,
and: PropTypes.string,
or: PropTypes.string,
}
Can.defaultProps = {
not: false
}
export default connect(mapStateToProps, mapDispatchToProps)(Can)
export function Permission(checker, action, controller = null, multiple = null) {
if (controller !== null && controller === 'and') {
return action === checker && multiple === checker ? true : false
} else if (controller !== null && controller === 'or') {
return action === checker || multiple === checker ? true : false
} else {
return action === checker ? true : false
}
}
import React, { Component } from 'react'
import { Icon, Popup, Menu } from 'semantic-ui-react'
import React, { Component, Fragment } from 'react'
import { Icon, Popup, Menu, Segment } from 'semantic-ui-react'
import { translate } from 'react-i18next'
import UploadSymbol from '../UploadSymbol'
import Can from '../Permission'
import { connect } from 'react-redux'
import { toggleVisibilityImgAlt, mergeCard, unlinkCard, blockCard, copyCard, pasteCard, searchLemma, addBeforeAfterCard, jumpRow, deleteCard } from '../../store/actions/CardUIActions'
import { AddNewBlankCard, toggleVisibilityImgAlt, mergeCard, unlinkCard, blockCard, copyCard, pasteCard, searchLemma, jumpRow, deleteCard, addNewRow, editRow } from '../../store/actions/CardUIActions'
import { setNavBar } from '../../store/functionUtils'
class BasicProjectNavBar extends Component {
......@@ -27,8 +28,12 @@ class BasicProjectNavBar extends Component {
return (
<Menu.Item className='navbar-icon fix-all-display' id='navbar-icon'>
<UploadSymbol type='icon' user={this.props.user} style={{marginRight: '.5em'}} />
<UploadSymbol type='icon' user={this.props.user} card={navbarCard} save/>
<Can perform='can_manage_preload' or='can_upload_symbol'>
<Fragment>
<UploadSymbol type='icon' user={this.props.user} style={{marginRight: '.5em'}} />
<UploadSymbol type='icon' user={this.props.user} card={navbarCard} save/>
</Fragment>
</Can>
<Popup
trigger={<Icon name='arrow left' bordered inverted color="teal"
size='large'
......@@ -120,7 +125,7 @@ class BasicProjectNavBar extends Component {
trigger={<Icon name='external share' flipped='horizontally' bordered inverted color="teal"
size='large'
className="icon-pointer"
onClick={() => {this.props.addBeforeAfterCard('before')}}
onClick={() => {this.props.AddNewBlankCard(navbarCard.id - 1, navbarCard.row)}}
/>}
content={t("POPUP_ADD_SX")}
/>
......@@ -129,7 +134,7 @@ class BasicProjectNavBar extends Component {
trigger={<Icon name='external share' bordered inverted color="teal"
size='large'
className="icon-pointer"
onClick={() => {this.props.addBeforeAfterCard('after')}}
onClick={() => {this.props.AddNewBlankCard(navbarCard.id + 1, navbarCard.row)}}
/>}
content={t("POPUP_ADD_DX")}
/>
......@@ -145,6 +150,15 @@ class BasicProjectNavBar extends Component {
content={t("POPUP_JUMP_ROW")}
/>
<Popup
trigger={<Icon name='sticky note' bordered inverted color="teal"
size='large'
className="icon-pointer"
onClick={() => {this.props.editRow(navbarCard.row, 'page')}}
/>}
content={t("POPUP_NEW_PAGE")}
/>
<Popup
trigger={<Icon name='delete' bordered inverted color="teal"
size='large'
......@@ -163,6 +177,27 @@ class BasicProjectNavBar extends Component {
/>
{navbarCard.lemma}
<Segment basic className='float-right no-padding nav-icon-margin'>
<Popup
trigger={<Icon name='minus circle' bordered inverted color="teal"
size='large'
className="icon-pointer"
onClick={() => {this.props.editRow(navbarCard.row, 'subtract')}}
/>}
content={t("POPUP_SUBTRACT_MARGIN")}
/>
</Segment>
<Segment basic className='float-right no-padding no-margin'>
<Popup
trigger={<Icon name='plus circle' bordered inverted color="teal"
size='large'
className="icon-pointer"
onClick={() => {this.props.editRow(navbarCard.row, 'add')}}
/>}
content={t("POPUP_ADD_MARGIN")}
/>
</Segment>
{
// <Segment basic className='float-right no-padding nav-icon-margin'>
// <Popup
......@@ -233,7 +268,9 @@ const mapDispatchToProps = (dispatch) => {
searchLemma: () => dispatch(searchLemma()),
deleteCard: () => dispatch(deleteCard()),
jumpRow: () => dispatch(jumpRow()),
addBeforeAfterCard: (position) => dispatch(addBeforeAfterCard(position)),
addNewRow: (row, type) => dispatch(addNewRow(row, type)),
editRow: (row, actions) => dispatch(editRow(row, actions)),
AddNewBlankCard: (index, row) => dispatch(AddNewBlankCard(index, row)),
}
}
......
import React, { Component } from 'react'
import { Card, Input, Image, Label, Transition, Segment, Loader } from 'semantic-ui-react'
import { withRouter } from 'react-router-dom'
import React, { Component, Fragment } from 'react'
import { Card, Input, Image, Label, Transition, Segment, Loader, Divider } from 'semantic-ui-react'
import { translate } from 'react-i18next'
import { connect } from 'react-redux'
import { AddNewBlankCard, DeleteCard, CardUINavbarCard, toggleVisibilityImgAlt, mergeCard, setImg, setNewImg } from '../../store/actions/CardUIActions'
import { chapterContentDataFetchDataSuccess } from '../../store/actions/ChapterFetchActions'
import { addNewRow } from '../../store/actions/CardUIActions'
import { setFocus, setExpandAll, setLineSpacing } from '../../store/functionUtils'
class CardUI extends Component {
......@@ -32,10 +33,7 @@ class CardUI extends Component {
Altro: {border: this.props.borderCard['Altro'].size + 'px ' + this.props.borderCard['Altro'].type + ' ' + this.props.borderCard['Altro'].color}
} : {}
this.setState({borderCard: styleCard})
let indexProject = this.props.project.findIndex(x => x.proj_id === parseInt(this.props.match.params.projectid, 10))
let margins = JSON.parse(this.props.project[indexProject].proj_layout).layout_margins
setLineSpacing(margins)
setLineSpacing(this.props.margins)
}
componentWillMount() {
......@@ -146,6 +144,7 @@ class CardUI extends Component {
let newRow = currentCard.row
if (input.keyCode === 13) {
newRow++
this.props.updateRowsArray(currentCard.row + 1, 'new_line')
}
this.props.AddNewBlankCard(index + 1, newRow)
}
......@@ -161,14 +160,13 @@ class CardUI extends Component {
}
found = false
setExpandAll(localCards)
let indexProject = this.props.project.findIndex(x => x.proj_id === parseInt(this.props.match.params.projectid, 10))
let margins = JSON.parse(this.props.project[indexProject].proj_layout).layout_margins
setLineSpacing(margins)
setLineSpacing(this.props.margins)
}
// MAIN RENDER
render() {
const { t } = this.props
// render the Cards Array to display
let cards = this.props.cards.slice()
let inputBorder = this.props.transparent === 'normal' ? false : true
......@@ -177,11 +175,11 @@ class CardUI extends Component {
let srcImg = testCustom && testCustom.custom ? window.env.CustomImage + item.img : window.env.PathImages + item.img
let styles = {}
if (this.props.Style && this.props.borderCard) {
styles = Object.assign({}, this.props.Style, this.state.borderCard[item.codClass])
if (this.props.cardStyle && this.props.borderCard) {
styles = Object.assign({}, this.props.cardStyle, this.state.borderCard[item.codClass])
}
else if (this.props.Style) {
styles = this.props.Style
else if (this.props.cardStyle) {
styles = this.props.cardStyle
}
else if (this.props.borderCard) {
styles = this.state.borderCard[item.codClass]
......@@ -259,7 +257,7 @@ class CardUI extends Component {
for (let i = 0; i <= this.props.cards[this.props.cards.length-1].row; i++) {
cardGroup.push(this.props.cards[this.props.cards.length-1].row)
}
// console.log(cardGroup);
cardGroup = cardGroup.map((item, index) => {
let cardPerRow = []
for (let i = 0; i < this.props.cards.length; i++) {
......@@ -267,11 +265,27 @@ class CardUI extends Component {
cardPerRow.push(cards[i])
}
}
// <Card.Group key={index} className='cardLine' style={{marginTop: '100px'}}>
let marginNewLine = this.props.margins && this.props.rows.length > 0 && this.props.rows[index]? this.props.margins[this.props.rows[index].type] : 0
let multiplier = this.props.rows.length > 0 && this.props.rows[index] ? this.props.rows[index].times : 1
marginNewLine = marginNewLine * multiplier
marginNewLine = index === 0 ? 0 : marginNewLine
marginNewLine = this.props.rowStyle && this.props.rowStyle.marginTop && index === 0 ? marginNewLine + parseInt(this.props.rowStyle.marginTop) : marginNewLine
let style = {marginTop: marginNewLine + 'px'}
let divider = null
if (this.props.rows.length > 0 && this.props.rows[index + 1] && this.props.rows[index + 1].page) {
divider = <Divider horizontal>{this.props.t("LBL_PAGE")}</Divider>
}
return(
<Card.Group key={index} className='cardLine'>
{cardPerRow}
</Card.Group>
<Fragment key={index}>
<Card.Group className='cardLine' style={style}>
{cardPerRow}
</Card.Group>
{divider}
</Fragment>
)
})
}
......@@ -327,6 +341,7 @@ class CardUI extends Component {
const mapStateToProps = (state) => {
return {
cards: state.chapterContentData,
rows: state.chapterRowsData,
navbarCard: state.CardUINavbarCard,
project: state.projectData,
visibilityImgAlt: state.toggleVisibilityImgAlt,
......@@ -341,6 +356,7 @@ const mapDispatchToProps = (dispatch) => {
DeleteCard: (index) => dispatch(DeleteCard(index)),
setNavbarCard: (value) => dispatch(CardUINavbarCard(value)),
updateCardArray: (array) => dispatch(chapterContentDataFetchDataSuccess(array)),
updateRowsArray: (row, type) => dispatch(addNewRow(row, type)),
toggleVisibilityImgAlt: (value) => dispatch(toggleVisibilityImgAlt(value)),
setNewImg: (e, newImg) => dispatch(setNewImg(e, newImg)),
mergeCard: (direction, id , lemma) => dispatch(mergeCard(direction, id , lemma)),
......@@ -348,4 +364,4 @@ const mapDispatchToProps = (dispatch) => {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(withRouter(CardUI))
export default connect(mapStateToProps, mapDispatchToProps)(translate('translations')(CardUI))
......@@ -5,7 +5,7 @@ import { translate } from 'react-i18next'
import { connect } from 'react-redux'
import { saveProject, CardUIcopyPaste } from '../../store/actions/CardUIActions'
import { chapterDataUpdateData, chapterContentDataFetchDataSuccess } from '../../store/actions/ChapterFetchActions'
import { chapterDataUpdateData, chapterContentDataFetchDataSuccess, chapterRowsDataFetchDataSuccess } from '../../store/actions/ChapterFetchActions'
class NavBar extends Component {
constructor(props) {
......@@ -26,7 +26,7 @@ class NavBar extends Component {
if (page) {
this.redirectChapter(page)
}
this.props.saveProject(this.props.match.params.chapterid)
this.props.saveProject(this.props.match.params.chapterid, page)
}
toTypoView() {
......@@ -96,6 +96,7 @@ class NavBar extends Component {
resetContent() {
this.props.resetContent([])
this.props.resetCopyCard({})
this.props.resetRowsCard([])
}
render() {
......@@ -190,10 +191,11 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
saveProject: (chapterId) => dispatch(saveProject(chapterId)),
saveProject: (chapterId, page) => dispatch(saveProject(chapterId, page)),
unlockChapter: (mutation) => dispatch(chapterDataUpdateData(mutation)),
resetContent: (value) => dispatch(chapterContentDataFetchDataSuccess(value)),
resetCopyCard: (value) => dispatch(CardUIcopyPaste(value)),
resetRowsCard: (value) => dispatch(chapterRowsDataFetchDataSuccess(value)),
}
}
......
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Modal, Icon, Button, Form, Message, Dropdown } from 'semantic-ui-react'
import { Modal, Icon, Button, Form, Message, Dropdown, Tab } from 'semantic-ui-react'
import { translate } from 'react-i18next'
import InputOptions from '../../components/options/InputOptions'
import MarginOptions from '../../components/options/MarginOptions'
import ImageOptions from '../../components/options/ImageOptions'
import CardOptions from '../../components/options/CardOptions'
import ProfileOptions from '../../components/options/ProfileOptions'
import { escapeQuotes } from '../../store/functionUtils'
import { escapeQuotes, isValidJSON } from '../../store/functionUtils'
import { connect } from 'react-redux'
import { profileDataCreateData, profileDataUpdateData } from '../../store/actions/ProfileFetchActions'
......@@ -51,7 +52,14 @@ class NewProfileForm extends Component {
Verbo: {color: '',size: '1',type: ''},
Altro: {color: '',size: '1',type: ''},
Tutti: {color: '',size: '1',type: ''}
}
},
queryParams: {
global: true,
preload_private: true,
preload_team: true,
preload_community: true
},
layout: props.optionsLayouts[0],
}
// Handle Form Options
this.handleChangeOption = this.handleChangeOption.bind(this)
......@@ -60,6 +68,8 @@ class NewProfileForm extends Component {
this.handleChangeColorBorder = this.handleChangeColorBorder.bind(this)
this.handleChangeBorder = this.handleChangeBorder.bind(this)
this.handleChangeOrder = this.handleChangeOrder.bind(this)
this.handleChangeLayout = this.handleChangeLayout.bind(this)
this.handleChangeQueryParams = this.handleChangeQueryParams.bind(this)
this.resetBorderAll = this.resetBorderAll.bind(this)
}
......@@ -98,12 +108,8 @@ class NewProfileForm extends Component {
this.setState({share: !this.state.share})
}
handleForwardForm() {
this.setState({indexForm: this.state.indexForm + 1})
}
handleBackForm() {
this.setState({indexForm: this.state.indexForm - 1})
handleTabChange(event, data) {
this.setState({indexForm: data.activeIndex})
}
onMouseOverIcon() {
......@@ -170,6 +176,10 @@ class NewProfileForm extends Component {
this.setState({priorityOrder: order})
}
handleChangeLayout(layout) {
this.setState({layout})
}
handleChangeBorder(data, item) {
let localBorderCar