Se agregan menus

This commit is contained in:
2020-12-12 00:25:59 -03:00
parent decd1469b4
commit 8bc3037e13
43 changed files with 1802 additions and 77 deletions

View File

@ -1,4 +1,5 @@
RewriteEngine On
RewriteBase /totalsport/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

View File

@ -0,0 +1,280 @@
class Elem {
constructor(tag, attrs, close = true) {
this.tag = '<' + tag
if (close) {
this.tag += '></' + tag + '>'
} else {
this.tag += '/>'
}
this.attrs = attrs
this.children = []
}
addChild(child) {
if (typeof child != 'object' || typeof child.tag == 'undefined') {
return this
}
this.children.push(child)
return this
}
html(text) {
this.text = text
return this
}
build() {
let obj = $(this.tag)
$.each(this.attrs, (key, el) => {
obj.attr(key, el)
})
$.each(this.children, (i, el) => {
obj.append(el.build())
})
if (typeof this.text !== 'undefined') {
obj.html(this.text)
}
return obj
}
}
var imagenes = {
imagenes: [],
url: '',
evento: '',
setup: () => {
$('#agregar_imagen').css('cursor', 'pointer').click(() => {
imagenes.add()
})
$('#imagenes .trash.icon').css('cursor', 'pointer').click(function() {
let i = $(this).attr('data-media')
imagenes.deleteImage(i)
})
},
buildForm: () => {
let form = new Elem('form', {class: 'ui form', id: 'add_image'}).addChild(
new Elem('div', {class: 'ui grid'}).addChild(
new Elem('div', {class: 'row'}).addChild(
new Elem('div', {class: 'sixteen wide column'}).addChild(
new Elem('div', {class: 'ui fluid input'}).addChild(
new Elem('input', {type: 'file', name: 'imagen[]', multiple: 'multiple'}, false)
)
)
)
).addChild(
new Elem('div', {class: 'row'}).addChild(
new Elem('div', {class: 'two wide column'}).addChild(
new Elem('div', {class: 'ui fluid button', type: 'submit'}).html('Agregar')
)
).addChild(
new Elem('div', {class: 'fourteen wide column'}).addChild(
new Elem('div', {id: 'resultado', class: 'ui fluid basic segment'})
)
)
)
)
return form.build()
},
add: () => {
var imgs = $('#imagenes')
var div = imgs.next('.modal')
if (div.length > 0) {
div.remove()
}
div = $('<div></div>').attr('class', 'ui modal').append(
$('<i></i>').attr('class', 'inside close icon')
)
if (imagenes.imagenes.length + videos.videos.length >= 12) {
div.append(
$('<div></div>').attr('class', 'header').html('Foto')
).append(
$('<div></div>').attr('class', 'content').html('Se ha llegado al máximo de elementos.')
)
imgs.after(div)
div.modal('show')
return
}
div.append(
$('<div></div>').attr('class', 'header').html('Foto')
).append(
$('<div></div>').attr('class', 'content').append(imagenes.buildForm())
)
imgs.after(div)
div.modal('show')
div.find('form .button').click((e) => {
div.find('form').submit()
})
div.find('form').submit((e) => {
e.preventDefault()
imagenes.addImage()
return false
})
},
addImage: () => {
let form = $('#add_image')
$('#add_image #resultado').html('')
$('#add_image #resultado').append(
$('<div></div>').attr('class', 'ui active loader')
)
let data = new FormData(form[0])
let url = imagenes.url + '/evento/' + imagenes.evento + '/image/add'
let fallo = () => {
$('#add_image #resultado').html('')
$('#add_image #resultado').append(
$('<div></div>').attr('class', 'ui negative message')
.append($('<i></i>').attr('class', 'inline close icon'))
.append('<p>No se pudo agregar.</p>')
)
$('#add_image #resultado .message .close').on('click', function() {
$(this).closest('.message')
.transition('fade');
});
}
$.ajax({
url: url,
data: data,
processData: false,
contentType: false,
type: 'POST',
success: (output) => {
if (output.estado) {
window.location.reload()
return
}
fallo()
},
error: () => {
fallo()
}
})
},
deleteImage: (i) => {
let media = imagenes.imagenes[i]
let url = imagenes.url + '/evento/' + imagenes.evento + '/image/delete'
$.post(url, {media: media}, (output) => {
if (output.estado) {
window.location.reload()
}
})
}
}
var videos = {
videos: [],
url: '',
evento: '',
setup: () => {
$('#agregar_video').css('cursor', 'pointer').click(() => {
videos.add()
})
$('#videos .trash.icon').css('cursor', 'pointer').click(function() {
let i = $(this).attr('data-media')
videos.deleteVideo(i)
})
},
buildForm: () => {
let form = new Elem('form', {
class: 'ui form',
id: 'add_video',
method: 'post',
enctype: 'multipart/form-data',
action: videos.url + '/evento/' + videos.evento + '/video/add'
}).addChild(
new Elem('div', {class: 'ui grid'}).addChild(
new Elem('div', {class: 'row'}).addChild(
new Elem('div', {class: 'sixteen wide column'}).addChild(
new Elem('div', {class: 'ui fluid input'}).addChild(
new Elem('input', {type: 'file', name: 'video[]', multiple: 'multiple'}, false)
)
)
)
).addChild(
new Elem('div', {class: 'row'}).addChild(
new Elem('div', {class: 'two wide column'}).addChild(
new Elem('div', {class: 'ui fluid button', type: 'submit'}).html('Agregar')
)
)
)
)
return form.build()
},
add: () => {
var vds = $('#videos')
var div = vds.next('.modal')
if (div.length > 0) {
div.remove()
}
div = $('<div></div>').attr('class', 'ui modal').append(
$('<i></i>').attr('class', 'inside close icon')
)
if (imagenes.imagenes.length + videos.videos.length >= 12) {
div.append(
$('<div></div>').attr('class', 'header').html('Video')
).append(
$('<div></div>').attr('class', 'content').html('Se ha llegado al máximo de elementos.')
)
vds.after(div)
div.modal('show')
return
}
div.append(
$('<div></div>').attr('class', 'header').html('Video')
).append(
$('<div></div>').attr('class', 'content').append(videos.buildForm())
)
vds.after(div)
div.modal('show')
div.find('form .button').click((e) => {
div.find('form').submit()
})
/*div.find('form').submit((e) => {
e.preventDefault()
videos.addImage()
return false
})*/
},
/*addImage: () => {
let form = $('#add_image')
$('#resultado').html('')
$('#resultado').append(
$('<div></div>').attr('class', 'ui active loader')
)
let data = new FormData(form[0])
let url = imagenes.url + '/evento/' + imagenes.evento + '/add'
let fallo = () => {
$('#resultado').html('')
$('#resultado').append(
$('<div></div>').attr('class', 'ui negative message')
.append($('<i></i>').attr('class', 'inline close icon'))
.append('<p>No se pudo agregar.</p>')
)
$('#resultado .message .close').on('click', function() {
$(this).closest('.message')
.transition('fade');
});
}
$.ajax({
url: url,
data: data,
processData: false,
contentType: false,
type: 'POST',
success: (output) => {
if (output.estado) {
window.location.reload()
return
}
fallo()
},
error: () => {
fallo()
}
})
},*/
deleteVideo: (i) => {
let media = videos.videos[i]
let url = videos.url + '/evento/' + videos.evento + '/video/delete'
$.post(url, {media: media}, (output) => {
if (output.estado) {
window.location.reload()
}
})
}
}

View File

@ -0,0 +1,16 @@
#eventos {
background-color: #e6e7e8;
padding-top: 3rem;
padding-bottom: 3rem;
}
#eventos .column {
padding-top: 0;
padding-bottom: 0rem;
}
#eventos .contenido {
padding-top: 1rem;
padding-bottom: 5rem;
}
#eventos .placeholder {
height: 100%;
}

View File

@ -0,0 +1,13 @@
#galeria {
background-color: #e6e7e8;
padding-top: 3.5rem;
padding-bottom: 3.5rem;
}
#thumbs .image {
width: 100% !important;
height: 7rem;
overflow: hidden;
}
#thumbs .image img {
max-width: none !important;
}

View File

@ -38,7 +38,7 @@
}
#nosotros .column {
padding-top: 0;
padding-bottom: 0;
padding-bottom: 0rem;
}
#nosotros .contenido {
padding-top: 5rem;
@ -79,34 +79,42 @@
color: white !important;
}
#eventos {
#galeria {
background-color: #e6e7e8;
padding-top: 3rem;
padding-bottom: 5rem;
}
#eventos .segment {
#galeria .segment {
background-color: white;
padding: 0;
}
#eventos .segment .image {
#galeria .segment .image {
height: 14rem;
width: 100%;
overflow: hidden;
}
#eventos .segment .image img {
#galeria .segment .image img {
max-width: none !important;
}
#eventos .segment .header {
#galeria .segment .header {
margin-top: 0;
padding-top: 1rem;
height: 7rem;
}
#contacto {
padding-top: 4rem;
padding-bottom: 4rem;
#servdeportivos {
background-color: #e6e7e8;
padding-top: 3rem;
padding-bottom: 3rem;
}
#contacto #map {
/*margin-top: 3rem;*/
#servdeportivos .column {
padding-top: 0;
padding-bottom: 0rem;
}
#servdeportivos .contenido {
padding-top: 1rem;
padding-bottom: 5rem;
}
#servdeportivos .placeholder {
height: 100%;
}

View File

@ -20,6 +20,15 @@ button.inverted {
box-shadow: none !important;
}
#contacto {
padding-top: 4rem;
padding-bottom: 4rem;
}
#contacto #map {
/*margin-top: 3rem;*/
height: 100%;
}
footer {
flex: none;
color: white;

View File

@ -0,0 +1,16 @@
#serviciosyproyectos {
background-color: #e6e7e8;
padding-top: 3rem;
padding-bottom: 3rem;
}
#serviciosyproyectos .column {
padding-top: 0;
padding-bottom: 0rem;
}
#serviciosyproyectos .contenido {
padding-top: 1rem;
padding-bottom: 5rem;
}
#serviciosyproyectos .placeholder {
height: 100%;
}