infractores 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.sample +8 -0
- data/.gitignore +22 -0
- data/.travis.yml +14 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +67 -0
- data/Gemfile.lock +417 -0
- data/Guardfile +8 -0
- data/LICENSE +21 -0
- data/Procfile +2 -0
- data/README.md +48 -0
- data/Rakefile +6 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/images/gallery-buttons.png +0 -0
- data/app/assets/images/logo-infractores.svg +10 -0
- data/app/assets/javascripts/application.js +18 -0
- data/app/assets/javascripts/bootstrap.js +4 -0
- data/app/assets/javascripts/index.js +82 -0
- data/app/assets/javascripts/twitter.js +18 -0
- data/app/assets/stylesheets/1-utilities/_variables.scss +12 -0
- data/app/assets/stylesheets/2-quarks/_typography.scss +32 -0
- data/app/assets/stylesheets/3-atoms/_buttons.scss +3 -0
- data/app/assets/stylesheets/4-molecules/_footer.scss +32 -0
- data/app/assets/stylesheets/4-molecules/_infraction-gallery.scss +101 -0
- data/app/assets/stylesheets/4-molecules/_navbar.scss +71 -0
- data/app/assets/stylesheets/5-pages/index.scss +165 -0
- data/app/assets/stylesheets/5-pages/show.scss +29 -0
- data/app/assets/stylesheets/application.css +18 -0
- data/app/assets/stylesheets/bootstrap_and_overrides.css +7 -0
- data/app/controllers/application_controller.rb +5 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/infractions_controller.rb +23 -0
- data/app/controllers/users_controller.rb +7 -0
- data/app/helpers/application_helper.rb +19 -0
- data/app/helpers/infractions_helper.rb +6 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/evidence.rb +23 -0
- data/app/models/infraction.rb +43 -0
- data/app/models/tweet.rb +54 -0
- data/app/models/user.rb +34 -0
- data/app/services/twitter_service.rb +51 -0
- data/app/uploaders/evidence_uploader.rb +62 -0
- data/app/views/infractions/_map.html.erb +17 -0
- data/app/views/infractions/_reported_by.html.erb +4 -0
- data/app/views/infractions/_summary.html.erb +23 -0
- data/app/views/infractions/index.html.erb +18 -0
- data/app/views/infractions/show.html.erb +24 -0
- data/app/views/layouts/application.html.erb +90 -0
- data/app/views/shared/_google_analytics.html.erb +12 -0
- data/app/views/users/index.html.erb +21 -0
- data/app/workers/tweet_inspector.rb +18 -0
- data/bin/bundle +3 -0
- data/bin/rails +8 -0
- data/bin/rake +8 -0
- data/bin/setup +29 -0
- data/bin/spring +15 -0
- data/config.ru +4 -0
- data/config/application.rb +27 -0
- data/config/boot.rb +3 -0
- data/config/database.yml.sample +85 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +50 -0
- data/config/environments/production.rb +79 -0
- data/config/environments/test.rb +42 -0
- data/config/initializers/assets.rb +15 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/carrierwave.rb +17 -0
- data/config/initializers/cookies_serializer.rb +3 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +4 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/twitter.rb +1 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/en.bootstrap.yml +23 -0
- data/config/locales/en.yml +23 -0
- data/config/locales/es.yml +263 -0
- data/config/routes.rb +6 -0
- data/config/secrets.yml +22 -0
- data/db/migrate/20150824210535_add_tweets_table.rb +8 -0
- data/db/migrate/20150829133406_create_infractions.rb +11 -0
- data/db/migrate/20150829134520_create_users.rb +12 -0
- data/db/migrate/20150829141909_add_user_id_to_tweets.rb +5 -0
- data/db/migrate/20150829154430_create_locations.rb +10 -0
- data/db/migrate/20150830224603_create_evidences_table.rb +8 -0
- data/db/migrate/20150911020838_add_valid_column_to_infractions.rb +6 -0
- data/db/migrate/20150911025204_add_index_to_users_username.rb +5 -0
- data/db/migrate/20151102220702_add_lat_lon_to_infractions.rb +6 -0
- data/db/migrate/20151102221811_remove_locations.rb +5 -0
- data/db/migrate/20151117194703_add_reported_at_to_infractions.rb +5 -0
- data/db/migrate/20160229023500_change_lat_lon_precision.rb +6 -0
- data/db/seeds.rb +7 -0
- data/infractores.gemspec +25 -0
- data/lib/assets/.keep +0 -0
- data/lib/infractores.rb +1 -0
- data/lib/infractores/version.rb +3 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/twitter.rake +16 -0
- data/lib/tasks/users.rake +9 -0
- data/log/.keep +0 -0
- data/public/404.html +67 -0
- data/public/422.html +67 -0
- data/public/500.html +66 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +5 -0
- data/vendor/assets/images/blank.gif +0 -0
- data/vendor/assets/images/fancybox_loading.gif +0 -0
- data/vendor/assets/images/fancybox_loading@2x.gif +0 -0
- data/vendor/assets/images/fancybox_overlay.png +0 -0
- data/vendor/assets/images/fancybox_sprite.png +0 -0
- data/vendor/assets/images/fancybox_sprite@2x.png +0 -0
- data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/.keep +0 -0
- data/vendor/assets/javascripts/jquery.fancybox-buttons.js +122 -0
- data/vendor/assets/javascripts/jquery.fancybox.pack.js +46 -0
- data/vendor/assets/javascripts/livereload.js +1183 -0
- data/vendor/assets/stylesheets/.keep +0 -0
- data/vendor/assets/stylesheets/jquery.fancybox-buttons.css +97 -0
- data/vendor/assets/stylesheets/jquery.fancybox.css +274 -0
- metadata +215 -0
data/config/routes.rb
ADDED
data/config/secrets.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: 6ee34b13e168333e2cd22082b393408b30aefab7b1cc3cdcf6fdff482b83ca9418489daf3e08e26173d03663fc9f77576ab8552290f866c4e5f939f26118c24a
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: 2755c0b82794687463d85f0acade5b3fb6bee317b780230f66ba33ee72ae40c55e428bbe16f20e19bc7608696a53606bddfb06c15e8f57ff701ff9815cf1fb46
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class CreateLocations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :locations do |t|
|
4
|
+
t.references :infraction
|
5
|
+
t.decimal :lon, precision: 10, scale: 6, null: false
|
6
|
+
t.decimal :lat, precision: 10, scale: 6, null: false
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
data/infractores.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'infractores/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "infractores"
|
8
|
+
spec.version = Infractores::VERSION
|
9
|
+
spec.authors = ["Ernesto Tagwerker", "Mauro Otonelli"]
|
10
|
+
spec.email = ["ernesto+github@ombulabs.com", "mauro.otonelli@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Track parking violations reported via Twitter}
|
13
|
+
spec.description = %q{Track any kind of violations via Twitter with a geolocated tweet}
|
14
|
+
spec.homepage = "https://github.com/ombulabs/infractores"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "bin"
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
end
|
data/lib/assets/.keep
ADDED
File without changes
|
data/lib/infractores.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "infractores/version"
|
data/lib/tasks/.keep
ADDED
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
namespace :twitter do
|
2
|
+
task download_tweets: :environment do
|
3
|
+
puts "Downloading mentions"
|
4
|
+
TwitterService.instance.download_tweets
|
5
|
+
puts "Downloaded mentions"
|
6
|
+
end
|
7
|
+
|
8
|
+
task populate_reported_at: :environment do
|
9
|
+
puts "Populating reported_at"
|
10
|
+
Infraction.all.find_each do |infraction|
|
11
|
+
infraction.reported_at = infraction.tweet.source["created_at"]
|
12
|
+
infraction.save!
|
13
|
+
end
|
14
|
+
puts "Populated reported_at"
|
15
|
+
end
|
16
|
+
end
|
data/log/.keep
ADDED
File without changes
|
data/public/404.html
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
data/public/422.html
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
data/public/500.html
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
data/public/favicon.ico
ADDED
File without changes
|
data/public/robots.txt
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|