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
e1c09d89
Commit
e1c09d89
authored
May 04, 2017
by
Zamil Majdy
Browse files
[#140657435] [#40] [Refactor] Add admin act as a company bar
parent
d4e22340
Changes
2
Hide whitespace changes
Inline
Side-by-side
assets/css/custom.css
View file @
e1c09d89
...
...
@@ -13,6 +13,10 @@
color
:
black
;
}
.item-list
{
word-wrap
:
break-word
;
width
:
100%
;
}
.ui.card.register
{
background-color
:
#EEEEEE
;
...
...
@@ -155,6 +159,8 @@ card .formRegis{
.ui.pointing.secondary.menu
{
background-color
:
#ffffff
;
margin-bottom
:
10px
;
margin-top
:
0px
;
}
.extra.extra-company
h3
{
...
...
@@ -237,3 +243,13 @@ card .formRegis{
margin-left
:
10%
;
margin-right
:
10%
;
}
.admin-bar
{
margin
:
0
;
padding
:
0
10px
0
0
;
width
:
100%
;
text-align
:
right
;
background-color
:
#304D8A
;
color
:
white
;
}
\ No newline at end of file
assets/js/components/TopMenu.jsx
View file @
e1c09d89
...
...
@@ -7,33 +7,55 @@ import Storage from '../lib/Storage';
export
default
class
TopMenu
extends
React
.
Component
{
static
propTypes
=
{
user
:
React
.
PropTypes
.
object
.
isRequired
,
};
constructor
(
props
)
{
super
(
props
);
/* istanbul ignore next */
this
.
state
=
{
activeItem
:
'
home
'
};
this
.
logout
=
this
.
logout
.
bind
(
this
);
this
.
logoutCompany
=
this
.
logoutCompany
.
bind
(
this
);
}
handleItemClick
=
(
e
,
{
name
})
=>
this
.
setState
({
activeItem
:
name
});
logout
=
()
=>
{
logout
=
(
e
)
=>
{
e
.
preventDefault
();
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
(
<
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
.
Menu
>
</
Menu
>
<
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
.
Menu
>
</
Menu
>
</
div
>
);
}
}
Write
Preview
Markdown
is supported
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