Skip to content
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

Can I add the feature to allow query params for new file name and contents? #16398

Closed
3 tasks done
coolaj86 opened this issue Jul 11, 2021 · 4 comments
Closed
3 tasks done
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@coolaj86
Copy link
Contributor

coolaj86 commented Jul 11, 2021

Gitea lets you open a URL to create a new file at a given path, like this:

https://git.example.com/example/project/_new/master/path/to

Github allows you to also specify the name of the file, and some contents, like this:

https://github.com/example/project/new/master
        ?filename=path/to/hello.md
        &value=Hello+World!

I would like to add this feature to gitea.

  • Would this be acceptable?
  • How can I find the JavaScript file I would need to edit to add this?
  • Where should I add documentation for a feature like this?
@a1012112796 a1012112796 added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Jul 12, 2021
@noerw
Copy link
Member

noerw commented Jul 12, 2021

Hi!

  1. 👍 I'm confident this will be accepted
  2. You could populate the field with javascript, or handle this in the serverside templating (we use mostly use the latter option, though I can see that this is not needed in this case). Add here if you do it in JS, add here and potentially here for the templating approach.
  3. As this feature probably targets devs that want to integrate with Gitea mostly, the developers section of our docs would be good

@coolaj86
Copy link
Contributor Author

Thanks. I've got this in my queue of side projects. I hope to work on this within the next two weeks.

@coolaj86
Copy link
Contributor Author

coolaj86 commented Jul 26, 2021

The blog project I've been working on that depends on this change is now at a stage where it will be immediately useful: https://bliss.coolaj86.com/

To demonstrate:

  1. Enter some content
  2. Enter a title
  3. Select Blog: Eon, Git: Gitea
  4. Paste the repo url in the Repo section
  5. Click "Create on Gitea"

Screen Shot 2021-07-26 at 3 20 35 AM

Example Link URL:

https://git.coolaj86.com/coolaj86/blog/_new/main/posts/hello-world.md?value=---%0Atitle%3A%20%22Hello%2C%20World%22%0Adescription%3A%20%22CHANGE%20ME%20!!!!!!%22%0Atimezone%3A%20%22America%2FDenver%22%0Adate%3A%20%222021-07-25%2002%3A08%3A00%20am%22%0Aupdated%3A%20%222021-07-25%2002%3A08%3A00%20am%22%0Auuid%3A%20d841df20-4c8d-43eb-9a19-c47873ffabc0%0Acategories%3A%0A%20%20-%20CHANGE_ME_______________%0Apermalink%3A%20%2Farticles%2Fhello-world%2F%0A---%0A%0AHello.%0AIs%20it%20me%20you%27re%20looking%20for%3F

Anyway, I plan to start this week, perhaps tomorrow.

@coolaj86
Copy link
Contributor Author

Done. Merged. Awesome!

@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

3 participants