UserTools.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template lang="html">
  2. <div id="user-tools">
  3. <!-- <h4
  4. > -->
  5. <a class="mdi mdi-account" href="/user">
  6. <span>{{ name }}</span>
  7. <!-- <span v-else>{{ mail }}</span> -->
  8. </a>
  9. <!-- </h4> -->
  10. <a href="/admin/content/materials"
  11. v-if="isAdmin"
  12. class="mdi mdi-settings"
  13. title="admin"
  14. ></a>
  15. <a href="/user/logout"
  16. @click.prevent="onLogout()"
  17. class="mdi mdi-logout"
  18. title="logout"
  19. ></a>
  20. <UserFlags v-if="isAdherent"/>
  21. </div>
  22. </template>
  23. <script>
  24. import { mapState, mapActions } from 'vuex'
  25. import UserFlags from 'vuejs/components/User/UserFlags'
  26. export default {
  27. watch: {
  28. },
  29. components: {
  30. UserFlags
  31. },
  32. // data () {
  33. // return {
  34. // mail: "Hello User!"
  35. // }
  36. // },
  37. computed: {
  38. ...mapState({
  39. mail: state => state.User.mail,
  40. name: state => state.User.name,
  41. isAdmin: state => state.User.isAdmin,
  42. isAdherent: state => state.User.isAdherent,
  43. flags: state => state.User.flags
  44. })
  45. },
  46. methods: {
  47. ...mapActions({
  48. userLogout: 'User/userLogout'
  49. }),
  50. onLogout () {
  51. console.log('UserTools onLogout')
  52. this.userLogout()
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="css" scoped>
  58. #user-tools{
  59. margin-right:0.2em;
  60. /* padding-right:0.5em; */
  61. /* border-right:1px solid #222; */
  62. }
  63. h4{
  64. margin:0;
  65. display:inline-block;
  66. font-size:inherited;
  67. vertical-align: top;
  68. }
  69. </style>