Skip to content

[Feature] Added possibility to upload multiple images #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions css/layout-css/agenda-style.upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,42 @@
display: none;
}

.agenda-multiple-images-holder {
display: flex;
flex-wrap: wrap;
}

.agenda-multiple-images-item {
width: calc(50% - 7.5px);
margin-top: 15px;
border-radius: 12px;
padding: 10px;
border: 1px solid rgba(127, 127, 127, 0.5);
cursor: pointer;
}

.agenda-multiple-images-item:nth-of-type(2n+1) {
margin-right: 15px;
}

.agenda-multiple-images-item .image {
width: 100%;
padding-top: 100%;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

@media screen and (min-width: 640px) {
.agenda-multiple-images-item {
width: calc(33.33% - 10px);
margin-right: 15px;
}

.agenda-multiple-images-item:nth-of-type(3n) {
margin-right: 0;
}

.agenda-detail-overlay .agenda-detail-overlay-wrapper {
position: absolute;
top: 0;
Expand Down
35 changes: 35 additions & 0 deletions css/layout-css/news-feed-style.upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,42 @@ html.ie11 .new-news-feed-list-container .news-feed-list-item:not(.open) .slide-o
padding: 20px 15px;
}

.news-feed-multiple-images-holder {
display: flex;
flex-wrap: wrap;
}

.news-feed-multiple-images-item {
width: calc(50% - 7.5px);
margin-top: 15px;
border-radius: 12px;
padding: 10px;
border: 1px solid rgba(127, 127, 127, 0.5);
cursor: pointer;
}

.news-feed-multiple-images-item:nth-of-type(2n+1) {
margin-right: 15px;
}

.news-feed-multiple-images-item .image {
width: 100%;
padding-top: 100%;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

@media screen and (min-width: 640px) {
.news-feed-multiple-images-item {
width: calc(33.33% - 10px);
margin-right: 15px;
}

.news-feed-multiple-images-item:nth-of-type(3n) {
margin-right: 0;
}

.news-feed-detail-overlay .news-feed-detail-wrapper .news-feed-item-inner-content {
padding: 20px 15px;
}
Expand Down
35 changes: 35 additions & 0 deletions css/layout-css/simple-list-style.upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,42 @@ html.ie11 .simple-list-item .list-item-description {
margin-left: 5px;
}

.simple-list-multiple-images-holder {
display: flex;
flex-wrap: wrap;
}

.simple-list-multiple-images-item {
width: calc(50% - 7.5px);
margin-top: 15px;
border-radius: 12px;
padding: 10px;
border: 1px solid rgba(127, 127, 127, 0.5);
cursor: pointer;
}

.simple-list-multiple-images-item:nth-of-type(2n+1) {
margin-right: 15px;
}

.simple-list-multiple-images-item .image {
width: 100%;
padding-top: 100%;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

@media screen and (min-width: 640px) {
.simple-list-multiple-images-item {
width: calc(33.33% - 10px);
margin-right: 15px;
}

.simple-list-multiple-images-item:nth-of-type(3n) {
margin-right: 0;
}

.simple-list-detail-overlay .simple-list-detail-overlay-wrapper {
position: absolute;
top: 0;
Expand Down
35 changes: 35 additions & 0 deletions css/layout-css/small-card-style.upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,42 @@
display: none;
}

.small-card-multiple-images-holder {
display: flex;
flex-wrap: wrap;
}

.small-card-list-multiple-images-item {
width: calc(50% - 7.5px);
margin-top: 15px;
border-radius: 12px;
padding: 10px;
border: 1px solid rgba(127, 127, 127, 0.5);
cursor: pointer;
}

.small-card-list-multiple-images-item:nth-of-type(2n + 1) {
margin-right: 15px;
}

.small-card-list-multiple-images-item .image {
width: 100%;
padding-top: 100%;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

@media screen and (min-width: 640px) {
.small-card-list-multiple-images-item {
width: calc(33.33% - 10px);
margin-right: 15px;
}

.small-card-list-multiple-images-item:nth-of-type(3n) {
margin-right: 0;
}

.small-card-detail-overlay .small-card-detail-overlay-wrapper {
position: absolute;
top: 0;
Expand Down
34 changes: 34 additions & 0 deletions css/layout-css/small-h-card-style.upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,45 @@
display: none;
}

.small-h-card-multiple-images-holder {
display: flex;
flex-wrap: wrap;
}

.small-h-card-multiple-images-item {
width: calc(50% - 7.5px);
margin-top: 15px;
border-radius: 12px;
padding: 10px;
border: 1px solid rgba(127, 127, 127, 0.5);
cursor: pointer;
}

.small-h-card-multiple-images-item:nth-of-type(2n+1) {
margin-right: 15px;
}

.small-h-card-multiple-images-item .image {
width: 100%;
padding-top: 100%;
background-size: contain;
background-repeat: no-repeat;
background-position: center;

.small-h-card-detail-overlay .small-h-card-detail-overlay-panel {
z-index: 1;
}

@media screen and (min-width: 640px) {
.small-h-card-multiple-images-item {
width: calc(33.33% - 10px);
margin-right: 15px;
}

.small-h-card-multiple-images-item:nth-of-type(3n) {
margin-right: 0;
}

.small-h-card-detail-overlay .small-h-card-detail-overlay-wrapper {
position: absolute;
top: 0;
Expand Down
10 changes: 5 additions & 5 deletions js/build.templates.js

Large diffs are not rendered by default.

31 changes: 30 additions & 1 deletion js/layout-javascript/agenda-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ function DynamicList(id, data, container) {
this.fetchedAllBookmarks = false;
this.searchValue = '';
this.activeFilters = {};
this.imagesData = {
images: [],
options: { index: null }
};

this.listItems = [];
this.agendasByDay = [];
Expand Down Expand Up @@ -744,6 +748,22 @@ DynamicList.prototype.attachObservers = function() {
$(this).parents('.agenda-item-bookmark-holder').removeClass('not-bookmarked').addClass('bookmarked');

record.bookmarkButton.like();
})
.on('click', '.agenda-multiple-images-item', function() {
_this.imagesData.options.index = $(this).index();

var agendaImageGallery = Fliplet.Navigate.previewImages(_this.imagesData);

agendaImageGallery.listen('afterChange', function() {
Fliplet.Page.Context.update({
agendaImageGalleryId: _this.data.id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we updating these page context parameters? Does this feature support opening a detail view gallery item using URL parameters? If so, I don't see any code that supports this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is how it is done in the gallery component. I do not think that is it possible to open a detail view using URL, as far as I remember this is done to correctly assign images to specific component. So if we have multiple gallery components it will not show all pictures from both of those components.
images

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the page context updating isn't going to do anything for the user, then take it out. It wasn't part of the requirement to get that working.

agendaImageGalleryIdOpenIndex: this.getCurrentIndex()
});
});

agendaImageGallery.listen('close', function() {
Fliplet.Page.Context.remove(['agendaImageGalleryId', 'agendaImageGalleryIdOpenIndex']);
});
});
}

Expand Down Expand Up @@ -2314,6 +2334,7 @@ DynamicList.prototype.addDetailViewData = function (entry) {
var label = '';
var labelEnabled = true;
var content = '';
var field = entry.originalData[dynamicDataObj.column];

// Define label
if (dynamicDataObj.fieldLabel === 'column-name' && dynamicDataObj.column !== 'custom') {
Expand All @@ -2330,7 +2351,15 @@ DynamicList.prototype.addDetailViewData = function (entry) {
if (dynamicDataObj.customFieldEnabled) {
content = new Handlebars.SafeString(Handlebars.compile(dynamicDataObj.customField)(entry.originalData));
} else {
content = entry.originalData[dynamicDataObj.column];
content = field;
}

if (dynamicDataObj.type === 'image') {
content = Array.isArray(field) ? content : field.split(/\n/);

content.forEach(function(imageUrl) {
_this.imagesData.images.push({ url: imageUrl });
});
}

// Define data object
Expand Down
31 changes: 30 additions & 1 deletion js/layout-javascript/news-feed-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ function DynamicList(id, data, container) {
this.fetchedAllBookmarks = false;
this.searchValue = '';
this.activeFilters = {};
this.imagesData = {
images: [],
options: { index: null }
};

this.queryOpen = false;
this.querySearch = false;
Expand Down Expand Up @@ -818,6 +822,22 @@ DynamicList.prototype.attachObservers = function() {
$(this).parents('.news-feed-like-holder').removeClass('not-liked').addClass('liked');
record.likeButton.like();
$(this).find('.count').html(count);
})
.on('click', '.news-feed-multiple-images-item', function() {
_this.imagesData.options.index = $(this).index();

var newsFeedImageGallery = Fliplet.Navigate.previewImages(_this.imagesData);

newsFeedImageGallery.listen('afterChange', function() {
Fliplet.Page.Context.update({
newsFeedImageGalleryId: _this.data.id,
newsFeedImageGalleryIdOpenIndex: this.getCurrentIndex()
});
});

newsFeedImageGallery.listen('close', function() {
Fliplet.Page.Context.remove(['newsFeedImageGalleryId', 'newsFeedImageGalleryIdOpenIndex']);
});
});
}

Expand Down Expand Up @@ -2072,6 +2092,7 @@ DynamicList.prototype.addDetailViewData = function (entry) {
var label = '';
var labelEnabled = true;
var content = '';
var field = entry.originalData[obj.column];

// Define label
if (obj.fieldLabel === 'column-name' && obj.column !== 'custom') {
Expand All @@ -2090,7 +2111,15 @@ DynamicList.prototype.addDetailViewData = function (entry) {
} else if (_this.data.filterFields.indexOf(obj.column) > -1) {
content = _this.Utils.String.splitByCommas(entry.originalData[obj.column]).join(', ');
} else {
content = entry.originalData[obj.column];
content = field;
}

if (obj.type === 'image') {
content = Array.isArray(field) ? content : field.split(/\n/);

content.forEach(function(imageUrl) {
_this.imagesData.images.push({ url: imageUrl });
});
}

// Define data object
Expand Down
33 changes: 31 additions & 2 deletions js/layout-javascript/simple-list-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ function DynamicList(id, data, container) {
this.dataSourceColumns;
this.searchValue = '';
this.activeFilters = {};
this.imagesData = {
images: [],
options: { index: null }
};

this.queryOpen = false;
this.querySearch = false;
Expand Down Expand Up @@ -793,6 +797,22 @@ DynamicList.prototype.attachObservers = function() {
$(this).parents('.simple-list-like-holder').removeClass('not-liked').addClass('liked');
record.likeButton.like();
$(this).find('.count').html(count);
})
.on('click', '.simple-list-multiple-images-item', function() {
_this.imagesData.options.index = $(this).index();

var simpleListImageGallery = Fliplet.Navigate.previewImages(_this.imagesData);

simpleListImageGallery.listen('afterChange', function() {
Fliplet.Page.Context.update({
simpleListImageGalleryId: _this.data.id,
simpleListImageGalleryIdOpenIndex: this.getCurrentIndex()
});
});

simpleListImageGallery.listen('close', function() {
Fliplet.Page.Context.remove(['simpleListImageGalleryId', 'simpleListImageGalleryIdOpenIndex']);
});
});
}

Expand Down Expand Up @@ -2034,6 +2054,7 @@ DynamicList.prototype.addDetailViewData = function (entry) {
var label = '';
var labelEnabled = true;
var content = '';
var field = entry.originalData[obj.column];

// Define label
if (obj.fieldLabel === 'column-name' && obj.column !== 'custom') {
Expand All @@ -2050,9 +2071,17 @@ DynamicList.prototype.addDetailViewData = function (entry) {
if (obj.customFieldEnabled) {
content = new Handlebars.SafeString(Handlebars.compile(obj.customField)(entry.originalData));
} else if (_this.data.filterFields.indexOf(obj.column) > -1) {
content = _this.Utils.String.splitByCommas(entry.originalData[obj.column]).join(', ');
content = _this.Utils.String.splitByCommas(field).join(', ');
} else {
content = entry.originalData[obj.column];
content = field;
}

if (obj.type === 'image') {
content = Array.isArray(field) ? content : field.split(/\n/);

content.forEach(function(imageUrl) {
_this.imagesData.images.push({ url: imageUrl });
});
}

// Define data object
Expand Down
Loading