How to add tables inside facebook instant articles? - facebook-instant-articles

In facebook format references https://developers.facebook.com/docs/instant-articles/reference nothing is mentioned about adding tables. When I try to add tables inside tags that is getting truncated by facebook. Is there anyone resolved this issue?
Thanks in advance for the help.

Tables are not supported out of the box. You can wrap them in an op-interactive though. They won't inherit any styling so you might need to add some styling as well.
<figure class="op-interactive">
<iframe>
<table>
[...]
</table>
</iframe>
</figure>

Related

grails fields plugin <f:display is 'chopping off' bootstrap dropright action with a table of values

grails v 3.3.9, fields plugin
fighting with fields plgin and theres a problem when rendering domain objects and using bootstrap
i've got a sample here from a simple standalone page to show the problem
<p>f:display category </p>
<f:display bean="maintenanceAgreement" >
</f:display>
<hr />
<p>f:field category</p>
<f:field bean="${this.pageScope.maintenanceAgreement}" property="category">
<g:render template="/_fields/map/displayWidget" ></g:render>
</f:field>
<hr />
in essenence i have added a template in "/_fields/map/displayWidget" that renders a drop right table on a button
when you render a map field directly from your Domain object the sample table opens and you get all of the table
however when you
you can see the differences between using f.display (has clipping problem), f.field ( which seems to work) and f.all that ignores my _fields/map/_displayWidget.gsp
I dont want to have not use the fields plugin but its not working with bootstrap templating
has any one come up with a fix for this problem?
the project demo page is here
github standalone page to show rendering problem
the attached shows the output as you try each and select category property
well goldarn it another 2 days down the pan - but i have it !
I thought at first it was something to do with fields plugin processing. so i hacked a clone of plugin project locally and added some bits so i could watch it/debug step through it
in doing so i noted that my dummy web domain class page i'd cut across to the plugin didnt have the clipping problem. but the styles were not the same so i copied main.css and grails.css from ordinary project back into the plugin, then re rendered in the browser - and the clipping happened again.
so its in the css!. some very careful watching of browser and looking at the browser 'inspect' indicated that the clipping seemed to be enabled very early on in the journey.
so in my dummy page i just used
I then spent a day wandering round the various bits of fields plugin as its not that well explained anywhere.
if you look at the plugins taglib display method, by default that triggers the /templates/fields/_list.gsp. naming is a little odd but its the gsp that renders the domains persistent attributes as an ordered list - the plugins default _list.gsp looks like this
<ol class="property-list ${domainClass.decapitalizedName}">
<g:each in="${domainProperties}" var="p">
<li class="fieldcontain">
<span id="${p.name}-label" class="property-label"><g:message code="${domainClass.decapitalizedName}.${p.name}.label" default="${p.defaultLabel}" /></span>
<div class="property-value" aria-labelledby="${p.name}-label">${body(p)}</div>
</li>
</g:each>
</ol>
so after much exploration coming up through templates, from the bottom I ended up right at the top with the '
so nearly there now. back into main.css that i'd copied in. if you edit that, down around line 215 you get this style. If you comment out the overflow property - its all fixed !
.property-list .fieldcontain {
list-style: none;
/*overflow: hidden; */
zoom: 1;
}
I tried auto, scroll, and visible but that seems to much about with too much of the page so best to just comment it out.
once you do that - the rest of the rendering of your forms starts to work !! blimey one line of css for all that pain. Attached is the page using
Lastly through out all this, id ended up digging through /tracing fields plugin. What a nest that is. Not really finished here, but basically
with no body just renders a label and no content. So you either need to provide provide a body tag, say to get the value field displayed.
as
if no widget template has been defined then the renderDefaultDisplay is called which again has very limited options for controlling the rendering by falling through a 'switch (prop.type)' and basically calls either g.format (bool), g.formatDate (but no LocalDateTime/LocalDate Support) or g.fieldValue, non of which are bootstrap enabled.
if you call
these two diagrams are not beautiful but just high level pseudo code walk through for what the core tags are trying to do. One day i'll try and pretty that up but it might help you if you get stuck
I'll raise a bug for the main.css clipping directly to the grails team and see what happens, but you can comment the line out yourself if you fall foul of it.

Umbraco, adding attachments to articles in back-end and then showing them in front-end CMS

On my Umbraco website, I have the section which shows latest News. Each news is one article.
Unfortunately, I can't add any attachments to any News article in back-end so users could see that attachment(s) on front-end of website and download them if they want to. This is how I it should look like
https://imagizer.imageshack.us/v2/895x383q90/826/cozp.jpg
Is this possible to do? While I was using Joomla CMS it was very easy by installing additional module/component which took me only 15 minutes to set.
Any help is appreciated and many thanks in advance for prompt replies!
MC2012
The solution is fairly simple:
Add the attachments to a folder in the 'Media' section
Add a field to the document type that the page uses called 'attachments' and use the datatype 'Multi-node Picker'
On the page content pick the attachments you are interested in
Render the list of attachments (http://our.umbraco.org/projects/backoffice-extensions/ucomponents/questionssuggestions/26638-Multi-Node-Tree-Picker-help-with-example-code-(in-Razor))
using something like:
<article>
#if(Model.HasValue("attachments")){
<ul>
#foreach(var item in Model.attachments){
var node = Library.NodeById(item.InnerText);
<li>
#node.Name
</li>
}
</ul>
}
</article>
Thank you very much for fast answer. However, in the meantime I have find solution. Here is the link
http://our.umbraco.org/forum/using/ui-questions/47616-Adding-attachments-to-articles-in-back-end-and-then-showing-them-in-front-end-CMS
I hope someone else will have some use of it because it is great solution.
BR,
MC2012

How to loop through properties in a tab and display them using Razor?

I have a Document Type, that has a tab with some properties.
The properties are Upload types, and Simple Editor types.
(Users are supposed to upload images with some image text).
I have not grouped the "Upload" and "Simple Editor" properties, so how do i do this?
Next question,
I want to loop through each group (there should be 3 currently) and display them on my website.
The markup should look like the following:
<div>
<img src="PATH-TO-UPLOAD-TYPE" />
<div>"TEXT FROM SIMPLE EDTIOR TYPE"</div>
</div>
..
<div>
<img src="PATH-TO-UPLOAD-TYPE" />
<div>"TEXT FROM SIMPLE EDTIOR TYPE"</div>
</div>
...
I would like to use Razor for this. Thanks in advance!
For the first part, using the Razor model, you can't. The content object that you get on the front end only contains the properties, the tabs are not included, as they're only really for organising things in the back office.
You CAN get that information using the Umbraco API, but it's pretty database intensive and could potentially be quite slow if you have a lot of properties/tabs.
You'd be better grouping them yourself in your Razor Macro.
for the second part, you can acces the properties of a page via #Model.property. For example:
<div>
<div>#Model.simpleProperty</div>
</div>

multiple Html.Attr on one tag in razor?

how do i use multiple Html.Attr on one tag as follows in a razor view? this doesnt work.
<tr #Html.Attr("style", "color: #FF3D0D;")
#Html.Atrr("data-item", Model.ItemNumber)>
I'm not familiar with the .Attr helper either, but just incase you copied the code directly from your view, there is a typo, you have #Html.Atrr which I'm guessing should be #Html.Attr for data-item
So, it has come to this..
#Html.Atrr("data-item", Model.ItemNumber)
- VS -
data-item="#Model.ItemNumber"
Just one word: don't. Your markup AND every single human being on earth will benefit from the later much straight forward syntax. The HtmlHelper Html.Atrr doesn't help at all, no value.
Also, the following works for me:
<body #Html.Raw("data-test1=\"1\"") #Html.Raw("date-test2=\"2\"")>
.. and renders:
<body data-test1="1" date-test2="2">
You probably should be using #Html.Attr and not #Html.Atrr... or, as others have pointed out, just writing the attributes explicitly.

Elegant code annotation for tutorials?

I've been writing some tutorials, and I'm trying to figure out an elegant way to add line-by-line annotations to the code in the tutorials.
For example, suppose I have some code like this:
<h1>Demo of web page</h1>
<p>This is a paragraph</p>
I'd like to be able to add something (maybe a tooltip or some kind of lightbox effect) that allows me to present an explanation of each line to the reader, while still letting them see the line in context. The best I've been able to come up with is prose explanations that say things like "The line that starts with <h1> is a headline."
Anyone ever seen something like this?
You might want to check out docco:
http://jashkenas.github.com/docco/
It's written in CoffeeScript and generates an HTML doc from a source file breaking up the comment sections and the code. It sets up the comments as annotations for each section in one column and the corresponding properly highlighted code in the other column. I think it's a great simple way to grok annotations while keeping the code in context. Oh, and it also knows markdown.
What about using title attributes?
<h1 title="your hover text">your text</h1>
I think I might have found something to rival Docco: the popover feature of Twitter Bootstrap: http://twitter.github.com/bootstrap/javascript.html#popover
I'm not sure that it will actually look good, but it seems like a good start.
Old but good question, I was searching for similar things when I found this. There are tons of ways of doing HTML annotation, see this article for a very nice listing and explanations.
If you want annotation that simply tells the user what each line does, I would write HTML comments for small pieces of code, and larger external annotations for large amounts of code. You could then parse them using custom JS to show prettier boxes if you so wish.
<h1>Heading</h1> <!-- A heading element -->
<p>paragraph</p> <!-- A paragraph element -->
<p>Paragraph with
<b>Bold</b> <!-- An inline Bold element -->
text</p>
For larger amounts of code, I would consider using something like the documentation that Docco creates. Sure, it's for JavaScript but who says a similar one can't be done for HTML. As this was tagged with jquery-UI, you also might be interested in a jQuery text annotater.

Resources