-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Manoel <[email protected]>
- Loading branch information
Showing
23 changed files
with
402 additions
and
183 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ | |
* | ||
*= require_tree . | ||
*= require_self | ||
*= require font-awesome | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
class HomeController < ApplicationController | ||
def index | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
module ApplicationHelper | ||
include FontAwesome::Rails::IconHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ProcessHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class Processo < ApplicationRecord | ||
belongs_to :user | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<%= stylesheet_link_tag "process" %> | ||
<h1>Lista de Processos</h1> | ||
<h2>Criar um novo processo</h2> | ||
<%= form_for :processo, url: process_creation_path ,html: {id: "creation_form", :multipart => true} do |f| %> | ||
<div> | ||
<%= f.label "Número do processo SEI" %> | ||
<%= f.text_field :sei_process_code %> | ||
</div> | ||
<div> | ||
<%= 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)) %> | ||
</div> | ||
<div> | ||
<%= f.file_field :documents, multiple: true, name: "doc_[document]" %> | ||
</div> | ||
<div> | ||
|
||
</div> | ||
<div> | ||
<%= submit_tag("Enviar") %> | ||
</div> | ||
<% end %> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Número SEI</th> | ||
<th>Status do processo</th> | ||
<th>Deletar</th> | ||
<th colspan="3"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @processes.each do |process| %> | ||
<tr> | ||
<td><%= process['sei_process_code'] %></td> | ||
<td align="right"><%= process['process_status_id'] %></td> | ||
<td align="center"> | ||
<%= link_to fa_icon('trash').html_safe, "#{process['id']}", :method => :delete, :action => "delete", :id => process['id'], class: "delete_link" %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"name": "secretaria_ppgi", | ||
"private": true, | ||
"dependencies": {} | ||
"dependencies": { | ||
"@fortawesome/fontawesome-free": "^5.15.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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== |