"Create Topic" visiblity in the Categories view


(Kolt) #1

If you change the default view from “Latest” to “Categories”, the place where you’d expect the “Create Topic” button to be is currently empty for regular users. For admins, that place is taken up by the “Create Category” button. If it is possible to create a new topic from the front page when it is configured as “Latest”, the same should be the case when you have “Categories” as the main view.

I do realize that the “Create Topic” button appears when you go from the categories view to an actual category, but expecting users to do this feels like a minor UX inconsistency. In one case, where “Latest” is the main view, users can create a new thread immediately from the front page, and choose the category in the composer. In the other case, where “Categories” is the main view, they can’t do this – they have to go through what seems like a sub-optimal step – clicking through to a category and then hitting “Create Topic”, rendering the composer’s – in my opinion – preferable way of selecting the category “un-utilized”.

Edit: Hm. Ten minutes later: I’m not sure if the above really constitutes a problem.


Why can I not create a topic on the categories page on my site?
(Steve Kryskalla) #2

I set the categories view as the default, so it’s the first thing users see after coming to the site / after logging in. So with this setup there is no way for a user to create a topic from the home page.

I tried to add the button myself but am getting a “composer was opened without a draft key” alert box when clicking on it.


(Steve Kryskalla) #3

Probably the wrong way to do it, but this worked:

diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6
index 486b851..6944db1 100644
--- a/app/assets/javascripts/discourse/controllers/composer.js.es6
+++ b/app/assets/javascripts/discourse/controllers/composer.js.es6
@@ -243,8 +243,7 @@ export default Discourse.Controller.extend({
     opts.promise = promise;

     if (!opts.draftKey) {
-      alert("composer was opened without a draft key");
-      throw "composer opened without a proper draft key";
+      opts.draftKey = Discourse.Composer.REPLY_AS_NEW_TOPIC_KEY;
     }

     // ensure we have a view now, without it transitions are going to be messed
diff --git a/app/assets/javascripts/discourse/templates/navigation/categories.js.handlebars b/app/assets/javascripts/discourse/templates/navigation/categories.js.handlebars
index ef986fd..f55fa58 100644
--- a/app/assets/javascripts/discourse/templates/navigation/categories.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/navigation/categories.js.handlebars
@@ -7,6 +7,8 @@
   {{customHTML "extraNavItem"}}
 </ul>

+<button id="create-topic" class='btn btn-default' style='color:#fff;background-color:#FDB913' {{action createTopic}}><i class='fa fa-plus'></i>{{i18n topic.create}}</button>
+
 {{#if canCreateCategory}}
   <button class='btn btn-default' style='color:#fff;background-color:#FDB913' {{action createCategory}}><i class='fa fa-plus'></i>{{i18n category.create}}</button>
 {{/if}}

(Sam Saffron) #4

My call on this would be to make it a site setting, it confused the bejesus out of me. As admin, going to the front page and not being able to create topics is super confusing.


(Tobias Eigen) #5

what he said. though the way I explained the problem in another (now closed) topic makes more sense to me than this topic which also confuses me.


(Tobias Eigen) #6

FYI if this happens then the problem for admins not being able to create topics from the categories page will go away, if I understand it correctly. I need to start learning the keyboard shortcuts and start using them… this is a good incentive. :smile:

https://github.com/discourse/discourse/pull/2912


(Jeff Atwood) #7

I agree with the general concept that creating a category is a rather rare act and doesn’t need to be so prominent in the UI. Perhaps someone could mock up a UI where create is just a + button in the corner, or something?

It hasn’t been a priority since it’s only an issue for admins. Moderators can’t even create categories as I recall.


(cpradio) #8

That is correct. :smile:


(Tobias Eigen) #9

It is now indeed possible to create a topic on the category page using the ‘c’ shortcut. So as far as I’m concerned this bug/ux issue is resolved so we can close this topic.

https://github.com/discourse/discourse/pull/2912


(Jeff Atwood) #10

Maybe… I still think we should demote Create Category as it is such a rare act.