added text coloring options for website
This commit is contained in:
		
							parent
							
								
									1aff4c384d
								
							
						
					
					
						commit
						c9977ae7d9
					
				| @ -14,11 +14,14 @@ body { | ||||
| {% if doc.font or doc.google_web_font_for_text %} | ||||
| 	font-family: '{{ doc.google_web_font_for_text or doc.font }}', 'Helvetica Neue', Arial, Sans !important; | ||||
| {% endif %} | ||||
| {% if doc.font_size %} | ||||
| 	font-size: {{ doc.font_size }} !important; | ||||
| {% endif %} | ||||
| 	{% if doc.font_size %}font-size: {{ doc.font_size }} !important;{% endif %} | ||||
| 	{% if doc.page_text %}color: #{{ doc.page_text }};{% endif %} | ||||
| } | ||||
| 
 | ||||
| {% if doc.page_links %}a, a:hover { | ||||
| 	color: #{{ doc.page_links }}; | ||||
| }{% endif %} | ||||
| 
 | ||||
| {% if doc.font_size %} | ||||
| .small { | ||||
| 	font-size: {{ doc.small_font_size }} !important; | ||||
| @ -29,16 +32,17 @@ div.outer { | ||||
| 	background-color: #{{ doc.page_background or "fff" }}; | ||||
| } | ||||
| 
 | ||||
| {% if doc.google_web_font_for_heading or doc.heading_font %} | ||||
| h1, h2, h3, h4, h5 { | ||||
| {% if doc.google_web_font_for_heading or doc.heading_font %}h1, h2, h3, h4, h5 { | ||||
| 	font-family: '{{ doc.google_web_font_for_heading or doc.heading_font }}', 'Helvetica Neue', Arial !important; | ||||
| } | ||||
| {% endif %} | ||||
| {% if doc.heading_text_style %} | ||||
| h1, h2, h3, h4, h5 { | ||||
| }{% endif %} | ||||
| 
 | ||||
| {% if doc.heading_text_style %}h1, h2, h3, h4, h5 { | ||||
| 	text-transform: {{ doc.heading_text_style }}; | ||||
| }	 | ||||
| {% endif %} | ||||
| }{% endif %} | ||||
| 
 | ||||
| {% if doc.page_headings %}h1, h2, h3, h4, h5 { | ||||
| 	color: #{{ doc.page_headings }}; | ||||
| }{% endif %} | ||||
| 
 | ||||
| {% if doc.page_border %} | ||||
| /* Page Border*/ | ||||
|  | ||||
| @ -17,8 +17,9 @@ | ||||
| 
 | ||||
| cur_frm.cscript.onload_post_render = function() { | ||||
| 	wn.require('lib/public/js/lib/jscolor/jscolor.js'); | ||||
| 	cur_frm.fields_dict.background_color.input.className = 'color'; | ||||
| 	cur_frm.fields_dict.page_background.input.className = 'color'; | ||||
| 	cur_frm.fields_dict.top_bar_background.input.className = 'color'; | ||||
| 	$.each(["background_color", "page_background", "page_text", "page_links",  | ||||
| 		"top_bar_background", "top_bar_foreground", "page_headings"], function(i, v) { | ||||
| 		cur_frm.fields_dict[v].input.className = 'color'; | ||||
| 	}) | ||||
| 	jscolor.bind(); | ||||
| } | ||||
| @ -15,7 +15,10 @@ | ||||
| # along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
| 
 | ||||
| from __future__ import unicode_literals | ||||
| import webnotes | ||||
| 
 | ||||
| from webnotes.utils import cint, cstr | ||||
| from webnotes import _ | ||||
| 
 | ||||
| class DocType: | ||||
| 	def __init__(self, d, dl): | ||||
| @ -26,6 +29,8 @@ class DocType: | ||||
| 		from jinja2 import Template | ||||
| 		import os | ||||
| 		 | ||||
| 		self.validate_colors() | ||||
| 		 | ||||
| 		with open(os.path.join( | ||||
| 				os.path.dirname(os.path.abspath(__file__)),  | ||||
| 				'custom_template.css'), 'r') as f: | ||||
| @ -47,6 +52,16 @@ class DocType: | ||||
| 			if f in self.doc.fields: | ||||
| 				del self.doc.fields[f] | ||||
| 	 | ||||
| 	def validate_colors(self): | ||||
| 		if self.doc.page_background==self.doc.page_text: | ||||
| 			webnotes.msgprint(_("Page text and background is same color. Please change."), | ||||
| 				raise_exception=1) | ||||
| 
 | ||||
| 		if self.doc.top_bar_background==self.doc.top_bar_foreground: | ||||
| 			webnotes.msgprint(_("Top Bar text and background is same color. Please change."), | ||||
| 				raise_exception=1) | ||||
| 
 | ||||
| 	 | ||||
| 	def prepare(self): | ||||
| 		if not self.doc.font_size: | ||||
| 			self.doc.font_size = '13px' | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| [ | ||||
|  { | ||||
|   "creation": "2013-01-25 11:35:10",  | ||||
|   "creation": "2013-03-08 11:36:53",  | ||||
|   "docstatus": 0,  | ||||
|   "modified": "2013-03-08 09:58:49",  | ||||
|   "modified": "2013-03-12 11:34:32",  | ||||
|   "modified_by": "Administrator",  | ||||
|   "owner": "Administrator" | ||||
|  },  | ||||
| @ -65,6 +65,24 @@ | ||||
|   "fieldtype": "Data",  | ||||
|   "label": "Page Background" | ||||
|  },  | ||||
|  { | ||||
|   "doctype": "DocField",  | ||||
|   "fieldname": "page_headings",  | ||||
|   "fieldtype": "Data",  | ||||
|   "label": "Page Headings" | ||||
|  },  | ||||
|  { | ||||
|   "doctype": "DocField",  | ||||
|   "fieldname": "page_text",  | ||||
|   "fieldtype": "Data",  | ||||
|   "label": "Page Text" | ||||
|  },  | ||||
|  { | ||||
|   "doctype": "DocField",  | ||||
|   "fieldname": "page_links",  | ||||
|   "fieldtype": "Data",  | ||||
|   "label": "Page Links" | ||||
|  },  | ||||
|  { | ||||
|   "doctype": "DocField",  | ||||
|   "fieldname": "page_border",  | ||||
| @ -88,9 +106,8 @@ | ||||
|   "description": "000 is black, fff is white",  | ||||
|   "doctype": "DocField",  | ||||
|   "fieldname": "top_bar_foreground",  | ||||
|   "fieldtype": "Select",  | ||||
|   "label": "Top Bar Foreground",  | ||||
|   "options": "000\nFFF" | ||||
|   "fieldtype": "Data",  | ||||
|   "label": "Top Bar Text" | ||||
|  },  | ||||
|  { | ||||
|   "doctype": "DocField",  | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user