PluginProbe
Friends / 4.3.2
Friends v4.3.2
4.3.2 4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 All 88 releases
friends / templates / admin / news.php

news.php in Friends 4.3.2, at templates/admin/news.php

192 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This template renders the Friends News page with a sidebar TOC.
4 *
5 * @package Friends
6 */
7
8 namespace Friends;
9
10 $entries = $args['entries'];
11 $active_index = 0;
12
13 ?>
14 <div class="friends-news">
15 <nav class="friends-news-toc">
16 <?php
17 foreach ( $entries as $index => $entry ) :
18 $classes = 'friends-news-toc-item';
19 if ( $index === $active_index ) {
20 $classes .= ' is-active';
21 }
22 ?>
23 <a href="#" class="<?php echo esc_attr( $classes ); ?>" data-index="<?php echo esc_attr( $index ); ?>">
24 <?php echo esc_html( $entry['title'] ); ?>
25 </a>
26 <?php endforeach; ?>
27 </nav>
28
29 <?php
30 foreach ( $entries as $index => $entry ) :
31 $is_welcome = '0' === $entry['version'];
32
33 $entry_args = array();
34 if ( ! empty( $entry['migration_version'] ) ) {
35 $entry_args = Admin::get_migration_data( $entry['migration_version'] );
36 }
37 $entry_args['version'] = $entry['version'];
38 if ( $is_welcome ) {
39 $entry_args['installed_plugins'] = get_plugins();
40 $entry_args['plugin-list'] = true;
41 }
42 ?>
43 <div class="friends-news-content" data-index="<?php echo esc_attr( $index ); ?>" <?php echo $index !== $active_index ? 'style="display:none"' : ''; ?>>
44 <?php Friends::template_loader()->get_template_part( $entry['template'], null, $entry_args ); ?>
45 </div>
46 <?php endforeach; ?>
47 </div>
48
49 <script>
50 jQuery(document).ready(function($) {
51 $('.friends-news-toc-item').on('click', function(e) {
52 e.preventDefault();
53 var index = $(this).data('index');
54 $('.friends-news-toc-item').removeClass('is-active');
55 $(this).addClass('is-active');
56 $('.friends-news-content').hide();
57 $('.friends-news-content[data-index="' + index + '"]').show();
58 });
59 });
60 </script>
61
62 <style>
63 .friends-news {
64 position: relative;
65 }
66 .friends-news-toc {
67 position: fixed;
68 width: 200px;
69 margin-left: -220px;
70 display: flex;
71 flex-direction: column;
72 gap: 2px;
73 }
74 .friends-news-toc-item {
75 display: block;
76 padding: 6px 10px;
77 font-size: 12px;
78 color: #50575e;
79 text-decoration: none;
80 border-radius: 3px;
81 line-height: 1.4;
82 text-wrap: balance;
83 }
84 .friends-news-toc-item:hover {
85 color: #1d2327;
86 background: #f0f0f1;
87 }
88 .friends-news-toc-item.is-active {
89 color: #2271b1;
90 }
91 /* News entry content styles */
92 .friends-news-changes {
93 display: grid;
94 grid-template-columns: 1fr 1fr;
95 gap: 16px;
96 margin-bottom: 24px;
97 }
98 .friends-news-change {
99 background: #fff;
100 border: 1px solid #c3c4c7;
101 border-radius: 4px;
102 padding: 16px;
103 }
104 .friends-news-changes > h3 {
105 grid-column: 1 / -1;
106 margin: 8px 0 0;
107 padding-bottom: 4px;
108 border-bottom: 1px solid #c3c4c7;
109 }
110 .friends-news-changes > h3:first-child {
111 margin-top: 0;
112 }
113 .friends-news-change h4 {
114 margin-top: 0;
115 font-size: 1.3em;
116 }
117 .friends-news-change p {
118 margin-bottom: 0;
119 }
120 .friends-news-status-complete,
121 .friends-news-status-progress {
122 margin: 16px 0;
123 padding: 12px 16px;
124 border-radius: 4px;
125 }
126 .friends-news-status-complete {
127 background: #d4edda;
128 color: #155724;
129 }
130 .friends-news-status-progress {
131 background: #fff3cd;
132 color: #856404;
133 }
134 .friends-news-status-complete .dashicons,
135 .friends-news-status-progress .dashicons {
136 vertical-align: text-bottom;
137 margin-right: 4px;
138 }
139 .friends-news-content .status-badge {
140 display: inline-block;
141 padding: 3px 8px;
142 border-radius: 3px;
143 font-size: 12px;
144 font-weight: 600;
145 }
146 .friends-news-content .status-completed {
147 background: #d4edda;
148 color: #155724;
149 }
150 .friends-news-content .status-pending {
151 background: #fff3cd;
152 color: #856404;
153 }
154 .friends-news-content .status-in-progress {
155 background: #cce5ff;
156 color: #004085;
157 }
158 .friends-news-content .status-no-tracking {
159 background: #e2e3e5;
160 color: #383d41;
161 }
162 .friends-news-content .progress-bar {
163 width: 100%;
164 height: 8px;
165 background: #e0e0e0;
166 border-radius: 4px;
167 margin-top: 5px;
168 overflow: hidden;
169 }
170 .friends-news-content .progress-bar-fill {
171 height: 100%;
172 background: #0073aa;
173 transition: width 0.3s ease;
174 }
175 @media screen and (max-width: 1460px) {
176 .friends-news-toc {
177 position: static;
178 width: auto;
179 margin-left: 0;
180 flex-direction: row;
181 flex-wrap: wrap;
182 margin-bottom: 16px;
183 gap: 4px;
184 }
185 }
186 @media screen and (max-width: 782px) {
187 .friends-news-changes {
188 grid-template-columns: 1fr;
189 }
190 }
191 </style>
192