informativo basico
This commit is contained in:
4
Gemfile
4
Gemfile
@@ -10,10 +10,12 @@ gem 'uglifier', '>= 1.3.0'
|
||||
gem 'coffee-rails', '~> 4.2'
|
||||
gem 'bootsnap', '>= 1.1.0', require: false
|
||||
|
||||
gem 'haml-rails'
|
||||
gem 'haml'
|
||||
gem 'mysql2'
|
||||
gem 'activeadmin'
|
||||
gem 'devise'
|
||||
gem 'will_paginate'
|
||||
gem "awesome_print"
|
||||
|
||||
group :development, :test do
|
||||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
||||
|
||||
21
Gemfile.lock
21
Gemfile.lock
@@ -57,6 +57,7 @@ GEM
|
||||
arbre (1.2.1)
|
||||
activesupport (>= 3.0.0)
|
||||
arel (9.0.0)
|
||||
awesome_print (1.8.0)
|
||||
babel-source (5.8.35)
|
||||
babel-transpiler (0.7.0)
|
||||
babel-source (>= 4.0, < 6)
|
||||
@@ -83,7 +84,6 @@ GEM
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
erubi (1.8.0)
|
||||
erubis (2.7.0)
|
||||
execjs (2.7.0)
|
||||
ffi (1.11.1)
|
||||
formtastic (3.1.5)
|
||||
@@ -94,20 +94,9 @@ GEM
|
||||
haml (5.1.1)
|
||||
temple (>= 0.8.0)
|
||||
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)
|
||||
actionpack (>= 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)
|
||||
concurrent-ruby (~> 1.0)
|
||||
inherited_resources (1.10.0)
|
||||
@@ -194,8 +183,6 @@ GEM
|
||||
actionpack (>= 4.2.0, < 6.0)
|
||||
railties (>= 4.2.0, < 6.0)
|
||||
ruby_dep (1.5.0)
|
||||
ruby_parser (3.13.1)
|
||||
sexp_processor (~> 4.9)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
@@ -207,7 +194,6 @@ GEM
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
sexp_processor (4.12.0)
|
||||
spring (2.0.2)
|
||||
activesupport (>= 4.2)
|
||||
spring-watcher-listen (2.0.1)
|
||||
@@ -242,17 +228,19 @@ GEM
|
||||
websocket-driver (0.7.0)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.3)
|
||||
will_paginate (3.1.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activeadmin
|
||||
awesome_print
|
||||
bootsnap (>= 1.1.0)
|
||||
byebug
|
||||
coffee-rails (~> 4.2)
|
||||
devise
|
||||
haml-rails
|
||||
haml
|
||||
listen (>= 3.0.5, < 3.2)
|
||||
mysql2
|
||||
puma (~> 3.11)
|
||||
@@ -262,6 +250,7 @@ DEPENDENCIES
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
uglifier (>= 1.3.0)
|
||||
web-console (>= 3.3.0)
|
||||
will_paginate
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.5.5p157
|
||||
|
||||
@@ -10,7 +10,4 @@
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require rails-ujs
|
||||
//= require activestorage
|
||||
//= require turbolinks
|
||||
//= require_tree .
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* 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.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
*/
|
||||
body {
|
||||
padding: 20px;
|
||||
font-family: 'Inconsolata', monospace;
|
||||
background-color: #f5fff1;
|
||||
}
|
||||
|
||||
a {
|
||||
color:black;
|
||||
}
|
||||
|
||||
a:hover{
|
||||
background-color: black;
|
||||
color: white;
|
||||
}
|
||||
|
||||
11
app/controllers/page_controller.rb
Normal file
11
app/controllers/page_controller.rb
Normal 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
|
||||
4
app/models/informativo.rb
Normal file
4
app/models/informativo.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class Informativo < ApplicationRecord
|
||||
self.table_name = "informativo"
|
||||
paginates_per 10
|
||||
end
|
||||
13
app/views/layouts/application.haml
Normal file
13
app/views/layouts/application.haml
Normal 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
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -1 +0,0 @@
|
||||
<%= yield %>
|
||||
5
app/views/page/home.haml
Normal file
5
app/views/page/home.haml
Normal 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
|
||||
3
app/views/page/informativo.haml
Normal file
3
app/views/page/informativo.haml
Normal file
@@ -0,0 +1,3 @@
|
||||
!= @informativo.Descricao
|
||||
%hr
|
||||
!= ap @informativo
|
||||
@@ -1,6 +1,7 @@
|
||||
require_relative 'boot'
|
||||
|
||||
require 'rails/all'
|
||||
require "awesome_print"
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
@@ -11,6 +12,10 @@ module Ambienteja
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 5.2
|
||||
|
||||
config.generators do |g|
|
||||
g.template_engine :haml
|
||||
end
|
||||
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration can go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded after loading
|
||||
|
||||
@@ -2,4 +2,9 @@ Rails.application.routes.draw do
|
||||
devise_for :admin_users, ActiveAdmin::Devise.config
|
||||
ActiveAdmin.routes(self)
|
||||
# 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
|
||||
|
||||
11
test/fixtures/admin_users.yml
vendored
11
test/fixtures/admin_users.yml
vendored
@@ -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
|
||||
@@ -1,7 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AdminUserTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user