-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
RE: Added language as a filter to explore/repo_search #29044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
snematoda
wants to merge
37
commits into
go-gitea:main
Choose a base branch
from
snematoda:patch-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
9e7ecdd
Added language as a filter to explore/repo_search
snematoda 94d2db8
Display only relevent languages
snematoda bd8e749
Rename Languages to ProgramLanguages
snematoda d199a13
Support searching and fix error msg
snematoda d5f5ef2
Switch Sort and set max height
snematoda d5eaca8
Minor style fixes
snematoda 9a77fb8
improve styling
snematoda 453b677
Update templates/explore/repo_search.tmpl
silverwind 55884cc
Merge remote-tracking branch 'up/main' into patch-1
snematoda 120c830
use unique css classes
snematoda 093a267
Merge branch 'main' into patch-1
silverwind 1e59ce2
use flex instead of float
silverwind 84dd029
move language before sort as we are no longer using float
silverwind ab87133
remove pointless margin, use gap
silverwind e95e6bf
remove unused classes, align language names
wxiaoguang 5a9d382
add support for user/org repos
snematoda 7c4b55d
Merge branch 'main' into patch-1
snematoda 22262e0
use translated all instead of 'Any'
snematoda f2c304e
display only relevent user repos
snematoda e50b52c
add api for languages
snematoda 97a73e5
Merge branch 'main' into patch-1
snematoda 85f1389
Update routers/api/v1/repo/languages.go
silverwind 1393328
added ownerID to languages api
snematoda 219d4d4
Merge branch 'main' into patch-1
snematoda 3794e37
Merge branch 'main' into patch-1
silverwind 2a8d0c8
Improved api and db calls
snematoda bc4d8b5
add tests and fix styling
snematoda 00fb639
move styles to base.css
snematoda 3ae0bb8
Merge branch 'main' into patch-1
snematoda 7fb0de1
hotfixes
snematoda 50049de
improve tests
snematoda 721cf39
merge upstream
snematoda 372ab85
hotfixes, follow style guidlines
snematoda e1d166a
Merge branch 'main' into patch-2
snematoda b399bb5
lint
snematoda 50c1a81
lint
snematoda 7982916
prealloc array
snematoda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright 2023 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package repo | ||
|
||
import ( | ||
"net/http" | ||
|
||
repo_model "code.gitea.io/gitea/models/repo" | ||
"code.gitea.io/gitea/modules/context" | ||
api "code.gitea.io/gitea/modules/structs" | ||
) | ||
|
||
func listPrimaryLanguageList(ctx *context.APIContext, ownerID int64) { | ||
langs, err := repo_model.GetPrimaryRepoLanguageList(ctx, ownerID, ctx.Doer) | ||
if err != nil { | ||
ctx.InternalServerError(err) | ||
return | ||
} | ||
|
||
list := make([]api.LanguageInfo, 0, len(langs)) | ||
|
||
for _, i := range langs { | ||
list = append(list, api.LanguageInfo{ | ||
Name: i.Language, | ||
Color: i.Color, | ||
}) | ||
} | ||
|
||
ctx.JSON(http.StatusOK, list) | ||
} | ||
|
||
// List all primary languages | ||
func ListPrimaryLanguages(ctx *context.APIContext) { | ||
// swagger:operation GET /repos/languages repository repoListPrimaryLanguages | ||
// --- | ||
// summary: Get primary languages and their color | ||
// produces: | ||
// - application/json | ||
// responses: | ||
// "200": | ||
// "$ref": "#/responses/PrimaryLanguageList" | ||
|
||
listPrimaryLanguageList(ctx, 0) | ||
} | ||
|
||
// List user primary languages | ||
func GetUserPrimaryLanguageList(ctx *context.APIContext) { | ||
// swagger:operation GET /users/{username}/languages user userListPrimaryLanguages | ||
// --- | ||
// summary: Get primary languages and their color | ||
// produces: | ||
// - application/json | ||
// parameters: | ||
// - name: username | ||
// in: path | ||
// description: username of user to get | ||
// type: string | ||
// required: true | ||
// responses: | ||
// "404": | ||
// "$ref": "#/responses/notFound" | ||
// "200": | ||
// "$ref": "#/responses/PrimaryLanguageList" | ||
|
||
listPrimaryLanguageList(ctx, ctx.ContextUser.ID) | ||
} | ||
|
||
// List org primary languages | ||
func GetOrgPrimaryLanguageList(ctx *context.APIContext) { | ||
// swagger:operation GET /orgs/{org}/languages organization orgListPrimaryLanguages | ||
// --- | ||
// summary: Get primary languages and their color | ||
// produces: | ||
// - application/json | ||
// parameters: | ||
// - name: org | ||
// in: path | ||
// description: name of the organization to get | ||
// type: string | ||
// required: true | ||
// responses: | ||
// "404": | ||
// "$ref": "#/responses/notFound" | ||
// "200": | ||
// "$ref": "#/responses/PrimaryLanguageList" | ||
|
||
listPrimaryLanguageList(ctx, ctx.Org.Organization.ID) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.