]> git.mxchange.org Git - friendica.git/blob - view/templates/settings_pagetypes.tpl
Merge pull request #3965 from tobiasd/20171126-docGettingStarted
[friendica.git] / view / templates / settings_pagetypes.tpl
1
2 <h4>{{$account_types}}</h4>
3 {{include file="field_radio.tpl" field=$account_person}}
4 <div id="account-type-sub-0" class="pageflags">
5         <h5>{{$user}}</h5>
6         {{include file="field_radio.tpl" field=$page_normal}}
7         {{include file="field_radio.tpl" field=$page_soapbox}}
8         {{include file="field_radio.tpl" field=$page_freelove}}
9 </div>
10
11 {{include file="field_radio.tpl" field=$account_organisation}}
12 {{include file="field_radio.tpl" field=$account_news}}
13
14 {{include file="field_radio.tpl" field=$account_community}}
15 <div id="account-type-sub-3" class="pageflags">
16         <h5>{{$community}}</h5>
17         {{include file="field_radio.tpl" field=$page_community}}
18         {{include file="field_radio.tpl" field=$page_prvgroup}}
19 </div>
20
21 <script language="javascript" type="text/javascript">
22         // This js part changes the state of page-flags radio buttons according
23         // to the selected account type. For a translation of the different
24         // account-types and page-flags have a look in the define section in boot.php
25         var accountType = {{$account_type}};
26
27         $(document).ready(function(){
28                 // Hide all DIV for page-flags expet the one which belongs to the present
29                 // account-type
30                 showPageFlags(accountType);
31
32                 // Save the ID of the active page-flage
33                 var activeFlag = $('[id^=id_page-flags_]:checked');
34
35                 $("[id^=id_account-type_]").change(function(){
36                         // Since the ID of the radio buttons containing the type of
37                         // the account-type we catch the last character of the ID to
38                         // know for what account-type the radio button stands for.
39                         var type = this.id.substr(this.id.length - 1);
40
41                         // Hide all DIV with page-flags and show only the one which belongs
42                         // to the selected radio button
43                         showPageFlags(type);
44
45                         // Uncheck all page-flags radio buttons
46                         $('input:radio[name="page-flags"]').prop("checked", false);
47
48                         // If the selected account type is the active one mark the page-flag
49                         // radio button as checked which is already by database state
50                         if (accountType == type) {
51                                 $(activeFlag).prop("checked", true);
52                         } else if (type == 1 || type == 2) {
53                                 // For account-type 1 or 2 the page-flags are always set to 1
54                                 $('#id_page-flags_1').prop("checked", true);
55                         } else {
56                                 // Mark the first available page-flags radio button of the selected
57                                 // account-type as checked
58                                 $('#account-type-sub-' + type + ' input:radio[name="page-flags"]').first().prop("checked", true);
59                         }
60                 });
61         });
62
63         // Show/Hide the page-flags according to the selected account-type
64         function showPageFlags(type) {
65                 $(".pageflags").hide();
66
67                 if (type == 0 || type == 3) {
68                         $("#account-type-sub-" + type).show();
69                 }
70         }
71 </script>