Commit Graph

25 Commits

Author SHA1 Message Date
Blake Erickson
fe676f334a
FEATURE: Return subcategories on categories endpoint (#14492)
* FEATURE: Return subcategories on categories endpoint

When using the API subcategories will now be returned nested inside of
each category response under the `subcategory_list` param. We already
return all the subcategory ids under the `subcategory_ids` param, but
you then would have to make multiple separate API calls to fetch each of
those subcategories. This way you can get **ALL** of the categories
along with their subcategories in a single API response.

The UI will not be affected by this change because you need to pass in
the `include_subcategories=true` param in order for subcategories to be
returned.

In a follow up PR I'll add the API scoping for fetching categories so
that a readonly API key can be used for the `/categories.json` endpoint. This
endpoint should be used instead of the `/site.json` endpoint for
fetching a sites categories and subcategories.

* Update PR based on feedback

- Have spec check for specific subcategory
- Move comparison check out of loop
- Only populate subcategory list if option present
- Remove empty array initialization
- Update api spec to allow null response

* More PR updates based on feedback

- Use a category serializer for the subcategory_list
- Don't include the subcategory_list param if empty
- For the spec check for the subcategory by id
- Fix spec to account for param not present when empty
2021-10-05 12:12:31 -06:00
Bianca Nenciu
d2cf43a7d5
FIX: Update categories without full page refresh (#11793)
Creating or moving a category required a full page refresh until it
showed up correctly.
2021-01-22 10:21:09 +02:00
Dan Ungureanu
069bc70bd4
UX: Improve sub-sub-categories styling in categories list (#8593)
- Using h4 instead of h3 for sub-categories.
- Show category description if it does not have subcategories.
- Implemented equivalent for mobile-view.
- Include description_excerpt in basic serializer. This is needed for
  displaying second-level categories in category list.

Follow-up to 9253cb79e3.
2019-12-19 17:09:45 +02:00
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Guo Xiang Tan
152238b4cf DEV: Prefer public_send over send. 2019-05-07 09:33:21 +08:00
Régis Hanol
5833e96017 FIX: use 'topic_all_time' as topic count failover in /categories page 2016-08-29 10:25:46 +02:00
Régis Hanol
eb953c0904 FIX: /categories page on mobile 2016-08-19 01:47:00 +02:00
Régis Hanol
6d1d7b7c8f UX: new /categories layout 2016-08-17 23:23:16 +02:00
Neil Lalonde
b9c7e3b74a FIX: categories page counts were very wrong for categories with sub-categories 2015-05-25 17:42:16 -04:00
Sam
8881e56df5 PERF: don't ever use inject on AR relations
inject will deteriorate to a method missing that
invokes arel and a world of uneeded work
2014-11-17 18:03:11 +11:00
Régis Hanol
7f498a8795 FIX: N+1 query on /categories page 2014-09-09 15:32:58 +02:00
Neil Lalonde
130f0e19ec FIX: more protection from nil in count_with_subcategories 2014-02-07 11:38:22 -05:00
Neil Lalonde
14018ec07c FIX: topic and post counts on /categories page should include sub-categories 2014-02-05 18:39:49 -05:00
Neil Lalonde
49c3482464 Show topic and post counts by day/week/month/year on categories page 2013-12-13 15:37:45 -05:00
Robin Ward
b93ca1089e List subcategories on categories page 2013-10-31 18:02:24 -04:00
Sam
666264879c change it so all topics MUST include a category, we store a special uncategorized category to compensate
this cleans up a bunch of internals and removes some settings
2013-10-24 12:08:02 +11:00
Robin Ward
541620c115 Routes and support for sub-categories 2013-10-23 15:22:49 -04:00
Sam
1ee49798b2 work in progress wide category list 2013-10-18 11:10:10 +11:00
Neil Lalonde
f62c421c91 Render category descriptions differently on the categories page 2013-06-14 11:18:44 -04:00
Robin Ward
f151b30044 Show excerpts on Categories page 2013-05-29 11:46:01 -04:00
Robin Ward
560fb15d8a Include pinned topics in category list.
- removes an (n+1) query for user data
- supports the preload store for the data to avoid a second request
- fix a bug where uncategorizes was reporting (0, 0, 0) for topics by week, month, year
2013-05-28 15:36:16 -04:00
Robin Ward
62a20f5655 FIX: Couldn't access "Uncategorized" category from category list. 2013-05-27 14:15:52 -04:00
Robin Ward
c6bd6371f2 Exclude recently made invisible topics from the categories list. Also remove a couple n+1 queries. 2013-04-05 16:09:27 -04:00
Jakub Arnold
61654ab8f0 Fix all the trailing whitespace 2013-02-07 16:45:24 +01:00
Robin Ward
21b5628528 Initial release of Discourse 2013-02-05 14:16:51 -05:00