This commit is contained in:
Rushabh Mehta 2014-02-13 18:51:23 +05:30
commit 0a9ce49711
24 changed files with 81 additions and 68 deletions

View file

@ -105,12 +105,17 @@ def rename_field(doctype, old_fieldname, new_fieldname):
where doctype=%s and field=%s""",
(new_fieldname, doctype, old_fieldname))
else:
# copy field value
webnotes.conn.sql("""update `tab%s` set `%s`=`%s`""" % \
(doctype, new_fieldname, old_fieldname))
# update in property setter
webnotes.conn.sql("""update `tabProperty Setter` set field_name = %s
where doc_type=%s and field_name=%s""", (new_fieldname, doctype, old_fieldname))
update_users_report_view_settings(doctype, old_fieldname)
def update_users_report_view_settings(doctype, ref_fieldname):
import json
user_report_cols = webnotes.conn.sql("""select defkey, defvalue from `tabDefaultValue` where
defkey like '_list_settings:%'""")
@ -118,7 +123,7 @@ def rename_field(doctype, old_fieldname, new_fieldname):
new_columns = []
columns_modified = False
for field, field_doctype in json.loads(value):
if field == old_fieldname and field_doctype == doctype:
if field == ref_fieldname and field_doctype == doctype:
new_columns.append([field, field_doctype])
columns_modified=True
if columns_modified:

View file

@ -36,7 +36,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'FontAwesome';
src: url('../lib/css/font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');
src: url('../webnotes/css/font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');
}
}

View file

@ -1,5 +1,5 @@
wn.make_editable = function(editor, doctype, name, fieldname) {
wn.require("assets/js/editor.min.js");
wn.require("/assets/js/editor.min.js");
WebPageEditor = bsEditor.extend({
onhide: function(action) {
@ -15,7 +15,12 @@ wn.make_editable = function(editor, doctype, name, fieldname) {
this._super(bool);
if(!bool) {
var $edit_btn = $(repl('<li><a href="#"><i class="icon-fixed-width icon-pencil"></i> Edit %(doctype)s</a></li>\
// remove existing web page editor toggles
$('li.editable-toggle + li').remove();
$('li.editable-toggle').remove();
var $edit_btn = $(repl('<li class="editable-toggle">\
<a href="#"><i class="icon-fixed-width icon-pencil"></i>Edit %(doctype)s</a></li>\
<li class="divider"></li>', {doctype: doctype}))
.prependTo($("#website-post-login ul.dropdown-menu"));

View file

@ -43,7 +43,7 @@
<header class="page-header">
<div class="container" data-html-block="header">
{%- if header is defined -%}{{ header }}{% elif title is defined %}<h2>{{ title }}</h2>{%- endif -%}
{%- if header is defined -%}<h2>{{ header }}</h2>{%- endif -%}
</div>
<div class="container">
<div class="row">

View file

@ -1,5 +1,3 @@
{% block title %} {{ title }} {% endblock %}
{% block header %}
<h2 itemprop="name headline" itemscope itemtype="http://schema.org/BlogPost">
{{ title }}
@ -38,5 +36,3 @@ $(function() {
{% endblock %}
{% block footer %}{% include 'templates/includes/blog_footer.html' %}{% endblock %}
{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %}

View file

@ -1,9 +1,3 @@
{% block title %} {{ title }} {% endblock %}
{% block header %}<h2>{{ title }}</h2>{% endblock %}
{% block breadcrumbs %}{% include "templates/includes/breadcrumbs.html" %}{% endblock %}
{% block content %}
<div class="webpage-content">
{# title, breadcrumbs, table of contents #}
@ -48,17 +42,15 @@
<script>
$(function() {
if(window.logged_in && getCookie("system_user")==="yes") {
wn.has_permission("Web Page", "{{ name }}", "write", function(r) {
wn.has_permission("Web Page", "{{ docname }}", "write", function(r) {
wn.require("assets/webnotes/js/wn/website/editable.js");
wn.make_editable($(".web-page-content"), "Web Page", "{{ name }}", "main_section");
wn.make_editable($(".web-page-content"), "Web Page", "{{ docname }}", "main_section");
});
}
});
</script>
{% endblock %}
{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %}
{% block style %}{{ style }}{% endblock %}
{% block script %}{{ script }}{% endblock %}

View file

@ -1,15 +1,10 @@
{% block title %}{{ title }}{% endblock %}
{% block header %}{{ group.group_title }}{% endblock %}
{% block header %}
<h2>{{ group.group_title }}</h2>
{% block content %}
{%- if group.group_description -%}
<p class="lead">{{ group.group_description }}</p>
{%- endif -%}
{% endblock %}
{% block breadcrumbs %}{% include "templates/includes/breadcrumbs.html" %}{% endblock %}
{% block content %}
<ul class="nav nav-tabs view-selector">
{%- for t in views -%}
{% set url = (pathname if t.default else "{}?view={}".format(pathname, t.name)) %}
@ -39,5 +34,3 @@
<script>$(function() { website.toggle_upvote(); });</script>
{% endblock %}
{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %}

View file

@ -1,6 +1,6 @@
<ul class="breadcrumb">
{% for parent in parents or [] %}
<li><a href="/{{ parent.name|lower }}">{{ parent.page_title or parent.title }}</a></li>
<li><a href="{{ parent.name }}">{{ parent.page_title or parent.title or "" }}</a></li>
{% endfor %}
<li class="active">{{ title }}</li>
<li class="active">{{ title or "" }}</li>
</ul>

View file

@ -1,7 +1,5 @@
{% block title %} About Us {% endblock %}
{% block header %}<h2>About Us</h2>{% endblock %}
{% block content %}
<div class="about-content">
{{ obj.doc.company_introduction or """<p>Some Introduction about your company that you would

View file

@ -1,7 +1,5 @@
{% block title %}{{ blog_title or "Blog" }}{% endblock %}
{% block header %}<h2>{{ blog_title or "Blog" }}</h2>{% endblock %}
{% block content %}
<div class="blog-list-content">
{% if blog_introduction %}
@ -26,5 +24,3 @@
{% endblock %}
{% block footer %}{% include 'templates/includes/blog_footer.html' %}{% endblock %}
{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %}

View file

@ -1,7 +1,5 @@
{% block title %}{{ heading or "Contact Us"}}{% endblock %}
{% block header %}<h2>{{ heading or "Contact Us"}}</h2>{% endblock %}
{% block content %}
<div class="contact-content">
<div class="row">

View file

@ -1,5 +1,3 @@
{% block title %} Login {% endblock %}
{% block content %}
<div class="login-content container" style="max-width: 800px;">
<div class="row" style="margin-top: 70px; margin-bottom: 20px">
@ -48,4 +46,6 @@
<script>
{% include "templates/includes/login.js" %}
</script>
{% endblock %}
{% endblock %}
{% block sidebar %}{% endblock %}

View file

@ -7,4 +7,4 @@ import webnotes
def get_context(context):
# get settings from site config
if webnotes.conf.get("fb_app_id"):
return { "fb_app_id": webnotes.conf.fb_app_id }
return { "fb_app_id": webnotes.conf.fb_app_id, "title": "Login" }

View file

@ -1,6 +1,6 @@
{% block title %}{{ title }}{% endblock %}
{% block header %}<h2 class="text-{{ 'success' if success else 'danger'}}">{{ title }}</h2>{% endblock %}
{% block header %}<span class="text-{{ 'success' if success else 'danger'}}">{{ title }}</span>{% endblock %}
{% block content %}
<div class="message-content">

View file

@ -1,14 +1,13 @@
{% if javascript -%}{{ javascript }}{%- endif %}
{% if google_analytics_id -%}
// Google Analytics template
window._gaq = window._gaq || [];
window._gaq.push(['_setAccount', '{{ google_analytics_id }}']);
window._gaq.push(['_trackPageview']);
<!-- Google Analytics -->
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
ga('create', '{{ google_analytics_id }}', 'auto');
ga('send', 'pageview');
<!-- End Google Analytics -->
{%- endif %}

View file

@ -8,7 +8,10 @@ no_sitemap = 1
base_template_path = "templates/pages/website_script.js"
def get_context(context):
return {
"javascript": webnotes.conn.get_value('Website Script', None, 'javascript'),
"google_analytics_id": webnotes.conn.get_value("Website Settings", "Website Settings", "google_analytics_id")
}
script_context = { "javascript": webnotes.conn.get_value('Website Script', None, 'javascript') }
if not webnotes.conf.developer_mode:
script_context["google_analytics_id"] = webnotes.conn.get_value("Website Settings", "Website Settings",
"google_analytics_id")
return script_context

View file

@ -1,7 +1,5 @@
{% block title %} Blog Writers {% endblock %}
{% block header %}<h2>Blog Writers</h2>{% endblock %}
{% block content %}
<div class="writers-content">
{% if writers_introduction %}
@ -15,5 +13,3 @@
{% endblock %}
{% block footer %}{% include "templates/includes/blog_footer.html" %}{% endblock %}
{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %}

View file

@ -1,6 +1,6 @@
<div class="small text-muted post-list-help"></div>
<div class="post-list">
{{ post_list_html }}
{{ post_list_html }}
</div>
<div class="text-center">
<button class="btn btn-default btn-more hide">More</button>

View file

@ -14,7 +14,7 @@ def get_url(params, nonce, secret=None):
return ''.join([webnotes.local.request.url_root, '?', urllib.urlencode(params)])
def get_signature(params, nonce, secret=None):
params = "".join((cstr(p) for p in params))
params = "".join((cstr(p) for p in params.values()))
if not secret:
secret = webnotes.local.conf.get("secret") or "secret"

View file

@ -391,7 +391,7 @@ a.no-decoration {
a.active {
pointer-events: none;
cursor: default;
color: initial;
border-bottom: inherit;
}
.page-breadcrumbs .breadcrumb {

View file

@ -248,11 +248,14 @@ $.extend(wn, {
window.previous_href = href;
history.pushState(null, null, href);
NProgress.start();
$.ajax({ url: href, cache: false }).done(function(data) {
history.replaceState(data, data.title, href);
$("html, body").animate({ scrollTop: 0 }, "slow");
wn.render_json(data);
})
}).always(function() {
NProgress.done();
});
},
render_json: function(data) {
if(data.reload) {
@ -270,6 +273,7 @@ $.extend(wn, {
}
});
if(data.title) $("title").html(data.title);
window.ga && ga('send', 'pageview', location.pathname);
$(document).trigger("page_change");
}
},
@ -429,6 +433,10 @@ $(document).on("page_change", function() {
$(".page-footer").toggleClass("hidden", !!!$(".page-footer").text().trim());
$("[data-html-block='breadcrumbs'] .breadcrumb").toggleClass("hidden",
$("[data-html-block='breadcrumbs']").text().trim()==$("[data-html-block='header']").text().trim());
if(!$(".page-sidebar").hasClass("hidden-xs")) {
$(".toggle-sidebar").trigger("click");
}
// add prive pages to sidebar
if(website.private_pages && $(".page-sidebar").length) {

View file

@ -9,9 +9,18 @@ $.extend(website, {
$('li[data-view="add"]').toggleClass("hide", !website.access.write);
$('li[data-view="settings"]').toggleClass("hide", !website.access.admin);
$('li[data-view="edit"]').toggleClass("hide", website.view!=="edit");
// show message
$(".post-list-help").html(!website.access.write ? "You do not have permission to post" : "");
if(!website.access.write) {
var sid = wn.get_cookie("sid");
if(!sid || sid==="Guest") {
$(".post-list-help").html("Please login to post");
} else {
$(".post-list-help").html("You do not have permission to post");
}
} else {
$(".post-list-help").html("");
}
}
},
setup_pagination: function() {

View file

@ -471,6 +471,21 @@ def render_blocks(context):
_render_blocks(context["template_path"])
# default blocks if not found
if "title" not in out:
out["title"] = context.get("title")
if "header" not in out:
out["header"] = out["title"]
if "breadcrumbs" not in out:
out["breadcrumbs"] = scrub_relative_urls(
webnotes.get_template("templates/includes/breadcrumbs.html").render(context))
if "sidebar" not in out:
out["sidebar"] = scrub_relative_urls(
webnotes.get_template("templates/includes/sidebar.html").render(context))
return out
def scrub_relative_urls(html):

View file

@ -75,7 +75,7 @@ def run(report_name, filters=()):
if report.is_standard=="Yes":
method_name = webnotes.local.module_app[scrub(module)] + "." + scrub(module) \
+ ".report." + scrub(report.name) + "." + scrub(report.name) + ".execute"
columns, result = webnotes.get_attr(method_name)(filters or {})
columns, result = webnotes.get_attr(method_name)(webnotes._dict(filters))
result = get_filtered_data(report.ref_doctype, columns, result)