@@ -29,6 +29,7 @@ | |||||
white-space: nowrap; | white-space: nowrap; | ||||
overflow: hidden; | overflow: hidden; | ||||
text-overflow: ellipsis; | text-overflow: ellipsis; | ||||
padding: 7px 0px; | |||||
margin: 0px; | margin: 0px; | ||||
} | } | ||||
@@ -1,3 +1,4 @@ | |||||
/*! | /*! | ||||
* Bootstrap v3.1.0 (http://getbootstrap.com) | * Bootstrap v3.1.0 (http://getbootstrap.com) | ||||
* Copyright 2011-2014 Twitter, Inc. | * Copyright 2011-2014 Twitter, Inc. | ||||
@@ -5,6 +6,7 @@ | |||||
*/ | */ | ||||
/*! normalize.css v3.0.0 | MIT License | git.io/normalize */ | /*! normalize.css v3.0.0 | MIT License | git.io/normalize */ | ||||
html { | html { | ||||
font-family: sans-serif; | font-family: sans-serif; | ||||
-webkit-text-size-adjust: 100%; | -webkit-text-size-adjust: 100%; | ||||
@@ -273,9 +275,10 @@ html { | |||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); | ||||
} | } | ||||
body { | body { | ||||
font-family: Helvetica, Arial, sans-serif; | |||||
font-family: "Open Sans", Helvetica, Arial, sans-serif; | |||||
font-size: 14px; | font-size: 14px; | ||||
line-height: 1.42857143; | |||||
line-height: 1.6; | |||||
/*line-height: 1.42857143;*/ | |||||
color: #333; | color: #333; | ||||
background-color: #fff; | background-color: #fff; | ||||
} | } | ||||
@@ -47,7 +47,7 @@ frappe.ui.form.Comments = Class.extend({ | |||||
c.image = frappe.user_info(c.comment_by).image; | c.image = frappe.user_info(c.comment_by).image; | ||||
c.comment_on = dateutil.comment_when(c.creation); | c.comment_on = dateutil.comment_when(c.creation); | ||||
c.fullname = frappe.user_info(c.comment_by).fullname; | c.fullname = frappe.user_info(c.comment_by).fullname; | ||||
$(repl('<div class="comment alert alert-warning col-md-10" data-name="%(name)s">\ | $(repl('<div class="comment alert alert-warning col-md-10" data-name="%(name)s">\ | ||||
<div class="row">\ | <div class="row">\ | ||||
<div class="col-xs-1">\ | <div class="col-xs-1">\ | ||||
@@ -65,13 +65,13 @@ frappe.ui.form.Comments = Class.extend({ | |||||
me.delete_comment(name); | me.delete_comment(name); | ||||
return false; | return false; | ||||
}) | }) | ||||
}); | }); | ||||
}, | }, | ||||
add_comment: function(btn) { | add_comment: function(btn) { | ||||
var me = this, | var me = this, | ||||
txt = me.input.val(); | txt = me.input.val(); | ||||
if(txt) { | if(txt) { | ||||
var comment = { | var comment = { | ||||
doctype: "Comment", | doctype: "Comment", | ||||
@@ -80,17 +80,17 @@ frappe.ui.form.Comments = Class.extend({ | |||||
comment: txt, | comment: txt, | ||||
comment_by: user | comment_by: user | ||||
}; | }; | ||||
return frappe.call({ | return frappe.call({ | ||||
method: "frappe.widgets.form.utils.add_comment", | method: "frappe.widgets.form.utils.add_comment", | ||||
args: { | args: { | ||||
doclist:[comment] | |||||
doc:comment | |||||
}, | }, | ||||
btn: btn, | btn: btn, | ||||
callback: function(r) { | callback: function(r) { | ||||
if(!r.exc) { | if(!r.exc) { | ||||
me.frm.get_docinfo().comments = | |||||
r.message.concat(me.get_comments()); | |||||
me.frm.get_docinfo().comments = | |||||
[r.message].concat(me.get_comments()); | |||||
me.frm.toolbar.show_infobar(); | me.frm.toolbar.show_infobar(); | ||||
me.input.val(""); | me.input.val(""); | ||||
me.refresh(); | me.refresh(); | ||||
@@ -109,17 +109,17 @@ frappe.ui.form.Comments = Class.extend({ | |||||
}, | }, | ||||
callback: function(r) { | callback: function(r) { | ||||
if(!r.exc) { | if(!r.exc) { | ||||
me.frm.get_docinfo().comments = | |||||
$.map(me.frm.get_docinfo().comments, | |||||
function(v) { | |||||
if(v.name==name) return null; | |||||
else return v; | |||||
me.frm.get_docinfo().comments = | |||||
$.map(me.frm.get_docinfo().comments, | |||||
function(v) { | |||||
if(v.name==name) return null; | |||||
else return v; | |||||
} | } | ||||
); | ); | ||||
me.refresh(); | me.refresh(); | ||||
me.frm.toolbar.show_infobar(); | me.frm.toolbar.show_infobar(); | ||||
} | } | ||||
} | } | ||||
}); | |||||
}); | |||||
} | } | ||||
}) | |||||
}) |
@@ -1,4 +1,8 @@ | |||||
<!DOCTYPE html> | <!DOCTYPE html> | ||||
<!-- | |||||
Built on Frappe.io. Free and Open Source Framework for the Web. | |||||
https://frappe.io/apps/frappe | |||||
--> | |||||
<html lang="en"> | <html lang="en"> | ||||
<head> | <head> | ||||
<meta charset="utf-8"> | <meta charset="utf-8"> | ||||
@@ -6,7 +10,7 @@ | |||||
<title>{{ title }}</title> | <title>{{ title }}</title> | ||||
<meta name="generator" content="frappe"> | <meta name="generator" content="frappe"> | ||||
<script type="text/javascript" src="/assets/frappe/js/lib/jquery/jquery.min.js"></script> | <script type="text/javascript" src="/assets/frappe/js/lib/jquery/jquery.min.js"></script> | ||||
<link rel="shortcut icon" href="{{ favicon or "" }}" type="image/x-icon"> | <link rel="shortcut icon" href="{{ favicon or "" }}" type="image/x-icon"> | ||||
<link rel="icon" href="{{ favicon or "" }}" type="image/x-icon"> | <link rel="icon" href="{{ favicon or "" }}" type="image/x-icon"> | ||||
{%- block head_include %}{% endblock -%} | {%- block head_include %}{% endblock -%} | ||||
@@ -14,15 +18,15 @@ | |||||
{%- if meta_description is defined %} | {%- if meta_description is defined %} | ||||
<meta name="description" content="{{ meta_description|striptags }}"> | <meta name="description" content="{{ meta_description|striptags }}"> | ||||
{%- endif -%} | {%- endif -%} | ||||
{%- for link in web_include_js %} | {%- for link in web_include_js %} | ||||
<script type="text/javascript" src="{{ link }}"></script> | <script type="text/javascript" src="{{ link }}"></script> | ||||
{%- endfor -%} | {%- endfor -%} | ||||
{%- for link in web_include_css %} | {%- for link in web_include_css %} | ||||
<link type="text/css" rel="stylesheet" href="{{ link }}"> | <link type="text/css" rel="stylesheet" href="{{ link }}"> | ||||
{%- endfor -%} | {%- endfor -%} | ||||
{%- block style %} | {%- block style %} | ||||
<style data-html-block="style"> | <style data-html-block="style"> | ||||
{%- if style is defined -%}{{ style }}{%- endif -%} | {%- if style is defined -%}{{ style }}{%- endif -%} | ||||
@@ -37,9 +41,9 @@ | |||||
<header class="container">{{ banner_html or "" }}</header> | <header class="container">{{ banner_html or "" }}</header> | ||||
{%- endif %} | {%- endif %} | ||||
{%- endblock -%} | {%- endblock -%} | ||||
{%- block navbar -%}{% include "templates/includes/navbar.html" %}{%- endblock -%} | {%- block navbar -%}{% include "templates/includes/navbar.html" %}{%- endblock -%} | ||||
<header class="page-header"> | <header class="page-header"> | ||||
<div class="container" data-html-block="header"> | <div class="container" data-html-block="header"> | ||||
{%- if header is defined -%}{{ header }}{%- endif -%} | {%- if header is defined -%}{{ header }}{%- endif -%} | ||||
@@ -79,7 +83,7 @@ | |||||
<div id="wrap-footer"> | <div id="wrap-footer"> | ||||
{%- block footer -%}{% include "templates/includes/footer.html" %}{%- endblock -%} | {%- block footer -%}{% include "templates/includes/footer.html" %}{%- endblock -%} | ||||
</div> | </div> | ||||
{%- block script %} | {%- block script %} | ||||
<script data-html-block="script"> | <script data-html-block="script"> | ||||
{%- if script is defined -%}{{ script }}{%- endif -%} | {%- if script is defined -%}{{ script }}{%- endif -%} | ||||
@@ -92,4 +96,4 @@ | |||||
</script> | </script> | ||||
{%- endblock -%} | {%- endblock -%} | ||||
</body> | </body> | ||||
</html> | |||||
</html> |
@@ -1,6 +1,8 @@ | |||||
<ul class="breadcrumb"> | <ul class="breadcrumb"> | ||||
{% for parent in parents or [] %} | |||||
<li><a href="{{ parent.name }}">{{ parent.page_title or parent.title or "" }}</a></li> | |||||
{% endfor %} | |||||
{% if parents|length > 0 %} | |||||
{% for parent in parents %} | |||||
<li><a href="{{ parent.name }}">{{ parent.page_title or parent.title or "" }}</a></li> | |||||
{% endfor %} | |||||
<li class="active">{{ title or "" }}</li> | <li class="active">{{ title or "" }}</li> | ||||
</ul> | |||||
{% endif %} | |||||
</ul> |
@@ -1,5 +1,5 @@ | |||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | ||||
# MIT License. See license.txt | |||||
# MIT License. See license.txt | |||||
from __future__ import unicode_literals | from __future__ import unicode_literals | ||||
@@ -8,19 +8,21 @@ from frappe.utils import now | |||||
def get_context(context): | def get_context(context): | ||||
doc = frappe.get_doc("Contact Us Settings", "Contact Us Settings") | doc = frappe.get_doc("Contact Us Settings", "Contact Us Settings") | ||||
query_options = filter(None, doc.query_options.replace(",", "\n").split()) if \ | query_options = filter(None, doc.query_options.replace(",", "\n").split()) if \ | ||||
doc.query_options else ["Sales", "Support", "General"] | doc.query_options else ["Sales", "Support", "General"] | ||||
address = frappe.get_doc("Address", doc.address) if doc.address else None | |||||
address = None | |||||
if doc.get("address"): | |||||
address = frappe.get_doc("Address", doc.address) | |||||
out = { | out = { | ||||
"query_options": query_options | "query_options": query_options | ||||
} | } | ||||
out.update(doc.as_dict()) | out.update(doc.as_dict()) | ||||
return out | return out | ||||
max_communications_per_hour = 300 | max_communications_per_hour = 300 | ||||
@frappe.whitelist(allow_guest=True) | @frappe.whitelist(allow_guest=True) | ||||
@@ -28,21 +30,21 @@ def send_message(subject="Website Query", message="", sender=""): | |||||
if not message: | if not message: | ||||
frappe.response["message"] = 'Please write something' | frappe.response["message"] = 'Please write something' | ||||
return | return | ||||
if not sender: | if not sender: | ||||
frappe.response["message"] = 'Email Id Required' | frappe.response["message"] = 'Email Id Required' | ||||
return | return | ||||
# guest method, cap max writes per hour | # guest method, cap max writes per hour | ||||
if frappe.db.sql("""select count(*) from `tabCommunication` | if frappe.db.sql("""select count(*) from `tabCommunication` | ||||
where TIMEDIFF(%s, modified) < '01:00:00'""", now())[0][0] > max_communications_per_hour: | where TIMEDIFF(%s, modified) < '01:00:00'""", now())[0][0] > max_communications_per_hour: | ||||
frappe.response["message"] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later" | frappe.response["message"] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later" | ||||
return | return | ||||
# send email | # send email | ||||
forward_to_email = frappe.db.get_value("Contact Us Settings", None, "forward_to_email") | forward_to_email = frappe.db.get_value("Contact Us Settings", None, "forward_to_email") | ||||
if forward_to_email: | if forward_to_email: | ||||
from frappe.utils.email_lib import sendmail | from frappe.utils.email_lib import sendmail | ||||
sendmail(forward_to_email, sender, message, subject) | sendmail(forward_to_email, sender, message, subject) | ||||
return "okay" | |||||
return "okay" |
@@ -4,6 +4,7 @@ | |||||
<title>Frappe Desk</title> | <title>Frappe Desk</title> | ||||
<meta name="author" content=""> | <meta name="author" content=""> | ||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'> | |||||
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> | <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> | ||||
<link rel="icon" href="images/favicon.ico" type="image/x-icon"> | <link rel="icon" href="images/favicon.ico" type="image/x-icon"> | ||||
{% for include in include_css -%} | {% for include in include_css -%} | ||||
@@ -26,4 +27,4 @@ | |||||
{% for include in include_js -%} | {% for include in include_js -%} | ||||
<script type="text/javascript" src="{{ include }}"></script> | <script type="text/javascript" src="{{ include }}"></script> | ||||
{%- endfor -%} | {%- endfor -%} | ||||
</body> | |||||
</body> |
@@ -54,16 +54,12 @@ def validate_link(): | |||||
frappe.response['message'] = 'Ok' | frappe.response['message'] = 'Ok' | ||||
@frappe.whitelist() | @frappe.whitelist() | ||||
def add_comment(doclist): | |||||
def add_comment(doc): | |||||
"""allow any logged user to post a comment""" | """allow any logged user to post a comment""" | ||||
doclist = json.loads(doclist) | |||||
doc = frappe.get_doc(json.loads(doc)) | |||||
doc.insert(ignore_permissions = True) | |||||
doclist[0]["__islocal"] = 1 | |||||
doclistobj = frappe.get_doc(doclist) | |||||
doclistobj.ignore_permissions = True | |||||
doclistobj.save() | |||||
return doclistobj.as_dict() | |||||
return doc.as_dict() | |||||
@frappe.whitelist() | @frappe.whitelist() | ||||
def get_next(doctype, name, prev): | def get_next(doctype, name, prev): | ||||