Bläddra i källkod

[website] style fixes

version-14
Rushabh Mehta 10 år sedan
förälder
incheckning
ae78f98d56
11 ändrade filer med 65 tillägg och 69 borttagningar
  1. +3
    -4
      frappe/cli.py
  2. +6
    -0
      frappe/public/css/desk.css
  3. +15
    -18
      frappe/public/css/website.css
  4. +4
    -0
      frappe/public/less/desk.less
  5. +13
    -21
      frappe/public/less/website.less
  6. +0
    -6
      frappe/templates/generators/web_page.html
  7. +9
    -6
      frappe/utils/boilerplate.py
  8. +2
    -2
      frappe/website/doctype/web_page/web_page.py
  9. +1
    -1
      frappe/website/js/website.js
  10. +8
    -6
      frappe/website/template.py
  11. +4
    -5
      frappe/website/website_generator.py

+ 3
- 4
frappe/cli.py Visa fil

@@ -29,7 +29,6 @@ def main():
sites_path = parsed_args.get("sites_path") sites_path = parsed_args.get("sites_path")


if not parsed_args.get("make_app"): if not parsed_args.get("make_app"):

if parsed_args.get("site")=="all": if parsed_args.get("site")=="all":
for site in get_sites(parsed_args["sites_path"]): for site in get_sites(parsed_args["sites_path"]):
print "\nRunning", fn, "for", site print "\nRunning", fn, "for", site
@@ -131,7 +130,7 @@ def setup_parser():
return parser.parse_args() return parser.parse_args()


def setup_install(parser): 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") help="Make a new application with boilerplate")
parser.add_argument("--install", metavar="DB-NAME", nargs=1, parser.add_argument("--install", metavar="DB-NAME", nargs=1,
help="Install a new db") help="Install a new db")
@@ -296,9 +295,9 @@ def setup_translation(parser):


# methods # methods
@cmd @cmd
def make_app(destination):
def make_app(destination, app_name):
from frappe.utils.boilerplate import make_boilerplate from frappe.utils.boilerplate import make_boilerplate
make_boilerplate(destination)
make_boilerplate(destination, app_name)


@cmd @cmd
def use(sites_path): def use(sites_path):


+ 6
- 0
frappe/public/css/desk.css Visa fil

@@ -16,6 +16,12 @@ body {
cursor: pointer; cursor: pointer;
} }
a, a,
a:hover,
a:active,
a:focus {
outline: 0;
}
a,
.badge, .badge,
.ui-menu .ui-menu-item { .ui-menu .ui-menu-item {
-webkit-transition: 0.2s; -webkit-transition: 0.2s;


+ 15
- 18
frappe/public/css/website.css Visa fil

@@ -10,6 +10,12 @@
a { a {
cursor: pointer; cursor: pointer;
} }
a,
a:hover,
a:active,
a:focus {
outline: 0;
}
img { img {
max-width: 100%; max-width: 100%;
} }
@@ -198,6 +204,9 @@ fieldset {
margin-bottom: 20px; margin-bottom: 20px;
padding: 25px 0px; padding: 25px 0px;
} }
.page-container {
padding: 0px;
}
.page-header h1, .page-header h1,
.page-header h2, .page-header h2,
.page-header h3 { .page-header h3 {
@@ -208,10 +217,10 @@ fieldset {
} }
.sidebar-item { .sidebar-item {
/*background-color: #f7f7f7;*/ /*background-color: #f7f7f7;*/
border-left: 1px solid #eee;
border-left: 1px solid #d1d8dd;
margin-left: -30px; margin-left: -30px;
padding: 5px 15px; padding: 5px 15px;
color: #999;
color: #8d99a6;
font-size: 85%; font-size: 85%;
} }
.sidebar-item:first-child { .sidebar-item:first-child {
@@ -221,19 +230,7 @@ fieldset {
padding-bottom: 10px; padding-bottom: 10px;
} }
.sidebar-item a { .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 { .sidebar-item a.active {
color: #000; color: #000;
@@ -364,7 +361,6 @@ a.active {
} }
.page-breadcrumbs .breadcrumb { .page-breadcrumbs .breadcrumb {
padding: 0px; padding: 0px;
margin-bottom: 2px;
background-color: transparent; background-color: transparent;
border-radius: 0px; border-radius: 0px;
font-size: 85%; font-size: 85%;
@@ -372,6 +368,9 @@ a.active {
.breadcrumb a { .breadcrumb a {
color: inherit; color: inherit;
} }
.breadcrumb > .active {
color: #8d99a6;
}
@media (min-width: 768px) { @media (min-width: 768px) {
.page-sidebar { .page-sidebar {
padding-left: 3em; padding-left: 3em;
@@ -399,7 +398,6 @@ a.active {
padding-left: 30px; padding-left: 30px;
} }
a.grey, a.grey,
.sidebar-section a,
.nav-pills a, .nav-pills a,
.control-value a, .control-value a,
.data-row a { .data-row a {
@@ -408,7 +406,6 @@ a.grey,
margin-bottom: 0.4em; margin-bottom: 0.4em;
} }
a.grey:hover, a.grey:hover,
.sidebar-section a:hover,
.nav-pills a:hover, .nav-pills a:hover,
.control-value a:hover, .control-value a:hover,
.data-row a:hover { .data-row a:hover {


+ 4
- 0
frappe/public/less/desk.less Visa fil

@@ -21,6 +21,10 @@ body {
cursor: pointer; cursor: pointer;
} }


a, a:hover, a:active, a:focus {
outline: 0;
}

// transition // transition
a, a,
.badge, .badge,


+ 13
- 21
frappe/public/less/website.less Visa fil

@@ -13,6 +13,9 @@
a { a {
cursor: pointer; cursor: pointer;
} }
a, a:hover, a:active, a:focus {
outline: 0;
}


img { img {
max-width: 100%; max-width: 100%;
@@ -232,7 +235,7 @@ fieldset {
} }


.page-container { .page-container {
padding: 0px;
} }


.page-header h1, .page-header h1,
@@ -251,10 +254,10 @@ fieldset {


.sidebar-item { .sidebar-item {
/*background-color: #f7f7f7;*/ /*background-color: #f7f7f7;*/
border-left: 1px solid #eee;
border-left: 1px solid @border-color;
margin-left: -30px; margin-left: -30px;
padding: 5px 15px; padding: 5px 15px;
color: #999;
color: @text-muted;
font-size: 85%; font-size: 85%;
} }


@@ -266,21 +269,7 @@ fieldset {
} }


.sidebar-item a { .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 { .sidebar-item a.active {
@@ -441,7 +430,6 @@ a.active {


.page-breadcrumbs .breadcrumb { .page-breadcrumbs .breadcrumb {
padding: 0px; padding: 0px;
margin-bottom: 2px;
background-color: transparent; background-color: transparent;
border-radius: 0px; border-radius: 0px;
font-size: 85%; font-size: 85%;
@@ -451,6 +439,10 @@ a.active {
color: inherit; color: inherit;
} }


.breadcrumb > .active {
color: @text-muted;
}

@media (min-width: 768px) { @media (min-width: 768px) {
.page-sidebar { .page-sidebar {
padding-left: 3em; padding-left: 3em;
@@ -486,13 +478,13 @@ a.active {


// links and text // 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; color: inherit;
border-bottom: 1px solid transparent; border-bottom: 1px solid transparent;
margin-bottom: 0.4em; 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; border-bottom: 1px solid @grey-link-color;
color: @grey-link-color; color: @grey-link-color;
} }


+ 0
- 6
frappe/templates/generators/web_page.html Visa fil

@@ -1,9 +1,3 @@
{% block title %}{{ title }}{% endblock %}

{% block header %}
{{ header }}
{% endblock %}

{% block content %} {% block content %}
<div class="webpage-content"> <div class="webpage-content">
{% include "templates/includes/slideshow.html" %} {% include "templates/includes/slideshow.html" %}


+ 9
- 6
frappe/utils/boilerplate.py Visa fil

@@ -6,25 +6,29 @@ from __future__ import unicode_literals
import frappe, os import frappe, os
from frappe.utils import touch_file from frappe.utils import touch_file


def make_boilerplate(dest):
def make_boilerplate(dest, app_name):
if not os.path.exists(dest): if not os.path.exists(dest):
print "Destination directory does not exist" print "Destination directory does not exist"
return return


hooks = frappe._dict() 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 hook_val = None
while not hook_val: while not hook_val:
hook_val = raw_input(key + ": ") hook_val = raw_input(key + ": ")
if hook_key=="app_name" and hook_val.lower().replace(" ", "_") != hook_val: if hook_key=="app_name" and hook_val.lower().replace(" ", "_") != hook_val:
print "App Name must be all lowercase and without spaces" print "App Name must be all lowercase and without spaces"
hook_val = "" hook_val = ""
elif hook_key=="app_title" and not hook_val:
hook_val = app_title


hooks[hook_key] = hook_val 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) 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, "templates"), with_init=True)
frappe.create_folder(os.path.join(dest, hooks.app_name, hooks.app_name, "www")) 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_icon = "{app_icon}"
app_color = "{app_color}" app_color = "{app_color}"
app_email = "{app_email}" app_email = "{app_email}"
app_url = "{app_url}"
app_version = "0.0.1" app_version = "0.0.1"


# Includes in <head> # Includes in <head>


+ 2
- 2
frappe/website/doctype/web_page/web_page.py Visa fil

@@ -49,8 +49,8 @@ class WebPage(WebsiteGenerator):


self.set_metatags(context) self.set_metatags(context)


if not context.header:
context.header = self.title
# if not context.header:
# context.header = self.title


# for sidebar # for sidebar
if not context.children: if not context.children:


+ 1
- 1
frappe/website/js/website.js Visa fil

@@ -199,7 +199,7 @@ $.extend(frappe, {
if(frappe.supports_pjax()) { if(frappe.supports_pjax()) {
// hack for chrome's onload popstate call // hack for chrome's onload popstate call
window.initial_href = window.location.href 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) { $(window).on("popstate", function(event) {
// don't run this on hash change // don't run this on hash change


+ 8
- 6
frappe/website/template.py Visa fil

@@ -5,6 +5,7 @@ from __future__ import unicode_literals
import frappe import frappe


from frappe.utils import strip_html from frappe.utils import strip_html
from frappe import _
from frappe.website.utils import scrub_relative_urls from frappe.website.utils import scrub_relative_urls
from jinja2.utils import concat from jinja2.utils import concat
from jinja2 import meta from jinja2 import meta
@@ -36,11 +37,13 @@ def render_blocks(context):
if "title" not in out: if "title" not in out:
out["title"] = context.get("title") 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"): 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 "breadcrumbs" not in out:
if context.doc and hasattr(context.doc, "get_parents"): 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"): if "{index}" in out.get("content", "") and context.get("children"):
html = frappe.get_template("templates/includes/static_index.html").render({ html = frappe.get_template("templates/includes/static_index.html").render({
"items": context["children"]}) "items": context["children"]})

out["content"] = out["content"].replace("{index}", html) out["content"] = out["content"].replace("{index}", html)


if "{next}" in out.get("content", ""): if "{next}" in out.get("content", ""):
next_item = context.doc.get_next() next_item = context.doc.get_next()
if next_item: if next_item:
if next_item.name[0]!="/": next_item.name = "/" + next_item.name 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) out["content"] = out["content"].replace("{next}", html)


if "sidebar" not in out and not out.get("no_sidebar"): if "sidebar" not in out and not out.get("no_sidebar"):


+ 4
- 5
frappe/website/website_generator.py Visa fil

@@ -183,20 +183,19 @@ class WebsiteGenerator(Document):
return self.get(self.parent_website_route_field) return self.get(self.parent_website_route_field)


def get_children(self, context=None): def get_children(self, context=None):
children = []
if self.get_route()==get_home_page(): 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' 1 as public_read from `tabTop Bar Item` where parentfield='sidebar_items'
order by idx""", as_dict=True) 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()) children = self.get_children_of(self.get_route())


if not children and self.parent_website_route: if not children and self.parent_website_route:
children = self.get_children_of(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): def get_children_of(self, route):
children = frappe.db.sql("""select name, page_name, children = frappe.db.sql("""select name, page_name,


Laddar…
Avbryt
Spara