Skip to content

Commit 098275c

Browse files
author
root
committed
If repo is default, hide identifier input field
1 parent f957aae commit 098275c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Diff for: app/views/repositories/_git_form.html.erb

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
$(document).ready(function() {
44

5+
// Actually this takes the parent <p> mark
56
var default_checkbox = $('#repository_is_default').parent();
67

78
<% if @project.repository.nil? %>
8-
var content = $('<%= content_tag :p do -%>
9-
<%= hidden_field_tag "repository[is_default]", "0" -%>
10-
<%= content_tag :label, l(:field_repository_is_default) -%>
11-
<%= check_box_tag "repository[is_default]", @repository.is_default, @repository.is_default, disabled: [email protected]_record? -%>
12-
<% end -%>');
9+
// Hide identifier input field since is_default is checked
10+
$('#repository_identifier').parent().hide();
11+
12+
// Toggle identifier input field if is_default is unchecked
13+
$('#repository_is_default').on('click', function(){
14+
$('#repository_identifier').parent().toggle();
15+
});
1316

14-
content.insertAfter(default_checkbox);
15-
default_checkbox.remove();
1617
<% elsif @project.repository == @repository %>
1718
var content = $('<%= content_tag :p do -%>
1819
<%= hidden_field_tag "repository[is_default]", "1" -%>

0 commit comments

Comments
 (0)