UX: Tweaks to group pages.

This commit is contained in:
Guo Xiang Tan
2018-03-29 14:57:10 +08:00
parent 27f06505b1
commit 52e75eaee9
29 changed files with 468 additions and 253 deletions

View File

@@ -11,8 +11,8 @@ acceptance("Group logs", {
];
};
server.get('/groups/snorlax.json', () => { // eslint-disable-line no-undef
return response({"basic_group":{"id":41,"automatic":false,"name":"snorlax","user_count":1,"alias_level":0,"visible":true,"automatic_membership_email_domains":"","automatic_membership_retroactive":false,"primary_group":true,"title":"Team Snorlax","grant_trust_level":null,"incoming_email":null,"has_messages":false,"flair_url":"","flair_bg_color":"","flair_color":"","bio_raw":"","bio_cooked":null,"public":true,"is_group_user":true,"is_group_owner":true}});
server.get('/groups/snorlax', () => { // eslint-disable-line no-undef
return response({"group":{"id":41,"automatic":false,"name":"snorlax","user_count":1,"alias_level":0,"visible":true,"automatic_membership_email_domains":"","automatic_membership_retroactive":false,"primary_group":true,"title":"Team Snorlax","grant_trust_level":null,"incoming_email":null,"has_messages":false,"flair_url":"","flair_bg_color":"","flair_color":"","bio_raw":"","bio_cooked":null,"public":true,"is_group_user":true,"is_group_owner":true}});
});
// Workaround while awaiting https://github.com/tildeio/route-recognizer/issues/53

View File

@@ -45,6 +45,15 @@ QUnit.test("Anonymous Viewing Group", assert => {
assert.ok(find(".nav-pills li a[title='Logs']").length === 0, 'it should not show Logs tab if user is not admin');
assert.ok(count('.group-post') > 0, "it lists stream items");
});
selectKit('.group-dropdown').expand();
andThen(() => {
assert.equal(
find('.select-kit-row').text().trim(), 'discourse',
'it displays the right row'
);
});
});
QUnit.test("User Viewing Group", assert => {

View File

@@ -19,7 +19,7 @@ QUnit.test("Creating a new group", assert => {
visit("/groups");
selectKit('.groups-admin-dropdown').expand().selectRowByValue("new");
click(".groups-header-new");
fillIn("input[name='name']", '1');
andThen(() => {

View File

@@ -1,6 +1,6 @@
export default {
"/groups/discourse.json":{
"basic_group":{
"/groups/discourse":{
"group":{
"id":47,
"automatic":false,
"name":"discourse",
@@ -14,6 +14,9 @@ export default {
"is_group_owner":true,
"mentionable":true,
"messageable":true
},
"extras": {
"visible_group_names": ["discourse"]
}
},
"/topics/groups/discourse.json":{

View File

@@ -53,7 +53,7 @@ export default function(helpers) {
this.get('/widgets/:widget_id', function(request) {
const w = _widgets.findBy('id', parseInt(request.params.widget_id));
if (w) {
return response({widget: w});
return response({ widget: w, extras: { hello: 'world' }});
} else {
return response(404);
}

View File

@@ -49,14 +49,17 @@ QUnit.test('createRecord with a record as attributes returns that record from th
QUnit.test('find', assert => {
const store = createStore();
return store.find('widget', 123).then(function(w) {
assert.equal(w.get('name'), 'Trout Lure');
assert.equal(w.get('id'), 123);
assert.ok(!w.get('isNew'), 'found records are not new');
assert.equal(w.get('extras.hello'), 'world', "extra attributes are set");
// A second find by id returns the same object
store.find('widget', 123).then(function(w2) {
assert.equal(w, w2);
assert.equal(w.get('extras.hello'), 'world', "extra attributes are set");
});
});
});