go_person 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7e3dd6b9e31664c0b28549dbb4d8c70e7cac5ab6
4
+ data.tar.gz: 1971ea403fabf7b24729da509582c908603a6c7c
5
+ SHA512:
6
+ metadata.gz: d982b6daca0c2842e735e9a797a5984dfd0ed9da21fdb1a7a38de84e3c25597724c7e5af4df411473581cfcc3b7fc5895dc028a9f40a4a23c1d4d6fe7cca2b35
7
+ data.tar.gz: 1c7dbd621a16abe241dee375e0ed0db8bdb9943386a80fc06299432cf6a952f6247e7b4c12e5865c2a9d177d7c75fc2590829d1d0af8ba98dd27534ae2015eb8
@@ -0,0 +1,20 @@
1
+ Copyright 2017 João Carlos Ottobboni
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # GoPerson
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'go_person'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install go_person
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,36 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'GoPerson'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ require 'bundler/gem_tasks'
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'test'
31
+ t.pattern = 'test/**/*_test.rb'
32
+ t.verbose = false
33
+ end
34
+
35
+
36
+ task default: :test
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,80 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ margin: 33px;
5
+ }
6
+
7
+ body, p, ol, ul, td {
8
+ font-family: verdana, arial, helvetica, sans-serif;
9
+ font-size: 13px;
10
+ line-height: 18px;
11
+ }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px;
17
+ }
18
+
19
+ a {
20
+ color: #000;
21
+ }
22
+
23
+ a:visited {
24
+ color: #666;
25
+ }
26
+
27
+ a:hover {
28
+ color: #fff;
29
+ background-color: #000;
30
+ }
31
+
32
+ th {
33
+ padding-bottom: 5px;
34
+ }
35
+
36
+ td {
37
+ padding: 0 5px 7px;
38
+ }
39
+
40
+ div.field,
41
+ div.actions {
42
+ margin-bottom: 10px;
43
+ }
44
+
45
+ #notice {
46
+ color: green;
47
+ }
48
+
49
+ .field_with_errors {
50
+ padding: 2px;
51
+ background-color: red;
52
+ display: table;
53
+ }
54
+
55
+ #error_explanation {
56
+ width: 450px;
57
+ border: 2px solid red;
58
+ padding: 7px 7px 0;
59
+ margin-bottom: 20px;
60
+ background-color: #f0f0f0;
61
+ }
62
+
63
+ #error_explanation h2 {
64
+ text-align: left;
65
+ font-weight: bold;
66
+ padding: 5px 5px 5px 15px;
67
+ font-size: 12px;
68
+ margin: -7px -7px 0;
69
+ background-color: #c00;
70
+ color: #fff;
71
+ }
72
+
73
+ #error_explanation ul li {
74
+ font-size: 12px;
75
+ list-style: square;
76
+ }
77
+
78
+ label {
79
+ display: block;
80
+ }
@@ -0,0 +1,58 @@
1
+ class PeopleController < ApplicationController
2
+ before_action :set_person, only: [:show, :edit, :update, :destroy]
3
+
4
+ # GET /people
5
+ def index
6
+ @people = Person.all
7
+ end
8
+
9
+ # GET /people/1
10
+ def show
11
+ end
12
+
13
+ # GET /people/new
14
+ def new
15
+ @person = Person.new
16
+ end
17
+
18
+ # GET /people/1/edit
19
+ def edit
20
+ end
21
+
22
+ # POST /people
23
+ def create
24
+ @person = Person.new(person_params)
25
+
26
+ if @person.save
27
+ redirect_to @person, notice: 'Person was successfully created.'
28
+ else
29
+ render :new
30
+ end
31
+ end
32
+
33
+ # PATCH/PUT /people/1
34
+ def update
35
+ if @person.update(person_params)
36
+ redirect_to @person, notice: 'Person was successfully updated.'
37
+ else
38
+ render :edit
39
+ end
40
+ end
41
+
42
+ # DELETE /people/1
43
+ def destroy
44
+ @person.destroy
45
+ redirect_to people_url, notice: 'Person was successfully destroyed.'
46
+ end
47
+
48
+ private
49
+ # Use callbacks to share common setup or constraints between actions.
50
+ def set_person
51
+ @person = Person.find(params[:id])
52
+ end
53
+
54
+ # Only allow a trusted parameter "white list" through.
55
+ def person_params
56
+ params.require(:person).permit(:name, :sex, :civil_state, :rg, :cpf, :birth_date, :nationality, :naturalness, :go_geography_state_id, :go_geography_city_id)
57
+ end
58
+ end
@@ -0,0 +1,2 @@
1
+ module PeopleHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,2 @@
1
+ class Person < ApplicationRecord
2
+ end
@@ -0,0 +1,67 @@
1
+ <%= form_with(model: person, local: true) do |form| %>
2
+ <% if person.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(person.errors.count, "error") %> prohibited this person from being saved:</h2>
5
+
6
+ <ul>
7
+ <% person.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= form.label :name %>
16
+ <%= form.text_field :name, id: :person_name %>
17
+ </div>
18
+
19
+ <div class="field">
20
+ <%= form.label :sex %>
21
+ <%= form.text_field :sex, id: :person_sex %>
22
+ </div>
23
+
24
+ <div class="field">
25
+ <%= form.label :civil_state %>
26
+ <%= form.text_field :civil_state, id: :person_civil_state %>
27
+ </div>
28
+
29
+ <div class="field">
30
+ <%= form.label :rg %>
31
+ <%= form.text_field :rg, id: :person_rg %>
32
+ </div>
33
+
34
+ <div class="field">
35
+ <%= form.label :cpf %>
36
+ <%= form.text_field :cpf, id: :person_cpf %>
37
+ </div>
38
+
39
+ <div class="field">
40
+ <%= form.label :birth_date %>
41
+ <%= form.date_select :birth_date, id: :person_birth_date %>
42
+ </div>
43
+
44
+ <div class="field">
45
+ <%= form.label :nationality %>
46
+ <%= form.text_field :nationality, id: :person_nationality %>
47
+ </div>
48
+
49
+ <div class="field">
50
+ <%= form.label :naturalness %>
51
+ <%= form.text_field :naturalness, id: :person_naturalness %>
52
+ </div>
53
+
54
+ <div class="field">
55
+ <%= form.label :go_geography_state_id %>
56
+ <%= form.number_field :go_geography_state_id, id: :person_go_geography_state_id %>
57
+ </div>
58
+
59
+ <div class="field">
60
+ <%= form.label :go_geography_city_id %>
61
+ <%= form.number_field :go_geography_city_id, id: :person_go_geography_city_id %>
62
+ </div>
63
+
64
+ <div class="actions">
65
+ <%= form.submit %>
66
+ </div>
67
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Person</h1>
2
+
3
+ <%= render 'form', person: @person %>
4
+
5
+ <%= link_to 'Show', @person %> |
6
+ <%= link_to 'Back', people_path %>
@@ -0,0 +1,45 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>People</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th>Name</th>
9
+ <th>Sex</th>
10
+ <th>Civil state</th>
11
+ <th>Rg</th>
12
+ <th>Cpf</th>
13
+ <th>Birth date</th>
14
+ <th>Nationality</th>
15
+ <th>Naturalness</th>
16
+ <th>Go geography state</th>
17
+ <th>Go geography city</th>
18
+ <th colspan="3"></th>
19
+ </tr>
20
+ </thead>
21
+
22
+ <tbody>
23
+ <% @people.each do |person| %>
24
+ <tr>
25
+ <td><%= person.name %></td>
26
+ <td><%= person.sex %></td>
27
+ <td><%= person.civil_state %></td>
28
+ <td><%= person.rg %></td>
29
+ <td><%= person.cpf %></td>
30
+ <td><%= person.birth_date %></td>
31
+ <td><%= person.nationality %></td>
32
+ <td><%= person.naturalness %></td>
33
+ <td><%= person.go_geography_state_id %></td>
34
+ <td><%= person.go_geography_city_id %></td>
35
+ <td><%= link_to 'Show', person %></td>
36
+ <td><%= link_to 'Edit', edit_person_path(person) %></td>
37
+ <td><%= link_to 'Destroy', person, method: :delete, data: { confirm: 'Are you sure?' } %></td>
38
+ </tr>
39
+ <% end %>
40
+ </tbody>
41
+ </table>
42
+
43
+ <br>
44
+
45
+ <%= link_to 'New Person', new_person_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New Person</h1>
2
+
3
+ <%= render 'form', person: @person %>
4
+
5
+ <%= link_to 'Back', people_path %>
@@ -0,0 +1,54 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Name:</strong>
5
+ <%= @person.name %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Sex:</strong>
10
+ <%= @person.sex %>
11
+ </p>
12
+
13
+ <p>
14
+ <strong>Civil state:</strong>
15
+ <%= @person.civil_state %>
16
+ </p>
17
+
18
+ <p>
19
+ <strong>Rg:</strong>
20
+ <%= @person.rg %>
21
+ </p>
22
+
23
+ <p>
24
+ <strong>Cpf:</strong>
25
+ <%= @person.cpf %>
26
+ </p>
27
+
28
+ <p>
29
+ <strong>Birth date:</strong>
30
+ <%= @person.birth_date %>
31
+ </p>
32
+
33
+ <p>
34
+ <strong>Nationality:</strong>
35
+ <%= @person.nationality %>
36
+ </p>
37
+
38
+ <p>
39
+ <strong>Naturalness:</strong>
40
+ <%= @person.naturalness %>
41
+ </p>
42
+
43
+ <p>
44
+ <strong>Go geography state:</strong>
45
+ <%= @person.go_geography_state_id %>
46
+ </p>
47
+
48
+ <p>
49
+ <strong>Go geography city:</strong>
50
+ <%= @person.go_geography_city_id %>
51
+ </p>
52
+
53
+ <%= link_to 'Edit', edit_person_path(@person) %> |
54
+ <%= link_to 'Back', people_path %>
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ resources :people
3
+ end
@@ -0,0 +1,18 @@
1
+ class CreatePeople < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :people do |t|
4
+ t.string :name
5
+ t.string :sex
6
+ t.string :civil_state
7
+ t.string :rg
8
+ t.string :cpf
9
+ t.date :birth_date
10
+ t.string :nationality
11
+ t.string :naturalness
12
+ t.integer :go_geography_state_id
13
+ t.integer :go_geography_city_id
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ require "go_person/engine"
2
+
3
+ module GoPerson
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,13 @@
1
+ module GoPerson
2
+ class Engine < ::Rails::Engine
3
+ initializer :append_migrations do |app|
4
+ # This prevents migrations from being loaded twice from the inside of the
5
+ # gem itself (dummy test app)
6
+ if app.root.to_s !~ /#{root}/
7
+ config.paths['db/migrate'].expanded.each do |migration_path|
8
+ app.config.paths['db/migrate'] << migration_path
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module GoPerson
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :go_person do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: go_person
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - João Carlos Ottobboni
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.1.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.1.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: gema.
42
+ email:
43
+ - jcottobboni@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - MIT-LICENSE
49
+ - README.md
50
+ - Rakefile
51
+ - app/assets/config/go_person_manifest.js
52
+ - app/assets/javascripts/people.js
53
+ - app/assets/stylesheets/people.css
54
+ - app/assets/stylesheets/scaffold.css
55
+ - app/controllers/people_controller.rb
56
+ - app/helpers/people_helper.rb
57
+ - app/models/application_record.rb
58
+ - app/models/person.rb
59
+ - app/views/people/_form.html.erb
60
+ - app/views/people/edit.html.erb
61
+ - app/views/people/index.html.erb
62
+ - app/views/people/new.html.erb
63
+ - app/views/people/show.html.erb
64
+ - config/routes.rb
65
+ - db/migrate/20171109010720_create_people.rb
66
+ - lib/go_person.rb
67
+ - lib/go_person/engine.rb
68
+ - lib/go_person/version.rb
69
+ - lib/tasks/go_person_tasks.rake
70
+ homepage: http://www.google.com.br
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.6.13
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: gema.
94
+ test_files: []