diff --git a/src/components/forms/summit-sponsorship-form.js b/src/components/forms/summit-sponsorship-form.js deleted file mode 100644 index 31b7b3cdd..000000000 --- a/src/components/forms/summit-sponsorship-form.js +++ /dev/null @@ -1,418 +0,0 @@ -/** - * Copyright 2019 OpenStack Foundation - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -import React from "react"; -import T from "i18n-react/dist/i18n-react"; -import "awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"; -import Input from "openstack-uicore-foundation/lib/components/inputs/text-input" -import Dropdown from "openstack-uicore-foundation/lib/components/inputs/dropdown" -import UploadInput from "openstack-uicore-foundation/lib/components/inputs/upload-input"; -import { isEmpty, scrollToError, shallowEqual } from "../../utils/methods"; -import SponsorshipTypeInput from "../inputs/sponsorship-input"; - -class SummitSponsorshipForm extends React.Component { - constructor(props) { - super(props); - - this.state = { - entity: { ...props.entity }, - errors: props.errors - }; - - this.handleChange = this.handleChange.bind(this); - this.handleSubmit = this.handleSubmit.bind(this); - this.handleUploadBadgeImage = this.handleUploadBadgeImage.bind(this); - this.handleRemoveBadgeImage = this.handleRemoveBadgeImage.bind(this); - } - - componentDidUpdate(prevProps, prevState, snapshot) { - const state = {}; - scrollToError(this.props.errors); - - if (!shallowEqual(prevProps.entity, this.props.entity)) { - state.entity = { ...this.props.entity }; - state.errors = {}; - } - - if (!shallowEqual(prevProps.errors, this.props.errors)) { - state.errors = { ...this.props.errors }; - } - - if (!isEmpty(state)) { - this.setState({ ...this.state, ...state }); - } - } - - handleChange(ev) { - let entity = { ...this.state.entity }; - let errors = { ...this.state.errors }; - let { value, id } = ev.target; - - if (ev.target.type === "checkbox") { - value = ev.target.checked; - } - - if (ev.target.type === "datetime") { - value = value.valueOf() / 1000; - } - - errors[id] = ""; - entity[id] = value; - this.setState({ entity: entity, errors: errors }); - } - - handleSubmit(ev) { - let entity = { ...this.state.entity }; - ev.preventDefault(); - - this.props.onSubmit(this.state.entity); - } - - hasErrors(field) { - let { errors } = this.state; - if (field in errors) { - return errors[field]; - } - - return ""; - } - - handleUploadBadgeImage(file) { - const formData = new FormData(); - formData.append("file", file); - this.props.onBadgeImageAttach(this.state.entity, formData); - } - - handleRemoveBadgeImage() { - const entity = { ...this.state.entity }; - entity["badge_image"] = ""; - this.setState({ entity: entity }); - this.props.onBadgeImageRemove(entity.id); - } - - render() { - const { entity } = this.state; - const { sponsorships } = this.props; - - const sponsorship_ddl = sponsorships.map((s) => ({ - label: s.name, - value: s.id - })); - - const lobby_template_ddl = [ - { label: "Big Images", value: "big-images" }, - { label: "Small Images", value: "small-images" }, - { label: "Horizontal Images", value: "horizontal-images" }, - { label: "Carousel", value: "carousel" } - ]; - - const expo_hall_template_ddl = [ - { label: "Big Images", value: "big-images" }, - { label: "Medium Images", value: "medium-images" }, - { label: "Small Images", value: "small-images" } - ]; - - const sponsor_page_template_ddl = [ - { label: "Big Header", value: "big-header" }, - { label: "Small Header", value: "small-header" } - ]; - - const event_page_template_ddl = [ - { label: "Big Images", value: "big-images" }, - { label: "Small Images", value: "small-images" }, - { label: "Horizontal Images", value: "horizontal-images" } - ]; - - return ( -
- ); - } -} - -export default SummitSponsorshipForm; diff --git a/src/i18n/en.json b/src/i18n/en.json index c3c0e36b2..c01abeafd 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -3125,6 +3125,7 @@ "sponsor_page_use_banner_widget": "Display Banner Widget on Sponsor Page", "should_display_on_expo_hall_page": "Display on Expo Hall Page", "should_display_on_lobby_page": "Display on Lobby Page", + "is_public": "Is Public", "badge_image": "Badge Image", "badge_alt": "Badge Alt Text", "save": "Save", diff --git a/src/layouts/summit-sponsorship-layout.js b/src/layouts/summit-sponsorship-layout.js index 3562cfe62..0b9e59873 100644 --- a/src/layouts/summit-sponsorship-layout.js +++ b/src/layouts/summit-sponsorship-layout.js @@ -9,7 +9,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - **/ + * */ import React from "react"; import { Switch, Route, withRouter } from "react-router-dom"; @@ -18,45 +18,26 @@ import { Breadcrumb } from "react-breadcrumbs"; import Restrict from "../routes/restrict"; import SummitSponsorshipListPage from "../pages/sponsors/summit-sponsorship-list-page"; -import EditSummitSponsorshipPage from "../pages/sponsors/edit-summit-sponsorship-page"; import NoMatchPage from "../pages/no-match-page"; -class SummitSponsorshipLayout extends React.Component { - render() { - const { match } = this.props; - return ( -