Merge branch 'main' of https://github.com/microsoft/Web-Dev-For-Beginners into main
commit
756cc8a7f6
@ -0,0 +1,45 @@
|
||||
name: Azure Static Web Apps CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build_and_deploy_job:
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and Deploy Job
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build And Deploy
|
||||
id: builddeploy
|
||||
uses: Azure/static-web-apps-deploy@v0.0.1-preview
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_NICE_BEACH_0FE9E9D0F }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
|
||||
action: "upload"
|
||||
###### Repository/Build Configurations - These values can be configured to match you app requirements. ######
|
||||
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
|
||||
app_location: "/quiz-app" # App source code path
|
||||
api_location: "api" # Api source code path - optional
|
||||
output_location: "dist" # Built app content directory - optional
|
||||
###### End of Repository/Build Configurations ######
|
||||
|
||||
close_pull_request_job:
|
||||
if: github.event_name == 'pull_request' && github.event.action == 'closed'
|
||||
runs-on: ubuntu-latest
|
||||
name: Close Pull Request Job
|
||||
steps:
|
||||
- name: Close Pull Request
|
||||
id: closepullrequest
|
||||
uses: Azure/static-web-apps-deploy@v0.0.1-preview
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_NICE_BEACH_0FE9E9D0F }}
|
||||
action: "close"
|
@ -0,0 +1 @@
|
||||
/.DS_Store
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"staticWebApps.appSubpath": "/",
|
||||
"staticWebApps.apiSubpath": "api",
|
||||
"staticWebApps.outputSubpath": "dist"
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Arpan Adhikari
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -0,0 +1,33 @@
|
||||
# Quizzes
|
||||
|
||||
These quizzes are the pre- and post-lecture quizzes for the web development for beginners curriculum at https://aka.ms/webdev-beginners
|
||||
|
||||
## Project setup
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
|
||||
Credits: Thanks to the original version of this quiz app: https://github.com/arpan45/simple-quiz-vue
|
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "quizzes",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^3.6.5",
|
||||
"vue": "^2.6.11",
|
||||
"vue-router": "^3.4.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"rules": {}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"routes": [
|
||||
{
|
||||
"route": "/*",
|
||||
"serve": "/index.html"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<div>
|
||||
<nav>
|
||||
<router-link class="navlink" to="/">Home</router-link>
|
||||
</nav>
|
||||
<div id="app">
|
||||
<h1>Web Development for Beginners: Quizzes</h1>
|
||||
<router-view>
|
||||
<Quiz />
|
||||
</router-view>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Quiz from "@/components/Quiz.vue";
|
||||
|
||||
export default {
|
||||
name: "App",
|
||||
components: {
|
||||
Quiz,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color: #252d4a;
|
||||
}
|
||||
nav {
|
||||
background-color: #252d4a;
|
||||
padding: 1em;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
nav a {
|
||||
color: white;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.link {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
.message {
|
||||
text-align: center;
|
||||
}
|
||||
.card {
|
||||
width: 60%;
|
||||
border: #252d4a solid;
|
||||
border-radius: 5px;
|
||||
margin: auto;
|
||||
padding: 1em;
|
||||
}
|
||||
.btn {
|
||||
min-width: 50%;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
margin-bottom: 5px;
|
||||
width: 50%;
|
||||
font-size: 16px;
|
||||
color: #ffffff;
|
||||
background-color: #252d4a;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
.ans-btn {
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
margin: 4px auto;
|
||||
}
|
||||
</style>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<div class="card">
|
||||
<div v-for="q in questions" :key="q.id">
|
||||
<div v-if="route == q.id">
|
||||
<h2>
|
||||
{{ q.quiz[currentQuestion].questionText }}
|
||||
</h2>
|
||||
<h3 class="message">{{ message }}</h3>
|
||||
<div>
|
||||
<button
|
||||
:key="index"
|
||||
v-for="(option, index) in q.quiz[currentQuestion].answerOptions"
|
||||
@click="handleAnswerClick(option.isCorrect)"
|
||||
class="btn ans-btn"
|
||||
>
|
||||
{{ option.answerText }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import questions from "@/assets/data/en/quiz.json";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentQuestion: 0,
|
||||
message: "",
|
||||
startQuiz: false,
|
||||
restart: false,
|
||||
questions: questions,
|
||||
route: "",
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleAnswerClick(isCorrect) {
|
||||
let nextQuestion = this.currentQuestion + 1;
|
||||
console.log(nextQuestion);
|
||||
if (isCorrect == "true") {
|
||||
this.message = "";
|
||||
//always 3 questions per quiz
|
||||
if (nextQuestion < 3) {
|
||||
this.currentQuestion = nextQuestion;
|
||||
} else {
|
||||
this.message = "Well done, you've completed the quiz";
|
||||
}
|
||||
} else {
|
||||
this.message = "sorry, try again";
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
console.log(this.$route.params.id);
|
||||
this.route = this.$route.params.id;
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
import App from './App.vue';
|
||||
Vue.config.productionTip = false;
|
||||
import router from './router';
|
||||
|
||||
new Vue({ router, render: (h) => h(App) }).$mount('#app');
|
@ -0,0 +1,34 @@
|
||||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
import Home from '@/views/Home.vue';
|
||||
import Quiz from '@/components/Quiz.vue';
|
||||
import NotFound from '@/views/NotFound.vue';
|
||||
Vue.use(Router);
|
||||
|
||||
const router = new Router({
|
||||
mode: 'history',
|
||||
base: process.env.BASE_URL,
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
path: '/quiz/:id',
|
||||
name: 'Quiz',
|
||||
component: Quiz,
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'NotFound',
|
||||
component: NotFound,
|
||||
meta: { title: 'Not Found' },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
next();
|
||||
});
|
||||
export default router;
|
@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<div>
|
||||
<router-link class="link" to="quiz/1"
|
||||
>Lesson 1: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link to="quiz/2">Lesson 1: Post-Lecture Quiz</router-link>
|
||||
<router-link class="link" to="quiz/3"
|
||||
>Lesson 2: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/4"
|
||||
>Lesson 2: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/5"
|
||||
>Lesson 3: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/6"
|
||||
>Lesson 3: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/7"
|
||||
>Lesson 4: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/8"
|
||||
>Lesson 4: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/9"
|
||||
>Lesson 5: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/10"
|
||||
>Lesson 5: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/11"
|
||||
>Lesson 6: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/12"
|
||||
>Lesson 6: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/13"
|
||||
>Lesson 7: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/14"
|
||||
>Lesson 7: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/15"
|
||||
>Lesson 8: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/16"
|
||||
>Lesson 8: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/17"
|
||||
>Lesson 9: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/18"
|
||||
>Lesson 9: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/19"
|
||||
>Lesson 10: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/20"
|
||||
>Lesson 10: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/21"
|
||||
>Lesson 11: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/22"
|
||||
>Lesson 11: Post-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/23"
|
||||
>Lesson 12: Pre-Lecture Quiz</router-link
|
||||
>
|
||||
<router-link class="link" to="quiz/24"
|
||||
>Lesson 12: Post-Lecture Quiz</router-link
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<p>Sorry, wrong number!</p>
|
||||
</div>
|
||||
</template>
|
Loading…
Reference in new issue