|
1 | | -<% resource_limit = UsersHelper.user_profile_resource_limit %> |
2 | 1 | <div class="wrapper collapsing-wrapper-tb"> |
3 | 2 | <%- model_class = Profile -%> |
4 | 3 |
|
|
128 | 127 |
|
129 | 128 | <%= render(partial: 'users/partials/ban', locals: { ban: @user.ban }) if @user.banned? && current_user.try(:is_admin?) %> |
130 | 129 |
|
131 | | - <div class="my-3"> |
132 | | - <% materials = @user.materials.in_current_space.limit(resource_limit) %> |
133 | | - <% materials_count = @user.materials.in_current_space.count %> |
134 | | - <% upcoming_events = @user.events.in_current_space.not_finished %> |
135 | | - <% past_events = @user.events.in_current_space.finished %> |
136 | | - <% events = upcoming_events.limit(resource_limit) %> |
137 | | - <% e = @user.events.in_current_space.from_verified_users.not_disabled %> |
138 | | - <% events_count = e.count %> |
139 | | - <% not_finished_events_count = e.not_finished.count %> |
140 | | - <% workflows = @user.workflows.in_current_space.visible_by(current_user).limit(resource_limit) %> |
141 | | - <% workflows_count = @user.workflows.in_current_space.visible_by(current_user).count %> |
142 | | - <% collections = @user.collections.in_current_space.visible_by(current_user).limit(resource_limit) %> |
143 | | - <% collections_count = @user.collections.in_current_space.visible_by(current_user).count %> |
144 | | - <% activator = tab_activator %> |
145 | | - |
146 | | - <ul class="nav nav-tabs"> |
147 | | - <!-- Tab: Events --> |
148 | | - <% if feature_enabled?('events') %> |
149 | | - <%= tab('Events', icon_class_for_model('events'), 'events', activator: activator, |
150 | | - disabled: { check: events_count.zero?, message: 'No associated events' }, |
151 | | - count: not_finished_events_count.zero? && events_count.positive? ? '0*' : not_finished_events_count) %> |
152 | | - <% end %> |
153 | | - |
154 | | - <!-- Tab: Materials --> |
155 | | - <% if feature_enabled?('materials') %> |
156 | | - <%= tab('Materials', icon_class_for_model('materials'), 'materials', activator: activator, |
157 | | - disabled: { check: materials.none?, message: 'No registered training materials' }, |
158 | | - count: materials_count) %> |
159 | | - <% end %> |
160 | | - |
161 | | - <!-- Tab: Collections --> |
162 | | - <% if feature_enabled?('collections') %> |
163 | | - <%= tab('Collections', icon_class_for_model('collections'), 'collections', activator: activator, |
164 | | - disabled: { check: collections.none?, message: 'No registered collections' }, |
165 | | - count: collections_count) %> |
166 | | - <% end %> |
167 | | - |
168 | | - <!-- Tab: Workflows --> |
169 | | - <% if feature_enabled?('workflows') %> |
170 | | - <%= tab('Workflows', icon_class_for_model('workflows'), 'workflows', activator: activator, |
171 | | - disabled: { check: workflows.none?, message: 'No workflows' }, |
172 | | - count: workflows_count) %> |
173 | | - <% end %> |
174 | | - </ul> |
175 | | - |
176 | | - <div class="tab-content"> |
177 | | - <!-- Tab: Events --> |
178 | | - <% if feature_enabled?('events') %> |
179 | | - <%= render partial: 'common/associated_events', |
180 | | - locals: { total_count: upcoming_events.count, |
181 | | - past_count: past_events.count, |
182 | | - limit: resource_limit, |
183 | | - resources: events, |
184 | | - activator: activator, |
185 | | - view_all_link: events_path(user: @user.username), |
186 | | - inc_expired_link: events_path(user: @user.username, include_expired: true) } %> |
187 | | - <% end %> |
188 | | - |
189 | | - <!-- Tab: Materials --> |
190 | | - <% if feature_enabled?('materials') %> |
191 | | - <%= render partial: 'common/associated_resources', |
192 | | - locals: { model: Material, |
193 | | - total_count: materials_count, |
194 | | - limit: resource_limit, |
195 | | - resources: materials, |
196 | | - activator: activator, |
197 | | - view_all_link: materials_path(user: @user.username) } %> |
198 | | - <% end %> |
199 | | - |
200 | | - <!-- Tab: Collections --> |
201 | | - <% if feature_enabled?('collections') %> |
202 | | - <%= render partial: 'common/associated_resources', |
203 | | - locals: { model: Collection, |
204 | | - total_count: collections_count, |
205 | | - limit: resource_limit, |
206 | | - resources: collections, |
207 | | - activator: activator, |
208 | | - view_all_link: collections_path(user: @user.username) } %> |
209 | | - <% end %> |
210 | | - |
211 | | - <!-- Tab: Workflows --> |
212 | | - <% if feature_enabled?('workflows') %> |
213 | | - <%= render partial: 'common/associated_resources', |
214 | | - locals: { model: Workflow, |
215 | | - total_count: workflows_count, |
216 | | - limit: resource_limit, |
217 | | - resources: workflows, |
218 | | - activator: activator, |
219 | | - view_all_link: workflows_path(user: @user.username) } %> |
220 | | - <% end %> |
221 | | - </div> <!-- end tab-content --> |
222 | | - </div> |
| 130 | + <!-- Registrations list: Events, Materials, Collections, Workflows --> |
| 131 | + <%= render(partial: 'common/registrations_list', locals: { user: @user }) %> |
223 | 132 | </div> |
224 | 133 | </div> |
0 commit comments