Merge "Refactoring of user profile block"
This commit is contained in:
47
dashboard/templates/_macros/user_profile.html
Normal file
47
dashboard/templates/_macros/user_profile.html
Normal file
@@ -0,0 +1,47 @@
|
||||
{% macro show_user_profile(user_id) -%}
|
||||
|
||||
<script type="text/javascript">
|
||||
function load_user_profile(extra_options) {
|
||||
$.ajax({
|
||||
url: make_uri("/api/1.0/users/{{ user_id }}", extra_options),
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$("#user_profile_template").tmpl(data["user"]).appendTo("#user_profile_container");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
var uri_options = {};
|
||||
load_user_profile(uri_options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script id="user_profile_template" type="text/x-jquery-tmpl">
|
||||
{% raw %}
|
||||
<div>
|
||||
<div style="float: left;"><img src="${gravatar}"></div>
|
||||
<div style="margin-left: 90px;">
|
||||
<h2>${user_name}</h2>
|
||||
<div>Company: {%html company_link %}
|
||||
[<span style="font-style: italic;"><a
|
||||
href="https://wiki.openstack.org/wiki/Stackalytics#Company_affiliation" style="color: grey" target="_blank">how to change↗</a></span>]
|
||||
</div>
|
||||
{%if launchpad_id != '' %}
|
||||
<div>Launchpad: <a href="https://launchpad.net/~${launchpad_id}">${launchpad_id}</a></div>
|
||||
{%/if%}
|
||||
{%if core != '' %}
|
||||
<div>Core in:
|
||||
{%each( index, value ) core %}
|
||||
${value[0]} (<small>${value[1]}</small>)
|
||||
{%/each%}
|
||||
</div>
|
||||
{%/if%}
|
||||
</div>
|
||||
</div>
|
||||
{% endraw %}
|
||||
</script>
|
||||
|
||||
<div id="user_profile_container" style="margin-bottom: 2em;"></div>
|
||||
|
||||
{%- endmacro %}
|
@@ -1,6 +1,7 @@
|
||||
{% extends "layout.html" %}
|
||||
{% import '_macros/activity_log.html' as activity_log %}
|
||||
{% import '_macros/contribution_summary.html' as contribution_summary %}
|
||||
{% import '_macros/user_profile.html' as user_profile %}
|
||||
|
||||
{% set show_company_breakdown = (not company) and (not user_id) %}
|
||||
{% set show_engineer_breakdown = (not user_id) %}
|
||||
@@ -53,37 +54,6 @@
|
||||
renderTableAndChart("/api/1.0/stats/modules", "module_container", "module_table", "module_chart", "module");
|
||||
{% endif %}
|
||||
|
||||
{% if show_user_profile %}
|
||||
$(document).ready(function () {
|
||||
$.ajax({
|
||||
url: make_uri("/api/1.0/users/{{ user_id }}"),
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$("#user_profile_template").tmpl(data["user"]).appendTo("#user_profile_container");
|
||||
}
|
||||
});
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
</script>
|
||||
|
||||
{# Templates #}
|
||||
<script id="user_profile_template" type="text/x-jquery-tmpl">
|
||||
{% raw %}
|
||||
<div>
|
||||
<div style="float: left;"><img src="${gravatar}"></div>
|
||||
<div style="margin-left: 90px;">
|
||||
<h2>${user_name}</h2>
|
||||
<div>Company: {%html company_link %}
|
||||
[<span style="font-style: italic;"><a
|
||||
href="https://wiki.openstack.org/wiki/Stackalytics#Company_affiliation" style="color: grey" target="_blank">how to change↗</a></span>]
|
||||
</div>
|
||||
{%if launchpad_id != '' %}
|
||||
<div>Launchpad: <a href="https://launchpad.net/~${launchpad_id}">${launchpad_id}</a></div>
|
||||
{%/if%}
|
||||
</div>
|
||||
</div>
|
||||
{% endraw %}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
@@ -175,7 +145,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% if show_user_profile %}
|
||||
<div id="user_profile_container" style="margin-bottom: 2em;"></div>
|
||||
{{ user_profile.show_user_profile(user_id=user_id) }}
|
||||
{% endif %}
|
||||
{% if show_user_activity %}
|
||||
{{ activity_log.show_activity_log(gravatar_size=32, show_all=False) }}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
{% extends "reports/base_report.html" %}
|
||||
{% import '_macros/activity_log.html' as activity_log %}
|
||||
{% import '_macros/contribution_summary.html' as contribution_summary %}
|
||||
{% import '_macros/user_profile.html' as user_profile %}
|
||||
|
||||
{% block title %}
|
||||
{{ user.user_name }} activity in OpenStack
|
||||
@@ -17,20 +18,7 @@
|
||||
{% block content %}
|
||||
<h1>{{ user.user_name }} activity report</h1>
|
||||
|
||||
<h2>Profile</h2>
|
||||
<ul>
|
||||
{% if user.launchpad_id %}
|
||||
<li>Launchpad: {{ user.launchpad_id }}</li>
|
||||
{% endif %}
|
||||
{% if user.core %}
|
||||
<li>Core in:
|
||||
{% for item in user.core %}
|
||||
{{ item[0] }} ({{ item[1] }})
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
{{ user_profile.show_user_profile(user_id=user.user_id) }}
|
||||
{{ contribution_summary.show_contribution_summary(user_id=user.user_id) }}
|
||||
|
||||
<div id="punch_card" style="width: 100%; height: 350px;"></div>
|
||||
|
Reference in New Issue
Block a user