-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feature: custom repo buttons #15532
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
feature: custom repo buttons #15532
Changes from 3 commits
c6ca8e7
8112e68
bad0c3b
a25a598
8f10b46
5cea177
b0125ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2021 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package migrations | ||
|
||
import ( | ||
"fmt" | ||
|
||
"xorm.io/xorm" | ||
) | ||
|
||
func addCustomRepoButtonsConfigRepositoryColumn(x *xorm.Engine) error { | ||
type Repository struct { | ||
CustomRepoButtonsConfig string `xorm:"TEXT"` | ||
} | ||
|
||
if err := x.Sync2(new(Repository)); err != nil { | ||
return fmt.Errorf("sync2: %v", err) | ||
} | ||
return nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1279,6 +1279,22 @@ async function initRepository() { | |
$('.language-stats-details, .repository-menu').slideToggle(); | ||
}); | ||
} | ||
|
||
// custom repo buttons | ||
(function() { | ||
if ($('.repo-buttons').length === 0) { | ||
return; | ||
} | ||
|
||
const $detailModal = $('#detail-modal'); | ||
|
||
$('.show-repo-button-content').on('click', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this would be a good case for @silverwind's jsx PR, as I am concerned with the below line of injecting HTML and it creating an XSS issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not suitable. JSX is when you want to create a DOM structure completely in JS but in this case, it's some pre-rendered Markdown from the server. Generally I don't like putting HTML into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @silverwind How about current way? Thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better, thanks. |
||
$detailModal.find('.content .render-content').html($(this).data('content')); | ||
$detailModal.find('.sub.header').text($(this).data('title')); | ||
$detailModal.modal('show'); | ||
return false; | ||
}); | ||
})(); | ||
} | ||
|
||
function initPullRequestMergeInstruction() { | ||
|
Uh oh!
There was an error while loading. Please reload this page.