fix to boilerplate, added Core module for Administrator and fixed layout in ControlImage in control.js

This commit is contained in:
Rushabh Mehta 2014-05-06 17:17:40 +05:30
parent 49de172a6d
commit 2f926f0136
9 changed files with 55 additions and 35 deletions

View file

@ -2,42 +2,48 @@ from frappe import _
data = {
"Calendar": {
"color": "#2980b9",
"icon": "icon-calendar",
"label": _("Calendar"),
"link": "Calendar/Event",
"color": "#2980b9",
"icon": "icon-calendar",
"label": _("Calendar"),
"link": "Calendar/Event",
"type": "view"
},
},
"Messages": {
"color": "#9b59b6",
"icon": "icon-comments",
"label": _("Messages"),
"link": "messages",
"color": "#9b59b6",
"icon": "icon-comments",
"label": _("Messages"),
"link": "messages",
"type": "page"
},
},
"To Do": {
"color": "#f1c40f",
"icon": "icon-check",
"label": _("To Do"),
"color": "#f1c40f",
"icon": "icon-check",
"label": _("To Do"),
"link": "List/ToDo",
"doctype": "ToDo",
"type": "list"
},
},
"Website": {
"color": "#16a085",
"icon": "icon-globe",
"color": "#16a085",
"icon": "icon-globe",
"type": "module"
},
"Installer": {
"color": "#888",
"icon": "icon-download",
"link": "applications",
"color": "#888",
"icon": "icon-download",
"link": "applications",
"type": "page",
"label": _("Installer")
},
"Setup": {
"color": "#bdc3c7",
"icon": "icon-wrench",
"color": "#bdc3c7",
"icon": "icon-wrench",
"type": "module"
},
}
},
"Core": {
"color": "#589494",
"icon": "icon-cog",
"type": "module",
"system_manager": 1
},
}

View file

@ -10,6 +10,7 @@ import os
from frappe.utils import now, cint
from frappe.model import no_value_fields
from frappe.model.document import Document
from frappe.model.db_schema import type_map
class DocType(Document):
def validate(self):
@ -198,7 +199,8 @@ def validate_fields(fields):
def check_min_items_in_list(fields):
if len(filter(lambda d: d.in_list_view, fields))==0:
for d in fields[:5]:
d.in_list_view = 1
if d.fieldtype in type_map:
d.in_list_view = 1
def check_width(d):
if d.fieldtype == "Currency" and cint(d.width) < 100:

View file

@ -73,7 +73,7 @@ frappe.desktop.render = function() {
$.each(modules_list, function(i, m) {
var module = frappe.modules[m];
if(module) {
if(m!="Setup" && user_list.indexOf(m)!==-1)
if(!in_list(["Setup", "Core"], m) && user_list.indexOf(m)!==-1)
add_icon(m);
}
})
@ -82,6 +82,9 @@ frappe.desktop.render = function() {
if(user_roles.indexOf('System Manager')!=-1)
add_icon('Setup')
if(user_roles.indexOf('Administrator')!=-1)
add_icon('Core')
// all applications
frappe.modules["All Applications"] = {
icon: "icon-th",

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
@ -16,7 +16,7 @@ class StaticDataMiddleware(SharedDataMiddleware):
def get_directory_loader(self, directory):
def loader(path):
site = get_site_name(self.environ.get('HTTP_HOST'))
site = get_site_name(frappe.app._site or self.environ.get('HTTP_HOST'))
path = os.path.join(directory, site, 'public', 'files', cstr(path))
if os.path.isfile(path):
return os.path.basename(path), self._opener(path)

View file

@ -106,6 +106,10 @@ div#freeze {
/*margin-top: -15px;*/
}
.form-control {
padding: 6px 8px;
}
.form-headline {
margin-bottom: 10px;
font-size: 120%;

View file

@ -103,14 +103,15 @@ frappe.ui.form.ControlImage = frappe.ui.form.Control.extend({
make: function() {
this._super();
var me = this;
this.$wrapper = $("<div></div>").appendTo(this.parent);
this.$body = $("<div>").appendTo(this.$wrapper)
.css({"margin-bottom": "10px", "margin-right": "15px", "float": "right",
"text-align": "right", "max-width": "100%"})
this.$wrapper = $("<div class='row'><div class='col-xs-4'></div></div>")
.appendTo(this.parent)
.css({"max-width": "600px", "margin": "0px"});
this.$body = $("<div class='col-xs-8'>").appendTo(this.$wrapper)
.css({"margin-bottom": "10px", "max-width": "100%"})
this.$wrapper.on("refresh", function() {
me.$body.empty();
if(me.df.options && me.frm.doc[me.df.options]) {
me.$img = $("<img src='"+me.frm.doc[me.df.options]+"' style='max-width: 70%;'>")
me.$img = $("<img src='"+me.frm.doc[me.df.options]+"' style='max-width: 100%;'>")
.appendTo(me.$body);
} else {
me.$buffer = $("<div class='missing-image'><i class='icon-camera'></i></div>")

View file

@ -117,7 +117,7 @@ frappe.views.ReportView = frappe.ui.Listing.extend({
if(!columns) {
var columns = [['name', this.doctype],];
$.each(frappe.meta.docfield_list[this.doctype], function(i, df) {
if(df.in_filter && df.fieldname!='naming_series'
if((df.in_filter || df.in_list_view) && df.fieldname!='naming_series'
&& !in_list(frappe.model.no_value_type, df.fieldname)) {
columns.push([df.fieldname, df.parent]);
}

View file

@ -185,6 +185,7 @@ data = {{
"{app_title}": {{
"color": "{app_color}",
"icon": "{app_icon}",
"type": "module",
"label": _("{app_title}")
}}
}}

View file

@ -9,14 +9,14 @@ from frappe.utils import cstr
# this is called by the Link Field
@frappe.whitelist()
def search_link(doctype, txt, query=None, filters=None, page_len=20, searchfield="name"):
def search_link(doctype, txt, query=None, filters=None, page_len=20, searchfield=None):
search_widget(doctype, txt, query, searchfield=searchfield, page_len=page_len, filters=filters)
frappe.response['results'] = build_for_autosuggest(frappe.response["values"])
del frappe.response["values"]
# this is called by the search box
@frappe.whitelist()
def search_widget(doctype, txt, query=None, searchfield="name", start=0,
def search_widget(doctype, txt, query=None, searchfield=None, start=0,
page_len=50, filters=None):
if isinstance(filters, basestring):
import json
@ -24,6 +24,9 @@ def search_widget(doctype, txt, query=None, searchfield="name", start=0,
meta = frappe.get_meta(doctype)
if not searchfield:
searchfield = "name"
standard_queries = frappe.get_hooks().standard_queries or []
if standard_queries:
standard_queries = dict([v.split(":") for v in standard_queries])