How can I set the default view for an 2sxc app? - dotnetnuke

Is there a way to make a certain template for an app the “default” template? Let’s say I have an app called “Photo Gallery” and it has 3 templates:
Carousel
Grid
Photo Album
By default, when dropped on the page, “Carousel” will show because it’s alphabetically the first option. I know that if I were to “hide” the view “Carousel” from the user, the “Grid” would be the default option. But what if I want all 3 options, I just want “Grid” to be the default template that’s chosen?
Is there a way to set a "default view" for a 2sxc app?

Yes there is, but it's hidden ;)
Go to the view Metadata and add an IsDefault decorator ;)
The effect will be a bit different depending on Content vs. App use. In Content, you can set a default for each content-type.
Without this, it will be A-Z priority.

Related

How do I hide certain fields from different templates in 2sxc apps using Formulas?

I have an App called "Features"
In Features, I have these fields:
Heading
Text
Image
The app has two separate razor templates. One of the templates displays an image, and the other one does not.
How can I hide the "Image" field from Template B, but still display it in Template A? Is this possible with Formulas? If so, how?
Yes, this can be done with formulas ;)
Best check out the current Content Templates, the basic-content (text/image) templates have exactly this implemented.
If you open it from a template which doesn't show images, the images-field is hidden (but the editor can reactivate it). So this is quite sophisticated, you can also do simpler implementations.
Basically the steps are:
Create an ephemeral field which just serves as a temporary variable to determine if it should be shown by default or not - we usually call it something like VarShowImage - probably default to true (so if it's not set, it's true when the form loads) https://docs.2sxc.org/basics/data/fields/ephemeral.html
In the toolbar where it should be hidden, prefill this like VarShowImage=false
On the field which should be hidden, create a formula to control visible based on this field

Configuring bottom bar in QLPreviewController

I have integrated QLPreviewController and UIDocumentInteractionController in my app, and it is working fine.
The only problem is- I want to configure the bottom toolbar, I want to remove the default toolbar items, which appear as shown in image below:
Is there any way to do so, please suggest.
Short Answer: NO, Not in IOS6+
Description:
One thing to note about QLPreviewController is that it's not meant to be customized. There were other libraries allowing you to change the functionality such as:
https://github.com/rob-brown/RBFilePreviewer
Which are not working in iOS 6+ since apple made a big change in QLPreviewController and it's technically running in a separate process. Although it might be possible (not sure) using private apis but your app will be rejected then.
You can find more info about this change here:
http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/
Hope this helps
Subclass UIToolbar
Create UINavigationController using
init(navigationBarClass:toolbarClass:) and supply UIToolbar subsclass created in step 1 for toolbarClass
Create QLPreviewController instance and push onto UINavigationController stack
Inside of UIToolbar subsclass override
setItems(_:animated:). To remove all buttons call super with empty array super.setItems([], animated: false) or potentially you can add only buttons you want to keep.
Present UINavigationController created in step 2
Here is the example PreviewControllerHideBottomButtons
Subclass QLPreviewController.
Search for the Toolbar in the view hierarchy.
Have a UIToolbar property in your class that has the same frame as the original toolbar.
Place your own toolbar above the default one with whatever buttons you want.
If you want it to be hidden as the default behavior of the QLPreviewController you can key value observe the hidden property of the default toolbar and present / hide your own accordingly.

Visualforce Custom lookup visualforce page

I was wondering if there is a way to override the native functionality of the lookup field in Salesforce and replace it with a visualforce page. The reason I'm trying to override this button is because when the user does a look up, the look up returns everybody with that name. What we want to return is a list of all the contacts by account for the contact being searched.
Here's what I'm trying to achieve:
When the user clicks the lookup button my visualforce page will launch and allow the user to see the account and all the contacts of that account.
Is this even possible? What other ways would you suggest going about this?
Here's a screen shot of what I'm trying to change:
Thanks for all your help!
It sounds really like you just need to customise the columns on the lookup to make it better suited to your needs. If you go to Setup -> Customize -> Contacts -> Search Layouts, you'll see entries for Lookup Dialogs and Lookup Phone Dialogs, there you can edit the columns displayed in the lookup windows.
If you really need a custom solution:
You can't override the lookup page itself, but you could create a new visualforce page for your account, using <apex:detail> and other similar tags to make your life simpler. Then you could include a search section underneath, where a user can enter various search terms which you put into a dynamic SOQL query and then render the results for them to choose from.
yeah its possible by javascript as i did by visual force page that will show the records of related lists and upon selection id of that record passed to parent window by jscipt. and performed same functionality ..
As far as I know - NO.
As a workaround you can use JavaScript.
What we did in our situation? We implement everything in JavaScript. We created an inputText and right on the right of this inputText we placed image with this lookup icon. On image click we create ExtJS popup window (I think you can simply create VF page and show this page in popup window). After window was closed you fill in the inputText field.
There's no out-of-the-box override for this button, last I checked, so something custom would be required. If you're set on having a popup and do not want an inline solution, I'd recommend reviewing this tutorial to get familiar with some of the issues with popups in Visualforce.
But considering what you are looking to accomplish, you could also have your account and filtered list of all contacts associated with that account appear inline on your page when the user clicks a new, custom search button. Of course that page would itself be in Visualforce (or inline Visualforce in a standard page layout) - which you may or may not want to have to code and maintain.
The AJAX Toolkit might also be a good place to start if you want to go with a custom JavaScript button placed on a standard page layout.

salesforce: How do I set custom tag homepage?

I've created custom object and custom tab (label text="order").
Now my header looks like below just like everyone can do.
[home]__[customer]__[order]
And when I click on "order" tab, I am redirected to home page of "order"
The "order" homepage has:
view (which goes to search feature)
recent record
My question is how do I change the layout of this homepage? I've look though entire site and documentations but seems like it is not possible. The only option I have is to create brand new visualforce page and set that page as default homepage for the "order" tab.
No, you can't change the contents of a default tab homepage beyond the limited controls under Setup. You would have to create a new Visualforce page and replace the page all together; however, with an enhancedList, you can get the basics down without too much coding, like this:
<apex:page>
<apex:enhancedList type="Account" height="500" />
</apex:page>
This would just show the standard Account list views on the tab (which could have Recent Items), but you could spruce things up with other components or make the list view customized with a set controller.

When I add a new Form in the Ide, it gets default properties, but I always use a different font and a different background color

Adding a new Form in the project creates a default form with default properties. I have to change them manually, but in all my project I have the same properties (font, background color, etc.).
Is there a way I can change the default Ide template for Forms?
Not using inheritance as Adrian recommended is a mistake. It is the right way to do it because you can in one fell swoop change every form in your app by editing the base form properties.
But you want to change the template. That's easy to do as well. Start a new scratch project with one Form and change the properties you want to have customized. Click File + Export Template. Select Item template, Next. Tick the form, Next. Next. Give it a good name and description and click Finish. You can now select that template whenever you create a new form.
Create your own form control that is derived from the base one and has all the properties set just like you want them, then you can use this one all over your project. Also changing something will be very easy since you'll have to do it only in one place.

Resources