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

Already on GitHub? Sign in to your account

Rename webmachine resources to controllers #413

Closed
arjan opened this Issue Sep 18, 2012 · 11 comments

Comments

Projects
None yet
3 participants
Owner

arjan commented Sep 18, 2012

No description provided.

@ghost ghost assigned arjan Sep 18, 2012

Owner

mworrell commented Sep 18, 2012

We should also rename the individual files in webzmachine, as they now collide with Basho webmachine. (Which is included in riak_core).

Shall we add a backwards compatibility handler for dispatch rules? (Map resource_xxxx to controller_xxxx?)

It could be better to give a warning that a certain controller is not found and that the dispatch rule is disabled.

Owner

arjan commented Sep 18, 2012

Yes, +1 for the warning.

Backward compatibility is not that important, imho, if we document the change in the upgrade notes.

Owner

mmzeeman commented Sep 18, 2012

Isn't it "just" a naming convention? I think can give it any name you like as long as the module exists.

Do you also want to give a warning if the name does not conform to the zotonic naming convention?

Owner

arjan commented Sep 18, 2012

Yep, it's just a naming convention. We can issue a warning if the controller module is not found (code:is_loaded/1) on dispatch load. If it is found, we just assume it's a valid controller module.

Owner

arjan commented Sep 18, 2012

webmachine changes:
arjan/webzmachine@2d3a5d2

zotonic changes:
arjan/zotonic@2a749f4

Owner

mmzeeman commented Sep 18, 2012

Nice. That actually means you don't need a table for compatibility reasons. You can name your controller resource_xxx (for a while) if you like.

Owner

arjan commented Sep 18, 2012

Yep, if you wrote your own controllers...
but all existing controllers have been renamed though.

Owner

arjan commented Sep 18, 2012

Fixed in 8e6332c

@arjan arjan closed this Sep 18, 2012

arjan added a commit that referenced this issue Sep 18, 2012

Owner

mmzeeman commented Oct 29, 2012

Was busy with moving a website to 0.9 and found out the rename of the controllers was a bit inconsistent. I did the move in a two step process. First I fixed the import

webmachine_resource.hrl import to webmachine_controller.hrl
and resource_html.hrl to html_controller.hrl note the swap in location

The I fixed the dispatch rules without looking... resource_page to page_controller, resource_template to template_controller and so on. But to my surprise this was a wrong guess.

Wouldn't it be better to have consistent names here with either controller in front or in the back. Personally I like to have the name in the back because that makes spotting the right controller faster. The same holds for reading the dispatch table.

Maybe a bit to late now, but it is faster to update now than later.

@mmzeeman mmzeeman reopened this Oct 29, 2012

Owner

mmzeeman commented Oct 29, 2012

The "name in front" convention is what the rest of the zotonic modules use. Actions, modules, services all have use this convention. So it is better to keep it that way.

Should we do something the name of the include files?

Owner

arjan commented Oct 29, 2012

Feel free to rename the HRL file.

I'd propose: controller_html_helper.hrl (the _helper) part to indicate that the file itself is not a controller

@arjan arjan closed this in 32258d0 Dec 4, 2012

rpip pushed a commit to rpip/zotonic that referenced this issue Aug 12, 2013

rpip pushed a commit to rpip/zotonic that referenced this issue Aug 12, 2013

rpip pushed a commit to rpip/zotonic that referenced this issue Aug 12, 2013

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