#37 Customize the user's page for pagure over dist-git
Merged 7 years ago by pingou. Opened 7 years ago by pingou.

@@ -0,0 +1,125 @@ 

+ {% extends "master.html" %}

+ 

+ {% block title %}User {{ user.html_title }}{% endblock %}

+ {% set tag = "users" %}

+ {% from "_browseheader.html" import browse_header %}

+ 

+ 

+ {% block header %}

+   <link href="{{ url_for('static', filename='vendor/selectize/selectize.bootstrap3.css') }}"

+   rel="stylesheet" />

+ {% endblock %}

+ 

+ 

+ {% from "_render_repo.html" import render_repos_as_card, render_activity_graph %}

+ 

+ 

+ {% block content %}

+ <div class="repo-header p-t-1">

+   <div class="container">

+     {{browse_header(select=tag)}}

+   </div>

+ </div>

+ <div class="p-t-2">

+   <div class="container">

+     <h2>

+         {{ user.default_email | avatar(36) | safe }} {{ username }}

+     </h2>

+     <p title="{{ user.created.strftime('%Y-%m-%d') }}">

+       Joined {{ user.created | humanize }} {% if config['FAS_URL']

+         %}(<a href="{{ config['FAS_URL'].rstrip('/') }}/user/view/{{ username }}">fas</a>){%

+         endif %}

+       <img src="https://apps.fedoraproject.org/calendar/api/{{ username }}/shield/vacation?connector=on&always=0" alt="" />

+     </p>

+     <div class="row">

+       <div class="col-md-8">

+         {{ render_activity_graph(username) }}

+         {{ render_repos_as_card(repos, repos_length, 'Projects', 'repopage', repopage, total_page_repos) }}

+         {{ render_repos_as_card(forks, forks_length, 'Forks', 'forkpage', forkpage, total_page_forks) }}

+       </div>

+       <div class="col-md-4">

+         <div class="card" id="group_list">

+             <div class="card-header">

+                 Groups <span class="label label-default">{{ user.groups | length }}</span>

+             </div>

+             {% for group in user.groups %}

+               <div class="list-group">

+                 <a class="list-group-item" href="{{ url_for(

+                     'view_group', group=group)}}">

+                   <div class=""><strong><span class="oi" data-glyph="people">

+                     </span> &nbsp;{{ group }}</strong>

+                   </div>

+                 </a>

+               </div>

+             {% else %}

+             <div class="card-block">

+               <p>No group found</p>

+             </div>

+             {% endfor %}

+         </div>

+       </div>

+     </div>

+   </div>

+ </div>

+ {% endblock %}

+ 

+ {% block jscripts %}

+     {{ super() }}

+     <script type="text/javascript">

+       $(function(){

+         $('.show_parts input[type="checkbox"]').change(function(){

+           $('#' + $(this).attr('name')).toggle();

+         });

+       });

+     </script>

+ <script src="{{ url_for('static', filename='vendor/selectize/selectize.min.js') }}" type="text/javascript"> </script>

+ <script type="text/javascript">

+ $(document).ready(function() {

+   $('#headerSearch').on('keypress keydown keyup', function(e) {

+     if (e.which == 13) {

+         e.preventDefault();

+         return false;

+     }

+   });

+   $('#term').selectize({

+     valueField: 'user',

+     labelField: 'user',

+     searchField: 'user',

+     onType: function(value) {

+       if (value == "") {

+         this.close();

+       }

+     },

+     onChange: function(value) {

+       if (value != "") {

+         $('#headerSearch').submit();

+       }

+     },

+     maxItems: 1,

+     create: false,

+     load: function(query, callback) {

+       if (!query.length) return callback();

+       $.getJSON(

+         "{{ url_for('api_ns.api_users') }}", {

+           pattern: query

+         },

+         function( data ) {

+           callback( data.users.map(function(x) { return { user: x }; }) );

+         }

+       );

+     },

+     render: {

+       option: function(item, escape) {

+         return '<div>' +

+           '<div class="projecticon-search pull-xs-left"><span class="oi" data-glyph="person"></span></div>' +

+           '<div class="title">' +

+             '<span class="name"><strong>' + escape(item.user) + '</strong></span>' +

+           '</div>' +

+           '<div class="description"><small>' + escape(item.user) + '</small></div>' +

+         '</div>';

+       }

+     },

+   });

+ });

+ </script>

+ {% endblock %}

no initial comment

Shouldn't it be group's name rather than SQLAlchemy object? (in url_for)

probably same thing which we did with fullname? i.e. show fullname and username in ().

why not to use <script ... /> instead of <script ...> </script>?

These are already the group names :)

Legacy habits, there used to be a difference (not sure if that's still the case)

No I indent on 2 spaces in the html/js parts :)

1 new commit added

  • Code style fixes
7 years ago

I think I addressed all the ones I agree with :)

Pull-Request has been merged by pingou

7 years ago
Metadata