Skip to content

Commit

Permalink
fix wall publihing
Browse files Browse the repository at this point in the history
  • Loading branch information
mrilyew committed Dec 7, 2024
1 parent 530287f commit 78004b1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
19 changes: 0 additions & 19 deletions Web/static/js/al_wall.js
Original file line number Diff line number Diff line change
Expand Up @@ -1290,25 +1290,6 @@ u(document).on("drop", '#write', function(e) {
}
})

u(document).on('submit', '#write > form', (e) => {
const target = u(e.target)
const horizontal_array = []
const horizontal_input = target.find(`input[name='horizontal_attachments']`)
const horizontal_attachments = target.find(`.post-horizontal > a`)
horizontal_attachments.nodes.forEach(_node => {
horizontal_array.push(`${_node.dataset.type}${_node.dataset.id}`)
})
horizontal_input.nodes[0].value = horizontal_array.join(',')

const vertical_array = []
const vertical_input = target.find(`input[name='vertical_attachments']`)
const vertical_attachments = target.find(`.post-vertical > .vertical-attachment`)
vertical_attachments.nodes.forEach(_node => {
vertical_array.push(`${_node.dataset.type}${_node.dataset.id}`)
})
vertical_input.nodes[0].value = vertical_array.join(',')
})

// !!! PHOTO PICKER !!!
u(document).on("click", "#__photoAttachment", async (e) => {
const photos_per_page = 23
Expand Down
5 changes: 5 additions & 0 deletions Web/static/js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ u(document).on('submit', 'form', async (e) => {
return false
}

if(e.target.closest('#write')) {
const target = u(e.target)
collect_attachments_node(target)
}

u('#ajloader').addClass('shown')

const form = e.target
Expand Down
19 changes: 19 additions & 0 deletions Web/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,22 @@ function sleep(time)
{
return new Promise((resolve) => setTimeout(resolve, time));
}

function collect_attachments_node(target)
{
const horizontal_array = []
const horizontal_input = target.find(`input[name='horizontal_attachments']`)
const horizontal_attachments = target.find(`.post-horizontal > a`)
horizontal_attachments.nodes.forEach(_node => {
horizontal_array.push(`${_node.dataset.type}${_node.dataset.id}`)
})
horizontal_input.nodes[0].value = horizontal_array.join(',')

const vertical_array = []
const vertical_input = target.find(`input[name='vertical_attachments']`)
const vertical_attachments = target.find(`.post-vertical > .vertical-attachment`)
vertical_attachments.nodes.forEach(_node => {
vertical_array.push(`${_node.dataset.type}${_node.dataset.id}`)
})
vertical_input.nodes[0].value = vertical_array.join(',')
}

0 comments on commit 78004b1

Please sign in to comment.