rudeshark.net/src/client/app/auth/views/form.vue

145 lines
2.6 KiB
Vue
Raw Normal View History

2018-02-20 12:50:01 +01:00
<template>
<div class="form">
<header>
<h1>{{ $t('share-access') }}</h1>
2018-07-24 16:43:14 +02:00
<img :src="app.iconUrl"/>
2018-02-20 12:50:01 +01:00
</header>
<div class="app">
<section>
<h2>{{ app.name }}</h2>
<p class="id">{{ app.id }}</p>
2018-02-20 12:50:01 +01:00
<p class="description">{{ app.description }}</p>
</section>
<section>
<h2>{{ $t('permission-ask') }}</h2>
2018-02-20 12:50:01 +01:00
<ul>
<template v-for="p in app.permission">
<li v-if="p == 'account-read'">{{ $t('account-read') }}</li>
<li v-if="p == 'account-write'">{{ $t('account-write') }}</li>
<li v-if="p == 'note-write'">{{ $t('note-write') }}</li>
<li v-if="p == 'like-write'">{{ $t('like-write') }}</li>
<li v-if="p == 'following-write'">{{ $t('following-write') }}</li>
<li v-if="p == 'drive-read'">{{ $t('drive-read') }}</li>
<li v-if="p == 'drive-write'">{{ $t('drive-write') }}</li>
<li v-if="p == 'notification-read'">{{ $t('notification-read') }}</li>
<li v-if="p == 'notification-write'">{{ $t('notification-write') }}</li>
2018-02-20 12:50:01 +01:00
</template>
</ul>
</section>
</div>
<div class="action">
<button @click="cancel">{{ $t('cancel') }}</button>
<button @click="accept">{{ $t('accept') }}</button>
2018-02-20 12:50:01 +01:00
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../i18n';
2018-02-20 12:50:01 +01:00
export default Vue.extend({
i18n: i18n('auth/views/form.vue'),
2018-02-20 12:50:01 +01:00
props: ['session'],
computed: {
app(): any {
return this.session.app;
}
},
methods: {
cancel() {
2018-11-09 00:13:34 +01:00
this.$root.api('auth/deny', {
2018-02-20 12:50:01 +01:00
token: this.session.token
}).then(() => {
this.$emit('denied');
});
},
accept() {
2018-11-09 00:13:34 +01:00
this.$root.api('auth/accept', {
2018-02-20 12:50:01 +01:00
token: this.session.token
}).then(() => {
this.$emit('accepted');
});
}
}
});
</script>
<style lang="stylus" scoped>
.form
> header
> h1
margin 0
padding 32px 32px 20px 32px
font-size 24px
font-weight normal
color #777
i
color #77aeca
&:before
content '「'
&:after
content '」'
b
color #666
> img
display block
z-index 1
width 84px
height 84px
margin 0 auto -38px auto
border solid 5px #fff
border-radius 100%
2018-04-29 01:51:17 +02:00
box-shadow 0 2px 2px rgba(#000, 0.1)
2018-02-20 12:50:01 +01:00
> .app
padding 44px 16px 0 16px
color #555
background #eee
2018-04-29 01:51:17 +02:00
box-shadow 0 2px 2px rgba(#000, 0.1) inset
2018-02-20 12:50:01 +01:00
&:after
content ''
display block
clear both
> section
float left
width 50%
padding 8px
text-align left
> h2
margin 0
font-size 16px
color #777
> .action
padding 16px
> button
margin 0 8px
2018-03-03 06:25:36 +01:00
padding 0
2018-02-20 12:50:01 +01:00
@media (max-width 600px)
> header
> img
box-shadow none
> .app
box-shadow none
@media (max-width 500px)
> header
> h1
font-size 16px
</style>