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
Show whitespace changes
Inline
Side-by-side
assets/js/VacancyPage.jsx
View file @
a15a59a2
...
...
@@ -33,14 +33,14 @@ export default class VacancyPage extends React.Component {
if
(
this
.
props
.
user
.
role
===
'
student
'
)
{
return
(
<
Tabs
selected
=
{
0
}
>
<
Pane
label
=
"Semua Lowongan"
>
<
Pane
label
=
"Semua Lowongan"
>
<
VacancyList
key
=
{
1
}
userId
=
{
this
.
state
.
id
}
url
=
"/vacancies/"
/>
</
Pane
>
<
Pane
label
=
"Lamaran saya"
>
<
Pane
label
=
"Lamaran saya"
>
<
VacancyList
key
=
{
2
}
userId
=
{
this
.
state
.
id
}
...
...
@@ -48,7 +48,7 @@ export default class VacancyPage extends React.Component {
url
=
{
`/students/
${
this
.
state
.
id
}
/applied-vacancies/`
}
/>
</
Pane
>
<
Pane
label
=
"Lamaran Ditandai"
>
<
Pane
label
=
"Lamaran Ditandai"
>
<
VacancyList
key
=
{
3
}
userId
=
{
this
.
state
.
id
}
...
...
@@ -59,7 +59,10 @@ export default class VacancyPage extends React.Component {
);
}
else
if
(
this
.
props
.
user
.
role
===
'
company
'
||
this
.
props
.
user
.
role
===
'
admin
'
)
{
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
(
...
...
@@ -71,6 +74,7 @@ export default class VacancyPage extends React.Component {
</
div
>
);
}
}
render
()
{
return
(
...
...
assets/js/components/TopMenu.jsx
View file @
a15a59a2
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
Server
from
'
../lib/Server
'
;
import
Storage
from
'
../lib/Storage
'
;
export
default
class
TopMenu
extends
React
.
Component
{
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
)
{
super
(
props
);
/* istanbul ignore next */
// console.log(this.props.user);
this
.
state
=
{
activeItem
:
'
home
'
};
this
.
logout
=
this
.
logout
.
bind
(
this
);
this
.
logoutCompany
=
this
.
logoutCompany
.
bind
(
this
);
}
handleItemClick
=
(
e
,
{
name
})
=>
this
.
setState
({
activeItem
:
name
});
logout
=
(
e
)
=>
{
e
.
preventDefault
();
logout
=
()
=>
{
Server
.
get
(
'
/api-auth/logout/?next=/
'
,
true
).
then
(()
=>
{
Storage
.
clear
();
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
()
{
const
{
activeItem
}
=
this
.
state
;
return
(
<
div
>
{
this
.
props
.
user
.
data
.
is_staff
&&
this
.
props
.
user
.
data
.
company
&&
(
<
div
className
=
"admin-bar"
>
Anda login sebagai perusahaan:
{
this
.
props
.
user
.
data
.
company
.
name
}
(#
{
this
.
props
.
user
.
data
.
company
.
id
}
).
Untuk keluar, silahkan klik
<
a
href
=
"#"
onClick
=
{
this
.
logoutCompany
}
>
link ini
</
a
>
</
div
>
)
}
<
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"
active
=
{
activeItem
===
'
home
'
}
onClick
=
{
this
.
handleItemClick
}
/>
<
Menu
.
Item
as
=
{
Link
}
to
=
"/profile"
name
=
"profil"
active
=
{
activeItem
===
'
profil
'
}
onClick
=
{
this
.
handleItemClick
}
/>
<
Menu
.
Item
as
=
{
Link
}
onClick
=
{
this
.
logout
}
name
=
"logout"
/>
<
Menu
.
Item
as
=
{
Link
}
to
=
"/profil"
name
=
"profile"
onClick
=
{
this
.
handleItemClick
}
/>
<
Menu
.
Item
>
<
Popup
trigger
=
{
<
Image
as
=
{
Link
}
to
=
"/profil"
src
=
{
this
.
props
.
photo
}
avatar
onClick
=
{
this
.
handleItemClick
}
/>
}
flowing
hoverable
>
<
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
>
</
div
>
);
}
}
assets/js/index.jsx
View file @
a15a59a2
...
...
@@ -5,14 +5,14 @@ import Dashboard from './Dashboard';
import
Login
from
'
./Login
'
;
import
VacancyPage
from
'
./VacancyPage
'
;
import
ProfilePage
from
'
./ProfilePage
'
;
import
CompanyPage
from
'
./CompanyPage
'
;
import
CompanyProfile
from
'
./CompanyProfile
'
;
import
CreateVacancy
from
'
./CreateVacancy
'
;
import
Server
from
'
./lib/Server
'
;
import
Storage
from
'
./lib/Storage
'
;
import
ApplicantPage
from
'
./ApplicantPage
'
;
import
TranscriptPage
from
'
./TranscriptPage
'
;
import
AdminVacancyPage
from
'
./AdminVacancyPage
'
;
import
HomeSupervisor
from
'
./HomeSupervisor
'
;
export
default
class
App
extends
React
.
Component
{
static
getRole
()
{
...
...
@@ -74,35 +74,34 @@ export default class App extends React.Component {
replace
({
pathname
:
'
/lowongan
'
});
cb
();
}
else
if
(
App
.
getRole
()
===
'
company
'
)
{
replace
({
pathname
:
'
/lowongan
'
});
cb
();
}
else
if
(
App
.
getRole
()
===
'
admin
'
)
{
replace
({
pathname
:
'
/perusahaan
'
});
cb
();
}
}
replace
({
pathname
:
'
/login
'
});
cb
();
};
render
()
{
const
staff
=
this
.
authorization
([
'
admin
'
]);
const
student
=
this
.
authorization
([
'
admin
'
,
'
student
'
]);
// const supervisor = this.authorization(['admin', 'supervisor']);
const
company
=
this
.
authorization
([
'
admin
'
,
'
company
'
]);
const
commonUser
=
this
.
authorization
([
'
admin
'
,
'
student
'
,
'
company
'
]);
const
grownups
=
this
.
authorization
([
'
admin
'
,
'
company
'
,
'
supervisor
'
]);
const
facultyMember
=
this
.
authorization
([
'
admin
'
,
'
student
'
,
'
supervisor
'
]);
const
all
=
this
.
authorization
([
'
admin
'
,
'
company
'
,
'
student
'
,
'
supervisor
'
]);
return
(
<
Router
history
=
{
browserHistory
}
>
<
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
=
"/lowongan"
component
=
{
commonUser
(
VacancyPage
)
}
/>
<
Route
path
=
"/admin-lowongan"
component
=
{
AdminVacancyPage
}
/>
<
Route
path
=
"/buat-lowongan"
component
=
{
company
(
CreateVacancy
)
}
/>
<
Route
path
=
"/buat-lowongan/:id"
component
=
{
company
(
CreateVacancy
)
}
/>
<
Route
path
=
"/pelamar"
component
=
{
company
(
ApplicantPage
)
}
/>
<
Route
path
=
"/profil"
component
=
{
App
.
getRole
()
===
'
student
'
?
student
(
ProfilePage
)
:
company
(
CompanyProfile
)
}
own
/>
<
Route
path
=
"/mahasiswa/:id"
component
=
{
grownups
(
ProfilePage
)
}
/>
<
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
>
<
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