[vhffs-dev] Modify Git Repository Description |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Hello,
following my request in the forum to modify git repository description
(https://forum.tuxfamily.org/topic/704/probleme-avec-git/), I've
investigated a way to add this feature.
I don't know if this is a popular request, but a diff is attached to
this message. It adds a description field in the git preference panel
and commit the modification in the git API. Similar code could be added
to the other source control type (svn, mercurial, bazaar, cvs).
The code is small and simple but I'm not a PERL developer, so feel free
to change my contribution :-)
Have a nice day,
François
diff --git a/vhffs-api/src/Vhffs/Panel/Git.pm b/vhffs-api/src/Vhffs/Panel/Git.pm
index 338bccf1..9b1e2476 100644
--- a/vhffs-api/src/Vhffs/Panel/Git.pm
+++ b/vhffs-api/src/Vhffs/Panel/Git.pm
@@ -211,6 +211,7 @@ sub save_prefs {
my $public = $cgi->param('public');
my $ml_name = $cgi->param('ml_name');
+ my $description = Encode::decode_utf8( scalar $cgi->param('description') );
unless( $user->can_modify($git) ) {
$panel->add_error( gettext('You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights') );
@@ -231,6 +232,14 @@ sub save_prefs {
$git->set_status(Vhffs::Constants::WAITING_FOR_MODIFICATION);
}
+ if(defined $description) {
+ $git->set_description($description);
+ $git->set_status(Vhffs::Constants::WAITING_FOR_MODIFICATION);
+ }
+ else {
+ $panel->add_error( gettext('You must enter a description') );
+ }
+
if($ml_name =~ /^\s*$/ or Vhffs::Functions::valid_mail($ml_name)) {
if($ml_name ne $git->get_ml_name) {
$git->set_ml_name($ml_name);
diff --git a/vhffs-panel/templates/scm/prefs.tt b/vhffs-panel/templates/scm/prefs.tt
index 79881d60..38de3a9f 100644
--- a/vhffs-panel/templates/scm/prefs.tt
+++ b/vhffs-panel/templates/scm/prefs.tt
@@ -7,6 +7,9 @@
<option value="0"[% ' selected="selected"' UNLESS repository.is_public %]>[% 'No' | i18n | html %]</option>
</select>
</p>
+ <p><label for="description" class="description">[% 'Repository description:' | i18n | html %]</label>
+ <textarea name="description" id="description" class="description" cols="45" rows="1">[% repository.get_description | html %]</textarea></p>
+
[% IF repository.supports_notifications %]
<h2>[% 'Options' | i18n | html %]</h2>
<p>