Started with Vue
This commit is contained in:
parent
9456c82536
commit
1778b59efa
@ -414,7 +414,7 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-10-25 18:55:25.257146",
|
||||
"modified": "2018-10-30 17:33:56.143330",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Education Settings",
|
||||
@ -458,6 +458,25 @@
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Guest",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
|
@ -476,7 +476,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2018-10-16 13:03:22.002322",
|
||||
"modified": "2018-10-30 17:30:55.381657",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Program",
|
||||
@ -501,6 +501,25 @@
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Guest",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
|
@ -54,5 +54,8 @@
|
||||
"stock/dashboard/item_dashboard.html",
|
||||
"stock/dashboard/item_dashboard_list.html",
|
||||
"stock/dashboard/item_dashboard.js"
|
||||
],
|
||||
"js/web-academy.min.js": [
|
||||
"public/js/education/web-academy.js"
|
||||
]
|
||||
}
|
||||
|
27
erpnext/public/js/education/web-academy.js
Normal file
27
erpnext/public/js/education/web-academy.js
Normal file
@ -0,0 +1,27 @@
|
||||
import Vue from 'vue/dist/vue.js';
|
||||
import VueRouter from 'vue-router/dist/vue-router.js'
|
||||
import AcademyRoot from "./web-academy/AcademyRoot.vue";
|
||||
import AcademyHome from "./web-academy/pages/AcademyHome.vue";
|
||||
import AcademyProgramPage from "./web-academy/pages/AcademyProgramPage.vue";
|
||||
import AcademyCoursePage from "./web-academy/pages/AcademyCoursePage.vue";
|
||||
|
||||
Vue.use(VueRouter)
|
||||
|
||||
const routes = [
|
||||
{path: '', component: AcademyHome},
|
||||
{path: '/Program/:code', component: AcademyProgramPage, props: true},
|
||||
{path: '/Course', component: AcademyCoursePage},
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
frappe.ready(() => {
|
||||
new Vue({
|
||||
el: "#web-academy",
|
||||
router: router,
|
||||
template: "<academy-root/>",
|
||||
components: { AcademyRoot }
|
||||
});
|
||||
})
|
10
erpnext/public/js/education/web-academy/AcademyRoot.vue
Normal file
10
erpnext/public/js/education/web-academy/AcademyRoot.vue
Normal file
@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<div id="academy-root">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "AcademyRoot",
|
||||
};
|
||||
</script>
|
@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<section class='section-padding section-bg'>
|
||||
<div class='container'>
|
||||
<h3 class='text-center'>Featured Programs</h3>
|
||||
<p class='lead text-center'>Master Engineering</p>
|
||||
<AcademyProgramCard v-for="program in featured_programs" v-bind:id="program" v-bind:title="program"/>
|
||||
<div class='mt-4 text-center'>
|
||||
<a class="btn btn-primary btn-lg" href="/program">View All</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
<script>
|
||||
import AcademyProgramCard from "../components/AcademyProgramCard.vue"
|
||||
export default {
|
||||
name: "AcademyCardList",
|
||||
data() {
|
||||
return {
|
||||
featured_programs: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
frappe.call("erpnext.www.academy.get_featured_programs").then(r => {
|
||||
this.featured_programs = r.message
|
||||
})
|
||||
},
|
||||
components: {
|
||||
AcademyProgramCard
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div class='card-deck mt-5'>
|
||||
<div class="card">
|
||||
<img :src="program.hero_image" style='height: 150px'>
|
||||
<div class='card-body'>
|
||||
<router-link :to="'/Program/' + program.name">
|
||||
<h5 class='card-title'>{{ program.name }}</h5>
|
||||
</router-link>
|
||||
<div v-html="program.description"></div>
|
||||
</div>
|
||||
<div class='card-footer text-right'>
|
||||
<!-- <a class='video-btn btn btn-secondary btn-sm' data-toggle="modal" data-src=" insert jinja stuff here " data-target="#myModal">Watch Intro</a> -->
|
||||
<a class='btn btn-secondary btn-sm' href="/enroll?course=user">Enroll Now</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ['title'],
|
||||
name: "AcademyProgramCard",
|
||||
data() {
|
||||
return {
|
||||
program: ''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
frappe.call({
|
||||
method: "erpnext.www.academy.get_program_details",
|
||||
args: {
|
||||
program_name: this.title
|
||||
}
|
||||
}).then(r => {
|
||||
this.program = r.message
|
||||
})
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<section class='top-section'>
|
||||
<div class='container'>
|
||||
<div class='text-center'>
|
||||
<!-- <img class="main-illustration" src='/assets/erpnext_com/img/erpnext_com_illustration.png'
|
||||
style='width: 700px;'> -->
|
||||
</div>
|
||||
<h1 v-html="title"></h1>
|
||||
<ul class="list-group">
|
||||
</ul>
|
||||
<p class='lead' v-html="description"></p>
|
||||
<p class="mt-4">
|
||||
<a class="btn btn-primary btn-lg" href="/enroll">Explore Courses</a>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "AcademyTopSection",
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
description: ''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
frappe.call("erpnext.www.academy.get_portal_details").then(r => {
|
||||
this.title = r.message.title,
|
||||
this.description = r.message.description
|
||||
})
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<div>
|
||||
Course Page
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "AcademyCoursePage"
|
||||
};
|
||||
</script>
|
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div>
|
||||
<AcademyTopSection/>
|
||||
<AcademyCardList/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import AcademyTopSection from "../components/AcademyTopSection.vue"
|
||||
import AcademyCardList from "../components/AcademyCardList.vue"
|
||||
|
||||
export default {
|
||||
name: "AcademyHome",
|
||||
components: {
|
||||
AcademyTopSection, AcademyCardList
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div>
|
||||
Program Page {{ code }}
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ['code'],
|
||||
name: "AcademyProgramPage",
|
||||
data() {
|
||||
return this.code
|
||||
}
|
||||
};
|
||||
</script>
|
8
erpnext/www/academy.html
Normal file
8
erpnext/www/academy.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% extends "frappe_theme/templates/web.html" %}
|
||||
|
||||
{% block title %}{{ heading or "Academy"}}{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
<div id="web-academy"></div>
|
||||
<script type="text/javascript" src="/assets/js/web-academy.min.js"></script>
|
||||
{% endblock %}
|
27
erpnext/www/academy.py
Normal file
27
erpnext/www/academy.py
Normal file
@ -0,0 +1,27 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import erpnext.education.utils as utils
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_portal_details():
|
||||
settings = frappe.get_doc("Education Settings")
|
||||
title = settings.portal_title
|
||||
description = settings.description
|
||||
return dict(title=title, description=description)
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_featured_programs():
|
||||
featured_program_names = frappe.get_list("Program", filters={"is_published": True, "is_featured": True})
|
||||
featured_list = [program["name"] for program in featured_program_names]
|
||||
if featured_list:
|
||||
return featured_list
|
||||
else:
|
||||
return None
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_program_details(program_name):
|
||||
try:
|
||||
program = frappe.get_doc('Program', program_name)
|
||||
return program
|
||||
except:
|
||||
return None
|
@ -1,10 +0,0 @@
|
||||
{% extends "templates/web.html" %}
|
||||
|
||||
{% block title %}{{ heading or "Web Academy"}}{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
|
||||
<div id="web-academy"></div>
|
||||
<script type="text/javascript" src="/assets/js/frappe-web-academy.min.js"></script>
|
||||
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user