Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added generic listview and itemview/edit form #3

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

oasisfleeting
Copy link

first time working with yeoman. Like your generator more than the built in component creators in joomla.

Oasis added 13 commits November 25, 2014 04:51
This should be used to create the list of items and will let the user choose a single view item.
Most likely used when the viewname ends with "s"
blank file to protect against directory indexing
generic list layout for listview
This should be used to create the list of items and will let the user choose a single view item.
Most likely used when the viewname ends with "s"
no indexes
no indexing
generic list layout for listview
create single item view
no indexing
no indexing
single item form
@oasisfleeting
Copy link
Author

There are a few problems that I already see with my templates. I'll keep working on them as I build this component.
I think the subpackage generator logic could work like the following:
views that end with optional "s" will have a list view and an item view created as well as generic layouts for those views
view: yo joomla-component:view "view-name[s]"

@srsgores
Copy link
Owner

I could merge, but I'm not sure I see the value in that, as this pr is missing the logic to:

  1. Detect pluralized view names
  2. Scaffold out the newly-added templates based on that condition

I might also add, I'm not familiar with list views, and what it would do for the user.

Further explanation would be appreciated.

Thanks for submitting this pr.

@oasisfleeting
Copy link
Author

Hi there. Nice to meet you. I'm sorry that I didn't add the actual logic to parse out the pluralized views. Today is my first time using yeoman and I just wanted to play with it a bit.
I will build more on my branch and notify you when it is in a mergable state.

List views are very common in joomla. The basic idea is an end user goes to a menu item in the back end i.e. "User Manager". They are presented with a list of those items and from there they can sort, filter and perform basic tasks like ordering and activation. For more in depth control of a single item, the end user / admin would click on a single item from that list and be taken to a form from which they can make more granular alterations to that items data.

You will see this design pattern a lot in the administrator area of joomla cms, especially while joomla is transitioning over to their new MVC model and still implementing their legacy classes which support J 2.5
users -> user
https://github.com/joomla/joomla-cms/tree/staging/administrator/components/com_users/views
articles -> article
https://github.com/joomla/joomla-cms/tree/staging/administrator/components/com_content/views
menus -> menu / items -> item
https://github.com/joomla/joomla-cms/tree/staging/administrator/components/com_menus/views

@oasisfleeting
Copy link
Author

Oh, I wanted to point out why i am calling them "listviews"
Right now you'll find a bunch of legacy classes to extend.
The most common way people code for these now is to extend these with a model class like JModelList / JDatabaseModel and fetch that list from the model into the view.
http://developer.joomla.org/manual/chap-Joomla_Platform_Manual-MVC.html
`
class HelloWorldViewHelloWorlds extends JViewLegacy

class HelloWorldController extends JControllerLegacy

class HelloWorldModelHelloWorld extends JModelItemLegacy

class HelloWorldModelUpdHelloWorld extends JModelFormLegacy
`
As things move away from 2.5 legacy support we'll have new abstract super classes to draw on a content model.
http://developer.joomla.org/manual/ch02s09s09s02.html

@srsgores
Copy link
Owner

@oasisfleeting, now that I understand better, I think this feature would be best suited as another subgenerator: perhaps something like yo joomla-component **list**view articles, where pluralization is set up by the user. This would avoid weird issues where pluralization may be unpredictable: ex. yo joomla-component listview fungi.

Also, you will need to write unit tests before I merge.

@oasisfleeting
Copy link
Author

Thank you. I will definitely test this and work on it some more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants