overleaf/services/web/frontend/js/features/clone-project-modal/controllers/left-menu-clone-project-modal-controller.js
Alf Eaton 0135236df8 Merge pull request #3446 from overleaf/ae-clone-project-modal
Migrate left menu Clone Project modal to React

GitOrigin-RevId: ad113e2b40de4007def513d40551d55bb0c913db
2021-01-07 03:04:54 +00:00

38 lines
861 B
JavaScript

import App from '../../../base'
import { react2angular } from 'react2angular'
import CloneProjectModal from '../components/clone-project-modal'
App.component('cloneProjectModal', react2angular(CloneProjectModal))
export default App.controller('LeftMenuCloneProjectModalController', function(
$scope,
ide
) {
$scope.show = false
$scope.projectId = ide.$scope.project_id
$scope.handleHide = () => {
$scope.$applyAsync(() => {
$scope.show = false
})
}
$scope.openCloneProjectModal = () => {
$scope.$applyAsync(() => {
const { project } = ide.$scope
if (project) {
$scope.projectId = project._id
$scope.projectName = project.name
$scope.show = true
// TODO: is this needed
window.setTimeout(() => {
$scope.$broadcast('open')
}, 200)
}
})
}
})