[minor] make route only if published
This commit is contained in:
parent
3854bcad04
commit
3ef7d5ba78
3 changed files with 9 additions and 5 deletions
|
|
@ -209,9 +209,10 @@ frappe.ui.form.Attachments = Class.extend({
|
|||
frappe.ui.get_upload_dialog = function(opts){
|
||||
dialog = new frappe.ui.Dialog({
|
||||
title: __('Upload Attachment'),
|
||||
no_focus: true,
|
||||
fields: [
|
||||
{fieldtype: "Section Break"},
|
||||
{"fieldtype": "Link" , "fieldname": "file" , "label": "File", "options": "File"},
|
||||
{"fieldtype": "Link" , "fieldname": "file" , "label": __("Select uploaded file"), "options": "File"},
|
||||
],
|
||||
});
|
||||
|
||||
|
|
@ -219,6 +220,7 @@ frappe.ui.get_upload_dialog = function(opts){
|
|||
btn.removeClass("btn-primary").addClass("btn-default");
|
||||
|
||||
dialog.show();
|
||||
var upload_area = $('<div style="padding-bottom: 25px;"></div>').prependTo(dialog.body);
|
||||
|
||||
var fd = dialog.fields_dict;
|
||||
$(fd.file.input).change(function() {
|
||||
|
|
@ -237,7 +239,7 @@ frappe.ui.get_upload_dialog = function(opts){
|
|||
});
|
||||
});
|
||||
frappe.upload.make({
|
||||
parent: dialog.body,
|
||||
parent: upload_area,
|
||||
args: opts.args,
|
||||
callback: function(attachment, r) {
|
||||
dialog.hide();
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ frappe.ui.Dialog = frappe.ui.FieldGroup.extend({
|
|||
|
||||
},
|
||||
focus_on_first_input: function() {
|
||||
if(this.no_focus) return;
|
||||
$.each(this.fields_list, function(i, f) {
|
||||
if(!in_list(['Date', 'Datetime', 'Time'], f.df.fieldtype) && f.set_focus) {
|
||||
f.set_focus();
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ class WebsiteGenerator(Document):
|
|||
def onload(self):
|
||||
self.get("__onload").update({
|
||||
"is_website_generator": True,
|
||||
"published": self.website_published()
|
||||
"published": self.is_website_published()
|
||||
})
|
||||
|
||||
def validate(self):
|
||||
if not self.route:
|
||||
if self.is_website_published() and not self.route:
|
||||
self.route = self.make_route()
|
||||
|
||||
self.route = self.route.strip('/.')
|
||||
|
|
@ -53,7 +53,8 @@ class WebsiteGenerator(Document):
|
|||
def on_trash(self):
|
||||
self.clear_cache()
|
||||
|
||||
def website_published(self):
|
||||
def is_website_published(self):
|
||||
"""Return true if published in website"""
|
||||
if self.website.condition_field:
|
||||
return self.get(self.website.condition_field) and True or False
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue