Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fasilkom UI Open Source Software
Kape
Commits
a15a59a2
Commit
a15a59a2
authored
May 22, 2017
by
sirinbaisa
Browse files
no message
parent
bb69e6b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
assets/js/VacancyPage.jsx
View file @
a15a59a2
...
@@ -33,14 +33,14 @@ export default class VacancyPage extends React.Component {
...
@@ -33,14 +33,14 @@ export default class VacancyPage extends React.Component {
if
(
this
.
props
.
user
.
role
===
'
student
'
)
{
if
(
this
.
props
.
user
.
role
===
'
student
'
)
{
return
(
return
(
<
Tabs
selected
=
{
0
}
>
<
Tabs
selected
=
{
0
}
>
<
Pane
label
=
"Semua Lowongan"
>
<
Pane
label
=
"Semua Lowongan"
>
<
VacancyList
<
VacancyList
key
=
{
1
}
key
=
{
1
}
userId
=
{
this
.
state
.
id
}
userId
=
{
this
.
state
.
id
}
url
=
"/vacancies/"
url
=
"/vacancies/"
/>
/>
</
Pane
>
</
Pane
>
<
Pane
label
=
"Lamaran saya"
>
<
Pane
label
=
"Lamaran saya"
>
<
VacancyList
<
VacancyList
key
=
{
2
}
key
=
{
2
}
userId
=
{
this
.
state
.
id
}
userId
=
{
this
.
state
.
id
}
...
@@ -48,7 +48,7 @@ export default class VacancyPage extends React.Component {
...
@@ -48,7 +48,7 @@ export default class VacancyPage extends React.Component {
url
=
{
`/students/
${
this
.
state
.
id
}
/applied-vacancies/`
}
url
=
{
`/students/
${
this
.
state
.
id
}
/applied-vacancies/`
}
/>
/>
</
Pane
>
</
Pane
>
<
Pane
label
=
"Lamaran Ditandai"
>
<
Pane
label
=
"Lamaran Ditandai"
>
<
VacancyList
<
VacancyList
key
=
{
3
}
key
=
{
3
}
userId
=
{
this
.
state
.
id
}
userId
=
{
this
.
state
.
id
}
...
@@ -59,17 +59,21 @@ export default class VacancyPage extends React.Component {
...
@@ -59,17 +59,21 @@ export default class VacancyPage extends React.Component {
);
);
}
else
if
(
this
.
props
.
user
.
role
===
'
company
'
||
this
.
props
.
user
.
role
===
'
admin
'
)
{
}
else
if
(
this
.
props
.
user
.
role
===
'
company
'
||
this
.
props
.
user
.
role
===
'
admin
'
)
{
return
(
return
(
<
VacancyList
key
=
{
1
}
userId
=
{
this
.
state
.
id
}
url
=
{
`/companies/
${
this
.
state
.
id
}
/vacancies/`
}
type
=
"company"
/>
<
VacancyList
key
=
{
1
}
userId
=
{
this
.
state
.
id
}
url
=
{
`/companies/
${
this
.
state
.
id
}
/vacancies/`
}
type
=
"company"
/>
);
);
return
(
return
(
<
div
>
<
div
>
<
h3
>
<
h3
>
Anda tidak terautentifikasi. Harap logout dan login
Anda tidak terautentifikasi. Harap logout dan login
kembali dengan akun yang benar
kembali dengan akun yang benar
</
h3
>
</
h3
>
</
div
>
</
div
>
);
);
}
}
}
render
()
{
render
()
{
...
...
assets/js/components/TopMenu.jsx
View file @
a15a59a2
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Menu
,
Image
}
from
'
semantic-ui-react
'
;
import
{
Menu
,
Image
,
Popup
,
Button
,
Card
}
from
'
semantic-ui-react
'
;
import
{
Link
,
browserHistory
}
from
'
react-router
'
;
import
{
Link
,
browserHistory
}
from
'
react-router
'
;
import
Server
from
'
../lib/Server
'
;
import
Server
from
'
../lib/Server
'
;
import
Storage
from
'
../lib/Storage
'
;
import
Storage
from
'
../lib/Storage
'
;
export
default
class
TopMenu
extends
React
.
Component
{
export
default
class
TopMenu
extends
React
.
Component
{
static
propTypes
=
{
static
propTypes
=
{
user
:
React
.
PropTypes
.
object
.
isRequired
,
// user: React.PropTypes.object.isRequired,
name
:
React
.
PropTypes
.
string
.
isRequired
,
email
:
React
.
PropTypes
.
string
.
isRequired
,
photo
:
React
.
PropTypes
.
any
.
isRequired
,
};
};
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
/* istanbul ignore next */
/* istanbul ignore next */
// console.log(this.props.user);
this
.
state
=
{
activeItem
:
'
home
'
};
this
.
state
=
{
activeItem
:
'
home
'
};
this
.
logout
=
this
.
logout
.
bind
(
this
);
this
.
logout
=
this
.
logout
.
bind
(
this
);
this
.
logoutCompany
=
this
.
logoutCompany
.
bind
(
this
);
}
}
handleItemClick
=
(
e
,
{
name
})
=>
this
.
setState
({
activeItem
:
name
});
handleItemClick
=
(
e
,
{
name
})
=>
this
.
setState
({
activeItem
:
name
});
logout
=
(
e
)
=>
{
logout
=
()
=>
{
e
.
preventDefault
();
Server
.
get
(
'
/api-auth/logout/?next=/
'
,
true
).
then
(()
=>
{
Server
.
get
(
'
/api-auth/logout/?next=/
'
,
true
).
then
(()
=>
{
Storage
.
clear
();
Storage
.
clear
();
browserHistory
.
push
(
'
/login
'
);
browserHistory
.
push
(
'
/login
'
);
});
});
};
};
logoutCompany
=
/* istanbul ignore next */
(
e
)
=>
{
e
.
preventDefault
();
const
userData
=
Storage
.
get
(
'
user-data
'
);
userData
.
company
=
null
;
Storage
.
set
(
'
user-data
'
,
userData
);
window
.
location
.
replace
(
'
/home
'
);
};
render
()
{
render
()
{
const
{
activeItem
}
=
this
.
state
;
const
{
activeItem
}
=
this
.
state
;
return
(
return
(
<
div
>
<
Menu
color
=
"blue"
pointing
secondary
>
{
this
.
props
.
user
.
data
.
is_staff
&&
this
.
props
.
user
.
data
.
company
&&
(
<
Image
as
=
"a"
size
=
"small"
src
=
"/assets/img/logo.png"
href
=
"/"
/>
<
div
className
=
"admin-bar"
>
<
Menu
.
Menu
position
=
"right"
>
Anda login sebagai perusahaan:
{
this
.
props
.
user
.
data
.
company
.
name
}
(#
{
this
.
props
.
user
.
data
.
company
.
id
}
).
<
Menu
.
Item
as
=
{
Link
}
to
=
"/home"
name
=
"home"
active
=
{
activeItem
===
'
home
'
}
onClick
=
{
this
.
handleItemClick
}
/>
Untuk keluar, silahkan klik
<
a
href
=
"#"
onClick
=
{
this
.
logoutCompany
}
>
link ini
</
a
>
<
Menu
.
Item
as
=
{
Link
}
to
=
"/profil"
name
=
"profile"
onClick
=
{
this
.
handleItemClick
}
/>
</
div
>
<
Menu
.
Item
>
)
}
<
Popup
<
Menu
color
=
"blue"
pointing
secondary
>
trigger
=
{
<
Image
<
Image
as
=
"a"
size
=
"small"
src
=
"/assets/img/logo.png"
href
=
"/"
/>
as
=
{
Link
}
to
=
"/profil"
src
=
{
this
.
props
.
photo
}
avatar
<
Menu
.
Menu
position
=
"right"
>
onClick
=
{
this
.
handleItemClick
}
<
Menu
.
Item
as
=
{
Link
}
to
=
"/home"
name
=
"home"
active
=
{
activeItem
===
'
home
'
}
onClick
=
{
this
.
handleItemClick
}
/>
/>
}
<
Menu
.
Item
as
=
{
Link
}
to
=
"/profile"
name
=
"profil"
active
=
{
activeItem
===
'
profil
'
}
onClick
=
{
this
.
handleItemClick
}
/>
flowing
<
Menu
.
Item
as
=
{
Link
}
onClick
=
{
this
.
logout
}
name
=
"logout"
/>
hoverable
</
Menu
.
Menu
>
>
</
Menu
>
</
div
>
<
Card
header
=
{
this
.
props
.
name
}
description
=
{
this
.
props
.
email
}
/>
<
Button
as
=
{
Link
}
onClick
=
{
this
.
logout
}
name
=
"logout"
color
=
"blue"
size
=
"tiny"
>
Logout
</
Button
>
</
Popup
>
</
Menu
.
Item
>
</
Menu
.
Menu
>
</
Menu
>
);
);
}
}
}
}
assets/js/index.jsx
View file @
a15a59a2
...
@@ -5,14 +5,14 @@ import Dashboard from './Dashboard';
...
@@ -5,14 +5,14 @@ import Dashboard from './Dashboard';
import
Login
from
'
./Login
'
;
import
Login
from
'
./Login
'
;
import
VacancyPage
from
'
./VacancyPage
'
;
import
VacancyPage
from
'
./VacancyPage
'
;
import
ProfilePage
from
'
./ProfilePage
'
;
import
ProfilePage
from
'
./ProfilePage
'
;
import
CompanyPage
from
'
./CompanyPage
'
;
import
CompanyProfile
from
'
./CompanyProfile
'
;
import
CompanyProfile
from
'
./CompanyProfile
'
;
import
CreateVacancy
from
'
./CreateVacancy
'
;
import
CreateVacancy
from
'
./CreateVacancy
'
;
import
Server
from
'
./lib/Server
'
;
import
Server
from
'
./lib/Server
'
;
import
Storage
from
'
./lib/Storage
'
;
import
Storage
from
'
./lib/Storage
'
;
import
ApplicantPage
from
'
./ApplicantPage
'
;
import
ApplicantPage
from
'
./ApplicantPage
'
;
import
TranscriptPage
from
'
./TranscriptPage
'
;
import
TranscriptPage
from
'
./TranscriptPage
'
;
import
AdminVacancyPage
from
'
./AdminVacancyPage
'
;
import
HomeSupervisor
from
'
./HomeSupervisor
'
;
export
default
class
App
extends
React
.
Component
{
export
default
class
App
extends
React
.
Component
{
static
getRole
()
{
static
getRole
()
{
...
@@ -74,35 +74,34 @@ export default class App extends React.Component {
...
@@ -74,35 +74,34 @@ export default class App extends React.Component {
replace
({
pathname
:
'
/lowongan
'
});
cb
();
replace
({
pathname
:
'
/lowongan
'
});
cb
();
}
else
if
(
App
.
getRole
()
===
'
company
'
)
{
}
else
if
(
App
.
getRole
()
===
'
company
'
)
{
replace
({
pathname
:
'
/lowongan
'
});
cb
();
replace
({
pathname
:
'
/lowongan
'
});
cb
();
}
else
if
(
App
.
getRole
()
===
'
admin
'
)
{
replace
({
pathname
:
'
/perusahaan
'
});
cb
();
}
}
}
}
replace
({
pathname
:
'
/login
'
});
cb
();
replace
({
pathname
:
'
/login
'
});
cb
();
};
};
render
()
{
render
()
{
const
staff
=
this
.
authorization
([
'
admin
'
]);
const
student
=
this
.
authorization
([
'
admin
'
,
'
student
'
]);
const
student
=
this
.
authorization
([
'
admin
'
,
'
student
'
]);
// const supervisor = this.authorization(['admin', 'supervisor']);
// const supervisor = this.authorization(['admin', 'supervisor']);
const
company
=
this
.
authorization
([
'
admin
'
,
'
company
'
]);
const
company
=
this
.
authorization
([
'
admin
'
,
'
company
'
]);
const
commonUser
=
this
.
authorization
([
'
admin
'
,
'
student
'
,
'
company
'
]);
const
commonUser
=
this
.
authorization
([
'
admin
'
,
'
student
'
,
'
company
'
]);
const
grownups
=
this
.
authorization
([
'
admin
'
,
'
company
'
,
'
supervisor
'
]);
const
grownups
=
this
.
authorization
([
'
admin
'
,
'
company
'
,
'
supervisor
'
]);
const
facultyMember
=
this
.
authorization
([
'
admin
'
,
'
student
'
,
'
supervisor
'
]);
const
facultyMember
=
this
.
authorization
([
'
admin
'
,
'
student
'
,
'
supervisor
'
]);
const
all
=
this
.
authorization
([
'
admin
'
,
'
company
'
,
'
student
'
,
'
supervisor
'
]);
return
(
return
(
<
Router
history
=
{
browserHistory
}
>
<
Router
history
=
{
browserHistory
}
>
<
Route
path
=
"/login"
component
=
{
Login
}
/>
<
Route
path
=
"/login"
component
=
{
Login
}
/>
<
Route
component
=
{
commonUser
(
Dashboard
)
}
onEnter
=
{
this
.
handleAuth
}
>
<
Route
component
=
{
all
(
Dashboard
)
}
onEnter
=
{
this
.
handleAuth
}
own
>
<
Route
path
=
"/transcript/:id"
component
=
{
company
(
TranscriptPage
)
}
/>
<
Route
path
=
"/transcript/:id"
component
=
{
company
(
TranscriptPage
)
}
/>
<
Route
path
=
"/lowongan"
component
=
{
commonUser
(
VacancyPage
)
}
/>
<
Route
path
=
"/lowongan"
component
=
{
commonUser
(
VacancyPage
)
}
/>
<
Route
path
=
"/admin-lowongan"
component
=
{
AdminVacancyPage
}
/>
<
Route
path
=
"/buat-lowongan"
component
=
{
company
(
CreateVacancy
)
}
/>
<
Route
path
=
"/buat-lowongan"
component
=
{
company
(
CreateVacancy
)
}
/>
<
Route
path
=
"/buat-lowongan/:id"
component
=
{
company
(
CreateVacancy
)
}
/>
<
Route
path
=
"/buat-lowongan/:id"
component
=
{
company
(
CreateVacancy
)
}
/>
<
Route
path
=
"/pelamar"
component
=
{
company
(
ApplicantPage
)
}
/>
<
Route
path
=
"/pelamar"
component
=
{
company
(
ApplicantPage
)
}
/>
<
Route
path
=
"/profil"
component
=
{
App
.
getRole
()
===
'
student
'
?
student
(
ProfilePage
)
:
company
(
CompanyProfile
)
}
own
/>
<
Route
path
=
"/profil"
component
=
{
App
.
getRole
()
===
'
student
'
?
student
(
ProfilePage
)
:
company
(
CompanyProfile
)
}
own
/>
<
Route
path
=
"/mahasiswa/:id"
component
=
{
grownups
(
ProfilePage
)
}
/>
<
Route
path
=
"/mahasiswa/:id"
component
=
{
grownups
(
ProfilePage
)
}
/>
<
Route
path
=
"/perusahaan/:id"
component
=
{
facultyMember
(
CompanyProfile
)
}
/>
<
Route
path
=
"/perusahaan/:id"
component
=
{
facultyMember
(
CompanyProfile
)
}
/>
<
Route
path
=
"/
perusahaan"
component
=
{
staff
(
CompanyPage
)
}
/>
<
Route
path
=
"/
home-supervisor"
component
=
{
HomeSupervisor
}
/>
<
Route
path
=
"/transkrip/:id"
component
=
{
facultyMember
(
CompanyProfile
)
}
/>
<
Route
path
=
"/transkrip/:id"
component
=
{
facultyMember
(
CompanyProfile
)
}
/>
</
Route
>
</
Route
>
<
Route
path
=
"/home"
onEnter
=
{
this
.
handleHome
}
/>
<
Route
path
=
"/home"
onEnter
=
{
this
.
handleHome
}
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment