{% load cosinnus_tags %}


{% if object.attached_objects.exists and not hide_attached or not hide_attached == True %}
    {% cosinnus_render_attached_objects object %}
{% endif %}

{% comment %} TODO: hide this wrapper if ALL of the meta-attributes don't exist {% endcomment %}

{% with group_carry=group %}
	{% with mt=object.media_tag_object|tag_group_filtered:group_carry %}
		{% with persons=mt.persons.all tags=mt.tags.all location=mt.location topics=mt.topics approach=mt.approach visibility=mt.visibility %}
		    {% if persons or tags or location or topics or approach or visibility != 1 and not hide_visibility_tag %}
		
				<div class="{% if list_view %}btn btn-default w100 {% if not list_view == "noindent" %}indented{% endif %}{% else %}btn btn-default dashboard-appwidget-contentline-indented{% endif %}">
				    <ul class="media-list fine-space">
				        <li class="media">
				            <div class="media-body no-vertical-padding">
				
				                {% if persons %}
				                    <ol class="input-area">
				                        <li class="w100 font11px no-vertical-padding no-horizontal-padding">
					                        <i class="fa fa-fw fa-user"></i>
					                        {% for person in persons %}
					                            {% if not forloop.first %}, {% endif %}
					                            <a href="{{ person.cosinnus_profile.get_absolute_url }}">{{ person|full_name }}</a>
					                        {% endfor %}
				                        </li>
				                    </ol>
				                {% endif %}
				                
				                {% if tags %}
				                    <ol class="input-area">
				                        <li class="w100 font11px no-vertical-padding no-horizontal-padding">
				                            <i class="fa fa-fw fa-tags"></i>
					                        {% for tag in tags %}
					                            <a href="#">{{ tag }}</a>
					                        {% endfor %}
				                       </li>
				                    </ol>
				                {% endif %}
				  
				                {% if location and not hide_location %}
				                    <ol class="input-area">
				                        <li class="w100 font11px no-vertical-padding no-horizontal-padding">
					                        <i class="fa fa-fw fa-map-marker"></i>
					                        <a href="{{ mt.location_url }}" target="_blank">{{ location }}</a>
				                       </li>
				                    </ol>
				                {% endif %}
				
				                {% if topics %}
				                    <ol class="input-area">
				                        <li class="w100 font11px no-vertical-padding no-horizontal-padding">
					                        <i class="fa fa-fw fa-lightbulb-o"></i>
					                        {% render_cosinnus_topics topics %}
				                       </li>
				                    </ol>
				                {% endif %}
				                
				                {% comment %} Valid start is disabled for now         
								{% if mt.valid_start %}
									<ol class="input-area">
				                        <li class="w100 font11px no-vertical-padding no-horizontal-padding">
					                        <i class="fa fa-fw fa-clock-o"></i>
										    {{ mt.valid_start }}{% if mt.valid_end %} &ndash; {{ mt.valid_end }}{% endif %}
									   </li>
				                    </ol>
								{% endif %}
								{% endcomment %}
				                
				                {% comment %} Approach hidden for now
				                {% if approach %}
				                    <ol class="input-area">
				                        <li class="w100 font11px no-vertical-padding no-horizontal-padding">
					                        <i class="fa fa-fw fa-bolt"></i>
					                        {{ mt.get_approach_display }}
				                        </li>
				                    </ol>
				                {% endif %}
				                {% endcomment %}
				  
								{% comment %} Group visibiity is not shown per default {% endcomment %}
								{% if visibility != 1 and not hide_visibility_tag %}
									<ol class="input-area">
				                        <li class="w100 font11px no-vertical-padding no-horizontal-padding">
					                        <i class="fa fa-fw fa-globe"></i>
										    {{ mt.get_visibility_display }}
				                        </li>
				                    </ol>
								{% endif %}
				
				            </div>
				        </li>
				    </ul>
				</div><!-- btn -->
		    
		    {% endif %}
		{% endwith %}
	{% endwith %}
{% endwith %}

