Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
227 lines (198 sloc) 8.74 KB
<% content_for :header_tags do %>
<%= stylesheet_link_tag('zero_clipboard', :plugin => 'redmine_git_hosting') %>
<%= javascript_include_tag('ZeroClipboard', :plugin => 'redmine_git_hosting') %>
<%= javascript_include_tag('zero_clipboard_setup', :plugin => 'redmine_git_hosting') %>
<script type="text/javascript" >
function test_zc_vis()
{
var cc = document.getElementById('clipboard_container')
if(cc != null)
{
if (cc.style.fontFamily == 'sans-serif' )
{
reset_zero_clipboard();
}
}
}
document.observe("dom:loaded", function() {
ZeroClipboard.setMoviePath('<%= image_path('ZeroClipboard.swf', :plugin => 'redmine_git_hosting') %>');
setZeroClipboardInputSource("mirror_pubkey");
// tab visiblity javascript screws up zeroclipboard, need to reset when we change
// to repo tab where the clipboard is visible
// and, for good measure, just reset it every quarter second (handles visibility during repository creation, which is otherwise weird)
document.getElementById("tab-repository").addEventListener("click", reset_zero_clipboard, false );
setInterval(test_zc_vis, 500);
test_zc_vis();
});
</script>
<% end %>
<% remote_form_for :repository, @repository, :url => { :controller => 'repositories', :action => 'edit', :id => @project }, :builder => TabularFormBuilder,:lang => current_language do |f| %>
<%= error_messages_for 'repository' %>
<div class="splitcontentleft">
<div class="box tabular">
<% if @repository && @repository.is_a?(Repository::Git) && GitHostingHelper.can_view_mirrors(@repository.project) %>
<h3>Repository Options</h3>
<% end %>
<p><%= label_tag('repository_scm', l(:label_scm)) %><%= scm_select_tag(@repository) %></p>
<% if @repository && @repository.is_a?(Repository::Git) %>
<%
mirror_pubkey = GitHosting.mirror_push_public_key
extra_vals = { :git_daemon=>"1", :git_http=>"1", :notify_cia=>"0" }
extra_vals.each_key do |e|
begin
val = @repository.extra[e]
if !val.nil?
extra_vals[e] = val.to_s
end
rescue
end
end
%>
<p>
<%= label_tag "extra[git_daemon]", l(:field_git_daemon) %>
<%= select_tag "extra[git_daemon]", options_for_select([ [l(:label_disabled), "0"], [l(:label_enabled), "1"]], :selected=>extra_vals[:git_daemon]) %>
</p>
<p>
<%= label_tag "extra[git_http]", l(:field_git_http) %>
<%= select_tag "extra[git_http]", options_for_select([ [l(:label_disabled), "0"], [l(:label_https_only), "1"], [l(:label_https_and_http), "2"] ], :selected=>extra_vals[:git_http]) %>
</p>
<p>
<%= label_tag "extra[notify_cia]", l(:field_notify_cia) %>
<%= select_tag "extra[notify_cia]", options_for_select([ [l(:label_disabled), "0"], [l(:label_enabled), "1"]], :selected=>extra_vals[:notify_cia]) %>
<% if extra_vals[:notify_cia] == "1" %>
<a id="notify_cia_test" href="<%= url_for(:controller => "gitolite_hooks", :action => "test", :projectid => @repository.project.identifier) %>"><%= l(:field_notify_cia_test) %></a>
<em><b><span id="notify_cia_result"></span></b></em>
<% end %>
</p>
<%= javascript_include_tag('notify_cia_test', :plugin => 'redmine_git_hosting') %>
<br/>
<% else %>
<%= repository_field_tags(f, @repository) if @repository %>
<% end %>
</div>
<div class="contextual">
<% if @repository && !@repository.new_record? %>
<%= link_to(l(:label_user_plural), {:controller => 'repositories', :action => 'committers', :id => @project}, :class => 'icon icon-user') %>
<%= link_to(l(:button_delete), {:controller => 'repositories', :action => 'destroy', :id => @project}, :confirm => l(:text_are_you_sure),:method => :post,:class => 'icon icon-del') %>
<% end %>
</div>
<%= submit_tag((@repository.nil? || @repository.new_record?) ? l(:button_create) : l(:button_save), :disabled => @repository.nil?) %>
</div>
<% if @repository && @repository.is_a?(Repository::Git) && GitHostingHelper.can_view_mirrors(@repository.project) %>
<!-- <div id="mirror_top_spacer" style="display:block;height:25px;clear:both;"></div> -->
<div class="splitcontentright">
<div class="box tabular">
<h3>Repository Mirrors</h3>
<% if GitHostingHelper.can_create_mirrors(@repository.project) %>
<div style="left:0px;clear:left;margin: 4px 5px;width: 96%;">
<%= link_to("Add Repository Mirror", url_for(:controller => 'repository_mirrors', :action => 'create', :project_id => @repository.project.identifier), :class => 'icon icon-add add-mirror' ) %>
</div>
<% end %>
<% if @repository.project.repository_mirrors.any? %>
<div class="autoscroll">
<table class="list" style="margin: 4px 5px; width: 96%">
<thead>
<tr>
<th>URL</th>
<th>Active</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<% @repository.project.repository_mirrors.each do |mirror| %>
<tr class="<%= cycle('odd', 'even') %>">
<td class="name"><%= link_to(h(mirror.url), url_for(:controller => 'repository_mirrors', :action => 'edit', :project_id => @repository.project.identifier, :id => mirror.id), :class => 'edit-mirror') %></td>
<td class="center"><%= checked_image mirror.active? %></td>
<td class="buttons">
<% if GitHostingHelper.can_edit_mirrors(@repository.project) %>
<% if mirror.active==1 -%>
<%= link_to(l(:button_push), url_for(:controller => 'repository_mirrors', :action => 'push', :project_id => @repository.project.identifier, :id => mirror.id), :title => l(:button_push_title), :alt => l(:button_push_title), :class => 'icon icon-push push-mirror') %>
<% end %>
<%= link_to(l(:button_edit), url_for(:controller => 'repository_mirrors', :action => 'edit', :project_id => @repository.project.identifier, :id => mirror.id), :class => 'icon icon-edit edit-mirror') %>
<%= link_to(l(:button_delete), url_for(:controller => 'repository_mirrors', :action => 'destroy', :project_id => @repository.project.identifier, :id => mirror.id), :class => 'icon icon-del delete-mirror') %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% else %>
<p class="nodata" style="margin: 4px 5px; width: 96%; padding: 8px;">No Mirrors Defined</p>
<% end %>
<div style="margin: 15px 5px; width: 96%;">
<div id="clipboard_container" title="<%= l(:label_copy_to_clipboard) %>" style="font-family:sans-serif;" >
<div id="clipboard_button"><%= image_tag 'paste.png', :plugin => 'redmine_git_hosting' %></div>
</div>
<span style="margin-left:10px;" >Mirrors Must Grant Write Access To The Following Public Key:</span>
<br/>
<textarea cols="40" id="mirror_pubkey" readonly="readonly" rows="20" style="height:140px;width:96%"><%= mirror_pubkey %></textarea>
</div>
<div id="mirror_bottom_spacer" style="display:block;height:10px;clear:both;"></div>
</div>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag('application', :plugin => 'redmine_git_hosting') %>
<%= stylesheet_link_tag('modalbox/modalbox', :plugin => 'redmine_git_hosting') %>
<%= javascript_include_tag('modalbox/lib/builder', :plugin => 'redmine_git_hosting') %>
<%= javascript_include_tag('modalbox/modalbox', :plugin => 'redmine_git_hosting') %>
<script type="text/javascript">
function getWidth() {
var width = 60*document.viewport.getWidth()/100;
if (width<750) { width=750 };
return width;
}
document.observe("dom:loaded", function() {
$$(".add-mirror").each(function(elem) {
Event.observe(elem, 'click', function(event) {
Event.stop(event);
Modalbox.show(
elem.href, {
title: "<%=l(:label_mirror_create)%>",
width: getWidth()
}
)
return false;
})
})
$$(".edit-mirror").each(function(elem) {
Event.observe(elem, 'click', function(event) {
Event.stop(event);
Modalbox.show(
elem.href, {
title: "<%=l(:label_mirror_edit)%>",
width: getWidth()
}
)
return false;
})
})
$$(".delete-mirror").each(function(elem) {
Event.observe(elem, 'click', function(event) {
Event.stop(event);
Modalbox.show(
elem.href, {
title: "<%=l(:label_mirror_delete)%>",
width: getWidth()
}
)
return false;
})
})
$$(".push-mirror").each(function(elem) {
Event.observe(elem, 'click', function(event) {
Event.stop(event);
Modalbox.show(
elem.href, {
title: "<%=l(:button_push_title)%>",
width: getWidth()
}
)
return false;
})
})
})
</script>
<% end %>
<% end %>
<% end %>
Something went wrong with that request. Please try again.