Bindings for data-* attribute - bootstrap-modal

I was going through some bootstrap samples and found tha data-* attributes:
.data-toggle="tooltip"
.data-placement="top"
etc.
I just wonder if there is a list of this data-* possible combinations and where can they be found.

From W3School:
The data-* attributes is used to store custom data private to the page or application.
The data-* attributes gives us the ability to embed custom data attributes on all HTML elements.
CSS Frameworks like Bootstrap uses them a lot to enable and target their components. You can usually find the list in the documentation of the specific component.
Bootstrap modal documentation. See also the options section.

Related

How to build a meta-driven application in emberJS

Note: The English used in this article (along with the terms) may be a bit "out of order" since my native language is not English. Rest assured I have tried my best to make it as readable as possible, and if I have missed anything please do comment before downvoting so I may update the question accordingly (I'm still new to this)
So I've searched most of the internet for a solution to this, to find a tutorial that would guide me on the metadata driven approach for building an application on EmberJS. The documentation on Ember doesn't explain anything about the approach, just a function definition of extractMeta here, and a basic overview of how to handle metadata here.
What I want to achieve is to build a portal, with Sugar as the back-end for the application. The application will use REST API for making calls to extract the data as well as the metadata of the application. We want to make the application generic, so that no matter what module is called, the metadata is extracted to determine the fields required in the model, a filtered portion of the data needed from the call is populated into the model accordingly and the is displayed in a generic template, that will be global and used throughout the application.
The metadata includes various items such as buttons, panels, attributes(each with multiple layers of data within) etc, each may be used once or multiple times within the call or not at all. For example, for displaying the application would require the attributes for display within the table, as well as buttons for adding, deleting updating etc. Upon click the panel may be required for say, adding a particular record, which itself may contain various fields.
As an example, is the default Sugar instance that shows the leads in the data, notice how it contains various components.
Here, another example, of the panel that appears when I click the create button in the leads list, notice the fields that appear within the panel
Please Note that I do understand how to make the REST API calls for the data as well as the metadata. But how to turn that into a generic meta driven application is what I am struggling with. Thanks in advance!
If I understand this correctly, you're looking for some kind of generic UI builder based off of returned data from a REST endpoint. Ember provides the component helper.
The {{component}} helper can be used to defer the selection of a
component to run time. The {{my-component}} syntax always renders the
same component, while using the {{component}} helper allows choosing a
component to render on the fly. This is useful in cases where you want
to interact with different external libraries depending on the data.
Using the {{component}} helper would allow you to keep different logic
well separated.
{{#each model as |post|}}
{{!-- either foo-component or bar-component --}}
{{component post.componentName post=post}}
{{/each}}
Read here for a more thorough explanation.
What you essentially need to do is build a bunch of different components for each of the possible attributes from the metadata. Your models will contain what components they should render and you'll use the component helper to dynamically render the correct elements.
If you're using a table based approach, have a look at ember light table. They leverage this approach heavily with how they build the columns for their tables and support custom components:
columns: computed(function() {
return [{
label: 'Avatar',
valuePath: 'avatar',
width: '60px',
sortable: false,
cellComponent: 'user-avatar'
}, {
label: 'First Name',
valuePath: 'firstName',
width: '150px'
}];
})
As you see here, the columns are rendered generically and they use the cellComponent property to determine which component type to render.

Sitecore 8.1 Header and Footer Composite Component

In Sitecore I have created base Template & Renderings for "Header, Top Menu, Logo, Search ,Login Button…etc that comes in Header across all Pages of the Site."
Also the same template & Rendering is using in other website so we can't set value in Standard field.
Now the problem is “suppose we have 100 pages in a Site then each page we have to go and add/update rendering & data source.
Is there any way that a “Header rendering” contains child rendering and by placing “Header rendering” render all its child renderings.
Header Composite Component ===>
Logo Component
Top Navigation Component
Search Component
There is a composite component module on the Sitecore Marketplace :https://marketplace.sitecore.net/Modules/C/Composite_components.aspx?sc_lang=en
This fill's your requirements exactly.
It works by creating a "Composite Component" item, then you add your renderings for your header to that component. E.g. Logo, Navigation etc...
Then in the standard values of your page templates, you add a new Composite Component rendering and set the datasource to the component item you created.
The module will then inject the renderings from the component item presentation into your current item. So you only have to update a single place to update all pages etc...
I have this running in a few production sites and it works well. It even supports the Experience Editor.
I don't think there's a solution out of the box. SxA solves this with Partial and Page Designs at site level. Just wrote a blog about it:
http://reinoudvandalen.nl/blog/sitecore-experience-accelerator-partial-designs-and-page-designs/
I also made something that might help you: Partial Layout Presets
http://reinoudvandalen.nl/blog/sitecore-partial-layout-presets/
It even allows you to store presets per site, but keep in mind that it injects composed layouts. If you modify the preset then it does not get applied to the pages where it was injected (though you might be able to pull something of with a shared datasource per site).
Lastly the obvious solution would be to create a page template per site so you'll be able to have standard values per site.
You may want to take a look at using Placeholder Fallback.
This will allow you to add components and renderings to a top level page and then the child pages would "fallback" to using the renderings inserted into the placeholder of the top level page in the item hierarchy. The editors can also insert page specific renderings on each child page if required.
If you do not want to custom code and only out of the box features then you could use Devices. You can find more information in the documentation about Set up a device layout. Once the device is created you can specify a different default device per site:
Now when you open the Presentation Details on the __Standard Values of your templates you can specify a different Layout or Renderings per device, i.e. different ones for AltSiteDevice

How to make a statically binded rendering editable via Experience Editor (Sitecore MVC)

So I have a layout view within Sitecore Mvc, this view contained a Controller Rendering that pulls in a header and footer navigation. Example:
#Html.Sitecore().Rendering("/sitecore/layout/renderings/some_rendering")
This specifies a Controller Rendering I've defined in Sitecore. This works great, except when I'm in the experience editor. It doesn't give me the ability to select this rendering. If I create a Placeholder and then define these navigation elements to this placeholder dynamically via Sitecore, then I can, but these navigational elements exist on every page of this layout, so I would like them statically placed instead of using a Placeholder, but I would still like the user to be able to select the navigation element in the experience editor (so I can create custom command to interact with this navigation, such as creating new links, etc).
Does anyone have an idea that will help me achieve this?
Use Edit Frame for that and create Custom Edit Frame Button for operations like adding new element to the navigation.
And remember to pass Datarsource ID or Path as a second parameter to the Html.Sitecore().Rendering() method:
#Html.Sitecore().Rendering("/sitecore/layout/renderings/some_rendering", new { DataSource = "{some-id-or-path}" })
Here is set of blog posts which can help you to understand how Edit Frames work and how to add them in Sitecore MVC solution:
https://visionsincode.wordpress.com/2015/01/08/how-to-use-editframe-in-sitecore-mvc/
https://www.cmsbestpractices.com/how-to-properly-use-sitecore-edit-frames/
https://briancaos.wordpress.com/2011/11/28/using-sitecore-editframe-in-pageedit/
You won't be able to remove the component or move it around the page (yeah, it's statically bound to one place on your layout), but you will be able to edit it's properties and datasource.
You can try to use GlassMapper views and statically inherit the view from the GlassView.
Then you'll be able to use Editable method to render the field.
But the consideration you need to take is that you'll not be able to set a datasource to the component from the page editor or content editor.
Instead of injecting the rendering through the Rendering method you should be able to use standart MVC RenderPartial.
I've used this approach on one of the projects I've been on and it worked.

List of News Articles In Sitecore (Best Approach?)

I am creating a Sitecore MVC site for a client and I need to create page that will list news articles for the company.
So far, I have created items that use a shared data template called “Article,” and I also have a sublayout (a view rendering) called “Article” that will display these items.
For the list itself, my plan was to create another component (a sublayout) call “News_List”, and to put a placeholder in it called “List”.
My question is this: can I allow the author to insert articles (e.g., N items of type “Article”) into this placeholder via the page editor?
Will SC allow you to insert multiple instances of the same component into a placeholder? Will this break anything?
I believe this is a pretty common question but I have not found a definitive answer. Thanks in advance…!
You can insert as many components (of the same type) in your placeholder as you want.. Just make sure to put the placeholder settings correctly and give it a decent name (not just "list" ;))
But are you sure you want to do this? Your editors will manually need to create a list of components for each article they want to add on the page. Doesn't sound to be very user (editor) friendly.. Maybe you should consider creating a list component that can get a list of articles as a datasource and show those. Or even select them automatically (but that might be not according to your business case)..
Yes, authors can add multiple instances of the same component into a single placeholder.
Assuming that the code of the component doesn't do any stupid things it's absolutely ok to do this.

Can I insert a Component TEMPLATE Link in the Tridion GUI?

In Tridion, similar to how a field in a schema or metadata schema can either be text, embedded schema, or component link... is there a way to allow the field to be an item select like a component link, but select different types of Tridion objects instead of components?
I'd like the user to be able to select a Compound Component Template or a Page object via selecting it through the interface instead of typing in the tcm into a text field and reading that value.
Is this possible?
No. Links to Component Templates are not handled by the Tridion GUIs. The Tridion Content Manager back-end can handle links to Component Templates in some situations, which is why (for example) you can see the Component Templates show up in the WhereUsed dialog of a Page.
Most people end up using a regular text field for holding such a Component Template link and then use something like Bart's Item Selector to provide an input aid.
You must be careful by creating links to other types than components because they might not be content portable and you will get issues after porting those fields from one environment to another.
Basically the tcm uris won't be resolved by content porter.
This would have to be achieved by building a custom CME (GUI) extension.