Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1123718
D531.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Sep 2, 4:41 PM
Size
8 KB
Mime Type
text/x-diff
Expires
Wed, Sep 3, 4:41 PM (16 h, 34 m)
Engine
blob
Format
Raw Data
Handle
726793
Attached To
D531: INP-1916 - Correct scroll-to-error behavior on the Configuration Pages
D531.diff
View Options
Index: core/admin_templates/config/config_general.tpl
===================================================================
--- core/admin_templates/config/config_general.tpl
+++ core/admin_templates/config/config_general.tpl
@@ -1,131 +1,15 @@
-<inp2:m_include t="incs/header"/>
-
-<inp2:m_Get name="section" result_to_var="section"/>
-<inp2:m_RenderElement name="combined_header" prefix="conf" section="$section" perm_event="conf:OnLoad" title_preset="config_list_general"/>
-
-<!-- ToolBar -->
-<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
- <tbody>
- <tr>
- <td>
- <script type="text/javascript">
- function validate_password_fields() {
- var $validated = true;
-
- $("input[primarytype='password']", '#' + $form_name).each(
- function ($e) {
- if ( !validate_password_field(this.id) ) {
- $validated = false;
- }
- }
- );
-
- return $validated;
- }
-
- function validate_password_field($field_id) {
- var password_field = document.getElementById($field_id),
- password_verify_field = document.getElementById('verify_' + $field_id);
-
- if ( password_field && password_verify_field && password_field.value == password_verify_field.value ) {
- return true;
- }
- else {
- var password_error_cell = document.getElementById('error_' + $field_id);
-
- if ( password_error_cell ) {
- $(window).scrollTop($(password_field).position().top - 15);
- password_error_cell.innerHTML = '<inp2:m_Phrase name="la_error_PasswordMatch"/>';
- }
-
- return false;
- }
- }
-
- function toggle_section($label) {
- var $table = document.getElementById('config_table');
- var $row = null;
- var $is_visible = false;
-
- for (var $i = 0; $i < $table.rows.length; $i++) {
- $row = $table.rows[$i];
- if ( $row.getAttribute('header_label') != $label ) {
- continue;
- }
-
- if ( !$row.style.display ) {
- $row.style.display = document.all ? 'block' : 'table-row';
- }
-
- $is_visible = !($row.style.display == 'none');
- $row.style.display = $is_visible ? 'none' : (document.all ? 'block' : 'table-row');
-
- document.getElementById('toggle_mark[' + $label + ']').innerHTML = '[' + ($is_visible ? '+' : '-') + ']';
- }
- }
-
- var a_toolbar = new ToolBar();
-
- a_toolbar.AddButton(
- new ToolBarButton(
- 'select',
- '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>',
- function() {
- submit_event('conf','<inp2:conf_SaveEvent/>');
- }
- )
- );
-
- a_toolbar.AddButton(
- new ToolBarButton(
- 'cancel',
- '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>',
- function() {
- submit_event('conf','OnCancel');
- }
- )
- );
-
- <inp2:m_if check="m_IsDebugMode">
- a_toolbar.AddButton( new ToolBarSeparator('sep1') );
-
- a_toolbar.AddButton(
- new ToolBarButton(
- 'new_item',
- '<inp2:m_phrase label="la_ToolTip_NewSystemSetting" escape="1"/>::<inp2:m_phrase label="la_ToolTip_Add" escape="1"/>',
- function() {
- std_precreate_item('conf', 'config/config_edit');
- }
- )
- );
- </inp2:m_if>
-
- <inp2:m_ModuleInclude template = "config/custom_toolbar"/>
-
- a_toolbar.Render();
- </script>
- </td>
- </tr>
- </tbody>
-</table>
-
-<inp2:m_include t="incs/config_blocks"/>
-
-<inp2:m_RenderElement name="config_updated_notice"/>
-<inp2:conf_SaveWarning name="grid_save_warning"/>
-
-<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bordered" id="config_table">
+<inp2:m_DefineElement name="extra_config_variables">
<!-- module root category selector: begin -->
<tr class="subsectiontitle">
<td colspan="2">
- <inp2:m_phrase name="la_Text_RootCategory" />
- </td>
- <td align="right">
- <a class="config-header" href="javascript:toggle_section('la_Text_RootCategory');" id="toggle_mark[la_Text_RootCategory]" title="Collapse/Expand Section">[-]</a>
- </td>
+ <inp2:m_phrase name="la_Text_RootCategory" />
+ </td>
+ <td align="right">
+ <a class="config-header" href="javascript:toggle_section('la_Text_RootCategory');" id="toggle_mark[la_Text_RootCategory]" title="Collapse/Expand Section">[-]</a>
+ </td>
</tr>
- <tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>" header_label="la_Text_RootCategory">
+ <tr class="<inp2:m_odd_even odd='table-color1' even='table-color2'/>" header_label="la_Text_RootCategory">
<td>
<span class="text"><inp2:m_phrase name="la_prompt_RootCategory" /></span>
</td>
@@ -144,37 +28,6 @@
<td class="error"> </td>
</tr>
<!-- module root category selector: end -->
+</inp2:m_DefineElement>
- <inp2:conf_PrintList block="config_block" per_page="-1" full_block="config_block" half_block1="config_block1" half_block2="config_block2" value_render_as="cf_default_value"/>
-</table>
-
-<script type="text/javascript">
- <inp2:m_if check="m_Get" name="refresh_tree">
- getFrame('menu').location.reload();
- </inp2:m_if>
-
- <inp2:m_if check="m_Get" name="refresh_all">
- var $menu_frame = getFrame('menu');
-
- $menu_frame.parent.location.href = $menu_frame.parent.location.href;
- </inp2:m_if>
-
- Application.setHook(
- 'conf:*',
- function ($event) {
- $event.status = $event.Name == 'OnCancel' ? true : validate_password_fields();
- }
- );
-
- <inp2:m_if check="m_Get" name="first_error">
- $(document).ready(function () {
- var $error_cell = $('.field-<inp2:m_Get name="first_error" js_escape="1"/>.error');
-
- if ( $error_cell.length ) {
- $(window).scrollTop($error_cell.position().top - 15);
- }
- });
- </inp2:m_if>
-</script>
-
-<inp2:m_include t="incs/footer"/>
+<inp2:m_include template="config/config_universal" title_preset="config_list_general"/>
Index: core/admin_templates/config/config_universal.tpl
===================================================================
--- core/admin_templates/config/config_universal.tpl
+++ core/admin_templates/config/config_universal.tpl
@@ -1,8 +1,8 @@
+<inp2:m_DefaultParam title_preset="section_label"/>
<inp2:m_include t="incs/header"/>
-<inp2:conf_InitList per_page="-1"/>
<inp2:m_Get name="section" result_to_var="section"/>
-<inp2:m_RenderElement name="combined_header" prefix="conf" section="$section" title_preset="section_label" perm_event="conf:OnLoad"/>
+<inp2:m_RenderElement name="combined_header" prefix="conf" section="$section" title_preset="$title_preset" perm_event="conf:OnLoad"/>
<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
@@ -35,7 +35,7 @@
var password_error_cell = document.getElementById('error_' + $field_id);
if ( password_error_cell ) {
- $(window).scrollTop($(password_field).position().top - 15);
+ $('#scroll_container_container').scrollTop($(password_field).position().top - 15);
password_error_cell.innerHTML = '<inp2:m_Phrase name="la_error_PasswordMatch"/>';
}
@@ -117,6 +117,10 @@
<div id="scroll_container">
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bordered" id="config_table">
+ <inp2:m_if check="m_ElementDefined" name="extra_config_variables">
+ <inp2:m_RenderElement name="extra_config_variables" />
+ </inp2:m_if>
+
<inp2:conf_PrintList list_name="default" block="config_block" full_block="config_block" half_block1="config_block1" half_block2="config_block2" value_render_as="cf_default_value"/>
</table>
</div>
@@ -140,13 +144,16 @@
);
<inp2:m_if check="m_Get" name="first_error">
- $(document).ready(function () {
- var $error_cell = $('.field-<inp2:m_Get name="first_error" js_escape="1"/>.error');
-
- if ( $error_cell.length ) {
- $(window).scrollTop($error_cell.position().top - 15);
+ Application.setHook(
+ 'm:OnAfterFormInit',
+ function () {
+ var $error_cell = $('.field-<inp2:m_Get name="first_error" js_escape="1"/>.error');
+
+ if ( $error_cell.length ) {
+ $('#scroll_container_container').scrollTop($error_cell.position().top - 15);
+ }
}
- });
+ );
</inp2:m_if>
</script>
Event Timeline
Log In to Comment