From 74cb41ae71d9597c9177c39329abcc840af11af9 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 20 Sep 2016 17:47:39 +0530 Subject: [PATCH] [enhance] web form pagination frappe/shishuvan#3 (#2076) * [enhance] web form pagination frappe/shishuvan#3 * [minor] add label in web form grid * [minor] select module for exporting web form * [fix] more fixes, #2057 --- frappe/change_log/v7/v7_1_0.md | 5 +- frappe/commands/utils.py | 13 ++ frappe/public/css/form.css | 1 + .../public/js/frappe/form/footer/assign_to.js | 3 +- .../js/frappe/form/templates/grid_body.html | 8 +- frappe/public/less/form.less | 1 + frappe/templates/generators/web_form.html | 131 +++++++++++++++--- frappe/website/doctype/web_form/web_form.json | 4 +- frappe/website/doctype/web_form/web_form.py | 77 ++++++---- .../web_form_field/web_form_field.json | 4 +- 10 files changed, 189 insertions(+), 58 deletions(-) diff --git a/frappe/change_log/v7/v7_1_0.md b/frappe/change_log/v7/v7_1_0.md index cc4a9aaef7..32e807d5bf 100644 --- a/frappe/change_log/v7/v7_1_0.md +++ b/frappe/change_log/v7/v7_1_0.md @@ -1,2 +1,5 @@ - Search for help from within the app. Click on "Help" -- Send a popup to all users on login for a new Note by checking on "Notify users with a popup when they log in" \ No newline at end of file +- Send a popup to all users on login for a new Note by checking on "Notify users with a popup when they log in" +- Updates to Web Form + - Add grids (child tables) + - Add page breaks (for long forms) \ No newline at end of file diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index b724b79d94..7c74e41834 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -200,6 +200,13 @@ def export_fixtures(context): def import_doc(context, path, force=False): "Import (insert/update) doclist. If the argument is a directory, all files ending with .json are imported" from frappe.core.page.data_import_tool import data_import_tool + + if not os.path.exists(path): + path = os.path.join('..', path) + if not os.path.exists(path): + print 'Invalid path {0}'.format(path) + sys.exit(1) + for site in context.sites: try: frappe.init(site=site) @@ -222,6 +229,12 @@ def import_csv(context, path, only_insert=False, submit_after_import=False, igno from frappe.utils.csvutils import read_csv_content site = get_site(context) + if not os.path.exists(path): + path = os.path.join('..', path) + if not os.path.exists(path): + print 'Invalid path {0}'.format(path) + sys.exit(1) + with open(path, 'r') as csvfile: content = read_csv_content(csvfile.read()) diff --git a/frappe/public/css/form.css b/frappe/public/css/form.css index 9193e1ee3b..481198e4b4 100644 --- a/frappe/public/css/form.css +++ b/frappe/public/css/form.css @@ -440,6 +440,7 @@ select.form-control { } .form-headline { padding: 0px 15px; + margin: 0px; } .form-headline .alert { font-size: 12px; diff --git a/frappe/public/js/frappe/form/footer/assign_to.js b/frappe/public/js/frappe/form/footer/assign_to.js index b4155142ba..9a2b6061a3 100644 --- a/frappe/public/js/frappe/form/footer/assign_to.js +++ b/frappe/public/js/frappe/form/footer/assign_to.js @@ -153,10 +153,9 @@ frappe.ui.to_do_dialog = function(opts){ var dialog = new frappe.ui.Dialog({ title: __('Add to To Do'), fields: [ - {fieldtype:'Check', fieldname:'myself', label:__("Assign to me"), "default":0}, - {fieldtype: 'Section Break'}, {fieldtype: 'Link', fieldname:'assign_to', options:'User', label:__("Assign To"), reqd:true, filters: {'user_type': 'System User'}}, + {fieldtype:'Check', fieldname:'myself', label:__("Assign to me"), "default":0}, {fieldtype:'Small Text', fieldname:'description', label:__("Comment"), reqd:true}, {fieldtype: 'Section Break'}, {fieldtype: 'Column Break'}, diff --git a/frappe/public/js/frappe/form/templates/grid_body.html b/frappe/public/js/frappe/form/templates/grid_body.html index aa7b89e440..7a2adac38f 100644 --- a/frappe/public/js/frappe/form/templates/grid_body.html +++ b/frappe/public/js/frappe/form/templates/grid_body.html @@ -7,11 +7,13 @@