-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into dependabot/bundler/bundler-7ec3bf…
…8405
- Loading branch information
Showing
72 changed files
with
1,285 additions
and
102 deletions.
There are no files selected for viewing
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
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,16 @@ | ||
# Copyright (c) Universidade Federal Fluminense (UFF). | ||
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file. | ||
|
||
# frozen_string_literal: true | ||
|
||
class PaperProfessorsController < ApplicationController | ||
authorize_resource | ||
|
||
active_scaffold :paper_professor do |config| | ||
config.create.label = :create_paper_professor_label | ||
config.columns = [:paper, :professor] | ||
config.columns[:professor].form_ui = :record_select | ||
|
||
config.actions.exclude :deleted_records | ||
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,16 @@ | ||
# Copyright (c) Universidade Federal Fluminense (UFF). | ||
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file. | ||
|
||
# frozen_string_literal: true | ||
|
||
class PaperStudentsController < ApplicationController | ||
authorize_resource | ||
|
||
active_scaffold :paper_student do |config| | ||
config.create.label = :create_paper_student_label | ||
config.columns = [:paper, :student] | ||
config.columns[:student].form_ui = :record_select | ||
|
||
config.actions.exclude :deleted_records | ||
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,86 @@ | ||
# Copyright (c) Universidade Federal Fluminense (UFF). | ||
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file. | ||
|
||
# frozen_string_literal: true | ||
|
||
class PapersController < ApplicationController | ||
authorize_resource | ||
|
||
active_scaffold :paper do |config| | ||
config.create.label = :create_paper_label | ||
config.actions.swap :search, :field_search | ||
config.list.sorting = { period: "DESC", owner: "ASC", order: "ASC" } | ||
|
||
config.columns.add :reason_group | ||
config.columns.add :reason_group_end | ||
form_columns = [ | ||
:period, :owner, :reference, :order, :kind, :doi_issn_event, | ||
:paper_professors, :paper_students, :other_authors, | ||
:reason_group, | ||
:reason_impact_factor, | ||
:reason_international_list, | ||
:reason_citations, | ||
:reason_national_interest, | ||
:reason_international_interest, | ||
:reason_national_representativeness, | ||
:reason_scientific_contribution, | ||
:reason_tech_contribution, | ||
:reason_innovation_contribution, | ||
:reason_social_contribution, | ||
:reason_other, | ||
:reason_justify, | ||
:reason_group_end, | ||
:other, | ||
] | ||
config.create.columns = form_columns | ||
config.update.columns = form_columns | ||
config.show.columns = [ | ||
:period, :owner, :reference, :kind, :doi_issn_event, | ||
:paper_professors, :paper_students, :other_authors, | ||
:reason_impact_factor, | ||
:reason_international_list, | ||
:reason_citations, | ||
:reason_national_interest, | ||
:reason_international_interest, | ||
:reason_national_representativeness, | ||
:reason_scientific_contribution, | ||
:reason_tech_contribution, | ||
:reason_innovation_contribution, | ||
:reason_social_contribution, | ||
:reason_other, | ||
:reason_justify, | ||
:order, | ||
:other, | ||
] | ||
config.list.columns = [ | ||
:period, :owner, :order, :reference | ||
] | ||
|
||
config.columns[:owner].form_ui = :record_select | ||
config.columns[:kind].form_ui = :select | ||
config.columns[:kind].options = { | ||
options: Paper::KINDS, | ||
include_blank: I18n.t("active_scaffold._select_") | ||
} | ||
config.columns[:order].form_ui = :select | ||
config.columns[:order].options = { | ||
options: Paper::ORDERS, | ||
include_blank: I18n.t("active_scaffold._select_") | ||
} | ||
|
||
|
||
config.columns[:paper_students].show_blank_record = false | ||
config.columns[:paper_professors].show_blank_record = false | ||
|
||
config.actions.exclude :deleted_records | ||
end | ||
|
||
protected | ||
def do_new | ||
super | ||
@record.period = CustomVariable.quadrennial_period | ||
unless current_user.professor.blank? | ||
@record.owner = current_user.professor | ||
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
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,52 @@ | ||
# frozen_string_literal: true | ||
|
||
class ReportsController < ApplicationController | ||
before_action :set_report, only: [:download, :download_by_identifier] | ||
before_action :check_downloadable, only: [:download, :download_by_identifier] | ||
authorize_resource | ||
|
||
skip_authorization_check only: :download_by_identifier | ||
skip_authorize_resource only: :download_by_identifier | ||
skip_before_action :authenticate_user!, only: :download_by_identifier | ||
|
||
active_scaffold :report do |config| | ||
config.list.columns = [:user, :file_name, :identifier, :created_at, :expires_at] | ||
config.show.columns = [:user, :file_name, :identifier, :created_at, :expires_at] | ||
config.update.columns = [:expires_at] | ||
config.columns[:user].clear_link | ||
config.actions.exclude :create, :delete | ||
config.action_links.add "download", | ||
label: " | ||
<i title='#{I18n.t("active_scaffold.download_link")}' | ||
class='fa fa-download'></i> | ||
".html_safe, | ||
page: true, | ||
type: :member, | ||
parameters: { format: :pdf }, | ||
method: :get, | ||
html_options: { target: "_blank" }, | ||
ignore_method: :cant_download? | ||
end | ||
|
||
def download | ||
redirect_to download_path(medium_hash: @report.carrierwave_file.medium_hash) | ||
end | ||
|
||
def download_by_identifier | ||
send_data(@report.carrierwave_file.read, filename: @report.carrierwave_file.original_filename, disposition: :inline) | ||
end | ||
|
||
private | ||
def set_report | ||
@report = params[:id] ? Report.find(params[:id]) : Report.find_by_identifier(params[:identifier]) | ||
raise ActionController::RoutingError.new("Este documento não foi encontrado.") if @report.nil? | ||
end | ||
|
||
def check_downloadable | ||
raise ActionController::RoutingError.new("Este documento expirou.") if cant_download?(@report) | ||
end | ||
|
||
def cant_download?(record) | ||
record.carrierwave_file.blank? | ||
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
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,7 @@ | ||
# Copyright (c) Universidade Federal Fluminense (UFF). | ||
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file. | ||
|
||
# frozen_string_literal: true | ||
|
||
module PaperProfessorsHelper | ||
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,7 @@ | ||
# Copyright (c) Universidade Federal Fluminense (UFF). | ||
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file. | ||
|
||
# frozen_string_literal: true | ||
|
||
module PaperStudentsHelper | ||
end |
Oops, something went wrong.