ng-flow define maximum number of files - ng-flow

I am using ng-flow in my app, is there any way to limit the number of files for upload?
A code sample:
<div class="thumbnail" ng-show="$flow.files.length">
<img flow-img="$flow.files[0]" />
</div>
<div>
Select image
Change
<a href="#" class="btn btn-danger" ng-show="$flow.files.length"
ng-click="$flow.cancel()">
Remove
</a>
</div>

The attribute flow-file-added is expecting a boolean value.
You can put all your conditions in there.
$flow.files.length returns the number a files you have already added
For example:
<div flow-init flow-files-submitted="$flow.upload()" flow-file-added="$flow.files.length<3"></div>

Related

Functionality of data-sly-test for given example in image

Please find the below snippet. Can any one explain above functionality for the data-sly-test. How it will work condition here for image??
<div class="spon-image-container col-12 col-md-4">
<sly data-sly-test="${properties.fileReference}">
<img class="spon-_image" src="${properties.fileReference}"/>
</sly>
</div>
There are a few things to mention here. The gist of the code snippet is, that the <img> tag will only be rendered if {$properties.fileReference} is not empty.
Be aware, there is no sanity check involved here. data-sly-test won't check if the referenced file exists etc.
So assume that ${properties.fileReference} equals /content/dam/myImage.png. Then the resulting HTML would like this:
<div class="spon-image-container col-12 col-md-4">
<img class="spon-_image" src="/content/dam/myImage.png"/>
</div>
On the other hand, if the ${properties.fileReference} is empty (or null) you get the following HTML:
<div class="spon-image-container col-12 col-md-4">
</div>
Depending on your HTML/CSS/JS you might not want that to happen. So you could improve your code to include the data-sly-test statement in the <div> tag:
<div class="spon-image-container col-12 col-md-4" data-sly-test="${properties.fileReference}">
<img class="spon-_image" src="${properties.fileReference}"/>
</div>
This way, the <div> is only rendered, if a fileReference is set. But even if you still want the <div> to appear, your code can be improved by removing the <sly> element and adding the data-sly-test to the <img> tag:
<div class="spon-image-container col-12 col-md-4">
<img class="spon-_image"
src="${properties.fileReference}"
data-sly-test="${properties.fileReference}"/>
</div>
As mentioned in the specification, data-sly-test:
Keeps or removes the element depending on the attribute value.
For your case if fileReferece property evaluates to true (not null, not empty), it will render:
<div class="spon-image-container col-12 col-md-4">
<img class="spon-_image" src="....."/>
</div>
Note that the sly tag unwraps/removes itself, it's actually unnecessary here as the data-sly-test attribute could be moved to the img.
If fileReference evaluates to false, it will render:
<div class="spon-image-container col-12 col-md-4">
</div>
It basically checks if the current resource properties(i.e component properties) contain fileRefernce then it will add an image tag.

Remove ce-wrappers of fluid cObject

I masked(mask-extension) a couple of plug-ins. When the image is generated in the template, it is always wrapped in following divs:
<div id="c63" class="frame frame-default frame-type-image frame-layout-0">
<div class="ce-image ce-center ce-above">
<div class="ce-gallery" data-ce-columns="1" data-ce-images="1">
<div class="ce-outer">
<div class="ce-inner">
<div class="ce-row">
<div class="ce-column">
<figure class="image"><img class="image-embed-item"
src="fileadmin/user_upload/bla" width="975"
height="678" alt=""></figure>
</div>
</div>
</div>
</div>
</div>
</div>
Is there any way to remove all those wrappers? I simply want to have the image.
Sidenotes:
1. f:image does not work, I cannot access the proper uid for it to show. (This is perhaps an issue with mask)
2. I cannot find the tt_content.stdWrap.innerWrap > in my typoScript, as I do not know where mask puts it. It is neither in the netup.ts nor in the NewContentElementWizard.ts
You need to overwrite the fluid_styled_content partial in Resources/Private/Partials/Media/Gallery.html.
How to overwrite, you can read here: https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/8.7/Configuration/OverridingFluidTemplates/

Github pages are not showing images

Images are not showing on my site on github pages.
This is my site:https://rsgrw23.github.io/rate-your-beer/
Locally everything is working fine.
This is the repository: https://github.com/rsgrw23/rate-your-beer
What is wrong?
For example, here's an excerpt of src/components/home.vue <template>:
<template>
<div class="home">
<img class="home__img__header" src="src/assets/craft-beer.jpg" alt="Craft Beer">
<header class="home__header">
<transition appear appear-active-class="bounce-enter-active">
<h1>"Czasem najlepszym wyjściem</h1>
</transition>
<transition appear appear-active-class="bounce-enter-active">
<h2>Jest wyjście na piwo"</h2>
</transition>
</header>
<main class="home__main">
<h1 class="home__title">Fun Facts</h1>
<article class="home__article">
<div class="home__content content-1"><h1>Lepsze od wody?</h1>
<p>W mi... dziś.</p></div>
<img class="home__img img-1" src="src/assets/wish-you-beer-here.jpg" alt="piwo">
</article>
<article class="home__article">
<img class="home__img img-2" src="src/assets/beer-mine.jpg" alt="piwo">
<div class="home__content content-2"><h1>Nie tylko z chmielem</h1>
<p>Je...em.</p>
<p>Co cie...ika!</p></div>
</article>
<article class="home__article">
<div class="home__content content-3"><h1>IPA czyli napój żołnieży</h1>
<p>Bry...wa.</p></div>
<img class="home__img img-3" src="src/assets/water.jpg" alt="piwo">
</article>
</main>
<div class="description">
<div class="description__content">
<div class="description__article">
<h1 class="description__header">Piłeś piwko?</h1>
<h2 class="description__header">Oceń je!</h2>
</div>
</div>
</div>
</div>
</template>
Images are located at src/assets/craft-beer.jpg for instance.
So webpack is able to find the images and process them as resources, you should reference the assets (images) via relative paths, not absolute paths.
So, considering a file at /src/components/home.vue with images at /src/assets (being / the project root), instead of:
<img class="home__img__header" src="src/assets/craft-beer.jpg" alt="Craft Beer">
Use:
<img class="home__img__header" src="../assets/craft-beer.jpg" alt="Craft Beer">
Naturally, in other files, change the relative path accordingly.
For the images to work with Vue the generated file there are few ways.Here is an SO link on the same.
How to import and use image in a Vue single file component?
What you will want to do here is something like this.
<img class="home__img__header" src="~src/assets/craft-beer.jpg" alt="Craft Beer">
This lets the webpack know about the image being an asset and generate its path appropriately.

Multiple Schema.org ItemList elements on one page

I defined multiple ItemLists on one page, and the Chrome extension Structured Data Testing Tool says: "ITEMLISTS_MULTIPLE_LISTS_ON_PAGE"
Is there any way to define multiple ItemList elements within one page while being still valid?
<div vocab="http://schema.org/" typeof="ItemList">
<h2 property="name">Top 10 laptops</h2><br>
<link property="itemListOrder" href="http://schema.org/ItemListOrderDescending" />
<p>1. <span property="itemListElement">HP Pavilion dv6-6013cl</span></p>
<p>2. <span property="itemListElement">Dell XPS 15 (Sandy Bridge)</span></p>
<p>3. <span property="itemListElement">Lenovo ThinkPad X220</span></p>
...
</div>
<div vocab="http://schema.org/" typeof="ItemList">
<h2 property="name">Top 10 tablets</h2><br>
<link property="itemListOrder" href="http://schema.org/ItemListOrderDescending" />
<p>1. <span property="itemListElement">Apple iPad</span></p>
<p>2. <span property="itemListElement">Samsung Galaxy Tab S3</span></p>
<p>3. <span property="itemListElement">Asus ZenPad 3S 10</span></p>
...
</div>
Google doesn't allow this.
What one could do is create an ItemList for the h2 items and create intermediary pages per h2 element

form of bootstrap is narrow and cols parameter does not work

I'm trying to learn bootstrap on my site but the form is just too narrow that I cannot change the width by changing the text field's cols.
see the page:
http://saslab.org/mycontact.php
and this page:
http://saslab.org/testme.html
could some one educate me on this?
thank you!
John
do it like this:
<div class="row">
<div class="span4">
<p>Name</p> <input type="text" name="name">
</div>
<div class="span4">
<p>Email</p> <input type="text" name="email">
</div>
<div class="span4">
<p>Phone</p> <input type="text" name="phone">
</div>
</div>
wrap the p tag and input with span
You have a line in your source: <div class="container marketing">. Upon further inspection, your 'marketing' class has the attribute text-align:center. This means all of your form will be centered because the div that contains it has that class. This is why your form is narrow.
Specifically, you have a file called mycontact.php and here's what you have for the CSS that applies:
.marketing .span12 {
text-align: center;
}
well, i guess it is Bootstrap's default css that causes the narrowing. in the following links, you can see the contrast
one without bootstrap:
http://saslab.org/testme.html
one with bootstrap:
http://saslab.org/testme_bootstrap.html