Fakultas Ilmu Komputer UI

Commit 3ecbe4e1 authored by Rayza Arasj Mahardhika's avatar Rayza Arasj Mahardhika
Browse files

1606876052-56-Sebagai pelamar, saya ingin menambahkan link github profile saya ke profil saya

parent 5e2c9122
......@@ -51,6 +51,7 @@ export default class ProfilePage extends React.Component {
job_seeking_status: '',
latest_work: '',
latest_work_desc: '',
github_url: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
......@@ -63,6 +64,7 @@ export default class ProfilePage extends React.Component {
website_url: '',
latest_work: '',
latest_work_desc: '',
github_url: '',
};
this.getProfile = this.getProfile.bind(this);
this.handleChange = this.handleChange.bind(this);
......@@ -109,6 +111,7 @@ export default class ProfilePage extends React.Component {
latest_work: data.latest_work,
latest_work_desc: data.latest_work_desc,
skills: data.skills,
github_url: data.github_url,
});
if (this.props.route.own) {
const newSession = this.props.user.data;
......@@ -120,6 +123,12 @@ export default class ProfilePage extends React.Component {
this.state.name = 'Gagal mendapatkan informasi';
}));
}
isFromGithubLinkValid = () => {
var github_link = this.state.form.github_url;
if (github_link == null) return;
return github_link.includes("https://github.com/");
}
parseIndonesianDateFormat(dateIndex) {
const monthNameIndex = {
......@@ -145,6 +154,10 @@ export default class ProfilePage extends React.Component {
handleSubmit = (e) => {
e.preventDefault();
if (!this.isFromGithubLinkValid()) {
alert("Pastikan link github yang anda tulis benar. (Berpola : https://github.com/<username>");
return;
}
const submitForm = {};
Object.keys(this.state.form).forEach((key) => {
......@@ -162,7 +175,6 @@ export default class ProfilePage extends React.Component {
}));
};
handleFile = (e) => {
const form = this.state.form;
form[e.target.name] = e.target.files[0];
......@@ -273,6 +285,10 @@ export default class ProfilePage extends React.Component {
name="website_url"
/>
</Form.Field>
<Form.Field>
<label htmlFor="linkedin_url">URL Profile Github</label>
<input onChange={this.handleChange} placeholder="https://github.com/bob" name="github_url" />
</Form.Field>
<Form.Field>
<label htmlFor="region">Region</label>
<input
......@@ -485,6 +501,20 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="github" size="big" />
</Grid.Column>
<Grid.Column width={13}>
{
this.state.github_url ?
<a href={ this.state.github_url }> { this.state.github_url } </a> :
<p> N/A </p>
}
</Grid.Column>
</Grid>
</Segment>
</div>
<Segment basic vertical>
......
......@@ -88,6 +88,7 @@ describe('ProfilePage', () => {
major: null,
batch: null,
show_transcript: false,
github_url: '',
};
const response2 = {
......@@ -232,4 +233,5 @@ describe('ProfilePage', () => {
profile.getProfile().then(()=> expect(profile.state.readNo).to.not.equal(''));
fetchMock.restore();
});
});
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 10:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0017_vacancy_amount'),
('core', '0019_merge_20191006_0852'),
('core', '0014_auto_20191004_1340'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 11:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0020_merge_20191006_1743'),
]
operations = [
migrations.AddField(
model_name='student',
name='github_url',
field=models.URLField(blank=True, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-12 01:32
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0052_merge_20191011_1837'),
('core', '0021_student_github_url'),
]
operations = [
]
......@@ -85,6 +85,7 @@ class Student(models.Model):
ui_ux_portofolio = models.FileField(upload_to=get_student_ui_ux_portofolio_file_path, null=True, blank=True, validators=[validate_document_file_extension])
latest_work = models.CharField(max_length=100, blank=True, null=True)
latest_work_desc = models.TextField(blank=True, null=True)
github_url = models.URLField(max_length=200,blank=True, null=True)
intro = models.CharField(max_length=50, blank=True, null=True)
expected_salary = models.CharField(max_length=10, blank=True, null=True)
job_seeking_status = models.CharField(max_length=30, blank=True, null=True)
......
......@@ -22,7 +22,7 @@ class StudentSerializer(serializers.ModelSerializer):
fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'gender','birth_place', 'birth_date', 'major', 'batch', \
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro', 'website_url', 'student_gpa', 'age','recommendations',
'latest_work', 'latest_work_desc','read_no', 'volunteer','job_seeking_status', 'skills', 'expected_salary', \
'self_description']
'self_description', 'github_url']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -65,6 +65,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'latest_work': instance.latest_work,
'latest_work_desc': instance.latest_work_desc,
'skills': instance.skills,
'github_url' : instance.github_url
}
def update(self, instance, validated_data):
......@@ -87,6 +88,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
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)
instance.github_url = validated_data.get('github_url', instance.github_url)
instance.save()
instance.user.save()
return instance
......@@ -95,7 +97,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
model = Student
fields = ['resume', 'email', 'phone_number', 'gender','photo', 'show_transcript', 'linkedin_url', 'region', 'intro', 'website_url', 'student_gpa',
'recommendations', 'latest_work', 'latest_work_desc', 'volunteer','job_seeking_status', 'skills', 'expected_salary', \
'self_description']
'self_description', 'github_url']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -249,6 +249,14 @@ class ProfileUpdateTests(APITestCase):
response = self.client.patch(url, {'volunteer': 'Ketua BEM UI - 2020'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('volunteer'), 'Ketua BEM UI - 2020')
response = self.client.patch(url, {'github_url': 'https://github.com/bob'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('github_url'), 'https://github.com/bob')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'github_url': 'this is not valid url'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def _create_test_file(self,path):
f = open(path, 'r')
......
......@@ -90,6 +90,7 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true,
"optional": true,
"requires": {
"is-extendable": "^0.1.0"
}
......@@ -1919,7 +1920,8 @@
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
"dev": true
"dev": true,
"optional": true
},
"arraybuffer.slice": {
"version": "0.0.7",
......@@ -2065,7 +2067,7 @@
"babel-core": {
"version": "6.26.3",
"resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz",
"integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==",
"integrity": "sha1-suLwnjQtDwyI4vAuBneUEl51wgc=",
"dev": true,
"requires": {
"babel-code-frame": "^6.26.0",
......@@ -4276,7 +4278,7 @@
"eslint-plugin-import": {
"version": "2.18.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz",
"integrity": "sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ==",
"integrity": "sha1-AvEYC5Cwd7M9RHoXojJs60AKzrY=",
"dev": true,
"requires": {
"array-includes": "^3.0.3",
......@@ -4305,7 +4307,7 @@
"resolve": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
"integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
"integrity": "sha1-P8ZEo1yEpIVUYJ/ybsUrZvpXffY=",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
......@@ -4606,11 +4608,6 @@
"eslint-visitor-keys": "^1.1.0"
}
},
"esprima": {
"version": "github:substack/esprima#0a7f8489a11b44b019ce168506f535f22d0be290",
"from": "github:substack/esprima#is-keyword",
"dev": true
},
"esquery": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz",
......@@ -4935,7 +4932,8 @@
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -4944,8 +4942,11 @@
"resolved": "https://registry.npmjs.org/falafel/-/falafel-0.2.1.tgz",
"integrity": "sha1-nvxRzhnsVykIayKuiJ5dfQ4lZgE=",
"dev": true,
"requires": {
"esprima": "github:substack/esprima#0a7f8489a11b44b019ce168506f535f22d0be290"
"dependencies": {
"esprima": {
"version": "github:substack/esprima#0a7f8489a11b44b019ce168506f535f22d0be290",
"from": "github:substack/esprima#0a7f8489a11b44b019ce168506f535f22d0be290"
}
}
},
"fast-deep-equal": {
......@@ -4997,7 +4998,7 @@
"fetch-mock": {
"version": "5.13.1",
"resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-5.13.1.tgz",
"integrity": "sha512-eWUo2KI4sRGnRu8tKELCBfasALM5BfvrCxdI7J02j3eUM9mf+uYzJkURA0PSn/29JVapVrYFm+z+9XijXu1PdA==",
"integrity": "sha1-lVeUp389ly8WRLms5loP39YPHfc=",
"dev": true,
"requires": {
"glob-to-regexp": "^0.3.0",
......@@ -5752,6 +5753,7 @@
"minipass": {
"version": "2.3.5",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -5768,6 +5770,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -5927,7 +5930,8 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -6019,7 +6023,8 @@
},
"yallist": {
"version": "3.0.3",
"bundled": true
"bundled": true,
"optional": true
}
}
},
......@@ -7243,7 +7248,8 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
"dev": true
"dev": true,
"optional": true
},
"isomorphic-fetch": {
"version": "2.2.1",
......@@ -7257,7 +7263,7 @@
"isparta": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/isparta/-/isparta-4.1.1.tgz",
"integrity": "sha512-kGwkNqmALQzdfGhgo5o8kOA88p14R3Lwg0nfQ/qzv4IhB4rXarT9maPMaYbo6cms4poWbeulrlFlURLUR6rDwQ==",
"integrity": "sha1-yS5JZylGkU7FQHyAEWDzN04LfLQ=",
"dev": true,
"requires": {
"babel-core": "^6.1.4",
......@@ -7274,7 +7280,7 @@
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=",
"dev": true
}
}
......@@ -7937,7 +7943,7 @@
"karma-firefox-launcher": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-1.2.0.tgz",
"integrity": "sha512-j9Zp8M8+VLq1nI/5xZGfzeaEPtGQ/vk3G+Y8vpmFWLvKLNZ2TDjD6cu2dUu7lDbu1HXNgatsAX4jgCZTkR9qhQ==",
"integrity": "sha1-ZP4D3RAwD5dU1I+ev78x9slKIAw=",
"dev": true,
"requires": {
"is-wsl": "^2.1.0"
......@@ -7989,7 +7995,7 @@
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"integrity": "sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
......@@ -8955,7 +8961,7 @@
"moment": {
"version": "2.24.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
"integrity": "sha1-DQVdU/UFKqZTyfbraLtdEr9cK1s="
},
"move-concurrently": {
"version": "1.0.1",
......@@ -10113,7 +10119,7 @@
"react-ckeditor-wrapper": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/react-ckeditor-wrapper/-/react-ckeditor-wrapper-1.1.2.tgz",
"integrity": "sha512-/COVfezpSKFQxC/OjFoZf1PyzxTvUxzndlpGjEcajzjRgKPzSFZiCoh/VqqwGaaHJROO9pePQ9JxmJy2YlzDAQ==",
"integrity": "sha1-cvDGgo4X6mNxXV6YNvOrovhIfPM=",
"requires": {
"babel-runtime": "6.x",
"classnames": "2.x",
......@@ -10155,7 +10161,7 @@
"react-hot-loader": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/react-hot-loader/-/react-hot-loader-3.1.3.tgz",
"integrity": "sha512-d7nZf78irxoGN5PY4zd6CSgZiroOhvIWzRast3qwTn4sSnBwlt08kV8WMQ9mitmxEdlCTwZt+5ClrRSjxWguMQ==",
"integrity": "sha1-b5KHcyaVjHywE0tRJHRReGkSYII=",
"dev": true,
"requires": {
"global": "^4.3.0",
......@@ -10168,7 +10174,7 @@
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
"dev": true
}
}
......@@ -10209,7 +10215,7 @@
"react-router": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-3.2.4.tgz",
"integrity": "sha512-5kIJXV1Yx+FYk0lDJoPQnt+qFf7HxS6XrIm2aCw0r3XQTxixFd0HSVlHenYRWKmSHlcvSQ7bpYWgdRwJGXWPKw==",
"integrity": "sha1-/dQVoGKYLgyUP4FO/eUG6uFBjQ4=",
"requires": {
"create-react-class": "^15.5.1",
"history": "^3.0.0",
......@@ -11635,7 +11641,7 @@
"starwars": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/starwars/-/starwars-1.0.1.tgz",
"integrity": "sha512-d23qkhEuFNlHas4/w2J6ZF6qS7jqy8OK4N3gfQbtTk/5Lt1wKe+xv0cIweuNxwtwBGVXvmsLV2mdUOBKfj12cA=="
"integrity": "sha1-+OIWt4KUs/y/ytJbRPJxF543U9U="
},
"static-extend": {
"version": "0.1.2",
......
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