Pārlūkot izejas kodu

[message.html] separate title and header

version-14
Rushabh Mehta pirms 10 gadiem
vecāks
revīzija
7ab5c17f7a
5 mainītis faili ar 17 papildinājumiem un 8 dzēšanām
  1. +2
    -0
      frappe/public/js/frappe/form/control.js
  2. +1
    -1
      frappe/templates/pages/message.html
  3. +6
    -3
      frappe/templates/pages/message.py
  4. +4
    -0
      frappe/utils/__init__.py
  5. +4
    -4
      frappe/website/doctype/blog_post/blog_post.py

+ 2
- 0
frappe/public/js/frappe/form/control.js Parādīt failu

@@ -961,6 +961,7 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
target: this,
txt: this.get_value()
});
return false;
},
new_doc: function() {
var doctype = this.get_options();
@@ -970,6 +971,7 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
} else {
new_doc(doctype, {"name_field": this.get_value()});
}
return false;
},
setup_autocomplete: function() {
var me = this;


+ 1
- 1
frappe/templates/pages/message.html Parādīt failu

@@ -1,6 +1,6 @@
{% block title %}{{ title }}{% endblock %}

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

{% block content %}
<!-- no-sidebar -->


+ 6
- 3
frappe/templates/pages/message.py Parādīt failu

@@ -1,18 +1,21 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# MIT License. See license.txt

from __future__ import unicode_literals
import frappe

from frappe.utils import strip_html_tags

no_cache = 1
no_sitemap = 1

def get_context(context):
message_context = {}
if hasattr(frappe.local, "message"):
message_context["title"] = frappe.local.message_title
message_context["header"] = frappe.local.message_title
message_context["title"] = strip_html_tags(frappe.local.message_title)
message_context["message"] = frappe.local.message
if hasattr(frappe.local, "message_success"):
message_context["success"] = frappe.local.message_success
return message_context

+ 4
- 0
frappe/utils/__init__.py Parādīt failu

@@ -147,6 +147,10 @@ def remove_blanks(d):

return d

def strip_html_tags(text):
"""Remove html tags from text"""
return re.sub("\<[^>]*\>", "", text)

def pprint_dict(d, level=1, no_blanks=True):
"""
Pretty print a dictionary with indents


+ 4
- 4
frappe/website/doctype/blog_post/blog_post.py Parādīt failu

@@ -3,11 +3,11 @@

from __future__ import unicode_literals

import frappe, re
import frappe
from frappe import _
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
from frappe.utils import today, cint, global_date_format, get_fullname
from frappe.utils import today, cint, global_date_format, get_fullname, strip_html_tags
from frappe.website.utils import find_first_image, get_comment_list
from markdown2 import markdown

@@ -29,7 +29,7 @@ class BlogPost(WebsiteGenerator):

if not self.blog_intro:
self.blog_intro = self.content[:140]
self.blog_intro = re.sub("\<[^>]*\>", "", self.blog_intro)
self.blog_intro = strip_html_tags(self.blog_intro)

if self.blog_intro:
self.blog_intro = self.blog_intro[:140]
@@ -157,7 +157,7 @@ def get_blog_list(doctype, txt=None, filters=None, limit_start=0, limit_page_len

for post in posts:
post.published = global_date_format(post.creation)
post.content = re.sub('\<[^>]*\>', '', post.content[:140])
post.content = strip_html_tags(post.content[:140])
if not post.comments:
post.comment_text = _('No comments yet')
elif post.comments==1:


Notiek ielāde…
Atcelt
Saglabāt