Procházet zdrojové kódy

[website] [minor] moving to framework

version-14
Rushabh Mehta před 12 roky
rodič
revize
386cd883b3
18 změnil soubory, kde provedl 67 přidání a 91 odebrání
  1. +1
    -0
      config.json
  2. +3
    -1
      webnotes/__init__.py
  3. +7
    -3
      webnotes/webutils.py
  4. +0
    -0
      website/doctype/about_us_settings/templates/__init__.py
  5. +0
    -0
      website/doctype/about_us_settings/templates/pages/__init__.py
  6. +1
    -1
      website/doctype/about_us_settings/templates/pages/about.html
  7. +6
    -0
      website/doctype/about_us_settings/templates/pages/about.py
  8. +10
    -10
      website/doctype/blog_post/templates/generators/blog_post.html
  9. +8
    -4
      website/doctype/blog_post/templates/pages/blog.html
  10. +3
    -3
      website/doctype/blogger/templates/pages/writers.html
  11. +0
    -0
      website/doctype/contact_us_settings/templates/__init__.py
  12. +0
    -0
      website/doctype/contact_us_settings/templates/pages/__init__.py
  13. +10
    -4
      website/doctype/contact_us_settings/templates/pages/contact.html
  14. +6
    -0
      website/doctype/contact_us_settings/templates/pages/contact.py
  15. +1
    -1
      website/doctype/web_page/templates/generators/web_page.html
  16. +3
    -3
      website/templates/base.html
  17. +6
    -43
      website/templates/includes/footer.html
  18. +2
    -18
      website/templates/pages/login.html

+ 1
- 0
config.json Zobrazit soubor

@@ -1,4 +1,5 @@
{
"base_template": "lib/website/templates/base.html",
"modules": {
"Finder": {
"type": "page",


+ 3
- 1
webnotes/__init__.py Zobrazit soubor

@@ -487,7 +487,9 @@ def get_config():
try:
with open(path, "r") as configfile:
this_config = json.loads(configfile.read())
_config.app_name = this_config.get("app_name")
for k in ("app_name", "base_template"):
_config[k] = this_config.get(k)
_config.modules.update(this_config["modules"])
_config.web.pages.update(this_config["web"]["pages"])
_config.web.generators.update(this_config["web"]["generators"])


+ 7
- 3
webnotes/webutils.py Zobrazit soubor

@@ -56,15 +56,17 @@ def render_page(page_name):

def build_page(page_name):
from jinja2 import Environment, FileSystemLoader
import os

if not webnotes.conn:
webnotes.connect()

sitemap = webnotes.cache().get_value("website_sitemap", build_sitemap)
page_options = sitemap.get(page_name)
basepath = webnotes.utils.get_base_path()
module = None
no_cache = False
if page_options.get("controller"):
module = webnotes.get_module(page_options["controller"])
no_cache = getattr(module, "no_cache", False)
@@ -89,10 +91,12 @@ def build_page(page_name):
context.update(module.get_context())
context = update_context(context)

jenv = Environment(loader = FileSystemLoader(basepath))
jenv = Environment(loader = FileSystemLoader(webnotes.utils.get_base_path()))
template_name = page_options['template']
context["base_template"] = jenv.get_template(webnotes.get_config().get("base_template"))
template_name = page_options['template']
html = jenv.get_template(template_name).render(context)
if not no_cache:


+ 0
- 0
website/doctype/about_us_settings/templates/__init__.py Zobrazit soubor


+ 0
- 0
website/doctype/about_us_settings/templates/pages/__init__.py Zobrazit soubor


website/doctype/about_us_settings/templates/about.html → website/doctype/about_us_settings/templates/pages/about.html Zobrazit soubor

@@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}

{% set title="About Us" %}


+ 6
- 0
website/doctype/about_us_settings/templates/pages/about.py Zobrazit soubor

@@ -0,0 +1,6 @@
import webnotes

def get_context():
return {
"obj": webnotes.bean("About Us Settings", "About Us Settings").get_controller()
}

+ 10
- 10
website/doctype/blog_post/templates/generators/blog_post.html Zobrazit soubor

@@ -1,15 +1,15 @@
{# Options: {
"doctype": "Web Page"
} #}

{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}

{% block javascript %}
{% include "app/website/templates/js/blog_page.js" %}
<script>
{% include "lib/website/doctype/blog_post/templates/includes/blog_page.js" %}
</script>
{% endblock %}

{% block css %}
{% include "app/website/templates/css/blog_page.css" %}
<style>
{% include "lib/website/doctype/blog_post/templates/includes/blog_page.css" %}
</style>
{% endblock %}

{% block content %}
@@ -27,7 +27,7 @@
<!-- end blog content -->
{% if blogger_info %}
<hr />
{% include "app/website/templates/html/blogger.html" %}
{% include "lib/website/doctype/blog_post/templates/includes/blogger.html" %}
{% endif %}
<hr>
<h3>{{ texts.comments }}</h3><br>
@@ -39,7 +39,7 @@
</div>
{% endif %}
{% include 'app/website/templates/html/comment.html' %}
{% include 'lib/website/doctype/blog_post/templates/includes/comment.html' %}
</div>
<div><button class="btn btn-default add-comment">{{ texts.add_comment }}</button></div>
<div style="display: none; margin-top: 10px; max-width: 400px;"
@@ -58,5 +58,5 @@
</form>
</div>
</div>
{% include 'app/website/templates/html/blog_footer.html' %}
{% include 'lib/website/doctype/blog_post/templates/includes/blog_footer.html' %}
{% endblock %}

+ 8
- 4
website/doctype/blog_post/templates/pages/blog.html Zobrazit soubor

@@ -1,11 +1,15 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}

{% block javascript %}
{% include "app/website/templates/js/blog.js" %}
<script>
{% include "lib/website/doctype/blog_post/templates/includes/blog.js" %}
</script>
{% endblock %}

{% block css %}
{% include "app/website/templates/css/blog.css" %}
<style>
{% include "lib/website/doctype/blog_post/templates/includes/blog.css" %}
</style>
{% endblock %}

{% set title="Blog" %}
@@ -29,5 +33,5 @@
style="display:none;">More...</button>
</div>
</div>
{% include 'app/website/templates/html/blog_footer.html' %}
{% include 'lib/website/doctype/blog_post/templates/includes/blog_footer.html' %}
{% endblock %}

website/doctype/blogger/templates/writers.html → website/doctype/blogger/templates/pages/writers.html Zobrazit soubor

@@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}

{% set title="Blog Writers" %}

@@ -10,8 +10,8 @@
{% endif %}
<hr>
{% for blogger_info in bloggers %}
{% include "app/website/templates/html/blogger.html" %}
{% include "lib/website/doctype/blog_post/templates/includes/blogger.html" %}
{% endfor %}
</div>
{% include 'app/website/templates/html/blog_footer.html' %}
{% include 'lib/website/doctype/blog_post/templates/includes/blog_footer.html' %}
{% endblock %}

+ 0
- 0
website/doctype/contact_us_settings/templates/__init__.py Zobrazit soubor


+ 0
- 0
website/doctype/contact_us_settings/templates/pages/__init__.py Zobrazit soubor


website/doctype/contact_us_settings/templates/contact.html → website/doctype/contact_us_settings/templates/pages/contact.html Zobrazit soubor

@@ -1,7 +1,9 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}

{% block javascript %}
{% include "app/website/templates/js/contact.js" %}
<script>
{% include "lib/website/doctype/contact_us_settings/templates/includes/contact.js" %}
</script>
{% endblock %}

{% set title="Contact Us" %}
@@ -15,9 +17,13 @@
style="display: none;">&nbsp;</p>
<p>
<select name="subject" class="form-control">
{% for option in obj.query_options %}
{% if obj.query_options -%}
{% for option in obj.query_options -%}
<option value="{{ option }}">{{ option }}</option>
{% endfor %}
{%- endfor %}
{% else %}
<option value="General">General</option>
{% endif %}
</select>
</p>
<p>

+ 6
- 0
website/doctype/contact_us_settings/templates/pages/contact.py Zobrazit soubor

@@ -0,0 +1,6 @@
import webnotes

def get_context():
return {
"obj": webnotes.bean("Contact Us Settings", "Contact Us Settings").get_controller()
}

+ 1
- 1
website/doctype/web_page/templates/generators/web_page.html Zobrazit soubor

@@ -1,4 +1,4 @@
{% extends "lib/website/templates/base.html" %}
{% extends base_template %}

{% block content %}
<div class="col-md-12" style="margin-top: 15px;">


+ 3
- 3
website/templates/base.html Zobrazit soubor

@@ -22,14 +22,14 @@
{%- endblock %}
</head>
<body>
{% block navbar %}{% endblock %}
<div class="container" style="padding-top: 50px">
{% block navbar %}{% include "lib/website/templates/includes/navbar.html" %}{% endblock %}
<div class="container">
{% block toolbar %}{% endblock %}
{% block banner %}{% endblock %}
<div class="content" id="page-{{ name }}" style="display: block;">
{% block content %}{% endblock %}
</div>
</div>
{% block footer %}{% endblock %}
{% block footer %}{% include "lib/website/templates/includes/footer.html" %}{% endblock %}
</body>
</html>

+ 6
- 43
website/templates/includes/footer.html Zobrazit soubor

@@ -22,9 +22,9 @@
{% endif %}
</div>
{% endif %}
<p style="float: right; clear: right;">
<a style="font-size: 90%; color: #888;" href="http://erpnext.org">ERPNext Powered</a>
</p>
{% block powered %}<p style="float: right; clear: right;">
<a style="font-size: 90%; color: #888;" href="http://getwebnotes.org">Built on Web Notes</a>
</p>{% endblock %}
<div class="web-footer-menu">
<ul>
{% for item in footer_items %}
@@ -33,46 +33,9 @@
{% endfor %}
</ul>
</div>
{% if copyright %}
<div class="web-footer-copyright">&copy; {{ copyright }}</div>
{% endif %}
{% if address %}
{{ address }}
{% endif %}
<br>
<div class="input-group col-md-6 col-md-offset-3">
<input class="form-control" type="text" id="footer-subscribe-email" placeholder="Your email address...">
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="footer-subscribe-button">Stay Updated</button>
</span>
</div>
<br>
<script>
$("#footer-subscribe-button").click(function() {

$("#footer-subscribe-email").attr('disabled', true);
$("#footer-subscribe-button").html("Sending...")
.attr("disabled", true);

if($("#footer-subscribe-email").val()) {
erpnext.send_message({
subject:"Subscribe me",
sender: $("#footer-subscribe-email").val(),
message: "Subscribe to newsletter (via website footer).",
callback: function(r) {
if(!r.exc) {
$("#footer-subscribe-button").html("Thank You :)")
.addClass("btn-success").attr("disabled", true);
} else {
$("#footer-subscribe-button").html("Error :( Not a valid id?")
.addClass("btn-danger").attr("disabled", false);
$("#footer-subscribe-email").val("").attr('disabled', false);
}
}
});
}
});
</script>
{% if copyright %}<div class="web-footer-copyright">&copy; {{ copyright }}</div>{% endif %}
{% if address %}{{ address }}{% endif %}
{% block extension %}{% endblock %}
</div>
</div>
</div>


+ 2
- 18
website/templates/pages/login.html Zobrazit soubor

@@ -1,4 +1,4 @@
{% extends "lib/website/templates/base.html" %}
{% extends base_template %}

{% block javascript %}
<script>
@@ -6,19 +6,11 @@
</script>
{% endblock %}

{% block css %}
<style>
body {
background-color: #F5EFE6;
}
</style>
{% endblock %}

{% set title="Login" %}

{% block content %}
<div style="max-width: 750px;">
<div class="row" style="margin-top: 100px;">
<div class="row" style="margin-top: 40px; margin-bottom: 20px">
<div class="col-sm-offset-3 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
@@ -49,14 +41,6 @@
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 web-footer login-footer text-center" style="margin-top: 25px">
<a href="index.html">Home</a> | <a href="https://erpnext.com">ERPNext</a><br><br>
{% if copyright %}
<div class="web-footer-copyright">&copy; {{ copyright }}</div>
{% endif %}
</div>
</div>
</div>

{% endblock %}

Načítá se…
Zrušit
Uložit