@@ -98,7 +98,6 @@ def install_app(name, verbose=False, set_as_patched=True): | |||
for app in app_hooks.required_apps: | |||
install_app(app) | |||
print "Installing {0}...".format(name) | |||
frappe.flags.in_install = name | |||
frappe.clear_cache() | |||
@@ -106,10 +105,11 @@ def install_app(name, verbose=False, set_as_patched=True): | |||
raise Exception("App not in apps.txt") | |||
if name in installed_apps: | |||
print "Already installed" | |||
frappe.msgprint("App {0} already installed".format(name)) | |||
return | |||
print "Installing {0}...".format(name) | |||
if name != "frappe": | |||
frappe.only_for("System Manager") | |||
@@ -239,13 +239,9 @@ body { | |||
font-size: 16px; | |||
line-height: 1.65em; | |||
} | |||
.navbar { | |||
background-color: #7575ff !important; | |||
} | |||
.navbar a { | |||
font-size: 16px; | |||
font-weight: normal; | |||
color: #fff !important; | |||
} | |||
.breadcrumb { | |||
line-height: 1.5em; | |||
@@ -281,9 +277,10 @@ h2 { | |||
.navbar { | |||
background-color: transparent; | |||
border: none; | |||
padding: 10px 0px; | |||
padding: 15px 0px; | |||
border-radius: 0px; | |||
border-bottom: 1px solid #7575ff; | |||
border-top: 5px solid #7575ff; | |||
border-bottom: 1px solid #d1d8dd; | |||
} | |||
.section { | |||
padding: 30px; | |||
@@ -370,3 +367,9 @@ h2 { | |||
border: 1px solid #d1d8dd; | |||
border-radius: 15px; | |||
} | |||
.screenshot { | |||
border: 2px solid #d1d8dd; | |||
box-shadow: 1px 1px 7px rgba(0, 0, 0, 0.15); | |||
margin: 30px 0px; | |||
max-width: 100%; | |||
} |
@@ -8,12 +8,14 @@ body { | |||
} | |||
.navbar { | |||
background-color: @erpnext-blue !important; | |||
//background-color: @navbar-bg !important; | |||
//background-color: @text-color !important; | |||
// border-bottom: 3px solid @border-color !important; | |||
} | |||
.navbar a { | |||
font-size: 16px; | |||
font-weight: normal; | |||
color: #fff !important; | |||
//color: #fff !important; | |||
} | |||
.breadcrumb { | |||
@@ -49,10 +51,10 @@ h2 { | |||
.navbar { | |||
background-color: transparent; | |||
border: none; | |||
padding: 10px 0px; | |||
padding: 15px 0px; | |||
border-radius: 0px; | |||
border-bottom: 1px solid @erpnext-blue; | |||
border-top: 5px solid @erpnext-blue; | |||
border-bottom: 1px solid @border-color; | |||
} | |||
.section { | |||
@@ -157,3 +159,10 @@ h2 { | |||
border: 1px solid #d1d8dd; | |||
border-radius: 15px; | |||
} | |||
.screenshot { | |||
border: 2px solid @border-color; | |||
box-shadow: 1px 1px 7px rgba(0,0,0,0.15); | |||
margin: 30px 0px; | |||
max-width: 100%; | |||
} |
@@ -9,7 +9,7 @@ | |||
<div class="section" style="padding-top: 0px;"> | |||
<div class="fake-browser-frame"> | |||
<img class="img-responsive browser-image feature-image" | |||
src="img/desktop.png"> | |||
src="assets/img/home.png"> | |||
</div> | |||
</div> | |||
@@ -256,20 +256,21 @@ frappe.ready(function() { | |||
btn: $form.find("[type='submit']"), | |||
callback: function(data) { | |||
if(!data.exc) { | |||
window.saving = false; | |||
if(window.success_message) { | |||
$form.addClass("hide"); | |||
$(".comments, .introduction").addClass("hide"); | |||
scroll(0, 0); | |||
$(".form-message") | |||
.html('{{ success_message }}<p><a href="{{ success_url }}">\ | |||
{{ _("Continue") }}</a></p>') | |||
.removeClass("hide"); | |||
} else { | |||
window.location.href = "{{ success_url }}"; | |||
} | |||
} | |||
} | |||
if(window.success_message) { | |||
$form.addClass("hide"); | |||
$(".comments, .introduction").addClass("hide"); | |||
scroll(0, 0); | |||
$(".form-message") | |||
.html('{{ success_message }}<p><a href="{{ success_url }}">{{ _("Continue") }}</a></p>') | |||
.removeClass("hide"); | |||
} else { | |||
window.location.href = "{{ success_url }}"; | |||
} | |||
} | |||
}, | |||
always: function() { | |||
window.saving = false; | |||
} | |||
}); | |||
return false; | |||
@@ -332,7 +332,6 @@ def get_messages_from_include_files(app_name=None): | |||
"""Returns messages from js files included at time of boot like desk.min.js for desk and web""" | |||
messages = [] | |||
for file in (frappe.get_hooks("app_include_js", app_name=app_name) or []) + (frappe.get_hooks("web_include_js", app_name=app_name) or []): | |||
print os.path.join(frappe.local.sites_path, file) | |||
messages.extend(get_messages_from_file(os.path.join(frappe.local.sites_path, file))) | |||
return messages | |||
@@ -347,8 +346,7 @@ def get_all_messages_from_js_files(app_name=None): | |||
continue | |||
for fname in files: | |||
if fname.endswith(".js"): | |||
print os.path.join(basepath, fname) | |||
if fname.endswith(".js") or fname.endswith(".html"): | |||
messages.extend(get_messages_from_file(os.path.join(basepath, fname))) | |||
return messages | |||
@@ -82,6 +82,9 @@ def make_boilerplate(dest, app_name): | |||
with open(os.path.join(dest, hooks.app_name, hooks.app_name, "config", "desktop.py"), "w") as f: | |||
f.write(encode(desktop_template.format(**hooks))) | |||
with open(os.path.join(dest, hooks.app_name, hooks.app_name, "config", "docs.py"), "w") as f: | |||
f.write(encode(docs_template.format(**hooks))) | |||
print "'{app}' created at {path}".format(app=app_name, path=os.path.join(dest, app_name)) | |||
@@ -254,3 +257,14 @@ gitignore_template = """.DS_Store | |||
*.egg-info | |||
*.swp | |||
tags""" | |||
docs_template = '''""" | |||
Configuration for docs | |||
""" | |||
# source_link = "https://github.com/org/repo" | |||
# docs_base_url = "https://frappe.github.io/repo" | |||
def get_context(context): | |||
context.brand_html = "{app_title}" | |||
''' |
@@ -24,18 +24,19 @@ class setup_docs(object): | |||
def setup_app_context(self): | |||
self.docs_config = frappe.get_module(self.app + ".config.docs") | |||
self.app_context = { | |||
"app": { | |||
"app": frappe._dict({ | |||
"name": self.app, | |||
"title": self.app_title, | |||
"description": markdown2.markdown(self.hooks.get("app_description")[0]), | |||
"version": self.hooks.get("app_version")[0], | |||
"headline": self.hooks.get("app_headline")[0], | |||
"publisher": self.hooks.get("app_publisher")[0], | |||
"icon": self.hooks.get("app_icon")[0], | |||
"email": self.hooks.get("app_email")[0], | |||
"source_link": self.docs_config.source_link, | |||
"docs_base_url": self.docs_config.docs_base_url, | |||
"license": self.hooks.get("app_license")[0] | |||
} | |||
}) | |||
} | |||
def build(self, docs_version): | |||
@@ -116,8 +117,11 @@ class setup_docs(object): | |||
"contents.py")), os.path.join(self.docs_path, "contents.py")) | |||
# install | |||
shutil.copy(os.path.join(frappe.get_app_path("frappe", "templates", "autodoc", | |||
"install.md")), os.path.join(self.docs_path, "install.md")) | |||
html = frappe.render_template("templates/autodoc/install.md", | |||
context = self.app_context) | |||
with open(os.path.join(self.docs_path, "install.md"), "w") as f: | |||
f.write(html) | |||
self.update_index_txt(self.docs_path) | |||
@@ -272,13 +276,15 @@ class setup_docs(object): | |||
print "Writing {0}".format(target_filename) | |||
context.brand_html = context.top_bar_items = context.favicon = None | |||
self.docs_config.get_context(context) | |||
if not context.brand_html: | |||
context.brand_html = self.app_title | |||
if context.docs_icon: | |||
context.brand_html = '<i class="{0}"></i> {1}'.format(context.docs_icon, context.app.title) | |||
else: | |||
context.brand_html = context.app.title | |||
if not context.top_bar_items: | |||
context.top_bar_items = [ | |||
@@ -310,7 +316,16 @@ class setup_docs(object): | |||
# copy assets from docs | |||
source_assets = frappe.get_app_path(self.app, "docs", "assets") | |||
if os.path.exists(source_assets): | |||
shutil.copytree(source_assets, assets_path) | |||
for basepath, folders, files in os.walk(source_assets): | |||
target_basepath = os.path.join(assets_path, os.path.relpath(basepath, source_assets)) | |||
# make the base folder | |||
if not os.path.exists(target_basepath): | |||
os.makedirs(target_basepath) | |||
# copy all files in the current folder | |||
for f in files: | |||
shutil.copy(os.path.join(basepath, f), os.path.join(target_basepath, f)) | |||
# make missing folders | |||
for fname in ("js", "css", "img"): | |||
@@ -123,6 +123,10 @@ $.extend(frappe, { | |||
if(opts.msg && data.message) { | |||
$(opts.msg).html(data.message).toggle(true); | |||
} | |||
if(opts.always) { | |||
opts.always(data); | |||
} | |||
}, | |||
show_message: function(text, icon) { | |||
if(!icon) icon="icon-refresh icon-spin"; | |||
@@ -175,7 +175,7 @@ def get_full_index(doctype="Web Page", base_url = None, extn = False): | |||
all_routes = [] | |||
def get_children(parent): | |||
children = frappe.db.get_all(doctype, ["parent_website_route", "page_name", "title"], | |||
children = frappe.db.get_all(doctype, ["parent_website_route", "page_name", "title", "template_path"], | |||
{"parent_website_route": parent}, order_by="idx asc") | |||
for d in children: | |||
d.url = abs_url(os.path.join(d.parent_website_route or "", d.page_name)) | |||
@@ -186,7 +186,7 @@ def get_full_index(doctype="Web Page", base_url = None, extn = False): | |||
if base_url: | |||
d.url = os.path.join(base_url, d.url) | |||
if extn and not d.children: | |||
if extn and os.path.basename(d.template_path).split(".")[0] != "index": | |||
d.url = d.url + ".html" | |||
# no index.html for home page | |||