-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/solver-it-sro/govbox-pro in…
…to GO-208/fix_setting_replyable_attribute_to_messages # Conflicts: # db/schema.rb
- Loading branch information
Showing
103 changed files
with
1,325 additions
and
1,866 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md bg-blue-600"> | ||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="flex-grow-0 flex-shrink-0 w-5 h-5 relative" preserveAspectRatio="xMidYMid meet"> | ||
<path d="M10 10H5H10Z" fill="white"></path> | ||
<path d="M10 5V10M10 10V15M10 10H15M10 10H5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> | ||
</svg> | ||
</div> |
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,4 @@ | ||
module Common | ||
class AddButtonComponent < ViewComponent::Base | ||
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,6 @@ | ||
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md bg-white"> | ||
<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg" class="flex-grow-0 flex-shrink-0 w-5 h-5 relative" preserveAspectRatio="xMidYMid meet"> | ||
<path d="M5 15.5L15 5.5L5 15.5ZM5 5.5L15 15.5L5 5.5Z" fill="#111827"></path> | ||
<path d="M5 5.5L15 15.5M5 15.5L15 5.5L5 15.5Z" stroke="#9CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> | ||
</svg> | ||
</div> |
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,4 @@ | ||
module Common | ||
class CloseButtonComponent < ViewComponent::Base | ||
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,5 @@ | ||
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md bg-white border border-gray-300"> | ||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="flex-grow-0 flex-shrink-0 w-5 h-5 relative" preserveAspectRatio="xMidYMid meet"> | ||
<path d="M8.33301 9.16667V14.1667M11.6663 9.16667V14.1667M3.33301 5.83333H16.6663M15.833 5.83333L15.1105 15.9517C15.0806 16.3722 14.8924 16.7657 14.5839 17.053C14.2755 17.3403 13.8696 17.5 13.448 17.5H6.55134C6.12979 17.5 5.7239 17.3403 5.41541 17.053C5.10693 16.7657 4.91877 16.3722 4.88884 15.9517L4.16634 5.83333H15.833ZM12.4997 5.83333V3.33333C12.4997 3.11232 12.4119 2.90036 12.2556 2.74408C12.0993 2.5878 11.8874 2.5 11.6663 2.5H8.33301C8.11199 2.5 7.90003 2.5878 7.74375 2.74408C7.58747 2.90036 7.49967 3.11232 7.49967 3.33333V5.83333H12.4997Z" stroke="#DC2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> | ||
</svg> | ||
</div> |
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,4 @@ | ||
module Common | ||
class DeleteButtonComponent < ViewComponent::Base | ||
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,3 @@ | ||
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md bg-white border border-gray-300"> | ||
<%= render Icons::PencilComponent.new %> | ||
</div> |
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,4 @@ | ||
module Common | ||
class EditButtonComponent < ViewComponent::Base | ||
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,3 @@ | ||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" class="flex-grow-0 flex-shrink-0 w-8 h-8 relative" preserveAspectRatio="xMidYMid meet"> | ||
<path d="M17.3333 21.3333H16V16H14.6667M16 10.6667H16.0133M28 16C28 17.5759 27.6896 19.1363 27.0866 20.5922C26.4835 22.0481 25.5996 23.371 24.4853 24.4853C23.371 25.5996 22.0481 26.4835 20.5922 27.0866C19.1363 27.6896 17.5759 28 16 28C14.4241 28 12.8637 27.6896 11.4078 27.0866C9.95189 26.4835 8.62902 25.5996 7.51472 24.4853C6.40042 23.371 5.5165 22.0481 4.91345 20.5922C4.31039 19.1363 4 17.5759 4 16C4 12.8174 5.26428 9.76516 7.51472 7.51472C9.76516 5.26428 12.8174 4 16 4C19.1826 4 22.2348 5.26428 24.4853 7.51472C26.7357 9.76516 28 12.8174 28 16Z" stroke="#9CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> | ||
</svg> |
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 @@ | ||
class Icons::InfoComponent < ViewComponent::Base | ||
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
23 changes: 23 additions & 0 deletions
23
app/components/settings/rules/action_form_component.html.erb
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,23 @@ | ||
<%= tag.turbo_frame id: "action-#{@index}", class:"flex justify-between self-stretch grow" do %> | ||
<div class="flex justify-stretch gap-2"> | ||
<%= @form.select :type, @action_type_list, {}, class:"mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %> | ||
<%= @form.text_field :value, class:"mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %> | ||
</div> | ||
<% if @enabled %> | ||
<div> | ||
<% if @form.object.type %> | ||
<%= button_tag type: "submit", formaction: settings_automation_action_path(id: @form.object.id, index: @index), formmethod: :delete, data: {turbo_frame: "condition-#{@index}"} do %> | ||
<%= render Common::DeleteButtonComponent.new %> | ||
<% end %> | ||
<%= button_tag type: "submit", formaction: settings_automation_action_path(index: @index), formmethod: :patch do %> | ||
<%= render Common::AddButtonComponent.new %> | ||
<% end %> | ||
<% else %> | ||
<%= button_tag type: "submit", formaction: settings_automation_actions_path(index: @index), formmethod: :post do %> | ||
<%= render Common::AddButtonComponent.new %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% 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,11 @@ | ||
class Settings::Rules::ActionFormComponent < ViewComponent::Base | ||
def initialize(form:, index:, enabled: true) | ||
@form = form | ||
@index = index | ||
@enabled = enabled | ||
end | ||
|
||
def before_render | ||
@action_type_list = Automation::Action.subclasses.map { |subclass| [t(subclass.name), subclass.name] } | ||
end | ||
end |
50 changes: 50 additions & 0 deletions
50
app/components/settings/rules/actions_form_component.html.erb
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,50 @@ | ||
<%= tag.turbo_frame(id: 'modal') do %> | ||
<div class="fixed inset-0 z-50 p-2" role="dialog" aria-modal="true"> | ||
<div class="fixed inset-0 transition-opacity bg-gray-400 bg-opacity-75" aria-hidden="true"></div> | ||
<div class="relative flex items-center justify-center h-full"> | ||
<div class="flex flex-col justify-start items-start w-[900] overflow-hidden rounded-lg bg-white border border-gray-300" role="dialog" style="box-shadow: 1px 1px 4px 0 rgba(0,0,0,0.1);"> | ||
<div class="flex flex-col justify-start items-start self-stretch flex-grow-0 flex-shrink-0"> | ||
<div class="flex justify-start items-center self-stretch flex-grow-0 flex-shrink-0 overflow-hidden gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200"> | ||
<div class="flex flex-col justify-start items-start flex-grow relative"> | ||
<p class="self-stretch flex-grow w-[788px] text-xl font-semibold text-left text-gray-900"> Úprava pravidla </p> | ||
<p class="flex-grow-0 flex-shrink-0 text-xs text-left text-gray-500"> Krok 3 z 3 – Akcie pravidla </p> | ||
</div> | ||
<%= link_to settings_automation_rules_path, data: { turbo_frame: "_top" } do %> | ||
<%= render Common::CloseButtonComponent.new %> | ||
<% end %> | ||
</div> | ||
<div class="flex justify-start items-center self-stretch flex-grow-0 flex-shrink-0 relative gap-4 p-6 bg-white border-t-0 border-r-0 border-b border-l-0 border-gray-200"> | ||
<%= render Icons::InfoComponent.new %> | ||
<p class="flex-grow w-[804px] text-base text-left text-gray-900"> Pravidlo spúšťa ľubovoľný počet akcií, pričom všetky budú vykonané ak sú splnené všetky podmienky pravidla.</p> | ||
</div> | ||
<%= form_with model: [:settings, @new_rule], class:"flex justify-start items-center self-stretch gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200" do |new_rule_form| %> | ||
<%= new_rule_form.fields_for :actions do |new_action_form| %> | ||
<%= tag.turbo_frame id: "action-new", class:"flex justify-between grow" do %> | ||
<%= render Settings::Rules::ActionFormComponent.new(form: new_action_form, index: @automation_rule.actions.size) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= form_with model: [:settings, @automation_rule], class:"flex flex-col self-stretch" do |rule_form| %> | ||
<%= tag.turbo_frame id: 'actions', class:"flex flex-col justify-start items-start grow gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200" do %> | ||
<%= rule_form.fields_for :actions do |action_form| %> | ||
<% if action_form.object.delete_record %> | ||
<%= action_form.hidden_field :delete_record, value:true %> | ||
<% else %> | ||
<%= render Settings::Rules::ActionsFormRowComponent.new(form: action_form, index: action_form.index) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= render Settings::Rules::HiddenRuleFormComponent.new(form: rule_form) %> | ||
<%= rule_form.fields_for :conditions do |condition_form| %> | ||
<%= render Settings::Rules::HiddenConditionRowComponent.new(form:condition_form) %> | ||
<% end %> | ||
<div class="flex justify-start items-start self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6"> | ||
<%= rule_form.button "Späť", formaction: conditions_step_settings_automation_rule_path, class:"flex justify-center items-center flex-grow relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md border border-gray-300 text-base font-medium text-left text-gray-900 bg-white" %> | ||
<%= rule_form.button "Uložiť zmeny", class:"flex justify-center items-center flex-grow relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md text-base font-medium text-left text-white bg-blue-600" %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<% 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,6 @@ | ||
class Settings::Rules::ActionsFormComponent < ViewComponent::Base | ||
def initialize(automation_rule:) | ||
@automation_rule = automation_rule | ||
@new_rule = Automation::Rule.new(actions: [Automation::Action.new]) | ||
end | ||
end |
20 changes: 20 additions & 0 deletions
20
app/components/settings/rules/actions_form_row_component.html.erb
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,20 @@ | ||
<%= tag.turbo_frame id: "condition-#{@index}", class:"flex justify-start self-stretch grow" do %> | ||
<div class="flex justify-between items-center self-stretch flex-grow flex-shrink-0 relative"> | ||
<div class="flex gap-1"> | ||
<p class="text-base font-medium text-left text-gray-900"><%= t @form.object.type %></p> | ||
<p class="text-base text-left text-gray-900"><%= @form.object.value %></p> | ||
<%= @form.hidden_field :type %> | ||
<%= @form.hidden_field :value %> | ||
</div> | ||
<% if @editable %> | ||
<div class="flex"> | ||
<%= button_tag type: "submit", formaction: settings_automation_action_path(index: @index), formmethod: :post do %> | ||
<%= render Common::EditButtonComponent.new %> | ||
<% end %> | ||
<%= button_tag type: "submit", formaction: settings_automation_action_path(id: @form.object.id, index: @index), formmethod: :delete do %> | ||
<%= render Common::DeleteButtonComponent.new %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% 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 @@ | ||
class Settings::Rules::ActionsFormRowComponent < ViewComponent::Base | ||
def initialize(form:, index:, editable: true) | ||
@form = form | ||
@index = index | ||
@editable = editable | ||
end | ||
end |
36 changes: 16 additions & 20 deletions
36
app/components/settings/rules/automation_rules_list_component.html.erb
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,23 +1,19 @@ | ||
<div class="flex flex-col justify-start items-start rounded-md bg-white border border-gray-200"> | ||
<div class="flex justify-start items-center relative gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200" > | ||
<p class=" w-[1074px] text-xl font-semibold text-left text-gray-900"> | ||
Automatické pravidlá | ||
</p> | ||
<div | ||
class="flex justify-center items-center relative gap-2.5 px-3.5 py-2.5 rounded-md bg-blue-600" | ||
> | ||
<p class=" text-base font-medium text-left text-white"> | ||
Vytvoriť pravidlo | ||
</p> | ||
</div> | ||
</div> | ||
<div class="flex flex-col justify-start items-start "> | ||
<div | ||
class="flex justify-start items-center gap-2 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200" | ||
> | ||
<% automation_rules.each do |automation_rule| %> | ||
<%= automation_rule %> | ||
<% end %> | ||
<div class="flex justify-start items-start w-full"> | ||
<div class="flex flex-col justify-start items-start flex-grow gap-4 p-4"> | ||
<div class="flex flex-col justify-start items-start self-stretch flex-grow-0 flex-shrink-0 overflow-hidden rounded-md bg-white border border-gray-200"> | ||
<div class="flex justify-start items-center self-stretch flex-grow-0 flex-shrink-0 relative overflow-hidden gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200" > | ||
<p class="flex-grow w-[1074px] text-xl font-semibold text-left text-gray-900">Automatické pravidlá</p> | ||
<%= link_to new_settings_automation_rule_path, class:"flex justify-center items-center gap-2.5 px-3.5 py-2.5 rounded-md bg-blue-600" do %> | ||
<p class="flex-grow-0 flex-shrink-0 text-base font-medium text-left text-white">Vytvoriť pravidlo</p> | ||
<% end %> | ||
</div> | ||
<div class="flex flex-col justify-start items-start self-stretch flex-grow-0 flex-shrink-0"> | ||
<div class="flex flex-col justify-start items-center self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200"> | ||
<% automation_rules.each do |automation_rule| %> | ||
<%= automation_rule %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
2 changes: 0 additions & 2 deletions
2
app/components/settings/rules/automation_rules_list_component.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,5 +1,3 @@ | ||
# frozen_string_literal: true | ||
|
||
class Settings::Rules::AutomationRulesListComponent < ViewComponent::Base | ||
renders_many :automation_rules | ||
end |
Oops, something went wrong.