FEATURE: Add `Group#full_name`.
This commit is contained in:
parent
5a2794a0c7
commit
43ee9f884e
|
@ -11,6 +11,11 @@
|
|||
|
||||
{{#if model.id}}
|
||||
{{#unless model.automatic}}
|
||||
<div>
|
||||
<label for='full_name'>{{i18n 'groups.edit.full_name'}}</label>
|
||||
{{input type='text' name='full_name' value=model.full_name class='group-edit-full-name'}}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="bio">{{i18n 'groups.bio'}}</label>
|
||||
{{d-editor value=model.bio_raw}}
|
||||
|
|
|
@ -36,9 +36,9 @@ export default Ember.Controller.extend({
|
|||
return !automatic && isGroupOwner;
|
||||
},
|
||||
|
||||
@computed('model.name', 'model.title')
|
||||
groupName(name, title) {
|
||||
return (title || name).capitalize();
|
||||
@computed('model.name', 'model.full_name')
|
||||
groupName(name, fullName) {
|
||||
return (fullName || name).capitalize();
|
||||
},
|
||||
|
||||
@computed('model.name', 'model.flair_url', 'model.flair_bg_color', 'model.flair_color')
|
||||
|
|
|
@ -134,7 +134,8 @@ const Group = Discourse.Model.extend({
|
|||
flair_color: this.get('flairHexColor'),
|
||||
bio_raw: this.get('bio_raw'),
|
||||
public: this.get('public'),
|
||||
allow_membership_requests: this.get('allow_membership_requests')
|
||||
allow_membership_requests: this.get('allow_membership_requests'),
|
||||
full_name: this.get('full_name')
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<div class='group-edit'>
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label for='title'>{{i18n 'groups.edit.group_title'}}</label>
|
||||
{{input type='text' name='title' value=model.title class='group-edit-title'}}
|
||||
<label for='full_name'>{{i18n 'groups.edit.full_name'}}</label>
|
||||
{{input type='text' name='full_name' value=model.full_name class='group-edit-full-name'}}
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<span class='group-title'>{{groupName}}</span>
|
||||
</h1>
|
||||
|
||||
{{#if model.title}}
|
||||
{{#if model.full_name}}
|
||||
<h3 class='group-name'>@{{model.name}}</h3>
|
||||
{{/if}}
|
||||
</span>
|
||||
|
|
|
@ -69,6 +69,7 @@ class Admin::GroupsController < Admin::AdminController
|
|||
group.flair_color = group_params[:flair_color].presence
|
||||
group.public = group_params[:public] if group_params[:public]
|
||||
group.bio_raw = group_params[:bio_raw] if group_params[:bio_raw]
|
||||
group.full_name = group_params[:full_name] if group_params[:full_name]
|
||||
|
||||
if group.save
|
||||
Group.reset_counters(group.id, :group_users)
|
||||
|
@ -145,7 +146,7 @@ class Admin::GroupsController < Admin::AdminController
|
|||
:name, :alias_level, :visible, :automatic_membership_email_domains,
|
||||
:automatic_membership_retroactive, :title, :primary_group,
|
||||
:grant_trust_level, :incoming_email, :flair_url, :flair_bg_color,
|
||||
:flair_color, :bio_raw, :public, :allow_membership_requests
|
||||
:flair_color, :bio_raw, :public, :allow_membership_requests, :full_name
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -239,7 +239,7 @@ class GroupsController < ApplicationController
|
|||
:flair_bg_color,
|
||||
:flair_color,
|
||||
:bio_raw,
|
||||
:title,
|
||||
:full_name,
|
||||
:public,
|
||||
:allow_membership_requests
|
||||
)
|
||||
|
|
|
@ -514,6 +514,7 @@ end
|
|||
# bio_cooked :text
|
||||
# public :boolean default(FALSE), not null
|
||||
# allow_membership_requests :boolean default(FALSE), not null
|
||||
# full_name :string
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
|
|
|
@ -18,7 +18,8 @@ class BasicGroupSerializer < ApplicationSerializer
|
|||
:bio_raw,
|
||||
:bio_cooked,
|
||||
:public,
|
||||
:allow_membership_requests
|
||||
:allow_membership_requests,
|
||||
:full_name
|
||||
|
||||
def include_incoming_email?
|
||||
staff?
|
||||
|
|
|
@ -396,7 +396,7 @@ en:
|
|||
to: "To"
|
||||
edit:
|
||||
title: 'Edit Group'
|
||||
group_title: 'Title'
|
||||
full_name: 'Full Name'
|
||||
add_members: "Add Members"
|
||||
delete_member_confirm: "Remove '%{username}' from the '%{group}' group?"
|
||||
request_membership_pm:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddFullNameToGroups < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :groups, :full_name, :string
|
||||
end
|
||||
end
|
|
@ -41,7 +41,8 @@ describe Admin::GroupsController do
|
|||
"bio_raw"=>nil,
|
||||
"bio_cooked"=>nil,
|
||||
"public"=>false,
|
||||
"allow_membership_requests"=>false
|
||||
"allow_membership_requests"=>false,
|
||||
"full_name"=>group.full_name
|
||||
}])
|
||||
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ describe "Groups" do
|
|||
flair_color: 'BBB',
|
||||
flair_url: 'fa-adjust',
|
||||
bio_raw: 'testing',
|
||||
title: 'awesome team',
|
||||
full_name: 'awesome team',
|
||||
public: true,
|
||||
allow_membership_requests: true
|
||||
} }
|
||||
|
@ -68,7 +68,7 @@ describe "Groups" do
|
|||
expect(group.flair_color).to eq('BBB')
|
||||
expect(group.flair_url).to eq('fa-adjust')
|
||||
expect(group.bio_raw).to eq('testing')
|
||||
expect(group.title).to eq('awesome team')
|
||||
expect(group.full_name).to eq('awesome team')
|
||||
expect(group.public).to eq(true)
|
||||
expect(group.allow_membership_requests).to eq(true)
|
||||
expect(GroupHistory.last.subject).to eq('allow_membership_requests')
|
||||
|
|
|
@ -10,7 +10,7 @@ test("Editing group", () => {
|
|||
andThen(() => {
|
||||
ok(find('.group-flair-inputs').length === 1, 'it should display avatar flair inputs');
|
||||
ok(find('.group-edit-bio').length === 1, 'it should display group bio input');
|
||||
ok(find('.group-edit-title').length === 1, 'it should display group title input');
|
||||
ok(find('.group-edit-full-name').length === 1, 'it should display group full name input');
|
||||
ok(find('.group-edit-public').length === 1, 'it should display group public input');
|
||||
ok(find('.group-edit-allow-membership-requests').length === 1, 'it should display group allow_membership_requets input');
|
||||
ok(find('.group-members-input .item').length === 7, 'it should display group members');
|
||||
|
|
Loading…
Reference in New Issue