Skip to content

Commit

Permalink
soem fixes for zero clipboard for mirror pubkey
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpaulbishop committed Sep 18, 2011
1 parent 9350844 commit f49b717
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 71 deletions.
140 changes: 72 additions & 68 deletions app/views/projects/settings/_repository.rhtml
Expand Up @@ -59,23 +59,7 @@
<% 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> -->

<% 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') %>
<%= 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">
ZeroClipboard.setMoviePath('<%= image_path('ZeroClipboard.swf', :plugin => 'redmine_git_hosting') %>');
setZeroClipboardInputSource("mirror_pubkey");
</script>
<% end %>

<div class="splitcontentright">
<div class="box tabular">
Expand Down Expand Up @@ -133,62 +117,82 @@

</div>
</div>
<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;
<% 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') %>
<%= 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 getWidth() {
var width = 60*document.viewport.getWidth()/100;
if (width<750) { width=750 };
return width;
}
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
document.getElementById("tab-repository").addEventListener("click", reset_zero_clipboard, false );

$$(".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;
$$(".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;
$$(".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;
$$(".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>
</script>
<% end %>
<% end %>
<% end %>
7 changes: 4 additions & 3 deletions assets/javascripts/zero_clipboard_setup.js
@@ -1,6 +1,7 @@
var zero_clipboard_source_input_control_id = "git_url_text";

document.observe("dom:loaded", function() {
function reset_zero_clipboard()
{
var clip_container = $('clipboard_container');
if (clip_container) {
clip_container.show();
Expand All @@ -14,11 +15,11 @@ document.observe("dom:loaded", function() {
clipboard.setText($(zero_clipboard_source_input_control_id).value);
});
}
});
}

function setZeroClipboardInputSource(id)
{
zero_clipboard_source_input_control_id = id;
}


document.observe("dom:loaded", function() { reset_zero_clipboard(); } )

0 comments on commit f49b717

Please sign in to comment.