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

Add the ability to have built in themes in Gitea #4198

Merged
merged 27 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a5e3375
Add the ability to have built in themes in Gitea
techknowlogick Jun 9, 2018
c410f17
Merge branch 'master' into theme
techknowlogick Jun 9, 2018
7686c0c
Merge branch 'master' into theme
techknowlogick Jun 9, 2018
2980555
update per feedback
techknowlogick Jun 11, 2018
b06271d
Merge branch 'master' into theme
techknowlogick Jun 11, 2018
bc898b2
Merge branch 'master' into theme
techknowlogick Jun 12, 2018
5081c40
neq not defined
techknowlogick Jun 12, 2018
fc552b6
Merge branch 'master' into theme
techknowlogick Jun 17, 2018
60757b5
Merge branch 'master' into theme
techknowlogick Jun 19, 2018
c47dc20
Merge branch 'master' into theme
techknowlogick Jun 23, 2018
29fd549
Merge branch 'master' into theme
techknowlogick Jun 24, 2018
6f7d8a1
Merge branch 'master' into theme
techknowlogick Jun 25, 2018
56bae58
Rename theme-dark.css to theme-arc-green.css
techknowlogick Jun 25, 2018
af2665b
Rename dark.less to arc-green.less
techknowlogick Jun 25, 2018
e281c86
strip new line
techknowlogick Jun 25, 2018
37a8076
fix make generate-stylesheets
techknowlogick Jun 25, 2018
366b573
Merge branch 'master' into theme
techknowlogick Jul 3, 2018
8d8c60c
Merge branch 'master' into theme
techknowlogick Jul 4, 2018
554a862
update theme name
techknowlogick Jul 4, 2018
eb5e2ca
update theme name
techknowlogick Jul 4, 2018
3e99050
simplify template
techknowlogick Jul 5, 2018
b70165f
add options for themes
techknowlogick Jul 5, 2018
c3c0c9c
update default theme name
techknowlogick Jul 5, 2018
362a4d0
add documentation about theme
techknowlogick Jul 5, 2018
4ac504f
Merge branch 'master' into theme
techknowlogick Jul 5, 2018
686e0c2
update docs
techknowlogick Jul 5, 2018
d2f944b
Merge branch 'master' into theme
lafriks Jul 5, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ else
endif
endif

# $(call strip-suffix,filename)
strip-suffix = $(firstword $(subst ., ,$(1)))

.PHONY: all
all: build

Expand Down Expand Up @@ -301,7 +304,7 @@ public/js/index.js: $(JAVASCRIPTS)

.PHONY: stylesheets-check
stylesheets-check: generate-stylesheets
@diff=$$(git diff public/css/index.css); \
@diff=$$(git diff public/css/*); \
if [ -n "$$diff" ]; then \
echo "Please run 'make generate-stylesheets' and commit the result:"; \
echo "$${diff}"; \
Expand All @@ -311,6 +314,7 @@ stylesheets-check: generate-stylesheets
.PHONY: generate-stylesheets
generate-stylesheets:
node_modules/.bin/lessc --clean-css public/less/index.less public/css/index.css
$(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),node_modules/.bin/lessc --clean-css public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)

.PHONY: swagger-ui
swagger-ui:
Expand Down
2 changes: 2 additions & 0 deletions custom/conf/app.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ THEME_COLOR_META_TAG = `#6cc644`
MAX_DISPLAY_FILE_SIZE = 8388608
; Whether the email of the user should be shown in the Explore Users page
SHOW_USER_EMAIL = true
; Set the default theme for the Gitea install
DEFAULT_THEME = default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default theme maybe need a name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lunny what about "gitea"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lunny updated


[ui.admin]
; Number of users that are displayed on one page
Expand Down
1 change: 1 addition & 0 deletions docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `EXPLORE_PAGING_NUM`: **20**: Number of repositories that are shown in one explore page.
- `ISSUE_PAGING_NUM`: **10**: Number of issues that are shown in one page (for all pages that list issues).
- `FEED_MAX_COMMIT_NUM`: **5**: Number of maximum commits shown in one activity feed.
- `DEFAULT_THEME`: **default**: Set the default theme for the Gitea install.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe list bundled themes if there is some themes?


### UI - Admin (`ui.admin`)

Expand Down
2 changes: 2 additions & 0 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ var (
ThemeColorMetaTag string
MaxDisplayFileSize int64
ShowUserEmail bool
DefaultTheme string

Admin struct {
UserPagingNum int
Expand All @@ -297,6 +298,7 @@ var (
ReactionMaxUserNum: 10,
ThemeColorMetaTag: `#6cc644`,
MaxDisplayFileSize: 8388608,
DefaultTheme: `default`,
Admin: struct {
UserPagingNum int
RepoPagingNum int
Expand Down
3 changes: 3 additions & 0 deletions modules/templates/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ func NewFuncMap() []template.FuncMap {
"ParseDeadline": func(deadline string) []string {
return strings.Split(deadline, "|")
},
"DefaultTheme": func() string {
return setting.UI.DefaultTheme
Copy link
Member

@jonasfranz jonasfranz Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it may be better to add this as variable to data since this function just acts like a variable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this because this pattern already exists and I am just following. Example see AppUrl above in this file.

},
}}
}

Expand Down
Loading