Fakultas Ilmu Komputer UI

Commit b0b35dd0 authored by Muhammad Fauzan Fikri's avatar Muhammad Fauzan Fikri
Browse files

1506688802 02

parent c917b5b4
......@@ -51,6 +51,7 @@ export default class ProfilePage extends React.Component {
refresh: 1,
loading: false,
linkedin_url: '',
website_url: '',
latest_work: '',
latest_work_desc: '',
};
......@@ -90,6 +91,7 @@ export default class ProfilePage extends React.Component {
intro: data.intro,
volunteer: data.volunteer,
linkedin_url: data.linkedin_url,
website_url: data.website_url,
latest_work: data.latest_work,
latest_work_desc: data.latest_work_desc,
});
......@@ -201,6 +203,10 @@ export default class ProfilePage extends React.Component {
<label htmlFor="linkedin_url">URL Profile LinkedIn</label>
<input onChange={this.handleChange} placeholder="https://www.linkedin.com/in/jojo/" name="linkedin_url" />
</Form.Field>
<Form.Field>
<label htmlFor="website_url">Website URL</label>
<input onChange={this.handleChange} placeholder="https://www.example.com/" name="website_url" />
</Form.Field>
<Form.Field>
<label htmlFor="region">Region</label>
<input onChange={this.handleChange} placeholder="Indonesia" name="region" />
......@@ -270,7 +276,6 @@ export default class ProfilePage extends React.Component {
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="mail" size="big" />
......@@ -313,6 +318,20 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="globe" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<a href={this.state.website_url}> { this.state.website_url || 'N/A' } </a>
</Grid.Column>
</Grid>
</Segment>
</div>
<Segment basic vertical>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
......@@ -323,6 +342,7 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
......@@ -334,6 +354,7 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
<Segment>
<Grid>
<Grid.Column width={2}>
......@@ -355,8 +376,8 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
</div>
</Segment>
<Segment basic vertical>
<Grid>
......
File mode changed from 100755 to 100644
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 08:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0020_merge_20191006_1444'),
]
operations = [
migrations.AddField(
model_name='student',
name='website_url',
field=models.URLField(blank=True, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-10 03:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0021_student_website_url'),
('core', '0039_merge_20191010_0833'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-10 04:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0040_merge_20191010_1031'),
('core', '0040_auto_20191010_1134'),
]
operations = [
]
......@@ -76,6 +76,7 @@ class Student(models.Model):
show_transcript = models.BooleanField(default=False)
photo = models.FileField(upload_to=get_student_photo_file_path, null=True, blank=True, validators=[validate_image_file_extension])
linkedin_url = models.URLField(max_length=200,blank=True, null=True)
website_url = models.URLField(max_length=200,blank=True, null=True)
region = models.CharField(max_length=30, blank=True, null=True)
recommendations = models.CharField(max_length=500, blank=True, null=True)
ui_ux_portofolio = models.FileField(upload_to=get_student_ui_ux_portofolio_file_path, null=True, blank=True, validators=[validate_document_file_extension])
......
......@@ -20,7 +20,7 @@ class StudentSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'birth_place', 'birth_date', 'major', 'batch', \
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro', 'age','recommendations',
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro', 'website_url', 'age','recommendations',
'latest_work', 'latest_work_desc','read_no', 'volunteer']
def get_accepted_no(self, obj):
......@@ -52,6 +52,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'photo': photo,
'show_transcript': instance.show_transcript,
'intro': instance.intro,
'website_url' : instance.website_url,
'volunteer': instance.volunteer,
'linkedin_url': instance.linkedin_url,
'recommendations': instance.recommendations,
......@@ -69,6 +70,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance.intro = validated_data.get('intro', instance.intro)
instance.volunteer = validated_data.get('volunteer', instance.volunteer)
instance.linkedin_url = validated_data.get('linkedin_url', instance.linkedin_url)
instance.website_url = validated_data.get('website_url', instance.website_url)
instance.recommendations = validated_data.get('recommendations', instance.recommendations)
instance.latest_work = validated_data.get('latest_work', instance.latest_work)
instance.latest_work_desc = validated_data.get('latest_work_desc', instance.latest_work_desc)
......@@ -78,7 +80,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro',
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro', 'website_url',
'recommendations', 'latest_work', 'latest_work_desc', 'volunteer']
......
......@@ -158,6 +158,11 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('linkedin_url'), 'https://www.linkedin.com/in/jojo/')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'website_url': 'https://www.example.com/'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('website_url'), 'https://www.example.com/')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'recommendations': 'mantap kak'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
......@@ -183,6 +188,10 @@ class ProfileUpdateTests(APITestCase):
response = self.client.patch(url, {'linkedin_url': 'this is not valid url'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'website_url': 'this is not valid url'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
new_user = User.objects.create_user('dummy.student2', 'dummy.student@student.com', 'lalala123')
new_student = Student.objects.create(user=new_user, npm="1212121212")
......
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