1. Sebastian Sdorra
  2. scm-gravatar-plugin

Commits

Sebastian Sdorra  committed cd581ab

prepare for version 1.20

  • Participants
  • Parent commits f650c6d
  • Branches default

Comments (0)

Files changed (2)

File pom.xml

View file
   <parent>
     <artifactId>scm-plugins</artifactId>
     <groupId>sonia.scm.plugins</groupId>
-    <version>1.2</version>
+    <version>1.20-SNAPSHOT</version>
   </parent>
 
   <groupId>sonia.scm.plugins</groupId>

File src/main/resources/sonia/scm/gravatar/sonia.gravatar.js

View file
 Sonia.gravatar.Config = {
   size: 32,
   notFoundType: 'identicon',
-  template: '<img style="border-radius: 3px;" width="{1}" height="{1}" src="http://www.gravatar.com/avatar/{0}?s={1}&d={2}" alt="">',
-  secureTemplate: '<img style="border-radius: 3px;" width="{1}" height="{1}" src="https://secure.gravatar.com/avatar/{0}?s={1}&d={2}" alt="">'
+  template: '<img style="border-radius: 3px;{3}" width="{1}" height="{1}" src="http://www.gravatar.com/avatar/{0}?s={1}&d={2}" alt="">',
+  secureTemplate: '<img style="border-radius: 3px;{3}" width="{1}" height="{1}" src="https://secure.gravatar.com/avatar/{0}?s={1}&d={2}" alt="">'
 }
 
-Sonia.gravatar.render = function(properties){
+Sonia.gravatar.render = function(properties, size, style){
   var hash = '00000000000000000000000000000000';
   if ( properties != null ){
     for (var i=0; i<properties.length; i++){
   if ("https:" == document.location.protocol){
     template = Sonia.gravatar.Config.secureTemplate;
   }
+  
+  if (!style){
+    style = "";
+  }
 
   return String.format(
     template,
     hash,
-    Sonia.gravatar.Config.size,
-    Sonia.gravatar.Config.notFoundType
-  );
+    size,
+    Sonia.gravatar.Config.notFoundType,
+    style
+  );  
+}
+
+Sonia.gravatar.defaultRender = function(properties){
+  return Sonia.gravatar.render(properties, Sonia.gravatar.Config.size);
 }
 
 
       this.addColumn('properties', {
         id: 'gravatar',
         dataIndex: 'properties',
-        renderer: Sonia.gravatar.render,
+        renderer: Sonia.gravatar.defaultRender,
         scope: this,
         width: Sonia.gravatar.Config.size + 10
       }, 0);
 
 }
 
-// for scm-manager 1.12
-
 if (Sonia.repository.CommitPanel){
   
   Ext.override(Sonia.repository.CommitPanel, {
     
-    // TODO
-    templateCommit: '' + Sonia.repository.CommitPanel.prototype.templateCommit
+    update: function(changeset){
+      changeset.leftPlaceholder = Sonia.gravatar.render(changeset.properties, 64, "margin-right: 5px; margin-bottom: 2px;");
+      this.changeset = changeset;
+      this.commitPanel.tpl.overwrite(this.commitPanel.body, this.changeset);
+    }
     
   });