Proposal for big but simple improvement: [add view] in IDE view

95 views
Skip to first unread message

Mika Sjöman

unread,
Dec 9, 2013, 10:57:25 AM12/9/13
to web...@googlegroups.com
Hi

I just noticed watching Massimo's video tutorials, how often we need to open a second tab in Chrome when we want to create a view/controller/model file. It often leads us to get conflicts since we do not want to close the previous (having multiple tabs open we are working on). 

If we could add a view with a button "add view" when looking at a controller and the list of views, we could basically stop opening multiple chrome tabs and also reduce the merges we need to do. 

Edit views: view1, view2, [Add view]

Clicking it would open the new text file immediately in another tab. 

It should also reload the files toggle view on the left. An [add or +] button could also be added after each section in the files toggle view to the left, and it would feel really complete. Even though I guess we would still open it sometime, it would reduce the times we need to click Edit link at the top bar. 

Paolo Valleri

unread,
Dec 9, 2013, 11:10:20 AM12/9/13
to web...@googlegroups.com, rober...@gmail.com
It is a good idea that could speed up the initial development phase; 
We could start by implementing some like that: while you edit the controller test.py at the top you will get a button 'add view' that when clicked creates a file (a view actually) in the directory app/views/test; the file name could be get by a dialog. Let me think about that a bit more.

For the [Add or +] in the file list, if I remember correctly Roberto (in CC) has started something a while ago. 

Paolo

Mika Sjöman

unread,
Dec 9, 2013, 11:28:18 AM12/9/13
to web...@googlegroups.com, rober...@gmail.com
Well, I was thinking that usually you write the controller first. If you click an [Add view] button, it could check which functions are missing a view and give you two options in a popup, or pop-down? (don't know what it is called);

---------
Add view for function:
  [Link: missing_view_function1]
  [Link: missing_view_function2]

OR add one with name:
Name: [  ] [Add View]
----------

Mostly you would just click on the missing view function link and you would not misspell the file name, which is a quite common error and it would reduce writing. Also you would not add one by mistake if there is one already. 

// cheers

paolo....@gmail.com

unread,
Dec 9, 2013, 12:18:20 PM12/9/13
to web...@googlegroups.com
You are right, technically speaking it is true we already have the name of views and we can avoid to ask them again to the users.
However what you proposed It's not so straightforward  with the current editor structure, I don't say it is impossible. At first sight we should:

1- migrate the file list sidebar into an indipendent component (currently it is part of the editor page) (backend part)
2- for each opened file(tab) stores in a javascript variable the current available views (js)
3- periodically or on demand, parse the python file to find the current declared endpoints (js)
4- remove from the declared endpoints(discovered in point3) those already available (point 2). (js)
5- feed the dropdown menu with those discovered in point4   (js)
6- when a new file is created, add the new view to the available views(point3) and update the file list sidebar(point 1).(backend/js)

I start with 1, I can work on the other points in the coming days/week.


 Paolo


2013/12/9 Mika Sjöman <mi...@orilinkinvent.com>

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/JO4PrRnDpnU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Roberto Perdomo

unread,
Dec 9, 2013, 3:42:34 PM12/9/13
to web...@googlegroups.com
Sometime ago I do an "Create" button in the "files toggle" menu, to allow create files from the editor page, when a new file is created the "files toggle" menu is updated using javascript to show the new files created.

Due to something problems I forgot to send the pull request for this, I can try update this work today and send the pull, to allow create view/model/controller.
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

Roberto Perdomo

unread,
Dec 9, 2013, 9:40:24 PM12/9/13
to web...@googlegroups.com

Mika Sjöman

unread,
Dec 10, 2013, 10:38:29 AM12/10/13
to web...@googlegroups.com

Wow that is wonderful! Web2py development will really become way smoother with this! I actually really enjoy the online IDE and not working with external apps. Fantastic to read that you took this suggestion so seriously and started working to implement it. I knew this was not that easy the second I wrote it though ;)
Reply all
Reply to author
Forward
0 new messages