diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-21 12:39:41 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-21 12:39:41 +0400 |
commit | fb5c1dd8f0ab630f785989537713aad1758ae5a9 (patch) | |
tree | 17d24c7b418d65f74853382dcbf3d3a81e3954d8 | |
parent | d545bb8de46990ead70d13839ee198083ad2d03f (diff) | |
parent | 3a47ed979a62e91fdcd7d05ebb309759788a23b6 (diff) |
Merge pull request #8113 from cirosantilli/factor-group-forms
Factor group forms
-rw-r--r-- | app/views/admin/groups/_form.html.haml | 10 | ||||
-rw-r--r-- | app/views/groups/edit.html.haml | 11 | ||||
-rw-r--r-- | app/views/groups/new.html.haml | 10 | ||||
-rw-r--r-- | app/views/shared/_group_form.html.haml | 12 |
4 files changed, 15 insertions, 28 deletions
diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml index 6aca358a0c9..f4d7e25fd74 100644 --- a/app/views/admin/groups/_form.html.haml +++ b/app/views/admin/groups/_form.html.haml @@ -2,16 +2,8 @@ - if @group.errors.any? .alert.alert-danger %span= @group.errors.full_messages.first - .form-group.group_name_holder - = f.label :name, class: 'control-label' do - Group name - .col-sm-10 - = f.text_field :name, placeholder: "Example Group", class: "form-control" - .form-group.group-description-holder - = f.label :description, "Details", class: 'control-label' - .col-sm-10 - = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 + = render 'shared/group_form', f: f .form-group.group-description-holder = f.label :avatar, "Group avatar", class: 'control-label' diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index b40c164f91a..eb24fd65d9e 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -11,16 +11,7 @@ - if @group.errors.any? .alert.alert-danger %span= @group.errors.full_messages.first - .form-group - = f.label :name, class: 'control-label' do - Group name - .col-sm-10 - = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control left" - - .form-group.group-description-holder - = f.label :description, "Details", class: 'control-label' - .col-sm-10 - = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 + = render 'shared/group_form', f: f .form-group .col-sm-2 diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml index d6c6fbd020c..6e17cdaef6f 100644 --- a/app/views/groups/new.html.haml +++ b/app/views/groups/new.html.haml @@ -2,16 +2,8 @@ - if @group.errors.any? .alert.alert-danger %span= @group.errors.full_messages.first - .form-group - = f.label :name, class: 'control-label' do - Group name - .col-sm-10 - = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control", tabindex: 1, autofocus: true - .form-group.group-description-holder - = f.label :description, "Details", class: 'control-label' - .col-sm-10 - = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4, tabindex: 2 + = render 'shared/group_form', f: f, autofocus: true .form-group.group-description-holder = f.label :avatar, "Group avatar", class: 'control-label' diff --git a/app/views/shared/_group_form.html.haml b/app/views/shared/_group_form.html.haml new file mode 100644 index 00000000000..93294e42505 --- /dev/null +++ b/app/views/shared/_group_form.html.haml @@ -0,0 +1,12 @@ +.form-group + = f.label :name, class: 'control-label' do + Group name + .col-sm-10 + = f.text_field :name, placeholder: 'Example Group', class: 'form-control', + autofocus: local_assigns[:autofocus] || false + +.form-group.group-description-holder + = f.label :description, 'Details', class: 'control-label' + .col-sm-10 + = f.text_area :description, maxlength: 250, + class: 'form-control js-gfm-input', rows: 4 |