Skip to content

Commit 9aecff6

Browse files
committed
Seminario
1 parent 1c4f8ef commit 9aecff6

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

Gemfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ ruby '2.4.2'
55

66
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
77
gem 'rails', '~> 5.2.2'
8+
#gem "activesupport", ">= 5.2.4.3"
9+
#gem "rack", ">= 2.1.4"
10+
#gem "puma", ">= 3.12.6"
811
# Use mysql as the database for Active Record
912
gem 'pg'
1013
gem 'mysql2'
1114
# Use Puma as the app server
12-
gem 'puma', '~> 3.11'
15+
#gem 'puma', '~> 3.11'
1316
# Use SCSS for stylesheets
1417
gem 'sass-rails', '~> 5.0'
1518
# Use Uglifier as compressor for JavaScript assets

Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ GEM
102102
coffee-script-source
103103
execjs
104104
coffee-script-source (1.12.2)
105-
concurrent-ruby (1.1.5)
105+
concurrent-ruby (1.1.8)
106106
crass (1.0.5)
107107
devise (4.7.1)
108108
bcrypt (~> 3.0)
@@ -125,7 +125,7 @@ GEM
125125
httparty (0.17.1)
126126
mime-types (~> 3.0)
127127
multi_xml (>= 0.5.2)
128-
i18n (1.7.0)
128+
i18n (1.8.8)
129129
concurrent-ruby (~> 1.0)
130130
image_processing (1.9.3)
131131
mini_magick (>= 4.9.5, < 5)
@@ -155,7 +155,7 @@ GEM
155155
mini_magick (4.9.5)
156156
mini_mime (1.0.2)
157157
mini_portile2 (2.4.0)
158-
minitest (5.12.2)
158+
minitest (5.14.3)
159159
msgpack (1.3.1)
160160
multi_xml (0.6.0)
161161
mysql2 (0.5.2)
@@ -262,7 +262,7 @@ GEM
262262
mini_portile2 (~> 2.0)
263263
trix-rails (2.2.0)
264264
rails (> 4.1, < 6.1)
265-
tzinfo (1.2.5)
265+
tzinfo (1.2.9)
266266
thread_safe (~> 0.1)
267267
uglifier (4.2.0)
268268
execjs (>= 0.3.0, < 3)
@@ -329,4 +329,4 @@ RUBY VERSION
329329
ruby 2.4.2p198
330330

331331
BUNDLED WITH
332-
2.0.1
332+
2.1.4

app/controllers/principal_controller.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ def seminario
3030
@pubs = Publicacion.where(titulo: (JSON.parse(@sem.pubs).reject{|x| x.empty?}.size > 0 ? JSON.parse(@sem.pubs).reject{|x| x.empty?} : ",")).all
3131
@imgs = Imagen.where(sesion: @sem.titulo).order(indice: :asc)
3232
@title = @sem.titulo
33+
@banner = @sem.banner.url if @sem.banner
34+
if @sem.banner.nil?
35+
begin
36+
@cliente = TinyTds::Client.new username: ENV["AG_USR"], password: ENV["AG_PWD"], host: ENV["AG_HOST"], port: ENV["AG_PORT"], database: ENV["AG_DB"]
37+
@resultado = @cliente.execute("SELECT ligaImagen FROM dbo.vw_DatosAgenda WHERE tituloActividad = '#{@sem.titulo}'")
38+
@banner = @resultado.first['ligaImagen']
39+
rescue
40+
@resultado = []
41+
@cliente.close if @cliente
42+
end
43+
end
3344
end
3445

3546
def publicaciones

app/views/principal/seminario.html.erb

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</div>
55
<div class="contenido">
66
<div class="seccion-pub">
7-
<img id="img-agenda" data-src="<%= @sem.banner.present? ? @sem.banner.url : '' %>" data-width data-height uk-img>
7+
<img id="img-agenda" data-src="<%= @banner %>" data-width data-height uk-img>
88
<% if @sem.descripcion.present? %>
99
<span class="titulo desc-pub">Sobre la <span class="outline blanco">sesión</span></span><br>
1010
<%= @sem.descripcion.gsub(/<(\/?)div>/,'<\1p>').html_safe %>
@@ -87,19 +87,6 @@
8787
<% end %>
8888
</div>
8989
<script>
90-
document.addEventListener("DOMContentLoaded", function(){
91-
var xhr = new XMLHttpRequest();
92-
xhr.open("get","https://www.colmex.mx/catalogo_eventos.json?titulo=<%= @sem.titulo %>");
93-
xhr.onload = function(){
94-
if(xhr.status === 200){
95-
var data = JSON.parse(xhr.response);
96-
if(data["videos"].length > 0){
97-
document.querySelector("#img-agenda").setAttribute("src", data["videos"][0]["ligaImagen"].replace("http","https"));
98-
}
99-
}
100-
}
101-
xhr.send();
102-
});
10390
window.addEventListener("resize", function(){
10491
document.querySelector(".video-princ").style.height = document.querySelector(".video-princ").offsetWidth * (9/16) + "px";
10592
});

0 commit comments

Comments
 (0)