Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouglas Lovell <doug@wbreeze.com>2017-03-12 18:22:00 +0300
committerAlfredo Sumaran <alfredo@gitlab.com>2017-04-09 16:43:49 +0300
commitd0beb755f9ee8a744be087b22d51e8fe9ea98586 (patch)
tree6dd0a4644560490e0ecbc7adcf1f08724cebd043 /app
parent3d1cade13f61115b63bf6dbda5a1f194ba54b24b (diff)
Add a name field to the group edit form
Enables user specification of group name vs. name inferred from group path. Cause new group form to copy name from path Adds some new page-specific javascript that copies entry from the group path field to the group name field when the group name field is initially empty. Remove duplicate group name entry field on group edit form This corrects the duplicated name entry field and tests that the JavaScript does not update the group name field if the user edits the group path. (Editing the group path is not recommended in any case, but it is possible.) Address eslint errors in group.js Enable group name copy with dispatch and explore group creation The dispatch and explore group creation forms require the group.js asset, and their tests now require testing against poltergeist Update workflow new group instruction Update the gitlab basics group creation document Add a change log entry Remove unused variable for eslint
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/dispatcher.js6
-rw-r--r--app/assets/javascripts/group.js21
-rw-r--r--app/views/shared/_group_form.html.haml18
3 files changed, 36 insertions, 9 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index 4e68f9c77e9..f277e1dddc7 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -37,6 +37,7 @@
import Issue from './issue';
import BindInOut from './behaviors/bind_in_out';
+import Group from './group';
import GroupName from './group_name';
import GroupsList from './groups_list';
import ProjectsList from './projects_list';
@@ -271,8 +272,9 @@ const ShortcutsBlob = require('./shortcuts_blob');
case 'groups:create':
case 'admin:groups:create':
BindInOut.initAll();
- case 'groups:new':
- case 'admin:groups:new':
+ new Group();
+ new GroupAvatar();
+ break;
case 'groups:edit':
case 'admin:groups:edit':
new GroupAvatar();
diff --git a/app/assets/javascripts/group.js b/app/assets/javascripts/group.js
new file mode 100644
index 00000000000..7732edde1e7
--- /dev/null
+++ b/app/assets/javascripts/group.js
@@ -0,0 +1,21 @@
+export default class Group {
+ constructor() {
+ this.groupPath = $('#group_path');
+ this.groupName = $('#group_name');
+ this.updateHandler = this.update.bind(this);
+ this.resetHandler = this.reset.bind(this);
+ if (this.groupName.val() === '') {
+ this.groupPath.on('keyup', this.updateHandler);
+ this.groupName.on('keydown', this.resetHandler);
+ }
+ }
+
+ update() {
+ this.groupName.val(this.groupPath.val());
+ }
+
+ reset() {
+ this.groupPath.off('keyup', this.updateHandler);
+ this.groupName.off('keydown', this.resetHandler);
+ }
+}
diff --git a/app/views/shared/_group_form.html.haml b/app/views/shared/_group_form.html.haml
index 8869d510aef..90ae3f06a98 100644
--- a/app/views/shared/_group_form.html.haml
+++ b/app/views/shared/_group_form.html.haml
@@ -1,12 +1,8 @@
+- content_for :page_specific_javascripts do
+ = page_specific_javascript_bundle_tag('group')
- parent = GroupFinder.new(current_user).execute(id: params[:parent_id] || @group.parent_id)
- group_path = root_url
- group_path << parent.full_path + '/' if parent
-- if @group.persisted?
- .form-group
- = f.label :name, class: 'control-label' do
- Group name
- .col-sm-10
- = f.text_field :name, placeholder: 'open-source', class: 'form-control'
.form-group
= f.label :path, class: 'control-label' do
@@ -20,7 +16,7 @@
= f.text_field :path, placeholder: 'open-source', class: 'form-control',
autofocus: local_assigns[:autofocus] || false, required: true,
pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_JS,
- title: 'Please choose a group name with no special characters.',
+ title: 'Please choose a group path with no special characters.',
"data-bind-in" => "#{'create_chat_team' if Gitlab.config.mattermost.enabled}"
- if parent
= f.hidden_field :parent_id, value: parent.id
@@ -33,6 +29,14 @@
%li It will change web url for access group and group projects.
%li It will change the git path to repositories under this group.
+.form-group.group-name-holder
+ = f.label :name, class: 'control-label' do
+ Group name
+ .col-sm-10
+ = f.text_field :name, class: 'form-control',
+ required: true,
+ title: 'You can choose a descriptive name different from the path.'
+
.form-group.group-description-holder
= f.label :description, class: 'control-label'
.col-sm-10