How to set theme id property on Components? - themes

Whatever I do, only theme set in application properties applies. Theme id doesnt work as expected.
For example:
I have two custom controls and each has 5 views. I try to set view title property for all views in first custom control with theme and same with second custom control, but with different theme (and title).
Both custom controls exist on same page.
Problem Im trying to solve is, instead of typing functions for properties for each component of same type I want to do it only in one place. In that case all views in one custom control. Or all views in a panel...

Regarding Themes: afaik we only can define a single theme per application. This theme can inherit from other themes but those need to be installed and registered at the file system level for the entire server.
Regarding your scenario:
If you really want to solve that with themes you could work with separate theme ids. But I really don't see the benefit of using themes here. As far as I understand your task I would solve it using custom properties for your custom controls. The view title would then be computed to reference that property as in
<xp:viewTitle xp:key="viewTitle" id="viewTitle1"
value="#{javascript:compositeData.ccViewTitle}">
</xp:viewTitle>
At design time the containing Xpage or Custom Control would then feed the appropriate view title to the child control:
<xc:ccInner ccViewTitle="View Title for First CC in Page"></xc:ccInner>
<xc:ccInner ccViewTitle="View Title for Second CC in Page"></xc:ccInner>
You also could compute this value, if necessary.

Related

Having multiple pages with multiple identical elements managed by a single code

in my xamarin application I have multiple pages that contain the same elements (header and horizontal menu), and every time I have to make a change I have to change the code in every single page, there is a way to insert fixed elements in each page ?
In xamarin, use Xamarin.Forms control templates to achieve what you want.
First create a template, design the style you want and set bindable parameters. Then when you use it, you only need to import the class directly, and you can flexibly bind the values you want to use.
For more information, please refer to the official documentation: Xamarin.Forms control templates.

Sitecore page editor dropdown

I would kindly ask for your help :) From couple of days I am trying to achieve "linked" custom field in content editor and dropdown in page editor.
Basically I want to have dropdown in page editor and content editor which are responsible for a same thing.
In my c# code i have enums which represent directions. I created custom field which accepts assembly and class with overridden onload method and successfully populate dropdown values in the content editor. So far so good but i have no idea how to create dropdown which will represent the same functionality inside page editor.
So please give me any ideas...
Judging from your reply to my comment you need to think of the following: How is my field value being rendered onto a page?
If you are always using 1 control to do this then you just need to ensure that this control has 2 different rendering modes depending on the Context.PageMode
But as I understand it you want this dropdown to also appear when someone renders your custom field using a <sc:FieldRenderer>. In this case you'll need to look into the RenderField pipeline of Sitecore. There you find a processor called RenderWebEditing. Possibly through some manipulation here you can get your dropdown appear as you wish.

AngularJS: "Global" menu buttons for multiple views

I've (very) recently dived into Angular, but I'm struggling a bit with how to design my layout.
For my site I've created a menu containing an input field and some buttons. The idea is that the input field combined with either of the buttons should service a function. So say for viewA, the input field should only act as a search bar. If the user however clicks one of the buttons the input field value should be used to as a basis to create a new item in another viewB.
The search function works great for viewA, but I'm unable to make the buttons switch views. I'm suspecting (or know, but don't know how to address it) this is because the mentioned buttons are outside the view (ng-view) and thus don't have a controller.
I've searched around for "multiple controllers / views", where suggestions vary from using the include function or create a service. Problem is I have no idea what would best practise or if it's even necessary for my case.
The menu + input field is another view. It should have its own controller. Based on the route – $on($routeChangeSuccess, ...) – you can use ng-switch to switch between the appropriate HTML/template in that view. If your templates are large, you can use ng-include inside the ng-switch directives. Otherwise don't bother, and just in-line the HTML inside each ng-switch-when.
For an example of how so use $routeChangeSuccess (but not ng-switch), see https://stackoverflow.com/a/11910904/215945

Adding custom fields to the article component

I've recently added custom fields to the article component using the documentation in the following url:
http://docs.joomla.org/Adding_custom_fields_to_the_article_component
Now this adds the custom fields defined to every new and existing article. Is there a way to define custom fields for specific article layout overrides.
Example:
If I have custom layouts for the category blog, (news, portfolio, events) can I define different custom fields for each category when creating a new article?
Kind of the way custom post types work in wordpress, or the way k2 component works, can this be done in joomla alone?
This is considerably easier to manage in K2 since the functionality is built in to do specifically what you want. It is trivial to assign extra fields to each category without having to go through the much more complex process described in your link.
However, if you want to stick with com_content, then you will need to create alternative layouts for displaying each category. You will still have all of the custom fields show up in the admin, but you can control the display on the front end with the alternative layouts. Here is the documentation (it's the same for 2.5) - http://docs.joomla.org/Layout_Overrides_in_Joomla_1.6#Introduction_to_Alternative_Layout_Feature_in_Version_1.6

Bind various panaroma/pivot items using MVVM

could someone help me with design/understanding the problem: what I need to achieve is page with Panorama/Pivot control, where its items (panos/pivots) will be set via binding, using standard MVVM pattern. Problem is I need to have different content (different user controls) on each pano/pivot, that means If I define a panorama/pivot item template, I doom all of them to be alike, which is not what I want.
I found this question here already asked: Databound windows phone panorama with MVVM design but its still not clear to me. Many thanks.
If you have a dynamic page count on panorama/pivot you could use selector to choose what template is right according to your content.
Implementing DataTemplateSelector
Also, Data Binding Pivot to MVVM may help you too
You could add a dependency property to the user control that you want to use as a data template, a dependency property named "Type" for example and depending on that property you can change the layout of your user control (data template) - for example you could have multiple grids inside your user control and you could show and hide them depending on the type.

Resources