Fakultas Ilmu Komputer UI

Commit 5e518b8c authored by Zamil Majdy's avatar Zamil Majdy
Browse files

[Refactor] [Post-Sprint-2] Fix conflict and deploying issues

parent adf2c345
......@@ -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{
......
......@@ -14,7 +14,7 @@ export default class Dashboard extends React.Component {
<div>
<TopMenu />
{this.props.children}
<Footer/>
<Footer />
</div>
)
}
......@@ -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>
)
}
......
......@@ -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) => {
......
......@@ -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
}
......@@ -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>
/>
),
);
}
......
......@@ -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();
......
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
......@@ -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:
......
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):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment