Commit Graph
247 Commits
Author SHA1 Message Date
Jozef Selesi b63ea2cdbf - All comments of an item can now be seen /comments?item_id=
- Return proper Content-Type header for GET /comments requests
- Got rid of the query processing for index() in REST_Controller()
- Small misc fixes
2008-11-18 15:48:08 +00:00
Bharat Mediratta d4fc15f76c Fix a typo in the text MPTT link 2008-11-18 09:07:46 +00:00
Bharat Mediratta d8225e44c4 Fix a typo user_id -> owner_id 2008-11-18 09:03:49 +00:00
Bharat Mediratta 394de8ec0a Gracefully handle the no-comments case 2008-11-18 09:03:26 +00:00
Jozef Selesi 3ebb751cda First iteration of REST controller refactoring. RESTful controllers that refer to collections should now have plural names and there should be only one controller per resource. Updated existing classes that implement REST_Controller. The routing now works like this:
GET    /controller    -> controller::_index()
POST   /controller    -> controller::_create()
GET    /controller/id -> controller::_show()
PUT    /controller/id -> controller::_update()
DELETE /controller/id -> controller::_delete()
GET    /form/edit/controller/resource_id -> controller::_form()
GET    /form/add/controller/data         -> controller::_form()
2008-11-18 08:28:32 +00:00
Bharat Mediratta 59dbd1dc83 Move User_Controller to Users_Controller per jozefs request. 2008-11-18 08:10:14 +00:00
Tim Almdal 8b6796fa5f Synchronize the model rules with the database definitions and vice-versa. 2008-11-18 00:38:36 +00:00
Bharat Mediratta c031fcef23 Remove stray <ul> from comment list 2008-11-17 04:54:13 +00:00
Bharat Mediratta c91e90406b Add output formats to our REST controllers. Add support for JSON and
XML to the comment controllers as a proof of concept.  It's not fully
baked; we should examine ways to create helpers to make this process
easier.
2008-11-17 00:30:18 +00:00
Bharat Mediratta 0975e702a9 Add _method=put to the edit form
Properly implement User_Controller::_put()
2008-11-16 19:26:44 +00:00
Bharat Mediratta 1a2cb5ff04 Put _method into the edit form's url; Implement Comment::_put() properly 2008-11-16 19:23:41 +00:00
Bharat Mediratta b6de985922 Handle _method in either GET or POST 2008-11-16 19:22:27 +00:00
Bharat Mediratta 5d14531af9 Drop the call to render() and just use the View's __toString method to
print it out.
2008-11-16 19:12:01 +00:00
Bharat Mediratta bcb2230a6b Remove a @todo 2008-11-16 10:19:01 +00:00
Bharat Mediratta 4610fc8e7f Create Forge::add_rules_from() which pulls validation rules from the model and
associates them with the form.  This replaces the various _add_validation_rules()
functions in the user and comment modules.

Move user edit form into user helper for consistency with the comment module.

Implement missing _form method in the user controller.
2008-11-16 07:51:42 +00:00
Bharat Mediratta ce7fbf979d Stop using the target param; replace the form by hand so that we can run ajaxify_comment_form() as needed. Otherwise the 2nd post attempt won't be ajax 2008-11-16 07:27:36 +00:00
Bharat Mediratta e3be3cecf5 Second half of renaming the tags module. Change all occurrences of
gTags to gTag in the CSS.
2008-11-16 07:20:58 +00:00
Bharat Mediratta e87a37b855 Rename 'tags' module to 'tag' for consistency of pluralization 2008-11-16 07:17:29 +00:00
Bharat Mediratta 140736a1e4 Several large changes:
1) Changed the way that we get forms.  Now, if you want to get a form
   for a REST resource you prefix /form to the resource id.  So:
    /form/photo/1    : returns a form for editing photo id 1
    /form/comments/1 : returns a form for adding a comment to photo id 1
    /form/comment/1  : returns a form for editing comment id 1

2) Changed the comment module to have two controllers:
    comment:  deals with a single comment resource
    comments: deal with collections of comments attached to an item

Related stuff:
- Moved the comments js into the theme
- Reworked Comment_Helper for clarity
- Moved form generation code down into Comment_Helper
- Cleaned up routes (eliminating new comment ones added in recent rev)
- Added form() function to all REST controllers
- Changed comment module to use a block instead of an arbitrary helper call from the theme
- Comment controller only returns HTML currently, but returns a 201 Created status
  code when a new comment is added, which the Ajax code can catch and act upon.
- Got rid of a lot of extra views in comment module
2008-11-16 07:14:12 +00:00
Bharat Mediratta b8b60df391 Rename gLogin -> gLoginForm
This disambiguates forms from blocks (for example in the comment
module we were calling both the form and block gComments).
2008-11-16 07:07:16 +00:00
Tim Almdal be67187ad9 Create MY_Forge to specify the defaul html 2008-11-16 06:43:31 +00:00
Felix Rabinovich 1a79a10893 prevent direct access. take 2 2008-11-16 06:09:11 +00:00
Felix Rabinovich d4c95a089e prevent direct access 2008-11-16 06:06:13 +00:00
Felix Rabinovich f27929e126 create a regular user and make scaffolding assign owner to logged in user 2008-11-16 05:46:42 +00:00
Bharat Mediratta 2d463c5531 use text::alternate where appropriate 2008-11-15 21:54:16 +00:00
Bharat Mediratta 6fd7194544 Destroy the session on logout, don't just delete the user. 2008-11-15 21:47:21 +00:00
Jozef Selesi fbc810098f Do comment add in a single request, some code cleanup. 2008-11-15 17:39:14 +00:00
Jozef Selesi 5e10b44a95 Remove unnecessary pasted code. 2008-11-15 17:04:16 +00:00
Jozef Selesi 0f11c77bcd Set svn:eol-style to LF. 2008-11-15 16:53:07 +00:00
Jozef Selesi f9eaa8c220 Initial add comment implementation. 2008-11-15 16:52:23 +00:00
Bharat Mediratta 66bd9d85b3 Show per-field error messages inline again 2008-11-15 10:15:12 +00:00
Bharat Mediratta ca05d94b70 Add gInline to the form's unordered list to clean it up. 2008-11-15 09:27:04 +00:00
Bharat Mediratta 89c6f8f914 Don't show gLoginMenu if there's no user module 2008-11-15 09:09:29 +00:00
Bharat Mediratta 16828a4bc7 Delete the user from the session when uninstalling the user module 2008-11-15 09:08:59 +00:00
Bharat Mediratta e901d613bf Add Theme::module() and module::get() 2008-11-15 09:08:18 +00:00
Bharat Mediratta c152e5db5a Only remove the user from the session when logging out. 2008-11-15 09:05:21 +00:00
Jozef Selesi 5486238d8d Set svn:eol-style to LF. 2008-11-15 08:52:58 +00:00
Bharat Mediratta db6061096e Item / Owner changes.
* Hardcode the item has_one owner relationship again
* Overload User_Model::__get to handle missing owners gracefully
* Fix Item_Controller to take the owner_id from the session or
  from the parent album when adding new albums and photos.
2008-11-15 08:44:01 +00:00
Felix Rabinovich 6dbf5ae172 Clean user / item relationship. Upload files gets the ownership of current user; and the views don't break if user module is not installed 2008-11-15 08:19:14 +00:00
Bharat Mediratta dc1090d005 Now, only logged in users can edit stuff in-place. 2008-11-15 08:16:58 +00:00
Bharat Mediratta 9d1a598ec0 Add support for modifying user data. It still needs work.
Make the continue= param a GET only parameter so that it's not part of
the form.
2008-11-15 08:15:00 +00:00
Bharat Mediratta ae7839ffaa Revise the user login code.
* Remove user registration link and popup from the theme; this
  shouldn't be done in a popup. Use ajaxform to simplify the way
  that we load the login popup.

* Create form.html.php, this is a template for Forge based forms.

* Move user validation rules into User_Model and let forms
  populate the rules into their forms as useful.

* Undo r18688's changes regarding the REST code.  We should never
  accept a null resource, this breaks the REST abstraction.

* Change login and user controllers to use Forge which lets us delete
  login.html.php and user.html.php since those now are generated by
  the theme-owned form template
2008-11-15 06:23:09 +00:00
Bharat Mediratta 26c8772e16 jquery.form.js r5945 2008-11-15 05:27:46 +00:00
Tim Almdal bd1ec2df1f The state of of the user registration functionality 2008-11-14 18:16:13 +00:00
Tim Almdal d7745f2ad8 Add the name attr to the input fields and use the form.serialize() method to generate the post data 2008-11-14 17:23:10 +00:00
Tim Almdal 61d957e372 Rename login.js to user.js 2008-11-14 16:58:59 +00:00
Tim Almdal ed90edfa96 Remove class="gInline" and set the css as suggested by thumb in -devel 2008-11-14 16:56:17 +00:00
Tim Almdal e0ec9dd76a Allow the HTTP get method to be called without an id to create any empty template. 2008-11-14 16:51:11 +00:00
Bharat Mediratta 5a2fe6bb0b Internationalize all strings 2008-11-14 08:22:53 +00:00
Tim Almdal 652cc48b77 change the display name to a varchar 2008-11-14 07:42:20 +00:00