informativo basico

This commit is contained in:
lontra
2019-05-29 21:06:15 +03:00
parent 102301019b
commit 7eb4842141
16 changed files with 68 additions and 82 deletions

View File

@@ -10,10 +10,12 @@ gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2' gem 'coffee-rails', '~> 4.2'
gem 'bootsnap', '>= 1.1.0', require: false gem 'bootsnap', '>= 1.1.0', require: false
gem 'haml-rails' gem 'haml'
gem 'mysql2' gem 'mysql2'
gem 'activeadmin' gem 'activeadmin'
gem 'devise' gem 'devise'
gem 'will_paginate'
gem "awesome_print"
group :development, :test do group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]

View File

@@ -57,6 +57,7 @@ GEM
arbre (1.2.1) arbre (1.2.1)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
arel (9.0.0) arel (9.0.0)
awesome_print (1.8.0)
babel-source (5.8.35) babel-source (5.8.35)
babel-transpiler (0.7.0) babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6) babel-source (>= 4.0, < 6)
@@ -83,7 +84,6 @@ GEM
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
erubi (1.8.0) erubi (1.8.0)
erubis (2.7.0)
execjs (2.7.0) execjs (2.7.0)
ffi (1.11.1) ffi (1.11.1)
formtastic (3.1.5) formtastic (3.1.5)
@@ -94,20 +94,9 @@ GEM
haml (5.1.1) haml (5.1.1)
temple (>= 0.8.0) temple (>= 0.8.0)
tilt tilt
haml-rails (2.0.1)
actionpack (>= 5.1)
activesupport (>= 5.1)
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 5.1)
has_scope (0.7.2) has_scope (0.7.2)
actionpack (>= 4.1) actionpack (>= 4.1)
activesupport (>= 4.1) activesupport (>= 4.1)
html2haml (2.2.0)
erubis (~> 2.7.0)
haml (>= 4.0, < 6)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
i18n (1.6.0) i18n (1.6.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
inherited_resources (1.10.0) inherited_resources (1.10.0)
@@ -194,8 +183,6 @@ GEM
actionpack (>= 4.2.0, < 6.0) actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0) railties (>= 4.2.0, < 6.0)
ruby_dep (1.5.0) ruby_dep (1.5.0)
ruby_parser (3.13.1)
sexp_processor (~> 4.9)
sass (3.7.4) sass (3.7.4)
sass-listen (~> 4.0.0) sass-listen (~> 4.0.0)
sass-listen (4.0.0) sass-listen (4.0.0)
@@ -207,7 +194,6 @@ GEM
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
sexp_processor (4.12.0)
spring (2.0.2) spring (2.0.2)
activesupport (>= 4.2) activesupport (>= 4.2)
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
@@ -242,17 +228,19 @@ GEM
websocket-driver (0.7.0) websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3) websocket-extensions (0.1.3)
will_paginate (3.1.7)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
activeadmin activeadmin
awesome_print
bootsnap (>= 1.1.0) bootsnap (>= 1.1.0)
byebug byebug
coffee-rails (~> 4.2) coffee-rails (~> 4.2)
devise devise
haml-rails haml
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
mysql2 mysql2
puma (~> 3.11) puma (~> 3.11)
@@ -262,6 +250,7 @@ DEPENDENCIES
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)
uglifier (>= 1.3.0) uglifier (>= 1.3.0)
web-console (>= 3.3.0) web-console (>= 3.3.0)
will_paginate
RUBY VERSION RUBY VERSION
ruby 2.5.5p157 ruby 2.5.5p157

View File

@@ -10,7 +10,4 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives. // about supported directives.
// //
//= require rails-ujs
//= require activestorage
//= require turbolinks
//= require_tree . //= require_tree .

View File

@@ -1,15 +1,14 @@
/* body {
* This is a manifest file that'll be compiled into application.css, which will include all the files padding: 20px;
* listed below. font-family: 'Inconsolata', monospace;
* background-color: #f5fff1;
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's }
* vendor/assets/stylesheets directory can be referenced here using a relative path.
* a {
* You're free to add application-wide styles to this file and they'll appear at the bottom of the color:black;
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS }
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope. a:hover{
* background-color: black;
*= require_tree . color: white;
*= require_self }
*/

View File

@@ -0,0 +1,11 @@
class PageController < ApplicationController
def home
@informativos = Informativo.order("data_inc desc").page(params[:page] || 1)
end
def informativo
@informativo = Informativo.find(params[:id])
end
end

View File

@@ -0,0 +1,4 @@
class Informativo < ApplicationRecord
self.table_name = "informativo"
paginates_per 10
end

View File

@@ -0,0 +1,13 @@
!!!
%html
%head
%meta{content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Ambiente Já!
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag "https://fonts.googleapis.com/css?family=Inconsolata&display=swap"
= stylesheet_link_tag 'application', media: 'all'
%body
%h1= "Ambiente Já!"
= yield

View File

@@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Ambienteja</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@@ -1 +0,0 @@
<%= yield %>

5
app/views/page/home.haml Normal file
View File

@@ -0,0 +1,5 @@
%h3= "#{@informativos.count} informativos"
- @informativos.each do |i|
%p= link_to "#{i.data_inc} > #{i.titulo}", "/informativo/#{i.id}"
= will_paginate @informativos

View File

@@ -0,0 +1,3 @@
!= @informativo.Descricao
%hr
!= ap @informativo

View File

@@ -1,6 +1,7 @@
require_relative 'boot' require_relative 'boot'
require 'rails/all' require 'rails/all'
require "awesome_print"
# Require the gems listed in Gemfile, including any gems # Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.
@@ -11,6 +12,10 @@ module Ambienteja
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2 config.load_defaults 5.2
config.generators do |g|
g.template_engine :haml
end
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers # Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading # -- all .rb files in that directory are automatically loaded after loading

View File

@@ -2,4 +2,9 @@ Rails.application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self) ActiveAdmin.routes(self)
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: "page#home"
get '/informativo/:id', to: 'page#informativo'
end end

View File

@@ -1,11 +0,0 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

View File

@@ -1,7 +0,0 @@
require 'test_helper'
class AdminUserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end