changeset 6399:782db8fc95ea

templates: replace various invalid attributes with data attributes
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 06 Jan 2017 01:43:50 +0100
parents 97b8db701355
children 437545429441
files kallithea/templates/admin/auth/auth_settings.html kallithea/templates/base/perms_summary.html kallithea/templates/changelog/changelog.html kallithea/templates/changeset/diff_block.html kallithea/templates/compare/compare_cs.html kallithea/templates/pullrequests/pullrequest_show.html
diffstat 6 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/admin/auth/auth_settings.html	Fri Jan 06 01:43:50 2017 +0100
+++ b/kallithea/templates/admin/auth/auth_settings.html	Fri Jan 06 01:43:50 2017 +0100
@@ -40,7 +40,7 @@
                 <ul class="list-group">
                 %for plugin_path in c.available_plugins:
                     <li class="list-group-item">
-                        <span plugin_id="${plugin_path}" class="toggle-plugin btn btn-default btn-xs ${'active' if plugin_path in c.enabled_plugins else ''}">
+                        <span data-plugin_id="${plugin_path}" class="toggle-plugin btn btn-default btn-xs ${'active' if plugin_path in c.enabled_plugins else ''}">
                             ${_('Enabled') if plugin_path in c.enabled_plugins else _('Disabled')}
                         </span>
                         ${plugin_path}
@@ -120,7 +120,7 @@
         }
         var elems = $auth_plugins_input.val().split(',').filter(notEmpty);
         var $cur_button = $(e.currentTarget);
-        var plugin_id = $cur_button.attr('plugin_id');
+        var plugin_id = $cur_button.data('plugin_id');
 
         if($cur_button.hasClass('active')){
             elems.splice(elems.indexOf(plugin_id), 1);
--- a/kallithea/templates/base/perms_summary.html	Fri Jan 06 01:43:50 2017 +0100
+++ b/kallithea/templates/base/perms_summary.html	Fri Jan 06 01:43:50 2017 +0100
@@ -11,10 +11,10 @@
             %if section != 'global':
               <div style="float: right">
                 ${_('Show')}:
-                <label>${h.checkbox('perms_filter_none_%s' % section, 'none', 'checked', class_='perm_filter filter_%s' % section, section=section, perm_type='none')}<span class="perm_tag none">${_('None')}</span></label>
-                <label>${h.checkbox('perms_filter_read_%s' % section, 'read', 'checked', class_='perm_filter filter_%s' % section, section=section, perm_type='read')}<span class="perm_tag read">${_('Read')}</span></label>
-                <label>${h.checkbox('perms_filter_write_%s' % section, 'write', 'checked', class_='perm_filter filter_%s' % section, section=section, perm_type='write')}<span class="perm_tag write">${_('Write')}</span></label>
-                <label>${h.checkbox('perms_filter_admin_%s' % section, 'admin', 'checked', class_='perm_filter filter_%s' % section, section=section, perm_type='admin')}<span class="perm_tag admin">${_('Admin')}</span></label>
+                <label>${h.checkbox('perms_filter_none_%s' % section, 'none', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'none'})}<span class="perm_tag none">${_('None')}</span></label>
+                <label>${h.checkbox('perms_filter_read_%s' % section, 'read', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'read'})}<span class="perm_tag read">${_('Read')}</span></label>
+                <label>${h.checkbox('perms_filter_write_%s' % section, 'write', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'write'})}<span class="perm_tag write">${_('Write')}</span></label>
+                <label>${h.checkbox('perms_filter_admin_%s' % section, 'admin', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'admin'})}<span class="perm_tag admin">${_('Admin')}</span></label>
               </div>
             %endif
         </div>
@@ -109,10 +109,10 @@
             }
         }
         var update_show = function($checkbox){
-            var section = $checkbox.attr('section');
+            var section = $checkbox.data('section');
 
             var elems = $('.filter_' + section).each(function(el){
-                var perm_type = $checkbox.attr('perm_type');
+                var perm_type = $checkbox.data('perm_type');
                 var checked = $checkbox.prop('checked');
                 if(checked){
                     $('.'+section+'_'+perm_type).show();
--- a/kallithea/templates/changelog/changelog.html	Fri Jan 06 01:43:50 2017 +0100
+++ b/kallithea/templates/changelog/changelog.html	Fri Jan 06 01:43:50 2017 +0100
@@ -111,7 +111,7 @@
                         <td class="date">
                             <div class="date" data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div>
                         </td>
-                        <td class="expand_commit" commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
+                        <td class="expand_commit" data-commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
                             <i class="icon-align-left" style="color:#999"></i>
                         </td>
                         <td class="mid">
@@ -298,7 +298,7 @@
                 });
 
                 $('.expand_commit').on('click',function(e){
-                    var cid = $(this).attr('commit_id');
+                    var cid = $(this).data('commit_id');
                     $('#C-'+cid).toggleClass('expanded');
 
                     //redraw the graph, r and jsdata are bound outside function
--- a/kallithea/templates/changeset/diff_block.html	Fri Jan 06 01:43:50 2017 +0100
+++ b/kallithea/templates/changeset/diff_block.html	Fri Jan 06 01:43:50 2017 +0100
@@ -4,7 +4,7 @@
                        cs_repo_name, cs_ref_name, cs_ref_type, cs_rev,
                        file_diff_data)">
 <div class="diff-collapse">
-    <span target="${'diff-container-%s' % (id(file_diff_data))}" class="diff-collapse-button">&uarr; ${_('Collapse Diff')} &uarr;</span>
+    <span data-target="${'diff-container-%s' % (id(file_diff_data))}" class="diff-collapse-button">&uarr; ${_('Collapse Diff')} &uarr;</span>
 </div>
 <div class="diff-container" id="${'diff-container-%s' % (id(file_diff_data))}">
 %for id_fid, url_fid, op, a_filename, cs_filename, diff, stats in file_diff_data:
@@ -73,7 +73,7 @@
                 <span style="float:right;margin-top:-3px">
                     <label>
                         ${_('Show inline comments')}
-                        ${h.checkbox('',checked="checked",class_="show-inline-comments",id_for=url_fid)}
+                        ${h.checkbox('checkbox-show-inline-' + id_fid, checked="checked",class_="show-inline-comments",**{'data-id_for':id_fid})}
                     </label>
                 </span>
             </div>
@@ -126,7 +126,7 @@
 
     $('.diff-collapse-button').click(function(e) {
         var $button = $(e.currentTarget);
-        var $target = $('#' + $button.attr('target'));
+        var $target = $('#' + $button.data('target'));
         if($target.hasClass('hidden')){
             $target.removeClass('hidden');
             $button.html("&uarr; {0} &uarr;".format(_TM['Collapse Diff']));
@@ -141,7 +141,7 @@
         if(target == null){
             target = this;
         }
-        var boxid = $(target).attr('id_for');
+        var boxid = $(target).data('id_for');
         if(target.checked){
             $('#{0} .inline-comments'.format(boxid)).show();
         }else{
--- a/kallithea/templates/compare/compare_cs.html	Fri Jan 06 01:43:50 2017 +0100
+++ b/kallithea/templates/compare/compare_cs.html	Fri Jan 06 01:43:50 2017 +0100
@@ -75,7 +75,7 @@
         <span class="branchtag">${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.cs_repo.repo_name,branch=cs.branch))}</span>
         %endif
         </td>
-        <td class="expand_commit" commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
+        <td class="expand_commit" data-commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
             <i class="icon-align-left" style="color:#999"></i>
         </td>
         <td>
@@ -136,13 +136,13 @@
 %endif
 
         $('.expand_commit').click(function(e){
-            var cid = $(this).attr('commit_id');
+            var cid = $(this).data('commit_id');
             $('#C-'+cid).toggleClass('expanded');
             r.render(jsdata);
         });
 
         $('.gravatar').click(function(e){
-            var cid = $(this).attr('commit_id');
+            var cid = $(this).data('commit_id');
             $('#row-'+cid).toggleClass('hl', !$('#row-'+cid).hasClass('hl'));
         });
     });
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jan 06 01:43:50 2017 +0100
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jan 06 01:43:50 2017 +0100
@@ -261,12 +261,12 @@
             %for u in [c.pull_request.other_repo.owner]:
               <li>
                 <a class="missing_reviewer missing_reviewer_${u.user_id}"
-                  user_id="${u.user_id}"
-                  fname="${u.name}"
-                  lname="${u.lastname}"
-                  nname="${u.username}"
-                  gravatar_lnk="${h.gravatar_url(u.email, size=28, default='default')}"
-                  gravatar_size="14"
+                  data-user_id="${u.user_id}"
+                  data-fname="${u.name}"
+                  data-lname="${u.lastname}"
+                  data-nname="${u.username}"
+                  data-gravatar_lnk="${h.gravatar_url(u.email, size=28, default='default')}"
+                  data-gravatar_size="14"
                   title="Click to add reviewer to the list, then Save Changes.">${u.full_name}</a>
               </li>
             %endfor
@@ -396,7 +396,7 @@
 
           $('.missing_reviewer').click(function(){
             var $this = $(this);
-            addReviewMember($this.attr('user_id'), $this.attr('fname'), $this.attr('lname'), $this.attr('nname'), $this.attr('gravatar_lnk'), $this.attr('gravatar_size'));
+            addReviewMember($this.data('user_id'), $this.data('fname'), $this.data('lname'), $this.data('nname'), $this.data('gravatar_lnk'), $this.data('gravatar_size'));
           });
       });
     </script>