All files / ext.wikilambda.edit/views ZObjectViewer.vue

100% Statements 8/8
100% Branches 1/1
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86                                                                  13x 13x 13x     13x                 3x 1x   2x       3x                                                              
<template>
	<!--
		WikiLambda Vue interface module for top-level view encapsulation.
 
		@copyright 2020– Abstract Wikipedia team; see AUTHORS.txt
		@license MIT
	-->
	<!-- TODO (T300537): Add a loading indicator, once T300538 is done upstream. -->
	<div id="ext-wikilambda-view">
		<wl-z-object
			:persistent="true"
		></wl-z-object>
		<div v-if="displaySuccessMessage" class="ext-wikilambda-view__message">
			<cdx-message
				class="ext-wikilambda-view__message__success"
				:auto-dismiss="true"
				type="success"
			>
				{{ $i18n( 'wikilambda-publish-successful' ).text() }}
			</cdx-message>
		</div>
		<cdx-button @click="$store.dispatch( 'toggleExpertMode' )">
			<template v-if="$store.getters.isExpertMode">
				{{ $i18n( 'wikilambda-disable-expert-mode' ).text() }}
			</template>
			<template v-else>
				{{ $i18n( 'wikilambda-enable-expert-mode' ).text() }}
			</template>
		</cdx-button>
	</div>
</template>
 
<script>
var ZObject = require( '../components/ZObject.vue' );
var CdxButton = require( '@wikimedia/codex' ).CdxButton;
var CdxMessage = require( '@wikimedia/codex' ).CdxMessage;
 
// @vue/component
module.exports = exports = {
	name: 'wl-z-object-viewer',
	components: {
		'wl-z-object': ZObject,
		'cdx-button': CdxButton,
		'cdx-message': CdxMessage
	},
	computed: {
		displaySuccessMessage: function () {
			if ( mw.Uri().query ) {
				return mw.Uri().query.success === 'true';
			}
			return false;
		}
	},
	mounted: function () {
		this.$emit( 'mounted' );
	}
};
</script>
 
<style lang="less">
.ext-wikilambda-view-nojsfallback {
	display: none;
}
 
.ext-wikilambda-view-nojswarning {
	font-weight: bold;
	margin-bottom: 1em;
}
 
.ext-wikilambda-view {
	&__message {
		display: flex;
		align-items: center;
		flex-direction: column;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
 
		&__success {
			max-width: 100%;
		}
	}
}
</style>