Commit Graph

2663 Commits

Author SHA1 Message Date
mrsdizzie af7ffaa279
Server-side syntax highlighting for all code (#12047)
* Server-side syntax hilighting for all code

This PR does a few things:

* Remove all traces of highlight.js
* Use chroma library to provide fast syntax hilighting directly on the server
* Provide syntax hilighting for diffs
* Re-style both unified and split diffs views
* Add custom syntax hilighting styling for both regular and arc-green

Fixes #7729
Fixes #10157
Fixes #11825
Fixes #7728
Fixes #3872
Fixes #3682

And perhaps gets closer to #9553

* fix line marker

* fix repo search

* Fix single line select

* properly load settings

* npm uninstall highlight.js

* review suggestion

* code review

* forgot to call function

* fix test

* Apply suggestions from code review

suggestions from @silverwind thanks

Co-authored-by: silverwind <me@silverwind.io>

* code review

* copy/paste error

* Use const for highlight size limit

* Update web_src/less/_repository.less

Co-authored-by: Lauris BH <lauris@nix.lv>

* update size limit to 1MB and other styling tweaks

* fix highlighting for certain diff sections

* fix test

* add worker back as suggested

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-07-01 00:34:03 +03:00
Cirno the Strongest b918609acc
Use custom SVGs for commit signing lock icon (#12017)
* Use custom SVGs for commit signing lock icon

* missing spans

* editorconfig

* xmlns and remove aria-hidden

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-28 00:05:50 -04:00
silverwind 7761245d08
Move fomantic and jQuery to main webpack bundle (#11997)
This saves around 3 MB binary size by not including useless fomantic
files in the build. Also, this allows us to move jQuery into the main
bundle as well which eliminates a few HTTP requests.

Also included are webpack config changes:

- split less and css loaders to speed up compliation
- enable css sourcemaps
- switch css minfier plugin to cssnano-webpack-plugin which works better
  for sourcemaps than the previous plugin

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-27 22:59:56 -04:00
Cirno the Strongest 1fd2beb6e9
Fix swagger docs for /repos/issues (#12069)
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-27 16:32:28 -04:00
mrsdizzie 4b66d9ad98
Show description on individual milestone view (#12055)
Fixes #12043

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-25 21:21:13 -04:00
Cirno the Strongest 0ea479561d
Add org avatar on top of internal repo icon (#11895)
* Add org avatar on top of internal repo icon

* add color for arc-green

* use wrapper div to avoid negative margins

* rename class and move div

* move div to icon tmpl

* remove unnecessary margin for lock octicon

* fix label align together with #11891

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-26 03:07:15 +03:00
Cirno the Strongest 6764daf7e5
Use Fomantic's fluid padded for blame full width (#12023)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-25 14:58:12 -04:00
6543 c86478ec47
[UI] Sortable Tables Header By Click (#7980)
* [UI] Sortable Tables Header By Click

* get rid of padding above header

* restart CI

* fix lint

* convert getArrow JS to SortArrow go func

* addopt SortArrow funct

* suggestions from @silverwind - tablesort.js

Co-authored-by: silverwind <me@silverwind.io>

* Update web_src/js/features/tablesort.js

Co-authored-by: silverwind <me@silverwind.io>

* Update web_src/js/features/tablesort.js

Co-authored-by: silverwind <me@silverwind.io>

Co-authored-by: silverwind <me@silverwind.io>
2020-06-24 23:23:05 +01:00
Cirno the Strongest d9aa007a9e
Use label to describe repository type (#11891)
* Use label instead of icon to describe repository type when repo avatar is set

* header_icon is not longer duplicated; move out of separate template

* handle archived case too

* use everywhere

* public template -> template

* bring back separate icon in better form

* definitely was overthinking this

* 32

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-22 16:20:51 -04:00
Cirno the Strongest daf62841f6
Fix sticky diff stats container (#12002)
* Fix sticky diff stats container

* Use pure CSS sticky instead of Fomantic's JS

* add border color to arc-green

* add slight padding on sides

* make linter happy

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-22 15:02:27 -04:00
6543 fc2f2c7602
API: Move AllowedReactions endpoint into GetGenneralUI endpoint + creat new swagger section settings (#11854)
* move Setting function into its own package

* swagger add&use new section "settings"

* move api AllowedReactions into general UI-Settings endpoint

* prepare TEST

* lint
2020-06-22 14:21:31 -04:00
Cirno the Strongest 180286da0c
Fix missing styling for dropdown icon on review button (#11998)
* Fix missing styling for dropdown icon on review button

* Remove unnecessary span element

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-22 03:02:22 +03:00
Cirno the Strongest c1a2887c02
Use octicons for all repo header buttons (#11890)
* Use octicons for all repo header buttons

* ensure margin isn't set on any other svg outside repo buttons

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-22 02:18:42 +03:00
zeripath a07cc0df76
Handle multiple merges in gitgraph.js (#11996)
* Handle multiple merges in gitgraph.js

There is a bug in web_src/js/vendor/gitgraph.js whereby it fails to
handle multiple merges in a single commit correctly. This PR adds
changes to make this work.

Fix #11981

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update web_src/js/vendor/gitgraph.js
2020-06-20 22:29:44 +03:00
Cirno the Strongest 92a05f87f0
Use only first line of commit when creating referenced comment (#11960)
* Use only first line of commit when creating referenced comment

* Update modules/repofiles/action.go

* Display first line only on feeds too

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
2020-06-19 15:19:56 +08:00
Cirno the Strongest 6c81b738f7
Update Fomantic-UI to 2.8.6 and remove old workarounds (#11933)
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-17 21:20:07 -04:00
techknowlogick 6bf78d2b57
Global default branch setting (#11918)
* Global default branch setting

* add to app.ini example per @silverwind

* update per @lunny

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-06-17 16:53:55 -04:00
Cirno the Strongest 61cd0ce866
Fix double divider on issue sidebar (#11919) 2020-06-17 10:12:06 -04:00
6543 f399cd326b
UI: Fix wrong closing tag (#11910)
* rm wrong closing tag

* Update templates/repo/sub_menu.tmpl

Co-authored-by: John Olheiser <john.olheiser@gmail.com>

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-06-16 11:27:20 -04:00
Cirno the Strongest 80a3745fc8
Make repository size unclickable on repo summary bar (#11887)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-15 21:45:17 -04:00
Cirno the Strongest c8780984f8
Rework blame template and styling (#11885)
* Rework blame template and styling

* cleanup template and add missing NumLines

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-15 14:39:39 -04:00
Cirno the Strongest 5f47835f4c
Better align items using flex within review request box (#11879)
* Better align items using flex within review request box

* use justify-content

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-15 03:37:00 -04:00
赵智超 48842ed108
ui: Show update branch item in merge box when it's necessary (#11761)
* ui: Show update branch item in merge box when it's necessary

As title, should show it without care about whether
this pr can be merged.

fix #10959

Signed-off-by: a1012112796 <1012112796@qq.com>

* fix ui

* Fix ui, thanks to @silverwind.

Co-authored-by: silverwind <me@silverwind.io>

* fix lint

* Update templates/repo/issue/view_content/pull.tmpl

Co-authored-by: silverwind <me@silverwind.io>

* Apply review suggestion

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-13 14:49:59 -04:00
Cirno the Strongest b6adf80a80
Fix repo internal icon when avatar is present (#11873)
* Fix repo internal icon when avatar is present

* fix tabs

* move repo icons in header to separate template
2020-06-13 00:24:41 +03:00
silverwind bc4f7ba69b
Add automatic JS license generation (#11810)
* Add automatic JS license generation

Removed librejs file and replaced it with a plaintext file that is built
from all JS dependencies that are included in the webpack build. It does
not cover the few remaining statically vendored files and fomantic is
added manually because it's not yet in the webpack build process.

Fixes: https://github.com/go-gitea/gitea/issues/11630

* fix lint

* remove jslicense, we're not librejs compatible any more

* remove license.txt test as it depens on absent files

* small optimization

* trailing comma

* localize and capitalize the word 'licenses'

* reduce text to just 'Licenses'

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-12 14:26:37 +03:00
mrsdizzie 2b573f49cf
Fix nil pointer in default issue mail template (#11862)
* Fix nil pointer in default issue mail template

Fix: template: issue/default:20:17: executing "issue/default" at <.Comment.Type>: nil pointer evaluating interface {}.Type

Introduced in #11167

* another one

Co-authored-by: zeripath <art27@cantab.net>
2020-06-12 11:56:31 +03:00
Cirno the Strongest 8770bceafa
Fix search form button overlap (#11840)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-11 23:35:03 -04:00
silverwind ca8ecf7ffc
Improve label edit buttons labels (#11841)
* Improve label edit buttons labels

Previously when editing the buttons in the "Edit Label" modal were a
strange "Update" and "No". Improved them to "Save" and "Cancel".

Also fixed indentation in the template file, recommended to view changes
with the "Hide whitespace changes" option enabled on GitHub.

* remove unnecessary button icon

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-11 17:06:20 -04:00
Cirno the Strongest b682a2c1b2
Show exact tag for commit on diff view (#11846)
* Show exact tag for commit on diff view

* Fix comment

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-11 15:42:55 -04:00
silverwind 628ee1d82e
Replace jquery-datetimepicker with native date input (#11684)
This removes the jQuery plugin as well as the associated config options.
Native input[type=date] does not require a language attribute as it is
localized by default, except for the placeholder attribute for which I
currently piggy-back the repo.issues.due_date_form localization option.

Implementation should pretty much match GH. Of note is that Safari does
not provide a UI for this input type, but I don't think providing one is
neccessary and GH did not bother either.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-10 14:35:27 -04:00
6543 68a2af6d68
API expose usefull General Repo settings settings (#11758)
* GeneralRepoSettings expose MirrorsDisabled, HTTPGitDisabled, MaxCreationLimit

* Apply suggestions from code review

Co-authored-by: proton <25139420+proton-ab@users.noreply.github.com>

* lint

Co-authored-by: proton <25139420+proton-ab@users.noreply.github.com>
2020-06-10 15:05:46 +03:00
6543 1ac46186ff
API allow to create closed milestones (#11745)
* API allow to create closed milestones

* set CloseDate too

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-09 18:01:36 -04:00
silverwind 19db3f4f0a
rework eslint config (#11615)
* rework eslint config

- use explicit config that only enables rules
- upgrade eslint to 7.1.0
- add new plugins with selected rules enabled
- fix discovered issues, remove global wipPrefixes

* remove if

* undo template change

* add disabled rules as well for easier config updating

* add missing disabled rule

* update eslint and plugins

* fix new violation

* remove deprecated rules

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-09 17:31:15 -04:00
John Olheiser aaff47ad75
Fix reply octicon (#11821)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-06-09 10:13:00 -05:00
Cirno the Strongest 27a6e03906
Remove page size limit comment from swagger (#11806)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-09 00:57:38 -04:00
6543 5814079bf5
Add option to API to update PullRequest base branch (#11666)
* EditPull: add option to change base

Close #11552
2020-06-07 20:13:40 +01:00
Cirno the Strongest 880ae454db
Work around fomantic 2.8.5 bugs (#11767)
Work around fomantic 2.8.5 bugs 

Closes #11759

Related fomantic/Fomantic-UI#1372 and fomantic/Fomantic-UI#1473
2020-06-07 19:25:52 +01:00
Lauris BH 2874ab54bc
Add language statistics API endpoint (#11737)
* Add language statistics API

* Add tests
2020-06-07 14:48:41 +03:00
Cirno the Strongest bbe13b60cd
Fix timezone on issue deadline (#11697)
* Fix timezone on issue deadline

* FormatDate

Co-authored-by: zeripath <art27@cantab.net>
2020-06-05 18:51:10 -04:00
l-jonas aa3c0f8eba
Add hide activity option (#11353)
* Add hide activity option

This closes https://github.com/go-gitea/gitea/issues/7927

* Adjust for linter

* Adjust for linter

* Add tests

* Remove info that admins can view the activity

* Adjust new tests for linter

* Rename v139.go to v140.go

* Rename v140.go to v141.go

* properly indent

* gofmt

Co-authored-by: Jonas Lochmann <git@inkompetenz.org>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-05 16:01:53 -04:00
John Olheiser ac07418011
Add compare link to releases (#11752)
Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-05 14:44:54 -04:00
Cirno the Strongest 5acba4609a
Add internal-repo octicon for public repos of private org (#11529)
* Show multiple octicons on repo list

* fix mixed spaces/tabs

* Internal repo octicon

* show internal icon in dashboard repolist

* swagger

* fix icon for normal repo on repo page

* don't expose owner visibility directly; provide internal in repo api

* fix icons for forks and mirrors

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-05 14:41:06 +03:00
zeripath f761a37a0f
Provide diff and patch API endpoints (#11751)
* Provide diff and patch API endpoints

The diff and patch endpoints on the main routes are not accessible by token
therefore we provide new API based endpoints for these

Fix #10923

Signed-off-by: Andrew Thornton <art27@cantab.net>

* placate swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Make the response an actual string

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-05 14:03:12 +03:00
赵智超 17f8de7a54
Fix to allow comment poster to edit or delete his own comments (#11671)
* bug: fix comment update permision check

No the ui only allow poster to update or delet comment, which
is not reasonable and different with handle logic, this pr
change it to allow poster of comment do it

ref code:
e8955173a9/routers/repo/issue.go (L1636)

e8955173a9/routers/repo/issue.go (L1681)

fix #11663

Signed-off-by: a1012112796 <1012112796@qq.com>

* simplify code

* fix sign in

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-05 13:10:10 +03:00
6543 b534a5164f
[API] Expose allowed Reactions (#11735)
* [API] Expose allowed Reactions

* dont be in soutch a rush

* add TEST

* use ElementsMatch

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-06-04 12:16:53 +03:00
mrsdizzie 2842f6cf42
Include query in sign in redirect (#11579)
* Include query in sign in redirect

Include query string in ctx.Data["SignInLink"] so people are redirected to the right page after singing in. Fixes case of:

Visit:

 https://try.gitea.io/mrsdizzie/testcase/issues?q=&type=all&sort=&state=open&labels=7071&milestone=0&assignee=0

Sign in, then redirected to:

 https://try.gitea.io/mrsdizzie/testcase/issues

Create a new "SignInLink" instead of updating the existing "Link" because too many places in the code assume "Link" won't have a query

* Apply suggestions from code review

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-03 23:41:02 -04:00
Cirno the Strongest 3ea5d864b9
Fix message wrapping on PR commit list (#11616)
* Fix message wrapping on PR commit list

* Update templates/repo/commits_list_small.tmpl

Co-authored-by: silverwind <me@silverwind.io>
2020-06-03 09:30:34 +01:00
赵智超 de0b2d4e32
bug: fix wrong poster message for code comment on Pull view (#11721)
As title, maybe fix one of issue in #11705

Signed-off-by: a1012112796 <1012112796@qq.com>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-03 02:09:03 -04:00
Cirno the Strongest 8e035f81c0
Fix styling for commiter on diff view (#11715)
* Fix styling for commiter on diff view

* Update options/locale/locale_en-US.ini

* Update templates/repo/commit_page.tmpl

Co-authored-by: silverwind <me@silverwind.io>

* Update templates/repo/commit_page.tmpl

Co-authored-by: silverwind <me@silverwind.io>

* Apply suggestions from code review

Co-authored-by: silverwind <me@silverwind.io>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-02 22:40:08 -04:00
S7evinK dcefcc10e6
Add missing templates (#11729)
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-02 22:04:52 -04:00