问题
I) Imagine that I created a projector get a list of content types (Course in my case) and display it.
The Create new course should satisfy 3 conditions:
I would like to add new elements on this list using jQuery AJAX calls, including data validation on client and server side, and reusing the code of the data annotation at the Models.
Before make the AJAX call, a pop-up dialog using jQuery UI appears, just like represented in the picture bellow:
but I would like to add just a button on the left side of projector course list, this button would pop-up a dialog with a form and it would create a new element (if valid) for this projector using AJAX.
II) We 3 different projects that are participating on that case scenario:
Course
- Is where I define the Course Content Type and a partial viewCreateCourse.cshtml
file where you can find the HTML template to create the form using jQuery UI dialog.At this project you can also find the Controller to
CourseController
with the actionCreateCourse
that call a service to create the new Course Content Type.Orchard.Projections
- Is where the Projector is defined.Orchard.Web
- Is where the theme is defined, and where I can possibly have an alternate of this projection, just adding a Create Item button in it, referencing the partial viewCreateCourse.cshtml
in Course project.
PROBLEM: I believe that most of my problems are architectural.
First question, is there a better approach than explained in II). If yes, please let me know.
Considering that II) is the best approach:
I would like to know witch alternate should I override at the ~\Orchard.Web\Themes\[Theme Name]\Views\[AlternateName].cshtml
to add the button at the top of the projector list.
Is it possible to call the partial view on the ~\Course/Views/Shared/CreateCourse.cshtml
from the alternate ?
Best regards
来源:https://stackoverflow.com/questions/10108136/projector-orchard-cms-and-widget