-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add general agenda app #608
Draft
Laykou
wants to merge
27
commits into
master
Choose a base branch
from
add-general-agenda-app
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
ab80a31
WIP: Add general agenda app
Laykou b967806
WIP: Add general agenda app
Laykou 7eff79f
Add Datahub::Upvs::ServicesWithForms
82b6c75
Fix XML for general agenda
Laykou 78191ef
Use ServicesWithForms search in controller
a8c103c
moved search_recipient to ServicesWithFormsController
9cc519e
Unify the form (add-general-agenda-app)
Laykou 306ff72
Draft signing
luciajanikova 4147fc7
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova 909a747
WIP: Add file upload to general agenda (add-general-agenda-app)
Laykou 2745f77
added validation to subject and text
b835e5e
Change Upvs::Submission form to attachment
cda8574
Complete signing of UPVS Submission (feature/upvs_submissions_signing)
Laykou 4f247df
Merge branch 'feature/upvs_submissions_signing' into add-general-agen…
Laykou d5e68d5
Add analyzers (add-general-agenda-app)
5bc7a8d
Add signature together with general agenda (add-general-agenda-app)
Laykou 1a34f91
Remove xml analyzer
c495f14
Fix submission tests
a152e34
Fix attachment tempaltes for general agenda form
Laykou 1326b85
fixed query and format of response
2ff65cb
Update UpvsSubmissions::SktalkMessageBuilder to include attachments
luciajanikova 38c4338
Merge branch 'add-general-agenda-app' of https://github.com/slovensko…
luciajanikova fc2c9ed
Add attachments uploads + signature for UPVS
Laykou 360f441
Fix validation of placeholders and links to blobs
Laykou befb48b
Cleanup unnecessary files
Laykou 66316b2
Drop Upvs::Submission.form column
luciajanikova cefe7f6
Schedule RemoveStaleBlobs job
luciajanikova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@keyframes spinner { | ||
to {transform: rotate(360deg);} | ||
} | ||
|
||
.spinner { | ||
position: absolute; | ||
top: 25%; | ||
left: 50%; | ||
} | ||
|
||
.spinner:before { | ||
content: ''; | ||
box-sizing: border-box; | ||
position: absolute; | ||
width: 20px; | ||
height: 20px; | ||
border-radius: 50%; | ||
border: 2px solid #ccc; | ||
border-top-color: #000; | ||
animation: spinner .6s linear infinite; | ||
} | ||
|
||
.spinner.spinner-lg:before { | ||
width: 60px; | ||
height: 60px; | ||
} |
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
55 changes: 55 additions & 0 deletions
55
app/controllers/apps/general_agenda_app/general_agenda_controller.rb
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,55 @@ | ||
module Apps | ||
module GeneralAgendaApp | ||
class GeneralAgendaController < ApplicationController | ||
skip_forgery_protection only: [:index] | ||
|
||
def index | ||
# Configuration of the form - as API | ||
attributes = { | ||
title: params[:title].presence || 'Všeobecná agenda', | ||
description: params[:description].presence || 'Formulár pre odoslanie podania pre všeobecnú agendu', | ||
subject: params[:subject_placeholder], | ||
text: params[:text_placeholder], | ||
signed_required: params[:signed_required], | ||
attachments_template: params[:attachments_template], | ||
}.with_indifferent_access | ||
|
||
# Appending whatever user submitted into recipient, subject, text and attachments | ||
# + remembers the form configuration between submits | ||
attributes.merge!(general_agenda_params || {}) | ||
|
||
@application_form = Apps::GeneralAgendaApp::GeneralAgenda::ApplicationForm.new(attributes) | ||
|
||
return render :invalid_template unless @application_form.valid_template? | ||
|
||
redirect_to_upvs_submission if @application_form.is_submitted && @application_form.valid? | ||
end | ||
|
||
def callback | ||
end | ||
|
||
private | ||
|
||
def redirect_to_upvs_submission | ||
@submission_form = UpvsSubmissions::Forms::GeneralAgenda.new(@application_form) | ||
|
||
render :redirect_to_upvs_submission | ||
end | ||
|
||
def general_agenda_params | ||
params[:apps_general_agenda_app_general_agenda_application_form]&.permit( | ||
:title, | ||
:description, | ||
:subject, | ||
:text, | ||
:signed_required, | ||
:recipient_name, | ||
:recipient_uri, | ||
:is_submitted, | ||
attachments: {}, | ||
attachments_template: [:name, :description, :required, :signed_required] | ||
) | ||
end | ||
end | ||
end | ||
end |
11 changes: 6 additions & 5 deletions
11
app/controllers/datahub/upvs/public_authority_edesks_controller.rb
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,8 +1,9 @@ | ||
module Datahub::Upvs | ||
class PublicAuthorityEdesksController < ApplicationController | ||
|
||
def search | ||
render json: PublicAuthorityEdesk.search(params[:q]) | ||
module Datahub | ||
module Upvs | ||
class PublicAuthorityEdesksController < ApplicationController | ||
def search | ||
render json: PublicAuthorityEdesk.search(params[:q]) | ||
end | ||
end | ||
end | ||
end |
26 changes: 26 additions & 0 deletions
26
app/controllers/datahub/upvs/services_with_forms_controller.rb
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,26 @@ | ||
module Datahub | ||
module Upvs | ||
class ServicesWithFormsController < ApplicationController | ||
def search_recipient | ||
result = if testing? | ||
# Datahub::Upvs::ServicesWithForms.search(params[:q]) | ||
[{ name: 'Testing - ico://sk/83369507', uri: 'ico://sk/83369507' }] | ||
else | ||
Datahub::Upvs::ServicesWithForms.search(params[:q]) | ||
end | ||
render json: { result: result } | ||
end | ||
|
||
private | ||
|
||
# Testing is determined based on the content of 'SLOVENSKO_SK_API_URL' which looks like e.g.: | ||
# - https://localhost:4000 | ||
# - https://fix.slovensko-sk-api.staging.slovensko.digital | ||
# | ||
# If you need to see production list of recipients, change the `SLOVENSKO_SK_API_URL` ENV to something else | ||
def testing? | ||
['staging.', 'localhost'].any? { |e| ENV['SLOVENSKO_SK_API_URL'].to_s.include?(e) } | ||
end | ||
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
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,11 @@ | ||
class RemoveStaleBlobs < ApplicationJob | ||
queue_as :default | ||
|
||
# TODO: Setup this as a cron job and run once a week | ||
def perform | ||
# In `GeneralAgenda` user can upload a file which creates an `ActiveStorage::Blob` | ||
# if this form is not converted into `Uvps::Submission`, the file remains uploaded, but not attached anywhere | ||
# These files should be regularly purged | ||
ActiveStorage::Blob.unattached.where('created_at < ?', 3.days.ago).each(&:purge_later) | ||
end | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / CodeQL
CSRF protection weakened or disabled High