mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
FEATURE: optionally show "Powered by Discourse" link to discourse.org (#26162)
This commit is contained in:
parent
83495f656d
commit
9376a2e755
|
@ -0,0 +1,15 @@
|
|||
import icon from "discourse-common/helpers/d-icon";
|
||||
import i18n from "discourse-common/helpers/i18n";
|
||||
|
||||
const PoweredByDiscourse = <template>
|
||||
<a class="powered-by-discourse" href="https://discourse.org">
|
||||
<span class="powered-by-discourse__content">
|
||||
<span class="powered-by-discourse__logo">
|
||||
{{icon "fab-discourse"}}
|
||||
</span>
|
||||
<span>{{i18n "powered_by_discourse"}}</span>
|
||||
</span>
|
||||
</a>
|
||||
</template>;
|
||||
|
||||
export default PoweredByDiscourse;
|
|
@ -59,6 +59,11 @@ export default Controller.extend({
|
|||
return this.capabilities.isAppWebview || this.capabilities.isiOSPWA;
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
showPoweredBy() {
|
||||
return this.showFooter && this.siteSettings.enable_powered_by_discourse;
|
||||
},
|
||||
|
||||
_mainOutletAnimate() {
|
||||
document.body.classList.remove("sidebar-animate");
|
||||
},
|
||||
|
|
|
@ -87,6 +87,10 @@
|
|||
</div>
|
||||
|
||||
<PluginOutlet @name="after-main-outlet" />
|
||||
|
||||
{{#if this.showPoweredBy}}
|
||||
<PoweredByDiscourse />
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<PluginOutlet
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
@import "navs";
|
||||
@import "offline-indicator";
|
||||
@import "pick-files-button";
|
||||
@import "powered-by-discourse";
|
||||
@import "relative-time-picker";
|
||||
@import "add-pm-participants";
|
||||
@import "download-calendar";
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
.powered-by-discourse {
|
||||
.admin-area &,
|
||||
.has-full-page-chat &,
|
||||
.static-login &,
|
||||
.invite-page & {
|
||||
display: none !important;
|
||||
}
|
||||
grid-area: below-content;
|
||||
justify-self: start;
|
||||
font-size: var(--font-down-1);
|
||||
letter-spacing: 0.2px; // extra spacing makes small text easier to read
|
||||
padding: 2px; // animated hover "border" width
|
||||
background: var(--secondary);
|
||||
border-radius: 0.75em;
|
||||
transition: all 0.25s ease-in-out;
|
||||
margin-bottom: 0.45em;
|
||||
color: var(--primary-medium);
|
||||
|
||||
&:visited {
|
||||
color: var(--primary-medium);
|
||||
}
|
||||
|
||||
&__content {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
color: currentColor;
|
||||
background: var(--secondary);
|
||||
border-radius: 0.62em;
|
||||
padding: 0.25em 0.65em 0.25em 0.5em;
|
||||
}
|
||||
|
||||
.d-icon {
|
||||
position: relative;
|
||||
top: 0.05em; // vertical alignment
|
||||
}
|
||||
|
||||
.discourse-no-touch & {
|
||||
&:hover {
|
||||
color: var(--primary-high);
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
// secondary repeat is an intentional buffer
|
||||
background: linear-gradient(
|
||||
45deg,
|
||||
var(--secondary),
|
||||
var(--secondary),
|
||||
var(--secondary),
|
||||
var(--secondary),
|
||||
var(--secondary),
|
||||
#d0232b,
|
||||
#f15d22,
|
||||
#fff9ae,
|
||||
#00a94f,
|
||||
#00aeef
|
||||
);
|
||||
background-size: 300%;
|
||||
animation: d-rainbow-shimmer 0.5s;
|
||||
animation-fill-mode: forwards;
|
||||
animation-timing-function: ease-in-out;
|
||||
animation-delay: 0.15s; // avoid animating on passing hover
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes d-rainbow-shimmer {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4802,6 +4802,7 @@ en:
|
|||
copy: "Copy..."
|
||||
paste: "Paste..."
|
||||
save: "Save as..."
|
||||
powered_by_discourse: "Powered by Discourse"
|
||||
|
||||
# This section is exported to the javascript for i18n in the admin section
|
||||
admin_js:
|
||||
|
|
|
@ -2332,6 +2332,8 @@ en:
|
|||
|
||||
share_anonymized_statistics: "Enable sharing of anonymized usage statistics with CDCK, Inc. (“Discourse”). When this setting is enabled, data concerning the usage of the site is collected and shared in anonymized form, ensuring no personal information is disclosed."
|
||||
|
||||
enable_powered_by_discourse: "Show “Powered by Discourse” link to discourse.org at the bottom of most pages."
|
||||
|
||||
auto_handle_queued_age: "Automatically handle records that are waiting to be reviewed after this many days. Flags will be ignored. Queued posts and users will be rejected. Set to 0 to disable this feature."
|
||||
penalty_step_hours: "Default penalties for silencing or suspending users in hours. First offense defaults to the first value, second offense defaults to the second value, etc."
|
||||
penalty_include_post_message: "Automatically include offending post message in email message template when silencing or suspending a user"
|
||||
|
|
|
@ -2818,6 +2818,10 @@ uncategorized:
|
|||
|
||||
share_anonymized_statistics: true
|
||||
|
||||
enable_powered_by_discourse:
|
||||
default: false
|
||||
client: true
|
||||
|
||||
auto_handle_queued_age:
|
||||
default: 60
|
||||
min: 0
|
||||
|
|
32
spec/system/powered_by_discourse_spec.rb
Normal file
32
spec/system/powered_by_discourse_spec.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "Powered by Discourse", type: :system do
|
||||
it "appears when enabled" do
|
||||
SiteSetting.enable_powered_by_discourse = true
|
||||
|
||||
visit "/"
|
||||
expect(page).to have_css(".powered-by-discourse")
|
||||
end
|
||||
|
||||
it "does not appear on admin routes when enabled" do
|
||||
SiteSetting.enable_powered_by_discourse = true
|
||||
|
||||
visit "/admin"
|
||||
expect(page).not_to have_css(".powered-by-discourse")
|
||||
end
|
||||
|
||||
it "does not appear on login required route when enabled" do
|
||||
SiteSetting.enable_powered_by_discourse = true
|
||||
SiteSetting.login_required = true
|
||||
|
||||
visit "/"
|
||||
expect(page).not_to have_css(".powered-by-discourse")
|
||||
end
|
||||
|
||||
it "does not appear when disabled" do
|
||||
SiteSetting.enable_powered_by_discourse = false
|
||||
|
||||
visit "/"
|
||||
expect(page).not_to have_css(".powered-by-discourse")
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user