Default Save Button

Topics: Customizing Orchard, General
Jun 20, 2011 at 11:24 AM

Hello,

How can I customize (or get rid of) the default save button at the bottom of the contentpart editor template?

Thank you,

Jun 20, 2011 at 11:36 AM

It depends on what do you mean by customizing it? Changing the look & feel? Or changing what it does when the user clicks on it ?

You might want to look at Ochard.Source/Modules/Orchard.ContentTypes/Views/Admin/EditPart.cshtml

Jun 20, 2011 at 11:39 AM

I want to include the form fields and I include those parts with @Display(Model)

But it automatically adds the save button to the bottom. I would like to add my own image based save and cancel buttons.

Jun 20, 2011 at 1:08 PM

I'm not sure what you mean by including form fields with @Display(Model) - you should be using drivers and placement to show or hide any bits of the editor UI.

You can hide the existing buttons with:

 

    <Place Content_PublishButton="-"/>
    <Place Content_SaveButton="-"/>

You can also override Content.PublishButton.cshtml and Content.SaveButton.cshtml

Or you can write your own driver in a module to include different button template parts.

Or you can use Placement to specify "alternate" template names.

 

 

Jun 20, 2011 at 1:16 PM

Thank you Pete!

Actually, my problem is that I created a custom contentpart, namely BookPart (it is associated with BookPartRecord).

I added a template under Views EditorTemplates Parts. It works good within the cms admin zone.

Now I would like my users to create book content within custom front pages. I added a membercontroller for this and this controller includes an action method, namely AddBook.

I created a view AddBook.cshtml and in that view I would like to display the form that I use in admin zone. To do that I use @Display but it comes with the default save button.

I hope I could describe what I want to do.

Thank you.

Jun 20, 2011 at 11:00 PM

Well that's what I thought, and I gave you the answer(s) in that last post :)

Sep 30, 2011 at 2:16 PM
Edited Sep 30, 2011 at 3:44 PM

Hi,

i'm also trying to create a custom save button. Im returning an editor shape from my controller so that you can edit the content item on the front end. But when viewing it with Shapetracing tool the info under display type says: n/a. Can I provide custom display type information so that I can distinguish between front end and backend content item editing?

EDIT: ok I'm really stuck here...why is the DisplayType n/a in shapetracing, when it sould be "Edit"?

Thanks!

Coordinator
Sep 30, 2011 at 7:23 PM

Sure, the display type can be set as one of the properties on Metadata.

Oct 3, 2011 at 7:36 AM
Edited Oct 3, 2011 at 7:39 AM

Ok, I think the best way to solve my problem is to create a custom template without using placement.info, I will use the ShapeHelper.Find method you wrote in one of your blog posts to display all shapes but the Content_SaveButton shape.