Skip to content

Commit d0f6fde

Browse files
author
root
committed
Merge branch 'devel' into v1.0.x
2 parents f2a483d + a00558c commit d0f6fde

File tree

16 files changed

+60
-48
lines changed

16 files changed

+60
-48
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Thanks for their contribution to :
5050
* Nicholas Clark
5151
* Robert Chady
5252
* Sébastien Dinot
53+
* wilsoc5
5354
* and others :)
5455

5556
## Contribute

Diff for: app/controllers/repository_git_extras_controller.rb

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ class RepositoryGitExtrasController < RedmineGitHostingController
22
unloadable
33

44
skip_before_filter :set_current_tab
5-
before_filter :set_git_extra
65

76
helper :extend_repositories
87

98

109
def update
10+
@git_extra = @repository.extra
1111
## Update attributes
1212
if @git_extra.update_attributes(params[:repository_git_extra])
1313
flash.now[:notice] = l(:notice_gitolite_extra_updated)
@@ -17,12 +17,4 @@ def update
1717
end
1818
end
1919

20-
21-
private
22-
23-
24-
def set_git_extra
25-
@git_extra = @repository.extra
26-
end
27-
2820
end

Diff for: app/controllers/repository_protected_branches_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def clone
5252

5353
def sort
5454
params[:repository_protected_branche].each_with_index do |id, index|
55-
@repository.protected_branches.update_all({position: index + 1}, {id: id})
55+
@repository.protected_branches.where(:id => id).update_all({:position => index + 1})
5656
end
5757
# Update Gitolite repository
5858
call_use_case

Diff for: app/models/repository_protected_branche.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class RepositoryProtectedBranche < ActiveRecord::Base
1414

1515
## Validations
1616
validates :repository_id, presence: true
17-
validates :path, presence: true, uniqueness: { scope: :permissions }
17+
validates :path, presence: true, uniqueness: { scope: [:permissions, :repository_id] }
1818
validates :permissions, presence: true, inclusion: { in: VALID_PERMS }
1919
validates :user_list, presence: true
2020

Diff for: app/views/common/_git_urls.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
#git_url_box= l(:label_repository_access_not_configured)
2020

2121
:javascript
22-
$(document).ready(function() { setFirstGitUrl('.git_url_list'); bindGitUrls('.git_url'); });
22+
$(document).ready(function() { setGitUrls('.git_url'); });

Diff for: app/views/repositories/git_instructions.html.haml

+1-19
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,4 @@
5555
= render 'common/git_urls', repository: @repository
5656

5757
:javascript
58-
$(document).ready(function() {
59-
var key = $('.git_url_list li').first().attr('id');
60-
var access = access_list[key];
61-
62-
$('.git_url_access').html(access.url);
63-
64-
$('.git_url_list li').on('click', function(){
65-
var key = $(this).attr('id');
66-
var access = access_list[key];
67-
68-
$('.git_url_access').html(access.url);
69-
70-
if (access.committer == true) {
71-
$('#repository_setup').show();
72-
} else {
73-
$('#repository_setup').hide();
74-
}
75-
});
76-
});
58+
$(document).ready(function() { setGitUrlsInstructions('.git_url'); });

Diff for: app/views/repository_git_notifications/show.html.haml

+8-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
%div{ style: 'display:block;height:10px;clear:both;' }
2626

27-
%table{ class: 'list git_mailing_list' }
27+
%table{ class: 'table table-hover' }
2828
%thead
2929
%tr
3030
%th= l(:label_git_notification_default_list)
@@ -36,31 +36,34 @@
3636
%tr
3737
%td
3838
- if @repository.default_list.any?
39-
%ul
39+
%ul{ class: 'list-unstyled' }
4040
- @repository.default_list.each do |item|
4141
%li= item
4242

4343
%td
4444
- if !@git_notification.nil? && @git_notification.include_list.any?
45-
%ul
45+
%ul{ class: 'list-unstyled' }
4646
- @git_notification.include_list.sort.each do |item|
4747
%li= item
4848

4949
%td
5050
- if !@git_notification.nil? && @git_notification.exclude_list.any?
51-
%ul
51+
%ul{ class: 'list-unstyled' }
5252
- @git_notification.exclude_list.sort.each do |item|
5353
%li= item
5454

5555
%td
5656
- if @repository.mail_mapping.any?
57-
%ul
57+
%ul{ class: 'list-unstyled' }
5858
- @repository.mail_mapping.each do |item, from|
5959
%li
6060
= item
6161
(
6262
= from
6363
)
6464

65+
- if [email protected]_notification_enabled?
66+
%em= l(:git_notifications_reminder)
67+
6568
:javascript
6669
$(document).ready(function() { initModalBoxes(modals); });

Diff for: app/views/repository_protected_branches/index.html.haml

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77

88
- if @repository_protected_branches.any?
99

10-
%table{ class: 'table table-hover', id: 'protected_branches', data: { 'update-url' => sort_repository_protected_branches_url } }
10+
%table{ class: 'table table-hover',
11+
id: 'protected_branches',
12+
data: { 'update-url' => sort_repository_protected_branches_url },
13+
style: "opacity: #{@repository.protected_branches_enabled? ? '1' : '0.5'};" }
1114
%thead
1215
%tr
1316
%th
@@ -39,6 +42,9 @@
3942
= link_to l(:button_clone), clone_repository_protected_branch_path(@repository, protected_branch), class: 'icon icon-clone modal-box'
4043
= link_to l(:button_delete), repository_protected_branch_path(@repository, protected_branch), remote: true, method: :delete, confirm: l(:text_are_you_sure), class: 'icon icon-del'
4144

45+
- if [email protected]_branches_enabled?
46+
%em= l(:protected_branches_reminder)
47+
4248
- else
4349
%p{ class: 'nodata' }= l(:label_no_data)
4450

Diff for: assets/javascripts/application.js

+26-5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function trigger_mode_change(element) {
3737
}
3838
}
3939

40+
// GIT URLS
4041
function updateUrl(element) {
4142
var url = $(element).data('url');
4243
var target = $(element).data('target');
@@ -47,21 +48,41 @@ function updateUrl(element) {
4748
$(element).addClass('selected');
4849
}
4950

50-
function setFirstGitUrl(elements) {
51+
function setGitUrls(elements) {
5152
$(elements).each(function(index, element){
52-
var first_url = $(element).children().first();
53-
updateUrl(first_url);
53+
if (index == 0){
54+
updateUrl(element);
55+
};
56+
$(element).on('click', function(){
57+
updateUrl($(this));
58+
});
5459
});
5560
}
5661

57-
function bindGitUrls(elements) {
62+
// GIT INSTRUCTIONS
63+
function updateInstructionUrl(element) {
64+
var url = $(element).data('url');
65+
var committer = $(element).data('committer');
66+
$('.git_url_access').html(url);
67+
if (committer == 'RW') {
68+
$('#repository_setup').show();
69+
} else {
70+
$('#repository_setup').hide();
71+
}
72+
}
73+
74+
function setGitUrlsInstructions(elements) {
5875
$(elements).each(function(index, element){
76+
if (index == 0){
77+
updateInstructionUrl(element);
78+
};
5979
$(element).on('click', function(){
60-
updateUrl($(this));
80+
updateInstructionUrl($(this));
6181
});
6282
});
6383
}
6484

85+
// REPOSITORY EDIT
6586
function setRepositoryActiveTab(current_tab) {
6687
var all_tabs = $("#repository-tabs li");
6788
var active_tab = '';

Diff for: assets/stylesheets/application.css

-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ PLUGIN ICONS
99
.icon-git { padding-right: 15px; }
1010
.icon-git-disabled { opacity: 0.5; }
1111

12-
table.git_mailing_list { width: 100%; margin-top: 15px; }
13-
table.git_mailing_list th { width: 25%; }
14-
table.git_mailing_list td { text-align: center; }
15-
table.git_mailing_list td ul { padding-left: 0px; list-style-type: none; }
16-
17-
1812
/*
1913
PLUGIN SETTINGS
2014
*/

Diff for: config/locales/models/repository_git_notification/en.yml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ en:
2424
label_gitolite_notify_prefix: Mailing list prefix
2525
label_gitolite_notify_sender_address: Mailing list sender address
2626

27+
git_notifications_reminder: The mailing list above is not enabled. Please enable Mailing List in the repository settings above.
28+
2729
activerecord:
2830
errors:
2931
models:

Diff for: config/locales/models/repository_git_notification/fr.yml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ fr:
2424
label_gitolite_notify_prefix: Préfixe de la liste de diffusion
2525
label_gitolite_notify_sender_address: Adresse de l'expéditeur de la liste de diffusion
2626

27+
git_notifications_reminder: La liste de diffusion n'est pas activée. Pour l'activer veuillez d'abord cocher la case "Activer la liste de diffusion" dans les paramètres du dépôt ci-dessus.
28+
2729
activerecord:
2830
errors:
2931
models:

Diff for: config/locales/models/repository_protected_branche/en.yml

+2
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ en:
1717

1818
label_branch_path: Branch path
1919
label_user_list: Users allowed
20+
21+
protected_branches_reminder: The protected branches above are not enabled. Please enable Protected Branches in the repository settings above.

Diff for: config/locales/models/repository_protected_branche/fr.yml

+2
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ fr:
1717

1818
label_branch_path: Chemin de la branche
1919
label_user_list: Liste des utilisateurs autorisés
20+
21+
protected_branches_reminder: Les branches protégées ci-dessus ne sont pas actives. Pour les activer veuillez d'abord cocher la case "Activer les branches protégées" dans les paramètres du dépôt ci-dessus.

Diff for: spec/models/repository_git_extra_spec.rb

+3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
it { should allow_mass_assignment_of(:git_http) }
1414
it { should allow_mass_assignment_of(:git_daemon) }
1515
it { should allow_mass_assignment_of(:git_notify) }
16+
it { should allow_mass_assignment_of(:git_annex) }
1617
it { should allow_mass_assignment_of(:default_branch) }
1718
it { should allow_mass_assignment_of(:protected_branch) }
19+
it { should allow_mass_assignment_of(:public_repo) }
20+
it { should allow_mass_assignment_of(:key) }
1821

1922
## Relations
2023
it { should belong_to(:repository) }

Diff for: spec/models/repository_protected_branche_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def build_protected_branch(opts = {})
3131
it { should validate_presence_of(:permissions) }
3232
it { should validate_presence_of(:user_list) }
3333

34+
it { should validate_uniqueness_of(:path).scoped_to([:permissions, :repository_id]) }
35+
3436
it { should validate_inclusion_of(:permissions).in_array(%w(RW RW+)) }
3537

3638
## Serializations

0 commit comments

Comments
 (0)