Search on Students in a Reaction Rolled Application
- Overview
- Leverage Existing Search
- The Parts
- Interface Model Action - TPRO::IRDA::People::Webuser::Search
- Interface Model Object - TPRO::IRDA::People::Webuser
- Data Model - TPRO::IRDA::Schema::Result::People::Webuser
- Controller - TPRO::Web::App::Controller::People::Webuser
- Layout - action/people/webuser_search
- Widget - TPRO::UI::Widget::People::Webuser::Search
Overview
I am working with a existing MFVC application that uses Catalyst and Reaction. I would like to enable searching for students based on:
- MGT ID
- CIA ID
- Student Name
Leverage Existing Search
The application has any existing search on webusers. I would like to re-use and apply this search to students. In order to know how to re-use the existing search on webusers, one must understand well how it works. Let’s break it down.
The Parts
What are the parts involved in the webuser search?
Interface Model Action - TPRO::IRDA::People::Webuser::Search
This package is a Reaction::InterfaceModel::Action subclass. The worker method of the class is do_apply which uses both $self->target_model and $self->query to perform a search on the Webuser Result Class (Model). We’ll create the analogous IM Action for Students:
TPRO::IRDA::People::Student::Search
We start with the webuser IM Action file then we edit the do_apply method to search on student related info instead of webuser.
Interface Model Object - TPRO::IRDA::People::Webuser
This package is a Reaction::InterfaceModel ::Object subclass. Further, we already have the Student counterpart:
TPRO::IRDA::People::Student
Data Model - TPRO::IRDA::Schema::Result::People::Webuser
This package is the Reaction/DBIC Result Class on the people.webusers table. The corresponding data model class for student ja existeix:
TPRO::IRDA::Schema::Result::People::Student
Controller - TPRO::Web::App::Controller::People::Webuser
This is the Catalyst Controller for the Webuser sub-application which includes search.
I am creating an analogous
TPRO::Web::App::Controller::People::Student
starting with the Webuser one and editing to match the needs of Student search.
Layout - action/people/webuser_search
Create analogous
share/skin/default/layout/action/people/student_search
Widget - TPRO::UI::Widget::People::Webuser::Search
This layout file need to call a widget named
People::Student::Search. We better make sure that puppy exists. Its full name is:
TPRO::UI::Widget::People::Student::Search
Showing changes from previous revision. Removed | Added
