fix(formatting): Spaces to Tabs

This commit is contained in:
Prateeksha Singh 2019-01-29 13:30:29 +05:30
parent e93cea1336
commit 14bdf84702
3 changed files with 253 additions and 253 deletions

View file

@ -1,147 +1,147 @@
<template>
<div class="modules-page-container">
<div v-for="category in module_categories"
:key="category">
<div class="modules-page-container">
<div v-for="category in module_categories"
:key="category">
<div v-if="modules.filter(m => m.category === category).length" class="module-category h6 uppercase">
{{ category }}
</div>
<div v-if="modules.filter(m => m.category === category).length" class="module-category h6 uppercase">
{{ category }}
</div>
<div class="modules-container">
<a v-for="module in modules.filter(m => m.category === category )"
:key="module.name"
:href="module.type === 'module' ? '#modules/' + module.module_name : module.link"
class="border module-box"
>
<div class="flush-top">
<div class="icon-box">
<span><i class="icon text-extra-muted" :class="module.icon"></i></span>
</div>
<div class="module-box-content">
<h4 class="h4">
{{ module.label }}
<span v-if="module.count" class="open-notification global">{{ module.count }}</span>
</h4>
<p class="small text-muted"> {{ module.description }} </p>
</div>
</div>
</a>
</div>
<div class="modules-container">
<a v-for="module in modules.filter(m => m.category === category )"
:key="module.name"
:href="module.type === 'module' ? '#modules/' + module.module_name : module.link"
class="border module-box"
>
<div class="flush-top">
<div class="icon-box">
<span><i class="icon text-extra-muted" :class="module.icon"></i></span>
</div>
<div class="module-box-content">
<h4 class="h4">
{{ module.label }}
<span v-if="module.count" class="open-notification global">{{ module.count }}</span>
</h4>
<p class="small text-muted"> {{ module.description }} </p>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
let modules_list = frappe.boot.allowed_modules
.filter(d => (d.type==='module' || d.category==='Places') && !d.blocked);
data() {
let modules_list = frappe.boot.allowed_modules
.filter(d => (d.type==='module' || d.category==='Places') && !d.blocked);
modules_list.forEach(module => {
module.count = this.get_module_count(module.module_name);
});
modules_list.forEach(module => {
module.count = this.get_module_count(module.module_name);
});
return {
route_str: frappe.get_route()[1],
module_label: '',
module_categories: ["Modules", "Domains", "Places", "Administration"],
modules: modules_list
};
},
methods: {
get_module_count(module_name) {
var module_doctypes = frappe.boot.notification_info.module_doctypes[module_name];
var sum = 0;
return {
route_str: frappe.get_route()[1],
module_label: '',
module_categories: ["Modules", "Domains", "Places", "Administration"],
modules: modules_list
};
},
methods: {
get_module_count(module_name) {
var module_doctypes = frappe.boot.notification_info.module_doctypes[module_name];
var sum = 0;
if(module_doctypes && frappe.boot.notification_info.open_count_doctype) {
// sum all doctypes for a module
for (var j=0, k=module_doctypes.length; j < k; j++) {
var doctype = module_doctypes[j];
let count = (frappe.boot.notification_info.open_count_doctype[doctype] || 0);
count = typeof count == "string" ? parseInt(count) : count;
sum += count;
}
}
if(module_doctypes && frappe.boot.notification_info.open_count_doctype) {
// sum all doctypes for a module
for (var j=0, k=module_doctypes.length; j < k; j++) {
var doctype = module_doctypes[j];
let count = (frappe.boot.notification_info.open_count_doctype[doctype] || 0);
count = typeof count == "string" ? parseInt(count) : count;
sum += count;
}
}
if(frappe.boot.notification_info.open_count_doctype
&& frappe.boot.notification_info.open_count_doctype[module_name]!=null) {
// notification count explicitly for doctype
let count = frappe.boot.notification_info.open_count_doctype[module_name] || 0;
count = typeof count == "string" ? parseInt(count) : count;
sum += count;
}
if(frappe.boot.notification_info.open_count_doctype
&& frappe.boot.notification_info.open_count_doctype[module_name]!=null) {
// notification count explicitly for doctype
let count = frappe.boot.notification_info.open_count_doctype[module_name] || 0;
count = typeof count == "string" ? parseInt(count) : count;
sum += count;
}
if(frappe.boot.notification_info.open_count_module
&& frappe.boot.notification_info.open_count_module[module_name]!=null) {
// notification count explicitly for module
let count = frappe.boot.notification_info.open_count_module[module_name] || 0;
count = typeof count == "string" ? parseInt(count) : count;
sum += count;
}
if(frappe.boot.notification_info.open_count_module
&& frappe.boot.notification_info.open_count_module[module_name]!=null) {
// notification count explicitly for module
let count = frappe.boot.notification_info.open_count_module[module_name] || 0;
count = typeof count == "string" ? parseInt(count) : count;
sum += count;
}
sum = sum > 99 ? "99+" : sum;
sum = sum > 99 ? "99+" : sum;
return sum;
}
}
return sum;
}
}
}
</script>
<style lang="less" scoped>
.modules-page-container {
margin: 70px 0px;
margin: 70px 0px;
}
.module-category {
margin-top: 30px;
margin-bottom: 15px;
border-bottom: 1px solid #d0d8dd;
margin-top: 30px;
margin-bottom: 15px;
border-bottom: 1px solid #d0d8dd;
}
.modules-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
column-gap: 15px;
row-gap: 15px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
column-gap: 15px;
row-gap: 15px;
}
.module-box {
border-radius: 4px;
cursor: pointer;
padding: 5px 0px;
display: block;
border-radius: 4px;
cursor: pointer;
padding: 5px 0px;
display: block;
}
.module-box:hover {
background-color: #fafbfc;
background-color: #fafbfc;
}
.module-box-content {
padding-right: 15px;
flex: 1;
padding-right: 15px;
flex: 1;
h4 {
margin-bottom: 5px
}
h4 {
margin-bottom: 5px
}
p {
margin-top: 5px;
font-size: 80%;
}
p {
margin-top: 5px;
font-size: 80%;
}
}
.icon-box {
padding: 15px;
width: 54px;
display: flex;
justify-content: center;
padding: 15px;
width: 54px;
display: flex;
justify-content: center;
}
.icon {
font-size: 24px;
font-size: 24px;
}
</style>

View file

@ -1,66 +1,66 @@
<template>
<div>
<div v-if="sections.length" class="sections-container">
<div v-for="section in sections"
:key="section.label"
class="border section-box"
>
<h4 class="h4"> {{ section.label }} </h4>
<p v-for="item in section.items" class="small"
:key="section.label + item.label"
:data-youtube-id="item.type==='help' ? item.youtube_id : false"
>
<a :href="item.route">{{ item.label || __(item.name) }}</a>
<span class="open-notification global hide"
@click="item.doctype || item.name ? frappe.ui.notifications.show_open_count_list(item.doctype || item.name) : false"
:data-doctype="item.doctype || item.name"></span>
</p>
</div>
</div>
<div>
<div v-if="sections.length" class="sections-container">
<div v-for="section in sections"
:key="section.label"
class="border section-box"
>
<h4 class="h4"> {{ section.label }} </h4>
<p v-for="item in section.items" class="small"
:key="section.label + item.label"
:data-youtube-id="item.type==='help' ? item.youtube_id : false"
>
<a :href="item.route">{{ item.label || __(item.name) }}</a>
<span class="open-notification global hide"
@click="item.doctype || item.name ? frappe.ui.notifications.show_open_count_list(item.doctype || item.name) : false"
:data-doctype="item.doctype || item.name"></span>
</p>
</div>
</div>
<div v-else class="sections-container">
<div v-for="n in 3" :key="n" class="skeleton-section-box"></div>
</div>
</div>
<div v-else class="sections-container">
<div v-for="n in 3" :key="n" class="skeleton-section-box"></div>
</div>
</div>
</template>
<script>
export default {
props: ['module_name', 'sections'],
updated() {
frappe.app.update_notification_count_in_modules();
}
props: ['module_name', 'sections'],
updated() {
frappe.app.update_notification_count_in_modules();
}
}
</script>
<style lang="less" scoped>
.sections-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
column-gap: 15px;
row-gap: 15px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
column-gap: 15px;
row-gap: 15px;
}
.section-box {
padding: 10px 20px;
border-radius: 4px;
padding: 10px 20px;
border-radius: 4px;
p {
line-height: 1.5em;
}
p {
line-height: 1.5em;
}
}
.skeleton-section-box {
background-color: #f5f7fa;
height: 250px;
border-radius: 4px;
background-color: #f5f7fa;
height: 250px;
border-radius: 4px;
}
.h4 {
margin-bottom: 15px;
margin-bottom: 15px;
}
a:hover, a:focus {
text-decoration: underline;
text-decoration: underline;
}
</style>

View file

@ -1,137 +1,137 @@
<template>
<div class="modules-page-container">
<module-detail v-if="this.route && modules_list.map(m => m.module_name).includes(route[1])" :module_name="route[1]" :sections="current_module_sections"></module-detail>
</div>
<div class="modules-page-container">
<module-detail v-if="this.route && modules_list.map(m => m.module_name).includes(route[1])" :module_name="route[1]" :sections="current_module_sections"></module-detail>
</div>
</template>
<script>
import ModuleDetail from './ModuleDetail.vue';
export default {
components: {
ModuleDetail
},
data() {
return {
route: frappe.get_route(),
current_module_label: '',
current_module_sections: [],
modules_data_cache: {},
modules_list: frappe.boot.allowed_modules
.filter(d => (d.type==='module' || d.category==='Places') && !d.blocked),
};
},
created() {
this.update_current_module();
},
mounted() {
frappe.module_links = {};
frappe.route.on('change', () => {
this.update_current_module();
});
},
methods: {
update_current_module() {
let route = frappe.get_route();
if(route[0] === 'modules' || !route[0]) {
this.route = route;
let module_name = route[1];
let title = this.current_module_label ? this.current_module_label : module_name;
components: {
ModuleDetail
},
data() {
return {
route: frappe.get_route(),
current_module_label: '',
current_module_sections: [],
modules_data_cache: {},
modules_list: frappe.boot.allowed_modules
.filter(d => (d.type==='module' || d.category==='Places') && !d.blocked),
};
},
created() {
this.update_current_module();
},
mounted() {
frappe.module_links = {};
frappe.route.on('change', () => {
this.update_current_module();
});
},
methods: {
update_current_module() {
let route = frappe.get_route();
if(route[0] === 'modules' || !route[0]) {
this.route = route;
let module_name = route[1];
let title = this.current_module_label ? this.current_module_label : module_name;
frappe.modules.home && frappe.modules.home.page.set_title(title);
frappe.modules.home && frappe.modules.home.page.set_title(title);
if(!frappe.modules.home) {
setTimeout(() => {
frappe.modules.home.page.set_title(title);
}, 200);
}
if(!frappe.modules.home) {
setTimeout(() => {
frappe.modules.home.page.set_title(title);
}, 200);
}
if(module_name) {
this.get_module_sections(module_name);
}
}
},
if(module_name) {
this.get_module_sections(module_name);
}
}
},
get_module_sections(module_name) {
let cache = this.modules_data_cache[module_name];
if(cache) {
this.current_module_sections = cache;
} else {
this.current_module_sections = [];
return frappe.call({
method: "frappe.desk.moduleview.get",
args: {
module: module_name,
},
callback: (r) => {
var m = frappe.get_module(module_name);
this.current_module_sections = r.message.data;
this.process_data(module_name, this.current_module_sections);
this.modules_data_cache[module_name] = this.current_module_sections;
},
freeze: true,
});
}
},
process_data(module_name, data) {
frappe.module_links[module_name] = [];
data.forEach(function(section) {
section.items.forEach(function(item) {
item.style = '';
if(item.type==="doctype") {
item.doctype = item.name;
get_module_sections(module_name) {
let cache = this.modules_data_cache[module_name];
if(cache) {
this.current_module_sections = cache;
} else {
this.current_module_sections = [];
return frappe.call({
method: "frappe.desk.moduleview.get",
args: {
module: module_name,
},
callback: (r) => {
var m = frappe.get_module(module_name);
this.current_module_sections = r.message.data;
this.process_data(module_name, this.current_module_sections);
this.modules_data_cache[module_name] = this.current_module_sections;
},
freeze: true,
});
}
},
process_data(module_name, data) {
frappe.module_links[module_name] = [];
data.forEach(function(section) {
section.items.forEach(function(item) {
item.style = '';
if(item.type==="doctype") {
item.doctype = item.name;
// map of doctypes that belong to a module
frappe.module_links[module_name].push(item.name);
}
if(!item.route) {
if(item.link) {
item.route=strip(item.link, "#");
}
else if(item.type==="doctype") {
if(frappe.model.is_single(item.doctype)) {
item.route = 'Form/' + item.doctype;
} else {
if (item.filters) {
frappe.route_options=item.filters;
}
item.route="List/" + item.doctype;
//item.style = 'font-weight: 500;';
}
// item.style = 'font-weight: bold;';
}
else if(item.type==="report" && item.is_query_report) {
item.route="query-report/" + item.name;
}
else if(item.type==="report") {
item.route="List/" + item.doctype + "/Report/" + item.name;
}
else if(item.type==="page") {
item.route=item.name;
}
// map of doctypes that belong to a module
frappe.module_links[module_name].push(item.name);
}
if(!item.route) {
if(item.link) {
item.route=strip(item.link, "#");
}
else if(item.type==="doctype") {
if(frappe.model.is_single(item.doctype)) {
item.route = 'Form/' + item.doctype;
} else {
if (item.filters) {
frappe.route_options=item.filters;
}
item.route="List/" + item.doctype;
//item.style = 'font-weight: 500;';
}
// item.style = 'font-weight: bold;';
}
else if(item.type==="report" && item.is_query_report) {
item.route="query-report/" + item.name;
}
else if(item.type==="report") {
item.route="List/" + item.doctype + "/Report/" + item.name;
}
else if(item.type==="page") {
item.route=item.name;
}
item.route = '#' + item.route;
}
item.route = '#' + item.route;
}
if(item.route_options) {
item.route += "?" + $.map(item.route_options, function(value, key) {
return encodeURIComponent(key) + "=" + encodeURIComponent(value); }).join('&');
}
if(item.route_options) {
item.route += "?" + $.map(item.route_options, function(value, key) {
return encodeURIComponent(key) + "=" + encodeURIComponent(value); }).join('&');
}
if(item.type==="page" || item.type==="help" || item.type==="report" ||
(item.doctype && frappe.model.can_read(item.doctype))) {
item.shown = true;
}
});
});
}
}
if(item.type==="page" || item.type==="help" || item.type==="report" ||
(item.doctype && frappe.model.can_read(item.doctype))) {
item.shown = true;
}
});
});
}
}
}
</script>
<style lang="less" scoped>
.modules-page-container {
margin: 15px 0px;
margin: 15px 0px;
}
</style>