Skip to content

Instantly share code, notes, and snippets.

@eltonsantos
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save eltonsantos/46c56d98c3ab8c0b6076 to your computer and use it in GitHub Desktop.

Select an option

Save eltonsantos/46c56d98c3ab8c0b6076 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
%html
%head
%title
MONITOR - PMF
/%meta{'http-equiv' => 'refresh', :content => "15"}
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
= javascript_include_tag "application", "data-turbolinks-track" => true
%link{:rel => "shortcut icon", :href => "/assets/favicon.ico" }
= csrf_meta_tags
%body
.navbar.navbar-default.nav-superior{role: "navigation"}
.container-fluid
%span.label.label-info#page-loading
CARREGANDO
.header
.navbar-header
= link_to image_tag("logo-fortaleza.png"), root_path, class: 'navbar-brand logo'
%h4.nome-projeto MONITOR - PMF
%h6.nome-prefeitura Prefeitura Municipal de Fortaleza
.container-fluid
.row
.container-fluid
.col-xs-12.col-sm-12.col-md-12.col-lg-12
= yield
.row
%footer.rodape
.rodape-interno
%p
%span.copyright
© SEPOG 2014 | COTEC
= yield :css
= yield :js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
// ENQUANTO A PÁGINA NÃO TIVER CARREGADA, MOSTRAR UM ÍCONE DE CARREGANDO...
$(document).on('page:change', function() {
$('#page-loading').toggle();
});
%div.page-header
-#= link_to t('.new', :default => t("helpers.links.new"), model: "#{model_class.model_name.human}"), new_sistema_path, :class => 'btn btn-warning pull-right'
%h3 Acompanhamento de Status dos sistemas/serviços da SEPOG
= render 'tabela_monit'
:plain
(function() {
jQuery(function() {
console.log("reloading table");
$("#reload-table").html("#{escape_javascript render 'tabela_monit'}");
});
}).call(this);
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
jQuery ->
setInterval(->
console.log "Getting table..."
$.ajax(
url: "/"
dataType: "script"
type: "GET"
).done (data) ->
console.log data
,3000)
class RegistrosController < ApplicationController
def index
respond_to do |format|
format.html
format.js
end
end
def tabela_monit
@registros = Registro.all.order("output DESC")
respond_to do |format|
format.html {render template: "tabela_monit", layout: false}
end
end
end
Rails.application.routes.draw do
resources :registros do
get 'tabela_monit'
end
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'registros#index'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment