commitdiff.tpl 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {*
  2. * commitdiff.tpl
  3. * gitphp: A PHP git repository browser
  4. * Component: Commitdiff view template
  5. *
  6. * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  7. *}
  8. {extends file='projectbase.tpl'}
  9. {block name=javascript}
  10. require.deps = ['commitdiff'];
  11. {if file_exists('js/commitdiff.min.js')}
  12. require.paths.commitdiff = "commitdiff.min";
  13. {/if}
  14. {/block}
  15. {block name=main}
  16. {* Nav *}
  17. <div class="page_nav">
  18. {if $commit}
  19. {assign var=tree value=$commit->GetTree()}
  20. {/if}
  21. {include file='nav.tpl' current='commitdiff' logcommit=$commit treecommit=$commit}
  22. <br />
  23. {if $sidebyside}
  24. <a href="{geturl project=$project action=commitdiff hash=$commit hashparent=$hashparent diffmode=unified}">{t}unified{/t}</a>
  25. {else}
  26. <a href="{geturl project=$project action=commitdiff hash=$commit hashparent=$hashparent diffmode=sidebyside}">{t}side by side{/t}</a>
  27. {/if}
  28. | <a href="{geturl project=$project action=commitdiff hash=$commit hashparent=$hashparent output=plain}">{t}plain{/t}</a>
  29. </div>
  30. {include file='title.tpl' titlecommit=$commit}
  31. <div class="page_body">
  32. {assign var=bugpattern value=$project->GetBugPattern()}
  33. {assign var=bugurl value=$project->GetBugUrl()}
  34. {foreach from=$commit->GetComment() item=line}
  35. {if strncasecmp(trim($line),'Signed-off-by:',14) == 0}
  36. <span class="signedOffBy">{$line|htmlspecialchars|buglink:$bugpattern:$bugurl}</span>
  37. {else}
  38. {$line|htmlspecialchars|buglink:$bugpattern:$bugurl}
  39. {/if}
  40. <br />
  41. {/foreach}
  42. <br />
  43. {if $sidebyside && ($treediff->Count() > 1)}
  44. <div class="commitDiffSBS">
  45. <div class="SBSTOC">
  46. <ul>
  47. <li class="listcount">
  48. {t count=$treediff->Count() 1=$treediff->Count() plural="%1 files changed:"}%1 file changed:{/t} <a href="#" class="showAll">{t}(show all){/t}</a></li>
  49. {foreach from=$treediff item=filediff}
  50. <li>
  51. <a href="#{$filediff->GetFromHash()}_{$filediff->GetToHash()}" class="SBSTOCItem">
  52. {if $filediff->GetStatus() == 'A'}
  53. {if $filediff->GetToFile()}{$filediff->GetToFile()}{else}{$filediff->GetToHash()}{/if} {t}(new){/t}
  54. {elseif $filediff->GetStatus() == 'D'}
  55. {if $filediff->GetFromFile()}{$filediff->GetFromFile()}{else}{$filediff->GetToFile()}{/if} {t}(deleted){/t}
  56. {elseif $filediff->GetStatus() == 'M'}
  57. {if $filediff->GetFromFile()}
  58. {assign var=fromfilename value=$filediff->GetFromFile()}
  59. {else}
  60. {assign var=fromfilename value=$filediff->GetFromHash()}
  61. {/if}
  62. {if $filediff->GetToFile()}
  63. {assign var=tofilename value=$filediff->GetToFile()}
  64. {else}
  65. {assign var=tofilename value=$filediff->GetToHash()}
  66. {/if}
  67. {$fromfilename}{if $fromfilename != $tofilename} -&gt; {$tofilename}{/if}
  68. {/if}
  69. </a>
  70. </li>
  71. {/foreach}
  72. </ul>
  73. </div>
  74. <div class="SBSContent">
  75. {/if}
  76. {* Diff each file changed *}
  77. {foreach from=$treediff item=filediff}
  78. <div class="diffBlob" id="{$filediff->GetFromHash()}_{$filediff->GetToHash()}">
  79. <div class="diff_info">
  80. {if ($filediff->GetStatus() == 'D') || ($filediff->GetStatus() == 'M')}
  81. {localfiletype type=$filediff->GetFromFileType()}:<a href="{geturl project=$project action=blob hash=$filediff->GetFromBlob() hashbase=$commit file=$filediff->GetFromFile()}">{if $filediff->GetFromFile()}a/{$filediff->GetFromFile()}{else}{$filediff->GetFromHash()}{/if}</a>
  82. {if $filediff->GetStatus() == 'D'}
  83. {t}(deleted){/t}
  84. {/if}
  85. {/if}
  86. {if $filediff->GetStatus() == 'M'}
  87. -&gt;
  88. {/if}
  89. {if ($filediff->GetStatus() == 'A') || ($filediff->GetStatus() == 'M')}
  90. {localfiletype type=$filediff->GetToFileType()}:<a href="{geturl project=$project action=blob hash=$filediff->GetToBlob() hashbase=$commit file=$filediff->GetToFile()}">{if $filediff->GetToFile()}b/{$filediff->GetToFile()}{else}{$filediff->GetToHash()}{/if}</a>
  91. {if $filediff->GetStatus() == 'A'}
  92. {t}(new){/t}
  93. {/if}
  94. {/if}
  95. </div>
  96. {if $filediff->IsBinary()}
  97. <pre>
  98. {t 1=$filediff->GetFromLabel() 2=$filediff->GetToLabel()}Binary files %1 and %2 differ{/t}
  99. </pre>
  100. {else}
  101. {if $sidebyside}
  102. {include file='filediffsidebyside.tpl' diffsplit=$filediff->GetDiffSplit()}
  103. {else}
  104. {include file='filediff.tpl' diff=$filediff->GetDiff('', true, true)}
  105. {/if}
  106. {/if}
  107. </div>
  108. {/foreach}
  109. {if $sidebyside && ($treediff->Count() > 1)}
  110. </div>
  111. <div class="SBSFooter"></div>
  112. </div>
  113. {/if}
  114. </div>
  115. {/block}