Skip to content
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

mvc/view: Create layout_partials/base_apply_button to centralize design of the standard Apply button #8297

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plist
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,7 @@
/usr/local/opnsense/mvc/app/views/OPNsense/Unbound/stats.volt
/usr/local/opnsense/mvc/app/views/OPNsense/Wireguard/diagnostics.volt
/usr/local/opnsense/mvc/app/views/OPNsense/Wireguard/general.volt
/usr/local/opnsense/mvc/app/views/layout_partials/base_apply_button.volt
/usr/local/opnsense/mvc/app/views/layout_partials/base_bootgrid_table.volt
/usr/local/opnsense/mvc/app/views/layout_partials/base_dialog.volt
/usr/local/opnsense/mvc/app/views/layout_partials/base_dialog_processing.volt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function getFormGrid($formname, $grid_id = null, $edit_alert_id = null)
return [
'table_id' => $basename,
'edit_dialog_id' => 'dialog_' . $basename,
'edit_alert_id' => $edit_alert_id == null ? 'change_message_' . $basename : $edit_alert_id,
'edit_alert_id' => $edit_alert_id == null ? 'change_message_base_form' : $edit_alert_id,
'fields' => array_values($all_data)
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public function v4Action()
$this->view->formGeneralSettings = $this->getForm("generalSettings4");

$this->view->formDialogSubnet = $this->getForm("dialogSubnet4");
$this->view->formGridSubnet = $this->getFormGrid("dialogSubnet4", null, "keaChangeMessage");
Monviech marked this conversation as resolved.
Show resolved Hide resolved
$this->view->formGridSubnet = $this->getFormGrid("dialogSubnet4");

$this->view->formDialogReservation = $this->getForm("dialogReservation4");
$this->view->formGridReservation = $this->getFormGrid("dialogReservation4", null, "keaChangeMessage");
$this->view->formGridReservation = $this->getFormGrid("dialogReservation4");

$this->view->formDialogPeer = $this->getForm("dialogPeer4");
$this->view->formGridPeer = $this->getFormGrid("dialogPeer4", null, "keaChangeMessage");
$this->view->formGridPeer = $this->getFormGrid("dialogPeer4");
}

public function leases4Action()
Expand Down
18 changes: 1 addition & 17 deletions src/opnsense/mvc/app/views/OPNsense/Kea/dhcpv4.volt
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,7 @@
</div>
</div>

<section class="page-content-main">
<div class="content-box">
<div class="col-md-12">
<br/>
<div id="keaChangeMessage" class="alert alert-info" style="display: none" role="alert">
{{ lang._('After changing settings, please remember to apply them.') }}
</div>
<button class="btn btn-primary" id="reconfigureAct"
data-endpoint='/api/kea/service/reconfigure'
data-label="{{ lang._('Apply') }}"
data-error-title="{{ lang._('Error reconfiguring DHCPv4') }}"
type="button"
></button>
<br/><br/>
</div>
</div>
</section>
{{ partial('layout_partials/base_apply_button', {'data_endpoint': '/api/kea/service/reconfigure'}) }}

{{ partial("layout_partials/base_dialog",['fields':formDialogSubnet,'id':formGridSubnet['edit_dialog_id'],'label':lang._('Edit Subnet')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogReservation,'id':formGridReservation['edit_dialog_id'],'label':lang._('Edit Reservation')])}}
Expand Down
23 changes: 23 additions & 0 deletions src/opnsense/mvc/app/views/layout_partials/base_apply_button.volt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<section class="page-content-main">
<div class="content-box">
<div class="col-md-12">
<br/>
<div id="{{ message_id|default('change_message_base_form') }}" class="alert alert-info" style="display: none" role="alert">
{{ lang._('After changing settings, please remember to apply them.') }}
</div>
<button class="btn btn-primary" id="{{ button_id|default('reconfigureAct') }}"
data-endpoint="{{ data_endpoint }}"
Monviech marked this conversation as resolved.
Show resolved Hide resolved
data-label="{{ lang._(data_label|default('Apply')) }}"
data-error-title="{{ lang._(data_error_title|default('Error reconfiguring service.')) }}"
{% if data_service_widget %}
data-service-widget="{{ data_service_widget }}"
{% endif %}
Monviech marked this conversation as resolved.
Show resolved Hide resolved
{% if data_grid_reload %}
data-grid-reload="{{ data_grid_reload }}"
{% endif %}
type="button">
fichtner marked this conversation as resolved.
Show resolved Hide resolved
</button>
<br/><br/>
</div>
</div>
</section>