comfortable Mexican sofa removes classes from divs - ruby-on-rails-4

I'm trying to get some parts of my site under a cms with comfortable mexican sofa.
I created the site and made it use my application.html layout. Then I tried to add a page and copy pasted my current index page source into the html editor. But when the html was pasted into the editor all the classes and id's were removed. Only html tags and texts were left. I tried to manually add a class to a div but after pressing "update page" it just disappeared. I can see the manually added class if I browse the revision history, but it doesn't show in the editor nor it is applied into the html rendered into the browser when previewing the page.
Stripping the class and id attributes from the elements works so well that it must be a planned feature. But how to turn that feature off?
I'm on rails 4.1.4

The culprit was {{ cms:page:content:rich_text }} in the layout content on Comfy's side. When I changed that into {{ cms:page:content }} the classes and id's started to stay in the pages.

Related

Sitecore 9 - Add an Image to a Link in the Footer

A client is using Sitecore 9 - we are not Sitecore developers.
We've been asked a simple thing: add social media links to the Footer of their Sitecore site.
Its proving more difficult than expected.
I've added the links on other pages by editing the HTML directly via the WYSWIG editor.
But the Footer appears more restricted, only accepting the addition of templates like 'Link'.
The 'Link' template has an option to add an external URL but doesn't have an option to add an image.
The CMS looks like this:
Is there any way to add a link, with an image, via the CMS (without the need to write Sitecore code), so the page chnages from this:
to this:
If you dont want to write Sitecore code, maybe you should think about using frontend.
Find the views that holds the footer (probably Foundation/Footer.cshtml) or something like that.
-To easily find where it is, follow these steps
Go to a content page Presentation Details that has footer (probably any)
Go to Controls
Find the footer rendering in there
Click on it
Grab the Datasource's value
Go to the Datasource's path
There should be a field holding the value of the view.
Add some css class on the div that holds those items, and do your frontend stuff in there...
It is not a scalable solution, so I would highly recommend updating the Footer rendering by adding new fields and adapting the model/view. So that way a content editor could easily add a new value for each socials.

Wagtail 2.0 Internal Link Not Working

I'm building a site with the new version of Wagtail (2.0) and when I try to add an internal link (a link to another page in my website) in a blog post using the Rich Text Editor, the hyperlink tags are stripped out and just the link text is showing. The code that gets rendered is <a id="5" linktype="page">sample page</a>.
If I add an external link, and set it to /sample-page/ then the hyperlink works as expected.
Does anyone know why this is happening?
When you output a rich text field on your template, you need to run it through the |richtext template filter:
http://docs.wagtail.io/en/v2.0.1/topics/writing_templates.html#rich-text-filter
This is because rich text is stored as a 'symbolic' variation of HTML, where items such as page links and images are represented as IDs rather than full URLs - this ensures that they won't break if a page is moved or renamed, for example. The |richtext filter is necessary to translate that symbolic HTML back to real HTML.

Adding HTML Text the right way in Experience editor

Our content author is more comfortable using Experience editor than the content editor and also has knowledge of HTML.
The requirement is - the author should also be able to add text - along with other components (carousel, banner, etc), or just create a whole HTML page using Rich text editor if they need to.
For eg: He will open Experience editor of a page, add a banner component and then below the banned wants to add text. (or maybe just design the whole page using HTML)
I'm handling this kind of task for the first time and here is what I did.
Create the following:
1. A template with the name "Rich Text Section", which has one field "Content" of type "Rich Text".
2. A View Rendering, "Rich Text Component", that points to a .cshtml which is a simple HTML
<div class="row">
#Html.Sitecore().Field("Content", Model)
</div>
A folder "Rich Text Sections" under Sitecore > Content > Home > Components. In this folder, the author can add only "Rich Text Section" templates.
To add text to/or design a page, the author needs to do the following.
Browse in content editor mode. Add a new item (say "LoremIpsum"), of template type "Rich Text", inside the "Rich Text Sections" folder.
Browse in Experience editor mode. Add the "Rich Text Component", set its data source to "LoremIpsum", and then write all the HTML content inside.
Here, the author has to switch to both editor modes. Please advise the better way to do this.
If you have the Insert Options set up correctly on the items in your solution, then from the Experience Editor you can use Insert Page from the Home tab on Ribbon. This will then pop up a modal showing all the Templates that have been configured as Insert Options, the same ones as if you were to right click on a node in the Content Editor and select the Insert option.
The page will be created as a child of the page you are currently on. You can navigate to different sections of the content tree by enabling the Navigation Bar option from the View Ribbon, selecting the page and selecting "Go".
EDIT: I mis-read your question. It seems you are trying to create the Datasource of the item when a component is added using the Experience Editor.
You need to set the Datasource Location and Datasource Template fields on the definition item of your Rendering:
Make sure you leave the Data source field empty on the Rendering item. Now when you add the component you will be prompted to Select the Associated Content. Your editors will be able to select existing content or create new ones.
You can read more in this blog post.

Sitecore, Content Editor, not generating links

I am having problem with content editor, I am using tool bar of content editor to generate hyperlinks, following is my HTML
<li>w</li>
<li>a</li>
<li>awealth</li>
<li>wwealth</li>
<li>ds</li>
some items are successfully linked to appropriate files but some links are rendered as they are and when i click on them i see page not found. IDs are valid, I have verified.
What could be the reason, Why some links aren't converted to links to actual files? Any other way to use content editor?
You need to render the field using Sitecore Controls:
<sc:Text runat="server" field="MyFieldName" />
sc:Text derives from the FieldRenderer.
You should consider reading http://sdn.sitecore.net/upload/sitecore6/64/presentation_component_api_cookbook_sc64-a4.pdf (sc:Text is used on page 36)

SharePoint 2013 Can't edit the Content Editor snippet

In SharePoint 2013 it is possible to create master pages and page layouts using the new Design Manager. After converting a HTML file to a masterpage, or after creating a new page layout, one can add SharePoint functionality by using the Snippet Manager. I have used this approach to convert a static HTML/CSS file into an SharePoint masterpage with accompanying page layouts. I'm able to use all the snippets from the Snippet Manager, except for the "Content Editor" snippet. I was able to add top navigation, the quick launch bar, page properties and even "Web Part Zone" snippets.
The usecase:
I want to have a editable footer. The footer consists of four parts, so I added four Content Editor snippets, by pasting the snippet code into the HTML masterpage. When generating a snippet, it's possible to set custom properties. I noticed that it's not possible to set the WebPartID over here. In the snippet, the following WebPartID is always used: 00000000-0000-0000-0000-000000000000. The "Web Part Zone" snippet however will generate a (random?) WebPartID (and works).
The problem:
Adding the snippet works fine, but when I publish the master page or page layout it's not possible to edit the CEWP. When I edit a page which uses either the master page or the page layout, the CEWP should transform to an editable region, but it doesn't. There is no error shown. The webpart renders itself correctly.
What I tried:
I tried filling in a random WebPartID, but that doesn't work. Searching on Google and on StackOverflow didn't gave me any clues, I can't find anyone facing the same problem.
The code:
The following snippet is generated:
<!--CS: Start Content Editor Snippet--><!--SPM:<%#Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>--><!--MS:<WebPartPages:ContentEditorWebPart xmlns:WebPartPages="namespace" runat="server" webpart="true">--><!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div class="ms-webpart-chrome ms-webpart-chrome-fullWidth "><div WebPartID="00000000-0000-0000-0000-000000000000" HasPers="true" id="WebPart" width="100%" class="ms-WPBody noindex " OnlyForMePart="true" allowMinimize="false" allowRemove="false" allowDelete="false" style=""><div class="ms-rtestate-field"></div><div class="ms-clear"></div></div></div><!--PE: End of READ-ONLY PREVIEW--><!--MS:<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">--><!--MS:<Title>--><!--SPM:$Resources:core,ContentEditorWebPartTitle;--><!--ME:</Title>--><!--MS:<FrameType>--><!--SPM:None--><!--ME:</FrameType>--><!--MS:<Description>--><!--SPM:$Resources:core,ContentEditorWebPartDescription;--><!--ME:</Description>--><!--MS:<IsIncluded>--><!--SPM:true--><!--ME:</IsIncluded>--><!--MS:<ZoneID>--><!--SPM:ImportedPartZone--><!--ME:</ZoneID>--><!--MS:<PartOrder>--><!--SPM:0--><!--ME:</PartOrder>--><!--MS:<FrameState>--><!--SPM:Normal--><!--ME:</FrameState>--><!--MS:<Height>--><!--ME:</Height>--><!--MS:<Width>--><!--ME:</Width>--><!--MS:<AllowRemove>--><!--SPM:false--><!--ME:</AllowRemove>--><!--MS:<AllowZoneChange>--><!--SPM:false--><!--ME:</AllowZoneChange>--><!--MS:<AllowMinimize>--><!--SPM:false--><!--ME:</AllowMinimize>--><!--MS:<AllowConnect>--><!--SPM:true--><!--ME:</AllowConnect>--><!--MS:<AllowEdit>--><!--SPM:true--><!--ME:</AllowEdit>--><!--MS:<AllowHide>--><!--SPM:false--><!--ME:</AllowHide>--><!--MS:<IsVisible>--><!--SPM:true--><!--ME:</IsVisible>--><!--MS:<DetailLink>--><!--ME:</DetailLink>--><!--MS:<HelpLink>--><!--ME:</HelpLink>--><!--MS:<HelpMode>--><!--SPM:Modeless--><!--ME:</HelpMode>--><!--MS:<Dir>--><!--SPM:Default--><!--ME:</Dir>--><!--MS:<PartImageSmall>--><!--ME:</PartImageSmall>--><!--MS:<MissingAssembly>--><!--SPM:Cannot import this Web Part.--><!--ME:</MissingAssembly>--><!--MS:<PartImageLarge>--><!--SPM:/_layouts/15/images/mscontl.gif--><!--ME:</PartImageLarge>--><!--MS:<IsIncludedFilter>--><!--ME:</IsIncludedFilter>--><!--MS:<ExportControlledProperties>--><!--SPM:true--><!--ME:</ExportControlledProperties>--><!--MS:<ConnectionID>--><!--SPM:00000000-0000-0000-0000-000000000000--><!--ME:</ConnectionID>--><!--MS:<ID>--><!--SPM:g_2bfa6a66_54d1_45e6_84e7_ebbb461f2911--><!--ME:</ID>--><!--MS:<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</ContentLink>--><!--MS:<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</Content>--><!--MS:<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</PartStorage>--><!--MS:<ID>--><!--SPM:g_a4deccb6_9661_415d_99c8_51f528cf7428--><!--ME:</ID>--><!--ME:</WebPart>--><!--ME:</WebPartPages:ContentEditorWebPart>--><!--CE: End Content Editor Snippet-->
This generates the following code in the .master file:
<WebPartPages:ContentEditorWebPart runat="server" webpart="true" __WebPartId="{B2063517-7C26-4084-AA28-36434C760CDB}"><WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"><Title>$Resources:core,ContentEditorWebPartTitle;</Title><FrameType>None</FrameType><Description>$Resources:core,ContentEditorWebPartDescription;</Description><IsIncluded>true</IsIncluded><PartOrder>0</PartOrder><FrameState>Normal</FrameState><Height /><Width /><AllowRemove>false</AllowRemove><AllowZoneChange>false</AllowZoneChange><AllowMinimize>false</AllowMinimize><AllowConnect>true</AllowConnect><AllowEdit>true</AllowEdit><AllowHide>false</AllowHide><IsVisible>true</IsVisible><DetailLink /><HelpLink /><HelpMode>Modeless</HelpMode><Dir>Default</Dir><PartImageSmall /><MissingAssembly>Cannot import this Web Part.</MissingAssembly><PartImageLarge>/_layouts/15/images/mscontl.gif</PartImageLarge><IsIncludedFilter /><ExportControlledProperties>true</ExportControlledProperties><ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID><ID>g_2bfa6a66_54d1_45e6_84e7_ebbb461f2911</ID><ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[]]></Content>
<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /><ID>g_a4deccb6_9661_415d_99c8_51f528cf7428</ID></WebPart></WebPartPages:ContentEditorWebPart>
Some more information:
I'm pasting the snippets in the HTML file, as indicated. When I add a Web Part Zone snippet, I'm able to add working "Content Editor" WebParts in it. "Web Part Zone" snippets are only available in the Page Layout Snippet Manager though, so I can't use that as a workaround to get the footer in the masterpage to work.
My questions:
How can I add a Content Editor WebPart through the Snippet Manager?
Are there others facing the same problem?
Is it okay to leave the WebPartID 00000000-0000-0000-0000-000000000000?
Having fought a bit with SharePoint on this, this is what I found:
There are two different ways the Snippets created by the Snippet Manager work. If they are put anywhere within the html code of your Masterpage or Page Layouts, they will have the exact same configurations as the ones you select on the Snippet Editor, and you won't be able to edit them afterwards.
However, if you put them inside a Webpart Container Snippet code, you will be able to edit the webparts when accessing the Edit Page feature on SharePoint. As you probably figured out, this only works on page layouts and not on masterpages.
I believe a way to have a dynamic footer, is to use a Content By Search Web part and point it to a specific List (Footer List) and on that list you can have a column with a Rich Text Editor type, and then you can create a specific Display Template that will render the list content as desired.
Hope it makes some sense.