Browse Source

multiple fixes

version-14
Rushabh Mehta 11 years ago
parent
commit
2ccbbe8c93
8 changed files with 58 additions and 49 deletions
  1. +1
    -0
      frappe/public/css/appframe.css
  2. +5
    -2
      frappe/public/css/bootstrap.css
  3. +14
    -14
      frappe/public/js/frappe/form/comments.js
  4. +12
    -8
      frappe/templates/base.html
  5. +6
    -4
      frappe/templates/includes/breadcrumbs.html
  6. +14
    -12
      frappe/templates/pages/contact.py
  7. +2
    -1
      frappe/templates/pages/desk.html
  8. +4
    -8
      frappe/widgets/form/utils.py

+ 1
- 0
frappe/public/css/appframe.css View File

@@ -29,6 +29,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 7px 0px;
margin: 0px;
}



+ 5
- 2
frappe/public/css/bootstrap.css View File

@@ -1,3 +1,4 @@

/*!
* Bootstrap v3.1.0 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
@@ -5,6 +6,7 @@
*/

/*! normalize.css v3.0.0 | MIT License | git.io/normalize */

html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
@@ -273,9 +275,10 @@ html {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
font-family: Helvetica, Arial, sans-serif;
font-family: "Open Sans", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
line-height: 1.6;
/*line-height: 1.42857143;*/
color: #333;
background-color: #fff;
}


+ 14
- 14
frappe/public/js/frappe/form/comments.js View File

@@ -47,7 +47,7 @@ frappe.ui.form.Comments = Class.extend({
c.image = frappe.user_info(c.comment_by).image;
c.comment_on = dateutil.comment_when(c.creation);
c.fullname = frappe.user_info(c.comment_by).fullname;
$(repl('<div class="comment alert alert-warning col-md-10" data-name="%(name)s">\
<div class="row">\
<div class="col-xs-1">\
@@ -65,13 +65,13 @@ frappe.ui.form.Comments = Class.extend({
me.delete_comment(name);
return false;
})
});
},
add_comment: function(btn) {
var me = this,
txt = me.input.val();
if(txt) {
var comment = {
doctype: "Comment",
@@ -80,17 +80,17 @@ frappe.ui.form.Comments = Class.extend({
comment: txt,
comment_by: user
};
return frappe.call({
method: "frappe.widgets.form.utils.add_comment",
args: {
doclist:[comment]
doc:comment
},
btn: btn,
callback: function(r) {
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.input.val("");
me.refresh();
@@ -109,17 +109,17 @@ frappe.ui.form.Comments = Class.extend({
},
callback: function(r) {
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.frm.toolbar.show_infobar();
}
}
});
});
}
})
})

+ 12
- 8
frappe/templates/base.html View File

@@ -1,4 +1,8 @@
<!DOCTYPE html>
<!--
Built on Frappe.io. Free and Open Source Framework for the Web.
https://frappe.io/apps/frappe
-->
<html lang="en">
<head>
<meta charset="utf-8">
@@ -6,7 +10,7 @@
<title>{{ title }}</title>
<meta name="generator" content="frappe">
<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="icon" href="{{ favicon or "" }}" type="image/x-icon">
{%- block head_include %}{% endblock -%}
@@ -14,15 +18,15 @@
{%- if meta_description is defined %}
<meta name="description" content="{{ meta_description|striptags }}">
{%- endif -%}
{%- for link in web_include_js %}
<script type="text/javascript" src="{{ link }}"></script>
{%- endfor -%}
{%- for link in web_include_css %}
<link type="text/css" rel="stylesheet" href="{{ link }}">
{%- endfor -%}
{%- block style %}
<style data-html-block="style">
{%- if style is defined -%}{{ style }}{%- endif -%}
@@ -37,9 +41,9 @@
<header class="container">{{ banner_html or "" }}</header>
{%- endif %}
{%- endblock -%}
{%- block navbar -%}{% include "templates/includes/navbar.html" %}{%- endblock -%}
<header class="page-header">
<div class="container" data-html-block="header">
{%- if header is defined -%}{{ header }}{%- endif -%}
@@ -79,7 +83,7 @@
<div id="wrap-footer">
{%- block footer -%}{% include "templates/includes/footer.html" %}{%- endblock -%}
</div>
{%- block script %}
<script data-html-block="script">
{%- if script is defined -%}{{ script }}{%- endif -%}
@@ -92,4 +96,4 @@
</script>
{%- endblock -%}
</body>
</html>
</html>

+ 6
- 4
frappe/templates/includes/breadcrumbs.html View File

@@ -1,6 +1,8 @@
<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>
</ul>
{% endif %}
</ul>

+ 14
- 12
frappe/templates/pages/contact.py View File

@@ -1,5 +1,5 @@
# 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

@@ -8,19 +8,21 @@ from frappe.utils import now

def get_context(context):
doc = frappe.get_doc("Contact Us Settings", "Contact Us Settings")
query_options = filter(None, doc.query_options.replace(",", "\n").split()) if \
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 = {
"query_options": query_options
}
out.update(doc.as_dict())
return out
max_communications_per_hour = 300

@frappe.whitelist(allow_guest=True)
@@ -28,21 +30,21 @@ def send_message(subject="Website Query", message="", sender=""):
if not message:
frappe.response["message"] = 'Please write something'
return
if not sender:
frappe.response["message"] = 'Email Id Required'
return
# guest method, cap max writes per hour
if frappe.db.sql("""select count(*) from `tabCommunication`
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"
return
# send email
forward_to_email = frappe.db.get_value("Contact Us Settings", None, "forward_to_email")
if forward_to_email:
from frappe.utils.email_lib import sendmail
sendmail(forward_to_email, sender, message, subject)
return "okay"
return "okay"

+ 2
- 1
frappe/templates/pages/desk.html View File

@@ -4,6 +4,7 @@
<title>Frappe Desk</title>
<meta name="author" content="">
<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="icon" href="images/favicon.ico" type="image/x-icon">
{% for include in include_css -%}
@@ -26,4 +27,4 @@
{% for include in include_js -%}
<script type="text/javascript" src="{{ include }}"></script>
{%- endfor -%}
</body>
</body>

+ 4
- 8
frappe/widgets/form/utils.py View File

@@ -54,16 +54,12 @@ def validate_link():
frappe.response['message'] = 'Ok'

@frappe.whitelist()
def add_comment(doclist):
def add_comment(doc):
"""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()
def get_next(doctype, name, prev):


Loading…
Cancel
Save