rosa-build/app/views/wiki/_history.html.haml

42 lines
1.7 KiB
Plaintext

= form_tag compare_path(@project, @name), :name => "compare-versions", :id => "version-form" do
%table.wiki{:cellpadding => "0", :cellspacing => "0"}
- @versions.each do |v|
%tr.history
%td.td1
%span#niceCheckbox1.niceCheck-main{:onclick => "changeCheck(this)"}
/ = check_box_tag "versions[]", v.id, :html => {:class => 'history_cbx'}
%input{:type => 'checkbox', :id => 'versions_', :name => 'versions[]', :value => v.id, :class => 'history_cbx'}
%td.td2
- user = User.where(:email => v.author.email).first
.avatar
%a{:href => "#"}
= link_to user_path_by_user(user) do
%img.mini-gravatar{:src => gravatar_url(v.author.email), :alt => "avatar: #{v.author.name.encode_to_default}"}
%span.username= user.present? ? user.uname : v.author.name.encode_to_default
.name
.both
%td.td3
%span.wiki-gray= "#{l v.committed_date.to_date, :format => :long}:"
= v.message.encode_to_default
- if @name
= raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), :title => t("wiki.view_commit")}]"
- else
= "[#{v.id[0..6]}]"
:javascript
$('.niceCheck-main').click(function() {
var count = 0;
$('input.history_cbx').each(function(i,el) {
if ($(el).attr('checked')) {
count = count + 1;
}
});
if (count > 2) {
var cbx = $( $(this).find('input.history_cbx')[0] );
if ( cbx.attr('checked') ) {
$(this).css('background-position', '0pt 0px');
cbx.removeAttr('checked');
}
}
});