Browse Source

new favicon

version-14
Anand Doshi 13 years ago
parent
commit
75dafe31d4
5 changed files with 21 additions and 4 deletions
  1. +2
    -0
      conf/index.html
  2. +1
    -1
      js/core.min.js
  3. +12
    -0
      js/legacy/app.js
  4. +4
    -1
      js/wn/router.js
  5. +2
    -2
      py/webnotes/model/doctype.py

+ 2
- 0
conf/index.html View File

@@ -4,6 +4,8 @@
<title>ERPNext</title>
{{ ajax_meta_tag }}
<meta name="author" content="">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<script type="text/javascript" src="lib/js/lib/jquery/jquery.min.js"></script>
<script type="text/javascript">
// browser support


+ 1
- 1
js/core.min.js View File

@@ -103,7 +103,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
wn.get_route=function(route){if(!route)
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;}
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;set_favicon();}
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
/*


+ 12
- 0
js/legacy/app.js View File

@@ -59,6 +59,7 @@ function startup() {
var t = to_open();
if(t) {
window.location.hash = t;
set_favicon();
} else if(home_page) {
loadpage(home_page);
}
@@ -149,3 +150,14 @@ get_window_height = function() {
var ht = window.innerHeight ? window.innerHeight : document.documentElement.offsetHeight ? document.documentElement.offsetHeight : document.body.offsetHeight;
return ht;
}

// favicon disappears when window.location.hash value is changed in firefox
// This is used to mitigate this favicon bug in firefox
function set_favicon() {
var link = $('link[type="image/x-icon"]').remove().attr("href");
var favicon ='\
<link rel="shortcut icon" href="' + link + '" type="image/x-icon"> \
<link rel="icon" href="' + link + '" type="image/x-icon">'

$(favicon).appendTo('head');
}

+ 4
- 1
js/wn/router.js View File

@@ -35,6 +35,9 @@ wn.get_route = function(route) {
wn.set_route = function() {
route = $.map(arguments, function(a) { return encodeURIComponent(a) }).join('/');
window.location.hash = route;
// Set favicon (app.js)
set_favicon();
}

wn._cur_route = null;
@@ -52,4 +55,4 @@ $(window).bind('hashchange', function() {
console.log(e);
}
}
});
});

+ 2
- 2
py/webnotes/model/doctype.py View File

@@ -379,7 +379,7 @@ def get_field_property(dt, fieldname, property):
prop = webnotes.conn.sql("""
select value
from `tabProperty Setter`
where doc_type=%s and doc_name=%s and property=%s""", (dt, field[0][0], property))
where doc_type=%s and field_name=%s and property=%s""", (dt, fieldname, property))
if prop:
return prop[0][0]
else:
@@ -394,7 +394,7 @@ def get_property(dt, property):
prop = webnotes.conn.sql("""
select value
from `tabProperty Setter`
where doc_type=%s and doc_name=%s and property=%s""", (dt, dt, property))
where doc_type=%s and field_name=%s and property=%s""", (dt, dt, property))
if prop:
return prop[0][0]
else:


Loading…
Cancel
Save