summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/gitblit/Constants.java4
-rw-r--r--src/com/gitblit/GitBlit.java10
-rw-r--r--src/com/gitblit/models/RepositoryModel.java2
-rw-r--r--src/com/gitblit/wicket/GitBlitWebApp.properties4
-rw-r--r--src/com/gitblit/wicket/pages/EditRepositoryPage.html6
-rw-r--r--src/com/gitblit/wicket/pages/EditRepositoryPage.java22
-rw-r--r--tests/com/gitblit/tests/RepositoryModelTest.java34
7 files changed, 41 insertions, 41 deletions
diff --git a/src/com/gitblit/Constants.java b/src/com/gitblit/Constants.java
index c84b95f1..80e77993 100644
--- a/src/com/gitblit/Constants.java
+++ b/src/com/gitblit/Constants.java
@@ -72,9 +72,9 @@ public class Constants {
public static final String DEFAULT_BRANCH = "default";
- public static String CUSTOM_DEFINED_PROP_SECTION = "gitblit";
+ public static String CUSTOM_FIELDS_PROP_SECTION = "gitblit";
- public static String CUSTOM_DEFINED_PROP_SUBSECTION = "customDefinedProperties";
+ public static String CUSTOM_FIELDS_PROP_SUBSECTION = "customFields";
public static String getGitBlitVersion() {
return NAME + " v" + VERSION;
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index 8ba080af..f4a5ccc0 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -859,9 +859,9 @@ public class GitBlit implements ServletContextListener {
"gitblit", null, "indexBranch")));
// Custom defined properties
- model.customDefinedProperties = new HashMap<String, String>();
- for (String aProperty : config.getNames(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION)) {
- model.customDefinedProperties.put(aProperty, config.getString(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION, aProperty));
+ model.customFields = new HashMap<String, String>();
+ for (String aProperty : config.getNames(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION)) {
+ model.customFields.put(aProperty, config.getString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, aProperty));
}
}
model.HEAD = JGitUtils.getHEADRef(r);
@@ -1111,8 +1111,8 @@ public class GitBlit implements ServletContextListener {
updateList(config, "indexBranch", repository.indexedBranches);
// User Defined Properties
- for (Entry<String, String> singleProperty : repository.customDefinedProperties.entrySet()) {
- config.setString(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION, singleProperty.getKey(), singleProperty.getValue());
+ for (Entry<String, String> singleProperty : repository.customFields.entrySet()) {
+ config.setString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, singleProperty.getKey(), singleProperty.getValue());
}
try {
diff --git a/src/com/gitblit/models/RepositoryModel.java b/src/com/gitblit/models/RepositoryModel.java
index 92fc2373..0e0c2df1 100644
--- a/src/com/gitblit/models/RepositoryModel.java
+++ b/src/com/gitblit/models/RepositoryModel.java
@@ -64,7 +64,7 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel
public List<String> preReceiveScripts;
public List<String> postReceiveScripts;
public List<String> mailingLists;
- public Map<String, String> customDefinedProperties;
+ public Map<String, String> customFields;
private String displayName;
public RepositoryModel() {
diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties
index b96a32ed..dfbdd4bf 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.properties
+++ b/src/com/gitblit/wicket/GitBlitWebApp.properties
@@ -202,8 +202,8 @@ gb.mailingLists = mailing lists
gb.preReceiveScripts = pre-receive scripts
gb.postReceiveScripts = post-receive scripts
gb.hookScripts = hook scripts
-gb.customDefinedProperties = custom defined properties
-gb.customDefinedPropertiesDescription = custom properties available to groovy hooks
+gb.customFields = custom fields
+gb.customFieldsDescription = custom fields available to groovy hooks
gb.accessPermissions = access permissions
gb.filters = filters
gb.generalDescription = common settings
diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.html b/src/com/gitblit/wicket/pages/EditRepositoryPage.html
index e144f382..07c55226 100644
--- a/src/com/gitblit/wicket/pages/EditRepositoryPage.html
+++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.html
@@ -36,9 +36,9 @@
<tr><td colspan="2"><h3><wicket:message key="gb.hookScripts"></wicket:message> &nbsp;<small><wicket:message key="gb.hookScriptsDescription"></wicket:message></small></h3></td></tr>
<tr><th style="vertical-align: top;"><wicket:message key="gb.preReceiveScripts"></wicket:message><p></p><span wicket:id="inheritedPreReceive"></span></th><td style="padding:2px;"><span wicket:id="preReceiveScripts"></span></td></tr>
<tr><th style="vertical-align: top;"><wicket:message key="gb.postReceiveScripts"></wicket:message><p></p><span wicket:id="inheritedPostReceive"></span></th><td style="padding:2px;"><span wicket:id="postReceiveScripts"></span></td></tr>
- <div wicket:id="customDefinedPropertiesSection">
- <tr><td colspan="2"><h3><wicket:message key="gb.customDefinedProperties"></wicket:message> &nbsp;<small><wicket:message key="gb.customDefinedPropertiesDescription"></wicket:message></small></h3></td></tr>
- <tr wicket:id="customDefinedProperties"><th style="vertical-align: top;"><span wicket:id="customLabel"></span></th><td class="edit"><input class="span8" type="text" wicket:id="customValue" size="30" tabindex="16" /></td></tr>
+ <div wicket:id="customFiledsSection">
+ <tr><td colspan="2"><h3><wicket:message key="gb.customFields"></wicket:message> &nbsp;<small><wicket:message key="gb.customFieldsDescription"></wicket:message></small></h3></td></tr>
+ <tr wicket:id="customFieldsListView"><th style="vertical-align: top;"><span wicket:id="customFieldLabel"></span></th><td class="edit"><input class="span8" type="text" wicket:id="customFieldValue" size="30" tabindex="16" /></td></tr>
</div>
<tr><td colspan='2'><div class="form-actions"><input class="btn btn-primary" type="submit" value="Save" wicket:message="value:gb.save" wicket:id="save" tabindex="17" /> &nbsp; <input class="btn" type="submit" value="Cancel" wicket:message="value:gb.cancel" wicket:id="cancel" tabindex="18" /></div></td></tr>
</tbody>
diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
index 13b9e5a6..f3e2c386 100644
--- a/src/com/gitblit/wicket/pages/EditRepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -165,17 +165,17 @@ public class EditRepositoryPage extends RootSubPage {
definedProperties.add(new AbstractMap.SimpleEntry<String, String>(customFieldProperty[0], customFieldProperty[1]));
}
- final ListView<Entry<String, String>> customDefinedProperties = new ListView<Entry<String, String>>("customDefinedProperties", definedProperties) {
+ final ListView<Entry<String, String>> customFieldsListView = new ListView<Entry<String, String>>("customFieldsListView", definedProperties) {
@Override
protected void populateItem(ListItem<Entry<String, String>> item) {
- String value = repositoryModel.customDefinedProperties.get(item.getModelObject().getKey());
+ String value = repositoryModel.customFields.get(item.getModelObject().getKey());
item.add(new Label(item.getModelObject().getKey(), item.getModelObject().getValue())); // Used to get the key later
- item.add(new Label("customLabel", item.getModelObject().getValue()));
- item.add(new TextField<String>("customValue", new Model<String>(value)));
+ item.add(new Label("customFieldLabel", item.getModelObject().getValue()));
+ item.add(new TextField<String>("customFieldValue", new Model<String>(value)));
}
};
- customDefinedProperties.setReuseItems(true);
+ customFieldsListView.setReuseItems(true);
CompoundPropertyModel<RepositoryModel> model = new CompoundPropertyModel<RepositoryModel>(
repositoryModel);
@@ -278,12 +278,12 @@ public class EditRepositoryPage extends RootSubPage {
repositoryModel.postReceiveScripts = postReceiveScripts;
// Loop over each of the user defined properties
- for (int i = 0; i < customDefinedProperties.size(); i++) {
- ListItem<ListItemModel<String>> item = (ListItem<ListItemModel<String>>) customDefinedProperties.get(i);
+ for (int i = 0; i < customFieldsListView.size(); i++) {
+ ListItem<ListItemModel<String>> item = (ListItem<ListItemModel<String>>) customFieldsListView.get(i);
String key = item.get(0).getId(); // Item 0 is our 'fake' label
String value = ((TextField<String>)item.get(2)).getValue(); // Item 2 is out text box
- repositoryModel.customDefinedProperties.put(key, value);
+ repositoryModel.customFields.put(key, value);
}
// save the repository
@@ -371,13 +371,13 @@ public class EditRepositoryPage extends RootSubPage {
form.add(new BulletListPanel("inheritedPostReceive", "inherited", GitBlit.self()
.getPostReceiveScriptsInherited(repositoryModel)));
- WebMarkupContainer customDefinedPropertiesSection = new WebMarkupContainer("customDefinedPropertiesSection") {
+ WebMarkupContainer customFiledsSection = new WebMarkupContainer("customFiledsSection") {
public boolean isVisible() {
return GitBlit.getString(Keys.repository.customFields, "").isEmpty() == false;
};
};
- customDefinedPropertiesSection.add(customDefinedProperties);
- form.add(customDefinedPropertiesSection);
+ customFiledsSection.add(customFieldsListView);
+ form.add(customFiledsSection);
form.add(new Button("save"));
Button cancel = new Button("cancel") {
diff --git a/tests/com/gitblit/tests/RepositoryModelTest.java b/tests/com/gitblit/tests/RepositoryModelTest.java
index 611ed295..3596c333 100644
--- a/tests/com/gitblit/tests/RepositoryModelTest.java
+++ b/tests/com/gitblit/tests/RepositoryModelTest.java
@@ -25,11 +25,11 @@ public class RepositoryModelTest {
public static void startGitBlit() throws Exception {
wasStarted = GitBlitSuite.startGitblit() == false;
- oldSection = Constants.CUSTOM_DEFINED_PROP_SECTION;
- oldSubSection = Constants.CUSTOM_DEFINED_PROP_SUBSECTION;
+ oldSection = Constants.CUSTOM_FIELDS_PROP_SECTION;
+ oldSubSection = Constants.CUSTOM_FIELDS_PROP_SUBSECTION;
- Constants.CUSTOM_DEFINED_PROP_SECTION = "RepositoryModelTest";
- Constants.CUSTOM_DEFINED_PROP_SUBSECTION = "RepositoryModelTestSubSection";
+ Constants.CUSTOM_FIELDS_PROP_SECTION = "RepositoryModelTest";
+ Constants.CUSTOM_FIELDS_PROP_SUBSECTION = "RepositoryModelTestSubSection";
}
@AfterClass
@@ -37,8 +37,8 @@ public class RepositoryModelTest {
if (wasStarted == false)
GitBlitSuite.stopGitblit();
- Constants.CUSTOM_DEFINED_PROP_SECTION = oldSection;
- Constants.CUSTOM_DEFINED_PROP_SUBSECTION = oldSubSection;
+ Constants.CUSTOM_FIELDS_PROP_SECTION = oldSection;
+ Constants.CUSTOM_FIELDS_PROP_SUBSECTION = oldSubSection;
}
@Before
@@ -46,9 +46,9 @@ public class RepositoryModelTest {
Repository r = GitBlitSuite.getHelloworldRepository();
StoredConfig config = JGitUtils.readConfig(r);
- config.unsetSection(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION);
- config.setString(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION, "commitMessageRegEx", "\\d");
- config.setString(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION, "anotherProperty", "Hello");
+ config.unsetSection(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION);
+ config.setString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, "commitMessageRegEx", "\\d");
+ config.setString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, "anotherProperty", "Hello");
config.save();
}
@@ -58,7 +58,7 @@ public class RepositoryModelTest {
Repository r = GitBlitSuite.getHelloworldRepository();
StoredConfig config = JGitUtils.readConfig(r);
- config.unsetSection(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION);
+ config.unsetSection(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION);
config.save();
}
@@ -67,8 +67,8 @@ public class RepositoryModelTest {
RepositoryModel model = GitBlit.self().getRepositoryModel(
GitBlitSuite.getHelloworldRepository().getDirectory().getName());
- assertEquals("\\d", model.customDefinedProperties.get("commitMessageRegEx"));
- assertEquals("Hello", model.customDefinedProperties.get("anotherProperty"));
+ assertEquals("\\d", model.customFields.get("commitMessageRegEx"));
+ assertEquals("Hello", model.customFields.get("anotherProperty"));
}
@Test
@@ -76,17 +76,17 @@ public class RepositoryModelTest {
RepositoryModel model = GitBlit.self().getRepositoryModel(
GitBlitSuite.getHelloworldRepository().getDirectory().getName());
- assertEquals("\\d", model.customDefinedProperties.get("commitMessageRegEx"));
- assertEquals("Hello", model.customDefinedProperties.get("anotherProperty"));
+ assertEquals("\\d", model.customFields.get("commitMessageRegEx"));
+ assertEquals("Hello", model.customFields.get("anotherProperty"));
- assertEquals("Hello", model.customDefinedProperties.put("anotherProperty", "GoodBye"));
+ assertEquals("Hello", model.customFields.put("anotherProperty", "GoodBye"));
GitBlit.self().updateRepositoryModel(model.name, model, false);
model = GitBlit.self().getRepositoryModel(
GitBlitSuite.getHelloworldRepository().getDirectory().getName());
- assertEquals("\\d", model.customDefinedProperties.get("commitMessageRegEx"));
- assertEquals("GoodBye", model.customDefinedProperties.get("anotherProperty"));
+ assertEquals("\\d", model.customFields.get("commitMessageRegEx"));
+ assertEquals("GoodBye", model.customFields.get("anotherProperty"));
}
}