[design] wip

This commit is contained in:
Rushabh Mehta 2014-12-15 17:59:27 +05:30 committed by Anand Doshi
parent d16d3be524
commit c35a4e1235
14 changed files with 176 additions and 165 deletions

View file

@ -7,5 +7,5 @@ import frappe
from frappe.model.document import Document
class DocPerm(Document):
__doclink__ = "https://frappe.io/docs/models/core/docperm"
__doclink__ = "https://frappe.io/docs/models/v5.x/core/docperm"
pass

View file

@ -90,7 +90,7 @@ class Database:
frappe.db.sql("select name from tabCustomer where name like %s", "a%")
# values as dict
frappe.db.sql("select name from tabCustomer where name like %(name)s and owner="%(owner)s",
frappe.db.sql("select name from tabCustomer where name like %(name)s and owner=%(owner)s",
{"name": "a%", "owner":"test@example.com"})
"""

View file

@ -56,7 +56,8 @@ def send(recipients=None, sender=None, doctype='User', email_field='email',
if not recipients: recipients = []
if not sender or sender == "Administrator":
sender = get_outgoing_email_account().email_id
email_account = get_outgoing_email_account()
sender = email_account.get("sender") or email_account.email_id
check_bulk_limit(len(recipients))
formatted = get_formatted_html(subject, message)

View file

@ -32,6 +32,73 @@
"permlevel": 0,
"precision": ""
},
{
"fieldname": "service",
"fieldtype": "Select",
"label": "Service",
"options": "\nGMail\nYahoo Mail\nOutlook.com",
"permlevel": 0,
"precision": ""
},
{
"allow_on_submit": 0,
"fieldname": "email_id",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Email Id",
"no_copy": 0,
"options": "email",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0
},
{
"allow_on_submit": 0,
"fieldname": "password",
"fieldtype": "Password",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Password",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
},
{
"allow_on_submit": 0,
"description": "e.g. \"Support\", \"Sales\", \"Jerry Yang\"",
"fieldname": "email_account_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Email Account Name",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
},
{
"description": "Append as communication against this DocType (must have fields, \"Status\", \"Subject\")",
"fieldname": "append_to",
@ -81,73 +148,6 @@
"search_index": 0,
"set_only_once": 0
},
{
"fieldname": "service",
"fieldtype": "Select",
"label": "Service",
"options": "\nGMail\nYahoo Mail\nOutlook.com",
"permlevel": 0,
"precision": ""
},
{
"allow_on_submit": 0,
"fieldname": "email_id",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Email Id",
"no_copy": 0,
"options": "email",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0
},
{
"allow_on_submit": 0,
"description": "e.g. \"Support\", \"Sales\", \"Jerry Yang\"",
"fieldname": "email_account_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Email Account Name",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
},
{
"allow_on_submit": 0,
"fieldname": "password",
"fieldtype": "Password",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Password",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
},
{
"allow_on_submit": 0,
"description": "e.g. pop.gmail.com",
@ -362,7 +362,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2014-09-15 12:01:38.649639",
"modified": "2014-12-15 15:20:22.723848",
"modified_by": "Administrator",
"module": "Email",
"name": "Email Account",

View file

@ -53,7 +53,8 @@ def get_outgoing_email_account(raise_exception_not_set=True):
"smtp_port": frappe.conf.get("mail_port"),
"use_tls": cint(frappe.conf.get("use_ssl") or 0),
"email_id": frappe.conf.get("mail_login"),
"password": frappe.conf.get("mail_password")
"password": frappe.conf.get("mail_password"),
"sender": frappe.conf.get("auto_email_id")
})
email_account.from_site_config = True

View file

@ -1,8 +1,8 @@
/* appframe header */
.appframe {
padding-top: 15px;
padding-bottom: 15px;
/* padding-top: 15px;
padding-bottom: 15px;*/
}
.appframe-wrapper {
@ -14,10 +14,9 @@
border-bottom: 1px solid #c7c7c7;
}
.appframe-titlebar, .appframe-iconbar, .appframe-form, .appframe-primary-actions {
/*background-color: rgba(255, 255, 255, 0.7);*/
/*.appframe-titlebar, .appframe-iconbar, .appframe-form, .appframe-primary-actions {
background-color: #f9f9f9;
}
}*/
.appframe-primary-actions {
border-bottom: 1px solid #c7c7c7;

View file

@ -31,6 +31,10 @@ a.form-link {
font-size: 102%;
}
em.link-option {
font-weight: normal;
}
.layout-main {
padding-bottom: 10px;
}
@ -69,8 +73,7 @@ div#freeze {
.app-page {
border: 1px solid #c7c7c7;
border-radius: 4px;
margin-top: 15px;
border-top: 0px;
padding: 0px;
overflow: hidden;
}
@ -81,14 +84,17 @@ div#freeze {
/* listing */
.show_filters {
padding-top: 15px;
padding-bottom: 15px;
padding: 15px;
padding-bottom: 5px;
margin-bottom: 15px;
border-bottom: 1px solid #c7c7c7;
}
.set-filters .btn-group {
.set-filters .btn {
margin-bottom: 10px;
}
.set-filters .btn-group {
margin-right: 10px;
}

View file

@ -810,13 +810,8 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
<input type="text" class="input-with-feedback form-control" \
style="display: table-cell">\
<span class="link-field-btn" style="display: table-cell">\
<a class="btn-search" title="' + __("Search Link") + '">\
<i class="icon-search"></i>\
</a><a class="btn-open" title="' + __("Open Link") + '">\
<i class="icon-arrow-right"></i>\
</a><a class="btn-new" title="' + __("Make New") + '">\
<i class="icon-plus"></i>\
</a>\
<a class="btn-open" title="' + __("Open Link") + '">\
<i class="icon-arrow-right"></i></a>\
</span>\
</div>').prependTo(this.input_area);
this.$input_area = $(this.input_area);
@ -841,17 +836,6 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
setup_buttons: function() {
var me = this;
// magnifier - search
this.$input_area.find(".btn-search").on("click", function() {
var doctype = me.get_options();
if(!doctype) return;
new frappe.ui.form.LinkSelector({
doctype: doctype,
target: me,
txt: me.get_value()
});
});
// open
this.$input_area.find(".btn-open").on("click", function() {
var value = me.get_value();
@ -859,18 +843,25 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
frappe.set_route("Form", me.get_options(), value);
});
// new
if(this.df.fieldtype==="Dynamic Link" || frappe.model.can_create(me.df.options)) {
this.$input_area.find(".btn-new").on("click", function() {
var doctype = me.get_options();
if(!doctype) return;
me.frm.new_doc(doctype, me);
});
if(this.only_input) this.$input_area.find(".btn-open").remove();
},
open_advanced_search: function() {
var doctype = this.get_options();
if(!doctype) return;
new frappe.ui.form.LinkSelector({
doctype: doctype,
target: this,
txt: this.get_value()
});
},
new_doc: function() {
var doctype = this.get_options();
if(!doctype) return;
if(this.frm) {
this.frm.new_doc(doctype, this);
} else {
this.$input_area.find(".btn-new").remove();
new_doc(doctype);
}
if(this.only_input) this.$input_area.find(".btn-open, .btn-new").remove();
},
setup_autocomplete: function() {
var me = this;
@ -915,12 +906,22 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
no_spinner: true,
args: args,
callback: function(r) {
if(frappe.model.can_create(doctype)) {
if(frappe.model.can_create(doctype)
&& me.df.fieldtype !== "Dynamic Link") {
// new item
r.results.push({
value: "<i class='icon-plus'></i> <em>" + __("Create a new {0}", [__(me.df.options)]) + "</em>",
make_new: true
value: "<i class='icon-plus'></i> <em class='link-option'>"
+ __("Create a new {0}", [__(me.df.options)]) + "</em>",
action: me.new_doc
});
};
// advanced search
r.results.push({
value: "<i class='icon-search'></i> <em class='link-option'>"
+ __("Advanced Search") + "</em>",
action: me.open_advanced_search
});
me.$input.cache[doctype][request.term] = r.results;
response(r.results);
},
@ -933,21 +934,14 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
me.autocomplete_open = false;
},
focus: function( event, ui ) {
if(ui.item.make_new) {
if(ui.item.action) {
return false;
}
},
select: function(event, ui) {
me.autocomplete_open = false;
if(ui.item.make_new) {
var doctype = me.get_options();
if(!doctype) return;
if (me.frm) {
me.frm.new_doc(doctype, me);
} else {
new_doc(doctype);
}
if(ui.item.action) {
ui.item.action.apply(me);
return false;
}

View file

@ -170,7 +170,7 @@ frappe.ui.form.Layout = Class.extend({
var section = this.section[0];
section.df = df;
if(df) {
if(df.label) {
if(df.label && false) {
this.labelled_section_count++;
var head = $('<h4 class="col-md-12">'
+ (df.options ? (' <i class="icon-fixed-width text-muted '+df.options+'"></i> ') : "")
@ -184,7 +184,7 @@ frappe.ui.form.Layout = Class.extend({
head.css({"margin-top": "0px"})
}
if(df.label || df.show_section_border) {
if(true || df.label || df.show_section_border) {
if(this.sections.length > 1) {
this.section.css("border-top", "1px solid #eee");

View file

@ -21,7 +21,7 @@ frappe.ui.form.Toolbar = Class.extend({
this.appframe.iconbar.hide();
} else {
this.appframe.iconbar.clear(1);
this.appframe.iconbar.clear(4)
this.appframe.iconbar.clear(4);
this.make_file_menu();
this.make_cancel_amend_button();
this.set_title_right();

View file

@ -246,11 +246,16 @@ frappe.ui.AppFrame = Class.extend({
},
add_icon_btn: function(group, icon, label, click) {
return this.iconbar.add_btn(group, icon, label, click);
if(this.sidebar_links.length) {
return $('<a class="small">' + label + '</a>').appendTo($('<p>')
.appendTo(this.sidebar_links)).click(click);
} else {
return this.iconbar.add_btn(group, icon, label, click);
}
},
add_button: function(label, click, icon, is_title) {
return this.iconbar.add_btn("1", icon, __(label), click);
return this.add_icon_btn("1", icon, __(label), click);
},
add_dropdown_button: function(parent, label, click, icon) {
@ -337,7 +342,7 @@ frappe.ui.make_app_page = function(opts) {
]
*/
var $wrapper = $(opts.parent)
$('<div class="app-page container"><div class="appframe-titlebar">\
$('<div class="appframe-titlebar">\
<div class="container">\
<div class="row">\
<div class="titlebar-item col-sm-8">\
@ -348,25 +353,27 @@ frappe.ui.make_app_page = function(opts) {
</div>\
</div>\
</div>\
<div class="appframe-iconbar hide">\
<div class="container">\
<div class="app-page container">\
<div class="appframe-iconbar hide">\
<div class="container">\
</div>\
</div>\
<div class="appframe-form hide">\
<div class="container">\
</div>\
</div>\
<div class="appframe-primary-actions hide">\
<div class="container">\
</div>\
</div>\
<div class="appframe-wrapper">\
<div class="appframe container">\
<div class="appframe-timestamp hide"></div>\
<div class="workflow-button-area btn-group pull-right hide"></div>\
<div class="clearfix"></div>\
</div>\
</div>\
</div>\
<div class="appframe-form hide">\
<div class="container">\
</div>\
</div>\
<div class="appframe-primary-actions hide">\
<div class="container">\
</div>\
</div>\
<div class="appframe-wrapper">\
<div class="appframe container">\
<div class="appframe-timestamp hide"></div>\
<div class="workflow-button-area btn-group pull-right hide"></div>\
<div class="clearfix"></div>\
</div>\
</div></div>\
<div class="appframe-footer hide"></div>').appendTo($wrapper);
if(opts.single_column) {
@ -374,12 +381,16 @@ frappe.ui.make_app_page = function(opts) {
} else {
opts.parent.layout = $('<div class="row">\
<div class="layout-main-section col-sm-9"></div>\
<div class="layout-side-section col-sm-3"></div>\
<div class="col-sm-3 layout-side-section">\
<div class="sidebar-links" style="margin-top: 5px;"></div>\
</div>\
</div>').appendTo($wrapper.find(".appframe"));
opts.parent.body = opts.parent.layout.find(".layout-main-section");
}
opts.parent.appframe = new frappe.ui.AppFrame($wrapper);
opts.parent.appframe.sidebar_links = $wrapper.find(".sidebar-links");
if(opts.set_document_title!==undefined)
opts.parent.appframe.set_document_title = opts.set_document_title;
if(opts.title) opts.parent.appframe.set_title(opts.title);

View file

@ -71,10 +71,9 @@ frappe.ui.Listing = Class.extend({
<div class="show_filters">\
<div class="set-filters">\
<button class="btn btn-primary btn-sm btn-new hide" \
style="margin-bottom: 10px; margin-right: 5px;">\
style="margin-right: 5px;">\
<i class="icon-plus"></i> '+__("New")+'</button>\
<button class="btn btn-default btn-sm new-filter text-muted" \
style="margin-bottom: 10px">\
<button class="btn btn-default btn-sm new-filter text-muted">\
<i class="icon-filter"></i> '+__("Add Filter")+'</button>\
</div>\
<div class="filter_area"></div>\
@ -184,11 +183,11 @@ frappe.ui.Listing = Class.extend({
}
// hide-filter
if(me.show_filters) {
this.add_button(__('Filter'), function() {
me.filter_list.add_filter();
}, 'icon-filter').addClass('btn-filter');
}
// if(me.show_filters) {
// this.add_button(__('Filter'), function() {
// me.filter_list.add_filter();
// }, 'icon-filter').addClass('btn-filter');
// }
if(me.no_toolbar || me.hide_toolbar) {
me.$w.find('.list-toolbar-wrapper').toggle(false);

View file

@ -58,8 +58,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
.appendTo(this.$page.find(".layout-main-section"));
this.$page.find(".layout-main-section")
.addClass("listview-main-section")
.parent().css({"margin-top":"-15px"});
.addClass("listview-main-section");
this.appframe = this.page.appframe;
var module = locals.DocType[this.doctype].module;
@ -69,7 +68,10 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
frappe.set_route(frappe.listview_parent_route[me.doctype]
|| frappe.get_module(module).link);
});
this.appframe.set_views_for(this.doctype, "list");
this.appframe.add_button("Report View", function() {
frappe.set_route("Report", me.doctype);
})
//this.appframe.set_views_for(this.doctype, "list");
},
setup: function() {
@ -87,7 +89,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
this.make_help();
this.setup_filterable();
this.init_filters();
this.$page.find(".show_filters").css({"padding":"15px", "margin":"0px -15px"});
this.$page.find(".show_filters").css({"margin":"0px -15px"});
},
init_listview: function() {
@ -294,7 +296,6 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
},
init_minbar: function() {
var me = this;
this.appframe.add_icon_btn("2", 'icon-tag', __('Show Tags'), function() { me.toggle_tags(); });
this.$page.on("click", ".list-tag-preview", function() { me.toggle_tags(); });
@ -402,7 +403,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
this.sidebar_stats = new frappe.views.SidebarStats({
doctype: this.doctype,
stats: this.listview.stats,
parent: this.$page.find('.layout-side-section'),
parent: $('<div>').appendTo(this.$page.find('.layout-side-section')),
set_filter: function(fieldname, label) {
me.set_filter(fieldname, label);
},

View file

@ -82,12 +82,11 @@ _f.Frm.prototype.setup = function() {
// wrapper
this.wrapper = this.parent;
frappe.ui.make_app_page({
parent: this.wrapper,
single_column: true
parent: this.wrapper
});
this.appframe = this.wrapper.appframe;
this.layout_main = $(this.wrapper)
.find(".layout-main")
.find(".layout-main-section")
.css({"padding-bottom": "0px"})
.get(0);
@ -326,7 +325,7 @@ _f.Frm.prototype.refresh_header = function() {
_f.Frm.prototype.show_web_link = function() {
var doc = this.doc;
if(this.fields_dict.parent_website_route) {
if(!doc.__islocal && doc.__onload.published) {
if(!doc.__islocal && doc.__onload && doc.__onload.published) {
cur_frm.set_intro(__("Published on website at: {0}",
[repl('<a href="/%(website_route)s" target="_blank">/%(website_route)s</a>', doc.__onload)]));
} else {