Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions erpnext_com/erpnext_com/doctype/domain_page/domain_page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2019, Frappe and contributors
// For license information, please see license.txt

frappe.ui.form.on('Domain Page', {
// refresh: function(frm) {

// }
});
93 changes: 93 additions & 0 deletions erpnext_com/erpnext_com/doctype/domain_page/domain_page.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"actions": [],
"autoname": "field:page_name",
"creation": "2019-12-18 18:12:03.130860",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"page_name",
"title",
"subtitle",
"route",
"column_break_5",
"is_published",
"domain_image",
"section_break_8",
"cards"
],
"fields": [
{
"fieldname": "page_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Page Name",
"reqd": 1,
"unique": 1
},
{
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"reqd": 1
},
{
"fieldname": "subtitle",
"fieldtype": "Text",
"label": "Subtitle",
"reqd": 1
},
{
"fieldname": "route",
"fieldtype": "Data",
"label": "Route"
},
{
"fieldname": "column_break_5",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "is_published",
"fieldtype": "Check",
"label": "Published"
},
{
"fieldname": "domain_image",
"fieldtype": "Attach",
"label": "Domain Image"
},
{
"fieldname": "section_break_8",
"fieldtype": "Section Break"
},
{
"fieldname": "cards",
"fieldtype": "Table",
"options": "Domain Card"
}
],
"links": [],
"modified": "2019-12-31 13:07:08.600361",
"modified_by": "Administrator",
"module": "erpnext_com",
"name": "Domain Page",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
20 changes: 20 additions & 0 deletions erpnext_com/erpnext_com/doctype/domain_page/domain_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
import frappe
from frappe.website.website_generator import WebsiteGenerator

class DomainPage(WebsiteGenerator):
website = frappe._dict(
page_title_field="title",
condition_field="is_published",
template="erpnext_com/doctype/domain_page/templates/domain.html",
no_cache=1,
sitemap=1
)

def get_context(self, context):
context.website = self

45 changes: 45 additions & 0 deletions erpnext_com/erpnext_com/doctype/domain_page/templates/domain.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% macro domain(domain, title, subtitle, image, features) %}
<!-- <section class='splash' style="background-image: url(/assets/erpnext_com/img/unsplash/{{ image }})"></section> -->
<section class='top-section'>
<div class=container>
<h1>{{ title }}</h1>
<p class='lead'>{{ subtitle }}</p>
<p class="mt-4">
<a class="btn btn-primary" href="/pricing">Start Free Trial</a>
</p>
<p class="mt-0 small text-muted">Try ERPNext free for 14 days</p>
</div>
</section>
<section class="section-bg section-md">
<div class="container">
<div class='row mt-4'>
{% for card in features %}
<div class='col-sm-4 mb-4'>
<a href='{{ card.path }}' class='card h-100 text-left'>
<div class='card-body '>
<h5 class='card-title'>{{ card.title }}</h5>
{{ card.content }}
</div>
</a>
</div>
{% endfor %}
</div>
</div>
</section>
{% include "erpnext_com/templates/includes/signup_footer.html" %}

<style>.footer-message { display: none; }</style>
{% endmacro %}



{% extends "frappe_theme/templates/base.html" %}


{% block title %} {{ website.page_name }} {% endblock %}

{% block content %}

{{ domain(website.page_name, website.title, website.subtitle, website.domain_image, website.cards) }}

{% endblock %}
10 changes: 10 additions & 0 deletions erpnext_com/erpnext_com/doctype/domain_page/test_domain_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals

# import frappe
import unittest

class TestDomainPage(unittest.TestCase):
pass
30 changes: 30 additions & 0 deletions erpnext_com/erpnext_com/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-

import frappe
import requests

eu = ["BE", "BG", "CZ", "DK", "DE", "EE", "IE", "EL", "ES", "FR", "HR",
"IT", "CY", "LV", "LT", "LU", "HU", "MT", "NL", "AT", "PL", "PT",
"RO", "SI", "SK", "FI", "SE"]

country_info = {}

@frappe.whitelist(allow_guest=True)
def get_country(fields=None):
global country_info
ip = frappe.local.request_ip

if not ip in country_info:
fields = ['countryCode', 'country', 'regionName', 'city']
try:
res = requests.get('https://pro.ip-api.com/json/{ip}?key={key}&fields={fields}'.format(
ip=ip, key=frappe.conf.get('ip-api-key'), fields=','.join(fields)))

country_info[ip] = res.json()

except Exception:
country_info[ip] = {}

return country_info[ip]


34 changes: 20 additions & 14 deletions erpnext_com/fixtures/contact_us_settings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
[
{
"address_line1": null,
"address_line2": null,
"address_title": null,
"city": null,
"country": null,
"docstatus": 0,
"doctype": "Contact Us Settings",
"forward_to_email": "sales@erpnext.com",
"heading": null,
"introduction": null,
"modified": "2015-03-04 12:31:58.948285",
"name": "Contact Us Settings",
"pincode": null,
"query_options": null,
"address_line1": null,
"address_line2": null,
"address_title": null,
"city": null,
"country": null,
"docstatus": 0,
"doctype": "Contact Us Settings",
"email_id": null,
"forward_to_email": "sales@erpnext.com",
"heading": null,
"introduction": null,
"modified": "2015-03-04 12:31:58.948285",
"name": "Contact Us Settings",
"parent": null,
"parentfield": null,
"parenttype": null,
"phone": null,
"pincode": null,
"query_options": null,
"skype": null,
"state": null
}
]
Loading