Skip to content

Commit

Permalink
Add external repository URL and new repository button to repository v…
Browse files Browse the repository at this point in the history
…iew page.
  • Loading branch information
t-yuki committed Jul 30, 2013
1 parent 5964705 commit ca0c269
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/views/scm/_view_repositories_show_contextual.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="contextual" style="padding-left: 5px;">
<% repository_url = repository.root_url %>
<% begin %>
<% interface = Object.const_get("#{repository.scm_name}Creator") %>
<% rescue NameError %>
<% end %>
<% if (interface && (interface < SCMCreator) && interface.enabled? && interface.options['url'].present? && repository.created_with_scm) %>
<% name = interface.repository_name(repository.root_url) %>
<% repository_url = interface.external_url(name) if name %>
<% end %>
<% if repository_url %>
<%= javascript_tag(" $(document).ready(function() {
$('#repository_url').focus(function(){
var self = $(this);
setTimeout(function() { self.select(); }, 10);
});
});") %>
| <%= text_field_tag 'repository_url', repository_url, :size => 24, :read_only => true, :style => 'color: rgb(153, 153, 153); padding: 3px 5px 2px;' %>
<% end %>
<% if User.current.allowed_to?(:manage_repository, @project) %>
| <%= link_to l(:label_repository_new), new_project_repository_path(@project), :class => 'icon icon-add' %>
<% end %>
</div>
1 change: 1 addition & 0 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

require_dependency 'scm_config'
require_dependency 'scm_hook'
require_dependency 'scm_repository_hook'

require_dependency File.expand_path(File.join(File.dirname(__FILE__), 'app/models/repository_observer'))

Expand Down
3 changes: 3 additions & 0 deletions lib/scm_repository_hook.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ScmRepositoryHook < Redmine::Hook::ViewListener
render_on :view_repositories_show_contextual, :partial => 'scm/view_repositories_show_contextual'
end

0 comments on commit ca0c269

Please sign in to comment.