From 5ce404f517c9de6e4b7a1e2564b5c4857c14c8f2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 31 Mar 2020 21:38:56 -0400 Subject: [PATCH] Refactor user settings page - Fix header hierarchy - [frio] Fix panel display - Move checkbox sub-template calls to template --- mod/settings.php | 105 ++----- view/templates/settings/settings.tpl | 282 +++++++++--------- view/theme/frio/css/style.css | 6 + .../frio/templates/settings/settings.tpl | 277 ++++++++--------- 4 files changed, 289 insertions(+), 381 deletions(-) diff --git a/mod/settings.php b/mod/settings.php index 3832de1b1..c4e248293 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -823,44 +823,11 @@ function settings_content(App $a) ]); } + $net_pub_desc = ''; if (strlen(DI::config()->get('system', 'directory'))) { $net_pub_desc = ' ' . DI::l10n()->t('Your profile will also be published in the global friendica directories (e.g. %s).', DI::config()->get('system', 'directory'), DI::config()->get('system', 'directory')); - } else { - $net_pub_desc = ''; } - $profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['profile_in_netdirectory', DI::l10n()->t('Allow your profile to be searchable globally?'), $profile['net-publish'], DI::l10n()->t("Activate this setting if you want others to easily find and follow you. Your profile will be searchable on remote systems. This setting also determines whether Friendica will inform search engines that your profile should be indexed or not.") . $net_pub_desc] - ]); - - $hide_friends = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your profile?'), $profile['hide-friends'], DI::l10n()->t('A list of your contacts is displayed on your profile page. Activate this option to disable the display of your contact list.')], - ]); - - $hide_wall = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['hidewall', DI::l10n()->t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], DI::l10n()->t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.')], - ]); - - $unlisted = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['unlisted', DI::l10n()->t('Make public posts unlisted'), DI::pConfig()->get(local_user(), 'system', 'unlisted'), DI::l10n()->t('Your public posts will not appear on the community pages or in search results, nor be sent to relay servers. However they can still appear on public feeds on remote servers.')], - ]); - - $accessiblephotos = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['accessible-photos', DI::l10n()->t('Make all posted pictures accessible'), DI::pConfig()->get(local_user(), 'system', 'accessible-photos'), DI::l10n()->t("This option makes every posted picture accessible via the direct link. This is a workaround for the problem that most other networks can't handle permissions on pictures. Non public pictures still won't be visible for the public on your photo albums though.")], - ]); - - $blockwall = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['blockwall', DI::l10n()->t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), DI::l10n()->t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts')], - ]); - - $blocktags = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.')], - ]); - - $unkmail = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.')], - ]); - $tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl'); $prof_addr = Renderer::replaceMacros($tpl_addr,[ @@ -870,18 +837,6 @@ function settings_content(App $a) $stpl = Renderer::getMarkupTemplate('settings/settings.tpl'); - $expire_arr = [ - 'days' => ['expire', DI::l10n()->t("Automatically expire posts after this many days:"), $expire, DI::l10n()->t('If empty, posts will not expire. Expired posts will be deleted')], - 'label' => DI::l10n()->t('Expiration settings'), - 'items' => ['expire_items', DI::l10n()->t('Expire posts'), $expire_items, DI::l10n()->t('When activated, posts and comments will be expired.')], - 'notes' => ['expire_notes', DI::l10n()->t('Expire personal notes'), $expire_notes, DI::l10n()->t('When activated, the personal notes on your profile page will be expired.')], - 'starred' => ['expire_starred', DI::l10n()->t('Expire starred posts'), $expire_starred, DI::l10n()->t('Starring posts keeps them from being expired. That behaviour is overwritten by this setting.')], - 'photos' => ['expire_photos', DI::l10n()->t('Expire photos'), $expire_photos, DI::l10n()->t('When activated, photos will be expired.')], - 'network_only' => ['expire_network_only', DI::l10n()->t('Only expire posts by others'), $expire_network_only, DI::l10n()->t('When activated, your own posts never expire. Then the settings above are only valid for posts you received.')], - ]; - - $group_select = Group::displayGroupSelection(local_user(), $a->user['def_gid']); - // Private/public post links for the non-JS ACL form $private_post = 1; if (!empty($_REQUEST['public']) && !$_REQUEST['public']) { @@ -932,40 +887,32 @@ function settings_content(App $a) '$defloc' => ['defloc', DI::l10n()->t('Default Post Location:'), $defloc, ''], '$allowloc' => ['allow_location', DI::l10n()->t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''], + '$h_prv' => DI::l10n()->t('Security and Privacy Settings'), + '$visibility' => $profile['net-publish'], + '$maxreq' => ['maxreq', DI::l10n()->t('Maximum Friend Requests/Day:'), $maxreq , DI::l10n()->t("\x28to prevent spam abuse\x29")], + '$profile_in_dir' => $profile_in_dir, + '$profile_in_net_dir' => ['profile_in_netdirectory', DI::l10n()->t('Allow your profile to be searchable globally?'), $profile['net-publish'], DI::l10n()->t("Activate this setting if you want others to easily find and follow you. Your profile will be searchable on remote systems. This setting also determines whether Friendica will inform search engines that your profile should be indexed or not.") . $net_pub_desc], + '$hide_friends' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your profile?'), $profile['hide-friends'], DI::l10n()->t('A list of your contacts is displayed on your profile page. Activate this option to disable the display of your contact list.')], + '$hide_wall' => ['hidewall', DI::l10n()->t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], DI::l10n()->t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.')], + '$unlisted' => ['unlisted', DI::l10n()->t('Make public posts unlisted'), DI::pConfig()->get(local_user(), 'system', 'unlisted'), DI::l10n()->t('Your public posts will not appear on the community pages or in search results, nor be sent to relay servers. However they can still appear on public feeds on remote servers.')], + '$accessiblephotos' => ['accessible-photos', DI::l10n()->t('Make all posted pictures accessible'), DI::pConfig()->get(local_user(), 'system', 'accessible-photos'), DI::l10n()->t("This option makes every posted picture accessible via the direct link. This is a workaround for the problem that most other networks can't handle permissions on pictures. Non public pictures still won't be visible for the public on your photo albums though.")], + '$blockwall' => ['blockwall', DI::l10n()->t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), DI::l10n()->t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts')], // array('blockwall', DI::l10n()->t('Allow friends to post to your profile page:'), !$blockwall, ''), + '$blocktags' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.')], // array('blocktags', DI::l10n()->t('Allow friends to tag your posts:'), !$blocktags, ''), + '$unkmail' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.')], + '$cntunkmail' => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail , DI::l10n()->t("\x28to prevent spam abuse\x29")], + '$group_select' => Group::displayGroupSelection(local_user(), $a->user['def_gid']), + '$permissions' => DI::l10n()->t('Default Post Permissions'), + '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user), - '$h_prv' => DI::l10n()->t('Security and Privacy Settings'), - - '$maxreq' => ['maxreq', DI::l10n()->t('Maximum Friend Requests/Day:'), $maxreq , DI::l10n()->t("\x28to prevent spam abuse\x29")], - '$permissions' => DI::l10n()->t('Default Post Permissions'), - '$visibility' => $profile['net-publish'], - '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user), - '$blockwall'=> $blockwall, // array('blockwall', DI::l10n()->t('Allow friends to post to your profile page:'), !$blockwall, ''), - '$blocktags'=> $blocktags, // array('blocktags', DI::l10n()->t('Allow friends to tag your posts:'), !$blocktags, ''), - - // ACL permissions box - '$group_perms' => DI::l10n()->t('Show to Groups'), - '$contact_perms' => DI::l10n()->t('Show to Contacts'), - '$private' => DI::l10n()->t('Default Private Post'), - '$public' => DI::l10n()->t('Default Public Post'), - '$is_private' => $private_post, - '$return_path' => $query_str, - '$public_link' => $public_post_link, - '$settings_perms' => DI::l10n()->t('Default Permissions for New Posts'), - - '$group_select' => $group_select, - - - '$expire' => $expire_arr, - - '$profile_in_dir' => $profile_in_dir, - '$profile_in_net_dir' => $profile_in_net_dir, - '$hide_friends' => $hide_friends, - '$hide_wall' => $hide_wall, - '$unlisted' => $unlisted, - '$accessiblephotos' => $accessiblephotos, - '$unkmail' => $unkmail, - '$cntunkmail' => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail , DI::l10n()->t("\x28to prevent spam abuse\x29")], - + '$expire' => [ + 'label' => DI::l10n()->t('Expiration settings'), + 'days' => ['expire', DI::l10n()->t("Automatically expire posts after this many days:"), $expire, DI::l10n()->t('If empty, posts will not expire. Expired posts will be deleted')], + 'items' => ['expire_items', DI::l10n()->t('Expire posts'), $expire_items, DI::l10n()->t('When activated, posts and comments will be expired.')], + 'notes' => ['expire_notes', DI::l10n()->t('Expire personal notes'), $expire_notes, DI::l10n()->t('When activated, the personal notes on your profile page will be expired.')], + 'starred' => ['expire_starred', DI::l10n()->t('Expire starred posts'), $expire_starred, DI::l10n()->t('Starring posts keeps them from being expired. That behaviour is overwritten by this setting.')], + 'photos' => ['expire_photos', DI::l10n()->t('Expire photos'), $expire_photos, DI::l10n()->t('When activated, photos will be expired.')], + 'network_only' => ['expire_network_only', DI::l10n()->t('Only expire posts by others'), $expire_network_only, DI::l10n()->t('When activated, your own posts never expire. Then the settings above are only valid for posts you received.')], + ], '$h_not' => DI::l10n()->t('Notification Settings'), '$lbl_not' => DI::l10n()->t('Send a notification email when:'), diff --git a/view/templates/settings/settings.tpl b/view/templates/settings/settings.tpl index fe83ebf0c..bd0fa5f20 100644 --- a/view/templates/settings/settings.tpl +++ b/view/templates/settings/settings.tpl @@ -2,183 +2,173 @@ {{$nickname_block nofilter}} -
- + + -

{{$h_pass}}

-
-{{include file="field_password.tpl" field=$password1}} -{{include file="field_password.tpl" field=$password2}} -{{include file="field_password.tpl" field=$password3}} +

{{$h_pass}}

+
+ {{include file="field_password.tpl" field=$password1}} + {{include file="field_password.tpl" field=$password2}} + {{include file="field_password.tpl" field=$password3}} -{{if $oid_enable}} -{{include file="field_input.tpl" field=$openid}} -{{/if}} + {{if $oid_enable}} + {{include file="field_input.tpl" field=$openid}} + {{/if}} -
- -
-
+
+ +
+
-

{{$h_basic}}

-
+

{{$h_basic}}

+
-{{include file="field_input.tpl" field=$username}} -{{include file="field_input.tpl" field=$email}} -{{include file="field_password.tpl" field=$password4}} -{{include file="field_custom.tpl" field=$timezone}} -{{include file="field_select.tpl" field=$language}} -{{include file="field_input.tpl" field=$defloc}} -{{include file="field_checkbox.tpl" field=$allowloc}} + {{include file="field_input.tpl" field=$username}} + {{include file="field_input.tpl" field=$email}} + {{include file="field_password.tpl" field=$password4}} + {{include file="field_custom.tpl" field=$timezone}} + {{include file="field_select.tpl" field=$language}} + {{include file="field_input.tpl" field=$defloc}} + {{include file="field_checkbox.tpl" field=$allowloc}} -
- -
-
+
+ +
+
+

{{$h_prv}}

+
-

{{$h_prv}}

-
+ - + {{include file="field_input.tpl" field=$maxreq}} -{{include file="field_input.tpl" field=$maxreq}} + {{$profile_in_dir nofilter}} -{{$profile_in_dir nofilter}} + {{include file="field_checkbox.tpl" field=$profile_in_net_dir}} + {{include file="field_checkbox.tpl" field=$hide_friends}} + {{include file="field_checkbox.tpl" field=$hide_wall}} + {{include file="field_checkbox.tpl" field=$unlisted}} + {{include file="field_checkbox.tpl" field=$accessiblephotos}} + {{include file="field_checkbox.tpl" field=$blockwall}} + {{include file="field_checkbox.tpl" field=$blocktags}} + {{include file="field_checkbox.tpl" field=$unkmail}} + {{include file="field_input.tpl" field=$cntunkmail}} -{{$profile_in_net_dir nofilter}} + {{$group_select nofilter}} -{{$hide_friends nofilter}} +

{{$permissions}}

-{{$hide_wall nofilter}} + {{$aclselect nofilter}} +
+ +
+
-{{$unlisted nofilter}} +

{{$expire.label}}

+
+
+ {{include file="field_input.tpl" field=$expire.days}} + {{include file="field_checkbox.tpl" field=$expire.items}} + {{include file="field_checkbox.tpl" field=$expire.notes}} + {{include file="field_checkbox.tpl" field=$expire.starred}} + {{include file="field_checkbox.tpl" field=$expire.network_only}} -{{$accessiblephotos nofilter}} +
+ +
+
+
-{{$blockwall nofilter}} +

{{$h_not}}

+
+
-{{$blocktags nofilter}} +
{{$lbl_not}}
-{{$unkmail nofilter}} +
+ {{include file="field_intcheckbox.tpl" field=$notify1}} + {{include file="field_intcheckbox.tpl" field=$notify2}} + {{include file="field_intcheckbox.tpl" field=$notify3}} + {{include file="field_intcheckbox.tpl" field=$notify4}} + {{include file="field_intcheckbox.tpl" field=$notify5}} + {{include file="field_intcheckbox.tpl" field=$notify6}} + {{include file="field_intcheckbox.tpl" field=$notify7}} + {{include file="field_intcheckbox.tpl" field=$notify8}} +
-{{include file="field_input.tpl" field=$cntunkmail}} + {{include file="field_checkbox.tpl" field=$email_textonly}} + {{include file="field_checkbox.tpl" field=$detailed_notif}} -{{$group_select nofilter}} + {{include file="field_checkbox.tpl" field=$desktop_notifications}} + -

{{$expire.label}}

-
-
-{{include file="field_input.tpl" field=$expire.days}} -{{include file="field_checkbox.tpl" field=$expire.items}} -{{include file="field_checkbox.tpl" field=$expire.notes}} -{{include file="field_checkbox.tpl" field=$expire.starred}} -{{include file="field_checkbox.tpl" field=$expire.network_only}} +
-
- -
-
-
+
+ +
+
-

{{$h_not}}

-
-
+

{{$h_advn}}

+
+
{{$h_descadvn}}
-
{{$lbl_not}}
+ {{$pagetype nofilter}} -
-{{include file="field_intcheckbox.tpl" field=$notify1}} -{{include file="field_intcheckbox.tpl" field=$notify2}} -{{include file="field_intcheckbox.tpl" field=$notify3}} -{{include file="field_intcheckbox.tpl" field=$notify4}} -{{include file="field_intcheckbox.tpl" field=$notify5}} -{{include file="field_intcheckbox.tpl" field=$notify6}} -{{include file="field_intcheckbox.tpl" field=$notify7}} -{{include file="field_intcheckbox.tpl" field=$notify8}} -
+
+ +
+
-{{include file="field_checkbox.tpl" field=$email_textonly}} -{{include file="field_checkbox.tpl" field=$detailed_notif}} +

{{$importcontact}}

+
+ +
{{$importcontact_text}}
+ -{{include file="field_checkbox.tpl" field=$desktop_notifications}} - - -
- -
- -
-
- -

{{$h_advn}}

-
-
{{$h_descadvn}}
- -{{$pagetype nofilter}} - -
- -
-
- -

{{$importcontact}}

-
- -
{{$importcontact_text}}
- - -
- -
-
- -

{{$relocate}}

-
-
{{$relocate_text}}
- -
- -
-
+
+ +
+
diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 5ace932ea..d0a4c39e4 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2904,6 +2904,12 @@ details.profile-jot-net[open] summary:before { font-size: 18px; } +.section-subtitle-wrapper > h2 { + font-size: 18px; + margin-top: 10px; + margin-bottom: 10px; +} + .fakelink > h3:before { padding-right: 10px; } diff --git a/view/theme/frio/templates/settings/settings.tpl b/view/theme/frio/templates/settings/settings.tpl index 40c1d85dd..626d3b4d0 100644 --- a/view/theme/frio/templates/settings/settings.tpl +++ b/view/theme/frio/templates/settings/settings.tpl @@ -1,54 +1,50 @@
- {{* include the title template for the settings title *}} - {{include file="section_title.tpl" title=$ptitle }} +

{{$ptitle}}

{{$nickname_block nofilter}} - + {{* We organize the settings in collapsable panel-groups *}}
{{* The password setting section *}}
-
-
+
{{include file="field_password.tpl" field=$password1}} {{include file="field_password.tpl" field=$password2}} {{include file="field_password.tpl" field=$password3}} - {{if $oid_enable}} + {{if $oid_enable}} {{include file="field_input.tpl" field=$openid}} {{include file="field_checkbox.tpl" field=$delete_openid}} - {{/if}} - -
- -
-
+ {{/if}} +
+
{{* The basic setting section *}}
-
-
- +
{{include file="field_input.tpl" field=$username}} {{include file="field_input.tpl" field=$email}} {{include file="field_password.tpl" field=$password4}} @@ -56,26 +52,24 @@ {{include file="field_select.tpl" field=$language}} {{include file="field_input.tpl" field=$defloc}} {{include file="field_checkbox.tpl" field=$allowloc}} - -
- -
-
+
+
{{* The privacity setting section *}}
-
-
+
@@ -83,212 +77,183 @@ {{$profile_in_dir nofilter}} - {{$profile_in_net_dir nofilter}} - - {{$hide_friends nofilter}} - - {{$hide_wall nofilter}} - - {{$unlisted nofilter}} - - {{$accessiblephotos nofilter}} - - {{$blockwall nofilter}} - - {{$blocktags nofilter}} - - {{$unkmail nofilter}} - + {{include file="field_checkbox.tpl" field=$profile_in_net_dir}} + {{include file="field_checkbox.tpl" field=$hide_friends}} + {{include file="field_checkbox.tpl" field=$hide_wall}} + {{include file="field_checkbox.tpl" field=$unlisted}} + {{include file="field_checkbox.tpl" field=$accessiblephotos}} + {{include file="field_checkbox.tpl" field=$blockwall}} + {{include file="field_checkbox.tpl" field=$blocktags}} + {{include file="field_checkbox.tpl" field=$unkmail}} {{include file="field_input.tpl" field=$cntunkmail}} {{$group_select nofilter}} -

{{$permissions}}

+

{{$permissions}}

{{$aclselect nofilter}} - -
- -
-
- +
+
-
-
- +
{{include file="field_input.tpl" field=$expire.days}} {{include file="field_checkbox.tpl" field=$expire.items}} {{include file="field_checkbox.tpl" field=$expire.notes}} {{include file="field_checkbox.tpl" field=$expire.starred}} {{include file="field_checkbox.tpl" field=$expire.network_only}} - -
- -
-
+
+
{{* The notification setting section *}}
-
-
-
+
-

{{$lbl_not}}

+
{{$lbl_not}}
-
- {{include file="field_intcheckbox.tpl" field=$notify1}} - {{include file="field_intcheckbox.tpl" field=$notify2}} - {{include file="field_intcheckbox.tpl" field=$notify3}} - {{include file="field_intcheckbox.tpl" field=$notify4}} - {{include file="field_intcheckbox.tpl" field=$notify5}} - {{include file="field_intcheckbox.tpl" field=$notify6}} - {{include file="field_intcheckbox.tpl" field=$notify7}} - {{include file="field_intcheckbox.tpl" field=$notify8}} -
- - {{include file="field_checkbox.tpl" field=$email_textonly}} - {{include file="field_checkbox.tpl" field=$detailed_notif}} - - {{* commented out because it was commented out in the original template -
- - {{$desktop_notifications_note}} -
- *}} - - {{include file="field_checkbox.tpl" field=$desktop_notifications}} - +
+ {{include file="field_intcheckbox.tpl" field=$notify1}} + {{include file="field_intcheckbox.tpl" field=$notify2}} + {{include file="field_intcheckbox.tpl" field=$notify3}} + {{include file="field_intcheckbox.tpl" field=$notify4}} + {{include file="field_intcheckbox.tpl" field=$notify5}} + {{include file="field_intcheckbox.tpl" field=$notify6}} + {{include file="field_intcheckbox.tpl" field=$notify7}} + {{include file="field_intcheckbox.tpl" field=$notify8}}
-
- + {{include file="field_checkbox.tpl" field=$email_textonly}} + {{include file="field_checkbox.tpl" field=$detailed_notif}} + + {{* commented out because it was commented out in the original template +
+ + {{$desktop_notifications_note}}
-
+ *}} + + {{include file="field_checkbox.tpl" field=$desktop_notifications}} + +
+
{{* The additional account setting section *}}
-
-
- +
{{$h_descadvn}}
{{$pagetype nofilter}} - -
- -
-
+
+
{{* Import contacts CSV *}}
-
-
- +
{{$importcontact_text}}
- -
-
- -
-
+
+
{{* The relocate setting section *}}
-
-
- +
{{$relocate_text}}
- -
-
- -
-
+
+