diff --git a/assets/css/custom.css b/assets/css/custom.css index e439c6079f45877d57ef8533740c66730f313726..cd15d1ff82e4456f06b209ad70cf2d0740cbf60f 100755 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -193,7 +193,7 @@ card .formRegis{ height: auto !important; /* real browsers */ min-height: 100%; /* real browsers */ background-color: #EEEEEE; - padding-bottom: 5%; + padding-bottom: 20px; } .footer{ @@ -201,8 +201,7 @@ card .formRegis{ position: absolute; bottom: 0; width: 100%; - padding: 1%; - + padding: 10px; } .footer h5{ diff --git a/assets/js/Dashboard.jsx b/assets/js/Dashboard.jsx index 0c5a4a8abf3fca1923a49685e8cc95b178c62b81..907993aedfe1977943e00c13d81415c57dd29ca6 100755 --- a/assets/js/Dashboard.jsx +++ b/assets/js/Dashboard.jsx @@ -14,7 +14,7 @@ export default class Dashboard extends React.Component { <div> <TopMenu /> {this.props.children} - <Footer/> + <Footer /> </div> ) } diff --git a/assets/js/Login.jsx b/assets/js/Login.jsx index 0065df988f8b5d93448959b78db5714a2e522a5f..eb2619513e7cd7ff353b73e343be3eba37a2767b 100644 --- a/assets/js/Login.jsx +++ b/assets/js/Login.jsx @@ -2,6 +2,7 @@ import React from 'react'; import { Grid, Segment, Header, Card, Image } from 'semantic-ui-react'; import LoginForm from './components/LoginForm'; import CompanyRegisterModal from './components/CompanyRegisterModal'; +import Footer from './components/Footer'; export default class Login extends React.Component { @@ -57,6 +58,7 @@ export default class Login extends React.Component { </Segment> </Grid.Column> </Grid> + <Footer /> </div> ) } diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx index 721c6cb9fb898d262d7f531a5ccd6d348da23701..f3a512b6756d4064c1068601323a58c44bb7045c 100644 --- a/assets/js/ProfilePage.jsx +++ b/assets/js/ProfilePage.jsx @@ -72,13 +72,11 @@ export default class ProfilePage extends React.Component { e.preventDefault(); const submitForm = {}; - console.log(this.state.form); Object.keys(this.state.form).forEach((key) => { if (this.state.form[key] !== '') { submitForm[key] = this.state.form[key]; } }); - console.log(submitForm); Server.submit(`/profiles/students/${this.state.id}/`, submitForm, 'PATCH').then(() => { this.modalAlert.open('Profil berhasil diperbaharui', 'Silakan periksa kembali profil anda' ); }, error => error.then((r) => { diff --git a/assets/js/components/Footer.jsx b/assets/js/components/Footer.jsx index 3d40f4818d87c0e239818cb4c90b59c8f5b64752..50a57ae5676d99b2ebc73b3354e20dea949e5aa0 100644 --- a/assets/js/components/Footer.jsx +++ b/assets/js/components/Footer.jsx @@ -4,11 +4,11 @@ import { Container } from 'semantic-ui-react'; export default class Footer extends React.Component { render() { return ( - <div className="footer"> - <Container textAlign="center"> - <h5>All Rights Reserved © 2017</h5> - </Container> - </div> + <div className="footer"> + <Container textAlign="center"> + <h5>All Rights Reserved © 2017</h5> + </Container> + </div> ); } -} \ No newline at end of file +} diff --git a/assets/js/components/VacancyList.jsx b/assets/js/components/VacancyList.jsx index 1fd30f08a61528cddee834416a9c6a434ebf89fc..936d30b28aee1bae7e2bd5147fdf95fccf4256a9 100644 --- a/assets/js/components/VacancyList.jsx +++ b/assets/js/components/VacancyList.jsx @@ -32,7 +32,6 @@ export default class VacancyList extends React.Component { Server.get(this.props.url, false).then((data) => { this.setState({ vacancies: data }); }); - console.log(this.state.vacancies); this.updateStatusList = this.updateStatusList.bind(this); this.generateVacancies = this.generateVacancies.bind(this); this.checkBookmark = this.checkBookmark.bind(this); @@ -59,12 +58,7 @@ export default class VacancyList extends React.Component { this.setState({ bookmarkList: data }); }); Server.get(`/students/${this.props.userId}/applied-vacancies/`, false).then((data) => { - // console.log('hasil api:'); - // console.log(data); - // console.log(data.vacancy); this.setState({ appliedList: data }); - console.log('applied list:') - console.log(this.state.appliedList); }); } @@ -87,9 +81,9 @@ export default class VacancyList extends React.Component { bookmarked={this.checkBookmark(this.props.status === 'applied' ? vacancy.vacancy.id : vacancy.id)} data={this.props.status === 'applied' ? vacancy.vacancy : vacancy} studentId={this.props.userId} - applicationStatus= {this.props.status === 'applied' ? (vacancy.status === 4 ? 'Ditolak' : + applicationStatus={this.props.status === 'applied' ? (vacancy.status === 4 ? 'Ditolak' : (vacancy.status === 3 ? 'Diterima' : 'Terdaftar')) : ''} - >{console.log(this.checkApplied(this.props.status === 'applied' ? vacancy.vacancy.id : vacancy.id))}</Vacancy> + /> ), ); } diff --git a/assets/js/index.jsx b/assets/js/index.jsx index 2e4ee5a22aa777a0e1e3c125ad2391c4ed6e5e31..8fa8387becf5cfe03bc9374ee249a96d815b5add 100644 --- a/assets/js/index.jsx +++ b/assets/js/index.jsx @@ -68,11 +68,8 @@ export default class App extends React.Component { }; handleHome= (nextState, replace, cb) => { - console.log(Server.isLoggedIn()); if (Server.isLoggedIn()) { - console.log('masuk'); if (App.getRole() === 'student') { - console.log('masuk3'); replace({ pathname: '/lowongan' }); cb(); } else if (App.getRole() === 'company') { replace({ pathname: '/lowongan' }); cb(); diff --git a/core/lib/mixins.py b/core/lib/mixins.py new file mode 100644 index 0000000000000000000000000000000000000000..69555547426abc1a78ba865c4f691a819933b1df --- /dev/null +++ b/core/lib/mixins.py @@ -0,0 +1,6 @@ +class MultiSerializerViewSetMixin(object): + def get_serializer_class(self): + try: + return self.serializer_action_classes[self.action] + except (KeyError, AttributeError): + return super(MultiSerializerViewSetMixin, self).get_serializer_class() \ No newline at end of file diff --git a/core/serializers/vacancies.py b/core/serializers/vacancies.py index 18100702fd23e48e590a6456229b8800f3d8bb1c..e28ac5cce43f7da842571e5ff8eacd42b149886a 100644 --- a/core/serializers/vacancies.py +++ b/core/serializers/vacancies.py @@ -6,6 +6,14 @@ from core.serializers.accounts import StudentSerializer, CompanySerializer class VacancySerializer(serializers.ModelSerializer): + company = CompanySerializer() + + class Meta: + model = Vacancy + fields = '__all__' + + +class PostVacancySerializer(serializers.ModelSerializer): company = serializers.PrimaryKeyRelatedField(queryset=Company.objects.all()) class Meta: diff --git a/core/views/vacancies.py b/core/views/vacancies.py index b5cb8983284d442a09dc4968250651bae716f362..2646b167ff00cf4cd5e8110ef11f7b1f6f5e1a53 100644 --- a/core/views/vacancies.py +++ b/core/views/vacancies.py @@ -1,22 +1,26 @@ import requests from django.conf import settings from rest_framework import viewsets, status +from rest_framework.decorators import detail_route from rest_framework.exceptions import ValidationError from rest_framework.generics import get_object_or_404 from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response -from rest_framework.decorators import detail_route +from core.lib.mixins import MultiSerializerViewSetMixin from core.lib.permissions import IsAdminOrStudent, IsAdminOrCompany, IsAdminOrVacancyOwner from core.models import Student, Company from core.models.vacancies import Vacancy, Application from core.serializers.vacancies import VacancySerializer, ApplicationSerializer, ApplicationStatusSerializer, \ - VacancyApplicationSerializer + VacancyApplicationSerializer, PostVacancySerializer -class VacancyViewSet(viewsets.ModelViewSet): +class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet): queryset = Vacancy.objects.all() serializer_class = VacancySerializer + serializer_action_classes = { + 'create': PostVacancySerializer + } permission_classes = [IsAdminOrCompany] def get_permissions(self):