@@ -29,7 +29,6 @@ def main(): | |||
sites_path = parsed_args.get("sites_path") | |||
if not parsed_args.get("make_app"): | |||
if parsed_args.get("site")=="all": | |||
for site in get_sites(parsed_args["sites_path"]): | |||
print "\nRunning", fn, "for", site | |||
@@ -131,7 +130,7 @@ def setup_parser(): | |||
return parser.parse_args() | |||
def setup_install(parser): | |||
parser.add_argument("--make_app", metavar="DEST", nargs=1, | |||
parser.add_argument("--make_app", metavar=("DESTINATION", "APP-NAME"), nargs=2, | |||
help="Make a new application with boilerplate") | |||
parser.add_argument("--install", metavar="DB-NAME", nargs=1, | |||
help="Install a new db") | |||
@@ -296,9 +295,9 @@ def setup_translation(parser): | |||
# methods | |||
@cmd | |||
def make_app(destination): | |||
def make_app(destination, app_name): | |||
from frappe.utils.boilerplate import make_boilerplate | |||
make_boilerplate(destination) | |||
make_boilerplate(destination, app_name) | |||
@cmd | |||
def use(sites_path): | |||
@@ -16,6 +16,12 @@ body { | |||
cursor: pointer; | |||
} | |||
a, | |||
a:hover, | |||
a:active, | |||
a:focus { | |||
outline: 0; | |||
} | |||
a, | |||
.badge, | |||
.ui-menu .ui-menu-item { | |||
-webkit-transition: 0.2s; | |||
@@ -10,6 +10,12 @@ | |||
a { | |||
cursor: pointer; | |||
} | |||
a, | |||
a:hover, | |||
a:active, | |||
a:focus { | |||
outline: 0; | |||
} | |||
img { | |||
max-width: 100%; | |||
} | |||
@@ -198,6 +204,9 @@ fieldset { | |||
margin-bottom: 20px; | |||
padding: 25px 0px; | |||
} | |||
.page-container { | |||
padding: 0px; | |||
} | |||
.page-header h1, | |||
.page-header h2, | |||
.page-header h3 { | |||
@@ -208,10 +217,10 @@ fieldset { | |||
} | |||
.sidebar-item { | |||
/*background-color: #f7f7f7;*/ | |||
border-left: 1px solid #eee; | |||
border-left: 1px solid #d1d8dd; | |||
margin-left: -30px; | |||
padding: 5px 15px; | |||
color: #999; | |||
color: #8d99a6; | |||
font-size: 85%; | |||
} | |||
.sidebar-item:first-child { | |||
@@ -221,19 +230,7 @@ fieldset { | |||
padding-bottom: 10px; | |||
} | |||
.sidebar-item a { | |||
color: #999; | |||
text-decoration: none; | |||
} | |||
.sidebar-item a:hover, | |||
.sidebar-item a:focus, | |||
.sidebar-item a:active { | |||
color: #333; | |||
text-decoration: none; | |||
/* thanks medium: https://medium.com/designing-medium/crafting-link-underlines-on-medium-7c03a9274f9 */ | |||
background-image: linear-gradient(to bottom, transparent 50%, rgba(153, 153, 153, 0.5) 50%); | |||
background-repeat: repeat-x; | |||
background-size: 5% 20%; | |||
background-position: 0 100%; | |||
color: #8d99a6; | |||
} | |||
.sidebar-item a.active { | |||
color: #000; | |||
@@ -364,7 +361,6 @@ a.active { | |||
} | |||
.page-breadcrumbs .breadcrumb { | |||
padding: 0px; | |||
margin-bottom: 2px; | |||
background-color: transparent; | |||
border-radius: 0px; | |||
font-size: 85%; | |||
@@ -372,6 +368,9 @@ a.active { | |||
.breadcrumb a { | |||
color: inherit; | |||
} | |||
.breadcrumb > .active { | |||
color: #8d99a6; | |||
} | |||
@media (min-width: 768px) { | |||
.page-sidebar { | |||
padding-left: 3em; | |||
@@ -399,7 +398,6 @@ a.active { | |||
padding-left: 30px; | |||
} | |||
a.grey, | |||
.sidebar-section a, | |||
.nav-pills a, | |||
.control-value a, | |||
.data-row a { | |||
@@ -408,7 +406,6 @@ a.grey, | |||
margin-bottom: 0.4em; | |||
} | |||
a.grey:hover, | |||
.sidebar-section a:hover, | |||
.nav-pills a:hover, | |||
.control-value a:hover, | |||
.data-row a:hover { | |||
@@ -21,6 +21,10 @@ body { | |||
cursor: pointer; | |||
} | |||
a, a:hover, a:active, a:focus { | |||
outline: 0; | |||
} | |||
// transition | |||
a, | |||
.badge, | |||
@@ -13,6 +13,9 @@ | |||
a { | |||
cursor: pointer; | |||
} | |||
a, a:hover, a:active, a:focus { | |||
outline: 0; | |||
} | |||
img { | |||
max-width: 100%; | |||
@@ -232,7 +235,7 @@ fieldset { | |||
} | |||
.page-container { | |||
padding: 0px; | |||
} | |||
.page-header h1, | |||
@@ -251,10 +254,10 @@ fieldset { | |||
.sidebar-item { | |||
/*background-color: #f7f7f7;*/ | |||
border-left: 1px solid #eee; | |||
border-left: 1px solid @border-color; | |||
margin-left: -30px; | |||
padding: 5px 15px; | |||
color: #999; | |||
color: @text-muted; | |||
font-size: 85%; | |||
} | |||
@@ -266,21 +269,7 @@ fieldset { | |||
} | |||
.sidebar-item a { | |||
color: #999; | |||
text-decoration: none; | |||
} | |||
.sidebar-item a:hover, | |||
.sidebar-item a:focus, | |||
.sidebar-item a:active { | |||
color: #333; | |||
text-decoration: none; | |||
/* thanks medium: https://medium.com/designing-medium/crafting-link-underlines-on-medium-7c03a9274f9 */ | |||
background-image: linear-gradient(to bottom, transparent 50%, rgba(153,153,153, 0.5) 50%); | |||
background-repeat: repeat-x; | |||
background-size: 5% 20%; | |||
background-position: 0 100%; | |||
color: @text-muted; | |||
} | |||
.sidebar-item a.active { | |||
@@ -441,7 +430,6 @@ a.active { | |||
.page-breadcrumbs .breadcrumb { | |||
padding: 0px; | |||
margin-bottom: 2px; | |||
background-color: transparent; | |||
border-radius: 0px; | |||
font-size: 85%; | |||
@@ -451,6 +439,10 @@ a.active { | |||
color: inherit; | |||
} | |||
.breadcrumb > .active { | |||
color: @text-muted; | |||
} | |||
@media (min-width: 768px) { | |||
.page-sidebar { | |||
padding-left: 3em; | |||
@@ -486,13 +478,13 @@ a.active { | |||
// links and text | |||
a.grey, .sidebar-section a, .nav-pills a, .control-value a, .data-row a { | |||
a.grey, .nav-pills a, .control-value a, .data-row a { | |||
color: inherit; | |||
border-bottom: 1px solid transparent; | |||
margin-bottom: 0.4em; | |||
} | |||
a.grey:hover, .sidebar-section a:hover, .nav-pills a:hover, .control-value a:hover, .data-row a:hover { | |||
a.grey:hover, .nav-pills a:hover, .control-value a:hover, .data-row a:hover { | |||
border-bottom: 1px solid @grey-link-color; | |||
color: @grey-link-color; | |||
} | |||
@@ -1,9 +1,3 @@ | |||
{% block title %}{{ title }}{% endblock %} | |||
{% block header %} | |||
{{ header }} | |||
{% endblock %} | |||
{% block content %} | |||
<div class="webpage-content"> | |||
{% include "templates/includes/slideshow.html" %} | |||
@@ -6,25 +6,29 @@ from __future__ import unicode_literals | |||
import frappe, os | |||
from frappe.utils import touch_file | |||
def make_boilerplate(dest): | |||
def make_boilerplate(dest, app_name): | |||
if not os.path.exists(dest): | |||
print "Destination directory does not exist" | |||
return | |||
hooks = frappe._dict() | |||
for key in ("App Name", "App Title", "App Description", "App Publisher", | |||
"App Icon", "App Color", "App Email", "App URL", "App License"): | |||
hook_key = key.lower().replace(" ", "_") | |||
hooks.app_name = app_name | |||
app_title = hooks.app_name.replace("_", " ").title() | |||
for key in ("App Title (defaut: {0})".format(app_title), "App Description", "App Publisher", | |||
"App Icon (e.g. 'octicon octicon-zap')", "App Color", "App Email", "App License"): | |||
hook_key = key.split(" (")[0].lower().replace(" ", "_") | |||
hook_val = None | |||
while not hook_val: | |||
hook_val = raw_input(key + ": ") | |||
if hook_key=="app_name" and hook_val.lower().replace(" ", "_") != hook_val: | |||
print "App Name must be all lowercase and without spaces" | |||
hook_val = "" | |||
elif hook_key=="app_title" and not hook_val: | |||
hook_val = app_title | |||
hooks[hook_key] = hook_val | |||
frappe.create_folder(os.path.join(dest, hooks.app_name, hooks.app_name, frappe.scrub(hooks.app_title)), | |||
frappe.create_folder(os.path.join(dest, hooks.app_name, hooks.app_name, hooks.app_title), | |||
with_init=True) | |||
frappe.create_folder(os.path.join(dest, hooks.app_name, hooks.app_name, "templates"), with_init=True) | |||
frappe.create_folder(os.path.join(dest, hooks.app_name, hooks.app_name, "www")) | |||
@@ -93,7 +97,6 @@ app_description = "{app_description}" | |||
app_icon = "{app_icon}" | |||
app_color = "{app_color}" | |||
app_email = "{app_email}" | |||
app_url = "{app_url}" | |||
app_version = "0.0.1" | |||
# Includes in <head> | |||
@@ -49,8 +49,8 @@ class WebPage(WebsiteGenerator): | |||
self.set_metatags(context) | |||
if not context.header: | |||
context.header = self.title | |||
# if not context.header: | |||
# context.header = self.title | |||
# for sidebar | |||
if not context.children: | |||
@@ -199,7 +199,7 @@ $.extend(frappe, { | |||
if(frappe.supports_pjax()) { | |||
// hack for chrome's onload popstate call | |||
window.initial_href = window.location.href | |||
$(document).on("click", "#wrap a", frappe.handle_click); | |||
$(document).on("click", "a", frappe.handle_click); | |||
$(window).on("popstate", function(event) { | |||
// don't run this on hash change | |||
@@ -5,6 +5,7 @@ from __future__ import unicode_literals | |||
import frappe | |||
from frappe.utils import strip_html | |||
from frappe import _ | |||
from frappe.website.utils import scrub_relative_urls | |||
from jinja2.utils import concat | |||
from jinja2 import meta | |||
@@ -36,11 +37,13 @@ def render_blocks(context): | |||
if "title" not in out: | |||
out["title"] = context.get("title") | |||
if "header" not in out and out.get("title"): | |||
out["header"] = out["title"] | |||
if not out.get("header") and "<h1" not in out.get("content", ""): | |||
if out.get("title"): | |||
out["header"] = out["title"] | |||
if out.get("header") and not out["header"].startswith("<h"): | |||
out["header"] = "<h2>" + out["header"] + "</h2>" | |||
out["header"] = "<h1>" + out["header"] + "</h1>" | |||
if "breadcrumbs" not in out: | |||
if context.doc and hasattr(context.doc, "get_parents"): | |||
@@ -64,15 +67,14 @@ def render_blocks(context): | |||
if "{index}" in out.get("content", "") and context.get("children"): | |||
html = frappe.get_template("templates/includes/static_index.html").render({ | |||
"items": context["children"]}) | |||
out["content"] = out["content"].replace("{index}", html) | |||
if "{next}" in out.get("content", ""): | |||
next_item = context.doc.get_next() | |||
if next_item: | |||
if next_item.name[0]!="/": next_item.name = "/" + next_item.name | |||
html = '''<p><br><a href="{name}" class="btn btn-primary"> | |||
{title} <i class="icon-chevron-right"></i></a> | |||
</p>'''.format(**next_item) | |||
html = '<p><br><a href="{name}">'+_("Next")+': {title}</a></p>'.format(**next_item) | |||
out["content"] = out["content"].replace("{next}", html) | |||
if "sidebar" not in out and not out.get("no_sidebar"): | |||
@@ -183,20 +183,19 @@ class WebsiteGenerator(Document): | |||
return self.get(self.parent_website_route_field) | |||
def get_children(self, context=None): | |||
children = [] | |||
if self.get_route()==get_home_page(): | |||
return frappe.db.sql("""select url as name, label as page_title, | |||
children = frappe.db.sql("""select url as name, label as page_title, | |||
1 as public_read from `tabTop Bar Item` where parentfield='sidebar_items' | |||
order by idx""", as_dict=True) | |||
if self.meta.get_field("parent_website_route"): | |||
if not children and self.meta.get_field("parent_website_route"): | |||
children = self.get_children_of(self.get_route()) | |||
if not children and self.parent_website_route: | |||
children = self.get_children_of(self.parent_website_route) | |||
return children | |||
else: | |||
return [] | |||
return children | |||
def get_children_of(self, route): | |||
children = frappe.db.sql("""select name, page_name, | |||