Skip to content

Commit

Permalink
issue-218: use at assertion column
Browse files Browse the repository at this point in the history
  • Loading branch information
¨caiovelp¨ committed Dec 9, 2024
1 parent 790aa6b commit 2a33bc2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/controllers/report_configurations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ReportConfigurationsController < ApplicationController
columns = [
:name, :image, :scale, :x, :y, :order, :text, :signature_type,
:preview, :use_at_report, :use_at_transcript,
:use_at_grades_report, :use_at_schedule, :expiration_in_months
:use_at_grades_report, :use_at_schedule, :use_at_assertion, :expiration_in_months
]
config.create.columns = columns
config.update.columns = columns
Expand All @@ -22,7 +22,7 @@ class ReportConfigurationsController < ApplicationController
config.list.columns = [
:name, :order, :text, :signature_type,
:use_at_report, :use_at_transcript, :use_at_grades_report,
:use_at_schedule, :expiration_in_months
:use_at_schedule, :use_at_assertion, :expiration_in_months
]
config.columns[:signature_type].form_ui = :select
config.columns[:signature_type].options = { options: ReportConfiguration.signature_types.keys.map(&:to_sym) }
Expand Down Expand Up @@ -65,7 +65,7 @@ def logo
def record_params
params.required(:record).permit(
:name, :use_at_report, :use_at_transcript, :use_at_grades_report,
:use_at_schedule, :text, :image, :order, :scale,
:use_at_schedule, :use_at_assertion, :text, :image, :order, :scale,
:x, :y, :signature_type, :expiration_in_months
)
end
Expand Down
6 changes: 5 additions & 1 deletion app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Ability
]

DOCUMENT_MODELS = [
Report
Report, Assertion
]

PLACE_MODELS = [
Expand Down Expand Up @@ -244,6 +244,10 @@ def initialize_documents(user, roles)
can :manage, Ability::DOCUMENT_MODELS
cannot :update, Report unless roles[Role::ROLE_ADMINISTRADOR]
end
if roles[Role::ROLE_SECRETARIA]
can :read, Ability::DOCUMENT_MODELS
can :execute, Ability::DOCUMENT_MODELS
end
end

def initialize_places(user, roles)
Expand Down
1 change: 1 addition & 0 deletions config/locales/report_configuration.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pt-BR:
use_at_report: "Usar em relatórios"
use_at_schedule: "Usar no quadro de horários"
use_at_transcript: "Usar no histórico"
use_at_assertion: "Usar em declarações"
order: "Prioridade"
scale: "Escala"
x: "X"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUseAtAssertionToReportConfigurations < ActiveRecord::Migration[7.0]
def change
add_column :report_configurations, :use_at_assertion, :boolean, default: false, null: false
end
end
5 changes: 5 additions & 0 deletions db/migrate/20241209223145_add_new_column_to_assertions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddNewColumnToAssertions < ActiveRecord::Migration[7.0]
def change
add_column :assertions, :assertion_template, :string
end
end
4 changes: 3 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2a33bc2

Please sign in to comment.