+
@@ -85,7 +98,6 @@
-
@@ -120,7 +132,6 @@
-
@@ -151,7 +162,6 @@
-
@@ -176,7 +186,6 @@
-
@@ -203,7 +212,6 @@
-
@@ -227,7 +235,6 @@
-
@@ -251,7 +258,6 @@
-
@@ -278,7 +284,6 @@
-
@@ -307,7 +312,10 @@
1605305587618
-
+
+
+
+
1605483214391
@@ -351,6 +359,7 @@
+
@@ -370,100 +379,160 @@
-
-
+
+
-
-
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
index 54be0f4e..9781a662 100644
--- a/Gemfile
+++ b/Gemfile
@@ -66,5 +66,6 @@ group :test do
gem 'shoulda-matchers'
end
+gem "font-awesome-rails"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
diff --git a/Gemfile.lock b/Gemfile.lock
index cb020534..919c5074 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -103,6 +103,8 @@ GEM
erubi (1.9.0)
execjs (2.7.0)
ffi (1.11.1)
+ font-awesome-rails (4.7.0.5)
+ railties (>= 3.2, < 6.1)
gherkin (5.1.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
@@ -191,8 +193,6 @@ GEM
rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
- ruby-debug-ide (0.7.2)
- rake (>= 0.8.1)
ruby_dep (1.5.0)
rubyzip (2.0.0)
sass (3.7.4)
@@ -260,13 +260,13 @@ DEPENDENCIES
cucumber-rails
database_cleaner
devise
+ font-awesome-rails
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2)
pg (>= 0.18, < 2.0)
puma (~> 3.12)
rails (~> 5.2.3)
rspec-rails
- ruby-debug-ide
sass-rails (~> 5.0)
selenium-webdriver
shoulda-matchers
@@ -282,4 +282,4 @@ RUBY VERSION
ruby 2.6.3p62
BUNDLED WITH
- 1.17.2
+ 1.17.3
diff --git a/app/assets/javascripts/process.coffee b/app/assets/javascripts/process.coffee
new file mode 100644
index 00000000..24f83d18
--- /dev/null
+++ b/app/assets/javascripts/process.coffee
@@ -0,0 +1,3 @@
+# 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/
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index d05ea0f5..d3e5ded7 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -12,4 +12,5 @@
*
*= require_tree .
*= require_self
+ *= require font-awesome
*/
diff --git a/app/assets/stylesheets/process.scss b/app/assets/stylesheets/process.scss
new file mode 100644
index 00000000..dd66d06a
--- /dev/null
+++ b/app/assets/stylesheets/process.scss
@@ -0,0 +1,11 @@
+// Place all the styles related to the process controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+#creation_form {
+ max-width: 60%;
+}
+
+.delete_link {
+ color: grey;
+}
\ No newline at end of file
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 457cc5f9..e43b93a4 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,7 +2,6 @@
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
-
protected
def configure_permitted_parameters
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 95f29929..3181ce6b 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,4 +1,5 @@
class HomeController < ApplicationController
def index
+
end
end
diff --git a/app/controllers/process_controller.rb b/app/controllers/process_controller.rb
new file mode 100644
index 00000000..824d462d
--- /dev/null
+++ b/app/controllers/process_controller.rb
@@ -0,0 +1,38 @@
+class ProcessController < ApplicationController
+ def reload_processes(user)
+ @processes = []
+ processes_query = user.processos
+ unless processes_query.nil?
+ processes_query.each do |process|
+ puts(process.attributes)
+ @processes.append(process.attributes)
+ end
+ end
+ @processes
+ end
+
+ def index
+ if user_signed_in?
+ @user = current_user
+ reload_processes(@user)
+ end
+ end
+
+ def create
+ if user_signed_in?
+ user = current_user
+ permitted_params = params.require(:processo).permit(:sei_process_code, :process_status_id, :documents)
+ process = user.processos.create(permitted_params)
+ reload_processes(user)
+ end
+ end
+
+ def delete
+ if user_signed_in?
+ user = current_user
+ permitted_params = params.permit(:id)
+ user.processos.destroy(permitted_params[:id])
+ reload_processes(user)
+ end
+ end
+end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index de6be794..1527a569 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,2 +1,3 @@
module ApplicationHelper
+ include FontAwesome::Rails::IconHelper
end
diff --git a/app/helpers/process_helper.rb b/app/helpers/process_helper.rb
new file mode 100644
index 00000000..96167865
--- /dev/null
+++ b/app/helpers/process_helper.rb
@@ -0,0 +1,2 @@
+module ProcessHelper
+end
diff --git a/app/models/processo.rb b/app/models/processo.rb
index ca45fc26..6274e74f 100644
--- a/app/models/processo.rb
+++ b/app/models/processo.rb
@@ -1,2 +1,3 @@
class Processo < ApplicationRecord
+ belongs_to :user
end
\ No newline at end of file
diff --git a/app/models/user.rb b/app/models/user.rb
index d0925982..1dc3c8d7 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -14,4 +14,5 @@ class User < ApplicationRecord
has_many :information
has_many :user_notifications
has_many :requests
+ has_many :processos
end
diff --git a/app/views/process/index.html.erb b/app/views/process/index.html.erb
new file mode 100644
index 00000000..1a0d5a78
--- /dev/null
+++ b/app/views/process/index.html.erb
@@ -0,0 +1,44 @@
+<%= stylesheet_link_tag "process" %>
+Lista de Processos
+Criar um novo processo
+<%= form_for :processo, url: process_creation_path ,html: {id: "creation_form", :multipart => true} do |f| %>
+
+ <%= f.label "Número do processo SEI" %>
+ <%= f.text_field :sei_process_code %>
+
+
+ <%= label_tag(:status_id, "Status do processo") %>
+ <%= f.select(:process_status_id, options_for_select([['Status 1', 1], ['Status 2', 2], ['Status 3', 3]], 1)) %>
+
+
+ <%= f.file_field :documents, multiple: true, name: "doc_[document]" %>
+
+
+
+
+
+ <%= submit_tag("Enviar") %>
+
+<% end %>
+
+
+
+ Número SEI |
+ Status do processo |
+ Deletar |
+ |
+
+
+
+ <% @processes.each do |process| %>
+
+ <%= process['sei_process_code'] %> |
+ <%= process['process_status_id'] %> |
+
+ <%= link_to fa_icon('trash').html_safe, "#{process['id']}", :method => :delete, :action => "delete", :id => process['id'], class: "delete_link" %>
+ <% end %>
+ |
+
+
+
+
diff --git a/config/database.yml b/config/database.yml
index 2eaf2ed7..b5549280 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -26,6 +26,7 @@ default: &default
development:
<<: *default
+ host: localhost
database: secretaria_ppgi_development
# The specified database role being used to connect to postgres.
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 4b828e80..c24f4038 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -12,3 +12,4 @@
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
+Rails.application.config.assets.precompile += %w( process.scss )
diff --git a/config/routes.rb b/config/routes.rb
index f33f7f68..37ea6b49 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,9 @@
# frozen_string_literal: true
Rails.application.routes.draw do
+ get 'process/index'
+ post 'process', to: 'process#create', as: 'process_creation'
+ delete 'process/:id', to: 'process#delete', as: 'process_delete'
get 'home/index'
devise_for :users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
diff --git a/package.json b/package.json
index 35eaf1ed..4278469d 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,7 @@
{
"name": "secretaria_ppgi",
"private": true,
- "dependencies": {}
+ "dependencies": {
+ "@fortawesome/fontawesome-free": "^5.15.1"
+ }
}
diff --git a/spec/controllers/process_controller_spec.rb b/spec/controllers/process_controller_spec.rb
new file mode 100644
index 00000000..63e88ce3
--- /dev/null
+++ b/spec/controllers/process_controller_spec.rb
@@ -0,0 +1,12 @@
+require 'rails_helper'
+
+RSpec.describe ProcessController, type: :controller do
+
+ describe "GET #index" do
+ it "returns http success" do
+ get :index
+ expect(response).to have_http_status(:success)
+ end
+ end
+
+end
diff --git a/spec/helpers/process_helper_spec.rb b/spec/helpers/process_helper_spec.rb
new file mode 100644
index 00000000..b97e971e
--- /dev/null
+++ b/spec/helpers/process_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ProcessHelper. For example:
+#
+# describe ProcessHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe ProcessHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/process/index.html.erb_spec.rb b/spec/views/process/index.html.erb_spec.rb
new file mode 100644
index 00000000..3bcdfae4
--- /dev/null
+++ b/spec/views/process/index.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe "process/index.html.erb", type: :view do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/yarn.lock b/yarn.lock
new file mode 100644
index 00000000..01c5ff74
--- /dev/null
+++ b/yarn.lock
@@ -0,0 +1,8 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+"@fortawesome/fontawesome-free@^5.15.1":
+ version "5.15.1"
+ resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.1.tgz#ccfef6ddbe59f8fe8f694783e1d3eb88902dc5eb"
+ integrity sha512-OEdH7SyC1suTdhBGW91/zBfR6qaIhThbcN8PUXtXilY4GYnSBbVqOntdHbC1vXwsDnX0Qix2m2+DSU1J51ybOQ==