Which file prepare the style and script [ERPNEXT]

98 views
Skip to first unread message

Syed Qadeer

unread,
Feb 26, 2013, 12:43:40 AM2/26/13
to erpnext-dev...@googlegroups.com

i have the virtual machine for the ERPNEXT , i am trying to change the little code to meet my needs and requirements.

so i am trying to change the UI and the javascript.

for example : lets take the Desktop folder from the Apps/Home/Desktop

there are 3 files , desktop.html , desktop.css and desktop.js

i wanted to know , which file is responsible for taking the desktop.css and desktop.js and converting them into the internal javascript and internal css

so that i can do my tweaks.

NOTE : i know that i can write the code in desktop.css and desktop.js , if i want to change the look and feel , but since i am interested in knowing which file is responsible for the conversion so that i can tweak with that module.

waiting for your favourable response.

warm regards.

Anand Doshi

unread,
Feb 26, 2013, 1:19:26 AM2/26/13
to erpnext-dev...@googlegroups.com

Crossposting from stack overflow answer:

Check:

https://github.com/webnotes/wnframework/blob/master/public/js/wn/views/pageview.js

show method creates new wn.views.Page(name)

its init method uses wn.dom.eval and wn.dom.set_style to set js and css

FYI: https://github.com/webnotes/wnframework/blob/master/public/js/wn/dom.js

Thanks,
Anand Doshi.
--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/U-_02vNn2asJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Syed Qadeer

unread,
Feb 26, 2013, 1:26:37 AM2/26/13
to erpnext-dev...@googlegroups.com
thanks, for that umm just a piece of advice .. please have some good comments and documentation for the code, i mean for a non python developer like me , ERPNEXT could turn out to be a worst nightmare ever.

and by the way , you have provided the Tagname "erpnext" for the stackoverflow, but its no where available, please check that as well.


On Tuesday, 26 February 2013 09:19:26 UTC+3, Anand Doshi wrote:

Crossposting from stack overflow answer:

Check:

https://github.com/webnotes/wnframework/blob/master/public/js/wn/views/pageview.js

show method creates new wn.views.Page(name)

its init method uses wn.dom.eval and wn.dom.set_style to set js and css

FYI: https://github.com/webnotes/wnframework/blob/master/public/js/wn/dom.js

Thanks,
Anand Doshi.

On 26-Feb-2013, at 11:13 AM, Syed Qadeer <sdqad...@gmail.com> wrote:

i have the virtual machine for the ERPNEXT , i am trying to change the little code to meet my needs and requirements.

so i am trying to change the UI and the javascript.

for example : lets take the Desktop folder from the Apps/Home/Desktop

there are 3 files , desktop.html , desktop.css and desktop.js

i wanted to know , which file is responsible for taking the desktop.css and desktop.js and converting them into the internal javascript and internal css

so that i can do my tweaks.

NOTE : i know that i can write the code in desktop.css and desktop.js , if i want to change the look and feel , but since i am interested in knowing which file is responsible for the conversion so that i can tweak with that module.

waiting for your favourable response.

warm regards.


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Anand Doshi

unread,
Feb 26, 2013, 1:37:15 AM2/26/13
to erpnext-dev...@googlegroups.com
Hi,

We couldn't create a tag "erpnext" on stack overflow because we don't have sufficient points :(.

We will keep it in mind to write more comments. We haven't had that motivation till now :)

Thanks,
Anand Doshi.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Syed Qadeer

unread,
Feb 26, 2013, 1:40:15 AM2/26/13
to erpnext-dev...@googlegroups.com
i know , we indian developers are always like that :P never write comments :P ...even i dont write comments :D ... but still as ErpNext being an opensource, it surely needs to be well documented.

Anand Doshi

unread,
Feb 26, 2013, 1:42:36 AM2/26/13
to erpnext-dev...@googlegroups.com
Well. Documentation is also a much desired contribution avenue. 
If you are into it, please add some comments where you deem necessary and send us a pull request. :)

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Syed Qadeer

unread,
Feb 26, 2013, 1:48:39 AM2/26/13
to erpnext-dev...@googlegroups.com
yup, hopefully, you will get to hear something from me , regarding the architecture and the documentation , and i surely have one more question , why is ERPNEXT so dependent on jquery as in javascript.

Anand Doshi

unread,
Feb 26, 2013, 1:52:38 AM2/26/13
to erpnext-dev...@googlegroups.com
Javascript - Its an architecture choice. Rendering forms on client side as opposed to using templating on server side.
jQuery makes so many things very easy in terms of manipulating DOM. 

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Syed Qadeer

unread,
Feb 26, 2013, 3:45:46 AM2/26/13
to erpnext-dev...@googlegroups.com
Dear Anand.


Check:

https://github.com/webnotes/wnframework/blob/master/public/js/wn/views/pageview.js

show method creates new wn.views.Page(name)

its init method uses wn.dom.eval and wn.dom.set_style to set js and css

FYI: https://github.com/webnotes/wnframework/blob/master/public/js/wn/dom.js


i checked these files but what i wanted to know is .. there must be a python file which reads the content from the .css , .js and .html and then sent them to the javascript for the rest of the processing,


i wanted to see that file.

Anand Doshi

unread,
Feb 26, 2013, 4:00:15 AM2/26/13
to erpnext-dev...@googlegroups.com
see webnotes/model/doctype.py
js and css files are sent using variables __js and __css

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Rushabh Mehta

unread,
Feb 26, 2013, 4:00:23 AM2/26/13
to erpnext-dev...@googlegroups.com
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Syed Qadeer

unread,
Feb 26, 2013, 4:12:24 AM2/26/13
to erpnext-dev...@googlegroups.com
Thanks Rusabh,

that was some help.

https://github.com/webnotes/wnframework/blob/master/core/doctype/page/page.py

this is exactly the file that i was looking for :D

Syed Qadeer

unread,
Feb 26, 2013, 10:34:06 AM2/26/13
to erpnext-dev...@googlegroups.com
i have one more query,

i want to set the user language from the database over here

def start(self):
"""start a new session"""
import os
import webnotes
import webnotes.utils

# generate sid
if webnotes.login_manager.user=='Guest':
sid = 'Guest'
else:
sid = webnotes.generate_hash()
			//get the user language here
self.data['data']['lang'] = set user language


self.data['user'] = webnotes.login_manager.user
self.data['sid'] = sid
self.data['data']['user'] = webnotes.login_manager.user
self.data['data']['session_ip'] = os.environ.get('REMOTE_ADDR')
self.data['data']['last_updated'] = webnotes.utils.now()
self.data['data']['session_expiry'] = self.get_expiry_period()

this is session.py

can you help me setting the user language here.

thanks

Rushabh Mehta

unread,
Feb 26, 2013, 11:30:57 PM2/26/13
to erpnext-dev...@googlegroups.com
Why in sessions.py?

Why not the place where it is set? (auth.py)



W: https://erpnext.com
T: @rushabh_mehta

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Syed Qadeer

unread,
Feb 27, 2013, 12:37:44 AM2/27/13
to erpnext-dev...@googlegroups.com
because of the page.py in the core/doctype/page ..

 i am trying to use the webnotes.lang here to get the user-preferred-language , but it is always returning me en when the page.py is processed ... but i want to know in page.py the user language so that i can add some of my code based upon the user language ... but since it is always giving me "en" i am unable to perform the action.

Syed Qadeer

unread,
Feb 27, 2013, 12:45:31 AM2/27/13
to erpnext-dev...@googlegroups.com
but , if i set the user language after all the pages processing is done and cached ,then in the auth.py i am getting the user-preferred language , when everything is cached and saved,it would be of no use to me ... as it will always display the same content for english but i have some more content to be displayed for an user with different language.


On Tuesday, 26 February 2013 08:43:40 UTC+3, Syed Qadeer wrote:

Rushabh Mehta

unread,
Feb 27, 2013, 1:29:25 AM2/27/13
to erpnext-dev...@googlegroups.com
Syed,

What are you trying to achieve? Only web pages are cached. Have not extended the multi-lingual feature to the website yet. That is a bit to-do and I am not sure of the architecture.

For the internal Pages, you should use wn._("text") in your javascript and those texts will automatically be scraped and appropriate translations appended.

If the user language changes mid-way, then they have to refresh the page.

best,
Rushabh



W: https://erpnext.com
T: @rushabh_mehta

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.

Syed Qadeer

unread,
Feb 27, 2013, 1:38:55 AM2/27/13
to erpnext-dev...@googlegroups.com
i am trying to change the css based upon the user-preferred language ... thats one of my requirements ...

if i could set the userlanguage session in the session.py then everything is sorted out.

On Wednesday, 27 February 2013 09:29:25 UTC+3, rushabh wrote:
Syed,

What are you trying to achieve? Only web pages are cached. Have not extended the multi-lingual feature to the website yet. That is a bit to-do and I am not sure of the architecture.

For the internal Pages, you should use wn._("text") in your javascript and those texts will automatically be scraped and appropriate translations appended.

If the user language changes mid-way, then they have to refresh the page.

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

On 27-Feb-2013, at 11:15 AM, Syed Qadeer <sdqad...@gmail.com> wrote:

but , if i set the user language after all the pages processing is done and cached ,then in the auth.py i am getting the user-preferred language , when everything is cached and saved,it would be of no use to me ... as it will always display the same content for english but i have some more content to be displayed for an user with different language.

On Tuesday, 26 February 2013 08:43:40 UTC+3, Syed Qadeer wrote:

i have the virtual machine for the ERPNEXT , i am trying to change the little code to meet my needs and requirements.

so i am trying to change the UI and the javascript.

for example : lets take the Desktop folder from the Apps/Home/Desktop

there are 3 files , desktop.html , desktop.css and desktop.js

i wanted to know , which file is responsible for taking the desktop.css and desktop.js and converting them into the internal javascript and internal css

so that i can do my tweaks.

NOTE : i know that i can write the code in desktop.css and desktop.js , if i want to change the look and feel , but since i am interested in knowing which file is responsible for the conversion so that i can tweak with that module.

waiting for your favourable response.

warm regards.


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Rushabh Mehta

unread,
Feb 27, 2013, 1:42:22 AM2/27/13
to erpnext-dev...@googlegroups.com
Are you trying to implement RTL?


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Syed Qadeer

unread,
Feb 27, 2013, 1:51:34 AM2/27/13
to erpnext-dev...@googlegroups.com
yes i am trying to implement RTL and as well as some different styling for non-english users.

Rushabh Mehta

unread,
Feb 27, 2013, 1:58:03 AM2/27/13
to erpnext-dev...@googlegroups.com
Can you push your updates (so far) in your fork so that I can see what are you doing? It will be much easier to understand and maybe I can suggest how to get to the next step rather than giving suggestions based on incomplete understanding.



W: https://erpnext.com
T: @rushabh_mehta

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Syed Qadeer

unread,
Feb 27, 2013, 2:08:23 AM2/27/13
to erpnext-dev...@googlegroups.com
core/doctype/page/page.py

# css
lang = ""
                if(webnotes.lang != "en")
                        lang = "_ar"

fpath = os.path.join(path, scrub(self.doc.name) + lang + '.css')

but here webnotes.lang is always "en"

so i thought of setting a session from the session.py

def start(self):
"""start a new session"""
import os
import webnotes
import webnotes.utils
# generate sid
if webnotes.login_manager.user=='Guest':
sid = 'Guest'
else:
sid = webnotes.generate_hash()
user_lang_pref = webnotes.conn.get_value("Profile", webnotes.login_manager.user, "language")
self.data['data']['userLang'] = user_lang_pref
                        # i know user_lang_pref will be in arabic it will not be "ar" well this is what i was testing but it is not working over here.

Syed Qadeer

unread,
Feb 27, 2013, 2:29:42 AM2/27/13
to erpnext-dev...@googlegroups.com
so rusabh, anything that you can help me with ??


On Tuesday, 26 February 2013 08:43:40 UTC+3, Syed Qadeer wrote:

Rushabh Mehta

unread,
Feb 27, 2013, 3:25:17 AM2/27/13
to erpnext-dev...@googlegroups.com
How are you linking it into css? what is user_lang_pref

What I meant was push into your fork at github.


W: https://erpnext.com
T: @rushabh_mehta

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages