Fakultas Ilmu Komputer UI

Commit 5527fe17 authored by Joshua Casey's avatar Joshua Casey
Browse files

Merge branch 'UserStory2' of https://gitlab.com/PPL2017csui/PPLA1 into UserStory2

parents fdc4bcf1 c0d5650c
......@@ -100,24 +100,33 @@ font-size: 30px;
}
.coverLetter{
margin-top:15px;
margin-top:30px;
}
.linkCV{
float: right;
margin-top: 10px;
margin-top: 30px;
margin-bottom: 10px;
}
.registerForm{
width: 500px;
margin: 0 auto;
padding:50px;
background-color: white;
background-color: #3B8686;
}
item{
color:black;
}
textarea{
width: 800px !important;
height: 160px !important;
}
.register{
background-color: white;
background-color:#3B8686;
}
......@@ -141,3 +150,10 @@ input.active:invalid {
margin-top: 5px;
}
card .formRegis{
margin-top: 100px;
}
itemLowongan{
color: black;
}
\ No newline at end of file
import React from 'react';
import { Button, Checkbox, Form, Input, TextArea, Grid, Divider, Header, Icon} from 'semantic-ui-react';
import { Button, Checkbox, Form, Input, TextArea, Grid, Divider, Header, Icon, Card } from 'semantic-ui-react';
export default class companyRegister extends React.Component {
render = () => (
<div className="register">
<div className="registerForm">
<Card fluid >
<Card.Content>
<Form>
<Header as='h2' icon textAlign='center'>
<Icon name='signup' circular />
......@@ -16,7 +19,7 @@ export default class companyRegister extends React.Component {
</Header>
<Form.Field required>
<label>Email</label>
<Input type="text" id="email" icon='user' iconPosition='left' placeholder="email" required />
<Input type="text" id="email" icon='user' iconPosition='left' placeholder="email" required />
</Form.Field>
<Form.Field required>
<label>Password</label>
......@@ -57,9 +60,11 @@ export default class companyRegister extends React.Component {
</Form.Field >
<Button type='submit' floated='right' color='blue'>Submit</Button>
</Form>
</div>
</div>
</Card.Content>
</Card>
</div>
</div>
)
}
......@@ -11,7 +11,7 @@ export default class Dashboard extends React.Component {
render = () => (
<div>
<TopMenu />
<TopMenu />
{this.props.children}
</div>
)
......
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, browserHistory } from 'react-router';
import { Segment, Modal, Button, Icon, Image as ImageComponent, Item, TextArea, Forms } from 'semantic-ui-react';
import { Router, Route, browserHistory, Redirect } from 'react-router';
import { Segment } from 'semantic-ui-react';
import Dashboard from './Dashboard';
import Login from './Login';
import VacancyPage from './VacancyPage';
import CompanyRegister from './CompanyRegister';
import Server from './lib/Server';
// import Register from './CompanyRegister'
import Pane from './components/Pane';
import Tabs from './components/Tabs';
import ModalAlert from './components/ModalAlert';
export const Profile = () => (
<Segment>
......@@ -16,20 +15,33 @@ export const Profile = () => (
</Segment>
);
export const App = () => (
<Router history={browserHistory}>
<Route path="/login" component={Login} />
{/*<Route path="/register" component={Register} />*/}
<Route component={Dashboard}>
<Route path="/" component={Profile} />
<Route path="profile" component={Profile} />
<Route path="lowongan" component={VacancyPage} />
<Route path="users" component={Profile} />
</Route>
</Router>
);
const paragraph = <ImageComponent src="http://semantic-ui.com/images/wireframe/short-paragraph.png" />;
const imageWireFrame = <Item.Image size="small" src="http://semantic-ui.com/images/wireframe/image.png" />;
export default class App extends React.Component {
constructor(props) {
super(props);
/* istanbul ignore next */
this.handleAuth = this.handleAuth.bind(this);
}
handleAuth = (nextState, replace) => (
Server.isLoggedIn() || replace({ pathname: '/login' })
);
render = () => (
<Router history={browserHistory}>
<Route path="/login" component={Login} />
<Route path="/register" component={CompanyRegister} />
<Route component={Dashboard} onEnter={this.handleAuth}>
<Route path="/" component={Profile} />
<Route path="profile" component={Profile} />
<Route path="lowongan" component={VacancyPage} />
<Route path="users" component={Profile} />
</Route>
<Redirect from="*" to="/login" />
</Router>
);
}
ReactDOM.render(<App />, document.getElementById('react-app'));
import React from 'react';
import { Segment, Input, Menu } from 'semantic-ui-react'
import Tabs from './components/Tabs';
import Pane from './components/Pane';
import VacancyList from './components/VacancyList';
import Server from './lib/Server';
export default class VacancyPage extends React.Component {
constructor(props) {
super(props);
/* istanbul ignore next */
this.state = { email: '', password: '', errorFlag: false };
this.state = {
email: '',
password: '',
errorFlag: false,
vacancies: [],
};
this.handleItemClick = this.handleItemClick.bind(this);
}
handleItemClick = (e, { name }) => this.setState({ activeItem: name });
render() {
const data = [{ data1: 'val1' }, { data1: 'val2' }];
// fetchVacancies(url) {
// console.log("maho");
// Server.get(url).then((data) => {
// this.setState({ vacancies: data });
// }, () => {
// });
// }
const {activeItem} = this.state;
render() {
const data = [{ data1: 'Software Enggineer' }, { data1: 'System Analyst' }];
return (<div>
<Tabs selected={0}>
<Pane label="Semua Lowongan">
<VacancyList vacancies={data} />
</Pane>
<Pane label="Lamaran saya">
<div>This is my tab 2 contents!</div>
</Pane>
</Tabs>
</div>
<Tabs selected={0}>
<Pane label="Semua Lowongan" >
<VacancyList url="/vacancies/" />
</Pane>
<Pane label="Lamaran saya" >
<VacancyList url="/b" />
</Pane>
<Pane label="Lamaran Ditandai" >
<VacancyList url="/c" />
</Pane>
</Tabs>
</div>
);
};
}
}
......@@ -4,7 +4,7 @@ import ModalPendaftaran from './ModalPendaftaran';
const paragraph = <ImageComponent src="http://semantic-ui.com/images/wireframe/short-paragraph.png" />;
const image = <Item.Image size="small" src="http://semantic-ui.com/images/wireframe/image.png" />;
export default class Lowongan extends React.Component {
static propTypes = {
data: React.PropTypes.object.isRequired,
......@@ -14,20 +14,23 @@ export default class Lowongan extends React.Component {
return (
<Item >
{this.props.image}
{image}
<Item.Content verticalAlign="middle">
<Item.Header>{this.props.header}</Item.Header>
<Item.Header>
{this.props.header}
</Item.Header>
<Item.Description>{this.props.content}</Item.Description>
<Item.Extra>
<Item.Content>
<h4>{ this.props.data.data1 }</h4>
{paragraph}
<h3>{ this.props.data.data1 }</h3>
<h4>PT. Koding Kuat </h4>
<h5> JL.Kali deres utara no.1 Jakarta Barat, DKI Jakarta</h5>
<ModalPendaftaran id={1} data={ { header: 'Deskripsi Lowongan', description: 'Lorem ipsum dolor sit amet, consectetur' +
' adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim ' +
'veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.' } } buttonTitle="Daftar" />
<ModalPendaftaran id={1} data={ { header: 'Deskripsi Lowongan', description: 'Lorem ipsum dolor sit amet'} } buttonTitle="Daftar" />
</Item.Extra>
</Item.Content>
</Item.Content>
</Item>
......
......@@ -46,26 +46,28 @@ export default class ModalPendaftaran extends React.Component {
>
<Modal.Header>{this.props.data.header}</Modal.Header>
<Modal.Content image>
<div className="image">
<Icon name="right arrow" />
</div>
<Modal.Content>
<Modal.Description>
<Modal.Header> <h3> Deskripsi Lowongan </h3></Modal.Header>
{this.props.data.description}
<div className="linkCV">
</Modal.Description>
<div className="coverLetter">
<div className="linkCV">
<a> your latest CV </a>
</div>
<div className="coverLetter">
<h5> Write your Cover Letter </h5>
<Form>
<TextArea placeholder="Tell us more" onChange={this.handleChange} />
<Form >
<TextArea placeholder="Tell us more" size='big' />
</Form>
</div>
</Modal.Description>
</Modal.Content>
<Modal.Actions>
<ModalAlert
......
......@@ -4,7 +4,7 @@ export default class Pane extends React.Component {
static displayName = 'Pane';
static propTypes = {
children: React.PropTypes.element.isRequired,
children: React.PropTypes.any.isRequired,
};
render = () => (
......
......@@ -38,7 +38,7 @@ export default class Tabs extends React.Component {
const activeClass = (this.state.selected === index ? 'active' : '');
return (
<li key={index}>
<a className={activeClass} onClick={this.handleClick.bind(this, index)}>
<a className={activeClass} href="#" onClick={this.handleClick.bind(this, index)}>
{child.props.label}
</a>
</li>
......
......@@ -6,16 +6,19 @@ import Server from '../lib/Server';
export default class TopMenu extends React.Component {
state = { activeItem: 'home' };
handleItemClick = (e, { name }) => this.setState({ activeItem: name })
render() {
const { activeItem } = this.state;
return (
<Menu pointing secondary>
<Menu color='blue' pointing secondary>
<Image as="a" size="small" src="/assets/img/logo.png" href="/" />
<Menu.Menu position="right">
<Menu.Item as={Link} to="/home" name="home" />
<Menu.Item as={Link} to="/profile" name="profil" />
<Menu.Item as={Link} to="/lowongan" name='home' active={activeItem === 'home'} onClick={this.handleItemClick} />
<Menu.Item as={Link} to="/profile" name='profil' active={activeItem === 'profil'} onClick={this.handleItemClick}/>
{Server.isLoggedIn() ?
<Menu.Item as={Link} href="/api/api-auth/logout/?next=/" name="logout" /> :
<Menu.Item as={Link} to="/login" name="login" />
<Menu.Item as={Link} href="/api/api-auth/logout/?next=/" name='logout' active={activeItem === 'logout'} onClick={this.handleItemClick}/> :
<Menu.Item as={Link} to="/login" name='login' active={activeItem === 'login'} onClick={this.handleItemClick} />
}
</Menu.Menu>
</Menu>
......
import React from 'react';
import { Item } from 'semantic-ui-react';
import Lowongan from './Lowongan';
import Server from '../lib/Server';
export default class VacancyList extends React.Component {
static propTypes = {
vacancies: React.PropTypes.array.isRequired,
url: React.PropTypes.string.isRequired,
};
constructor(props) {
super(props);
this.state = { vacancies: [] };
console.log(Server.isLoggedIn());
Server.get(this.props.url).then((data) => {
console.log(data);
this.setState({ vacancies: data });
}, () => {
});
this.generateVacancies = this.generateVacancies.bind(this);
}
generateVacancies() {
return this.props.vacancies.map((vacancy) =>
return this.state.vacancies.map((vacancy, index) =>
<Lowongan key={vacancy.id} data={vacancy} />,
);
}
render = () => (
<Item.Group relaxed>
{/*<Item.Group relaxed>*/}
render = () => {
return (
<Item.Group relaxed>
{/*<Item.Group relaxed>*/}
{ this.generateVacancies() }
{/*</Item.Group>*/}
</Item.Group>
)
{/*</Item.Group>*/}
</Item.Group>
);
}
}
\ No newline at end of file
......@@ -7,8 +7,8 @@ export default class Server {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i += 1) {
const cookie = cookies[i].trim();
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (`${name}`)) {
if (cookie.substring(0, name.length) === (`${name}`)) {
// Does this cookie string begin with the name we want?
/* istanbul ignore next */
return decodeURIComponent(cookie.substring(name.length + 1));
}
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-28 07:00
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20170328_1131'),
]
operations = [
migrations.AddField(
model_name='vacancy',
name='created',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='vacancy',
name='name',
field=models.CharField(default=django.utils.timezone.now, max_length=100),
preserve_default=False,
),
migrations.AddField(
model_name='vacancy',
name='updated',
field=models.DateTimeField(auto_now=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-28 07:17
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20170328_1400'),
]
operations = [
migrations.RenameField(
model_name='company',
old_name='alamat',
new_name='address',
),
]
......@@ -69,7 +69,7 @@ class Company(models.Model):
description = models.TextField()
verified = models.BooleanField(default=False)
logo = models.FileField(upload_to=get_company_logo_file_path, null=True, blank=True)
alamat = models.CharField(max_length=1000, blank=True, null=True)
address = models.CharField(max_length=1000, blank=True, null=True)
@property
def name(self):
......
......@@ -9,3 +9,6 @@ class Vacancy(models.Model):
open_time = models.DateTimeField()
description = models.TextField(blank=True)
close_time = models.DateTimeField()
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
name = models.CharField(max_length=100, null=False)
......@@ -35,7 +35,7 @@ router.register(r'login', LoginViewSet)
router.register(r'vacancies', VacancyViewSet)
router.register(r'students/(?P<student_id>\d+)/bookmarked-vacancies', BookmarkedVacancyByStudentViewSet,
base_name='bookmarked-vacancy-list')
router.register(r'students/(?P<student_id>\d+)/applications', ApplicationViewSet,
router.register(r'students/(?P<student_id>\d+)/applied-vacancies', ApplicationViewSet,
base_name='applications')
......
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