Skip to content

Commit

Permalink
🚚 move share buttons to froide
Browse files Browse the repository at this point in the history
  • Loading branch information
krmax44 committed Apr 15, 2024
1 parent 04783a0 commit 2558c45
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 221 deletions.
21 changes: 14 additions & 7 deletions fragdenstaat_de/fds_cms/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,20 +386,27 @@ class ShareLinksPlugin(CMSPluginBase):
model = ShareLinksCMSPlugin
module = _("Elements")
name = _("Share Links")
render_template = "fds_cms/share_buttons.html"
render_template = "snippets/share_buttons.html"
text_enabled = True
cache = True

def render(self, context, instance, placeholder):
context = super().render(context, instance, placeholder)
url = ""
if "request" in context:
req = context["request"]
url = req.build_absolute_uri()
context["object"] = instance
context["url"] = instance.url or url

context["id"] = instance.pk
context["url"] = instance.url
context["text"] = instance.title
context["image"] = instance.image
context["twitter"] = instance.twitter
context["mastodon"] = instance.mastodon
context["facebook"] = instance.facebook
context["email"] = instance.email
context["clipboard"] = instance.clipboard
context["native_share"] = instance.native_share
context["native_text"] = instance.native_text
context["icons_only"] = instance.icons_only
context["links"] = instance.native_links

return context


Expand Down
1 change: 0 additions & 1 deletion fragdenstaat_de/fds_cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ class ShareLinksCMSPlugin(CMSPlugin):
native_links = models.BooleanField(
_("Link instead of button"),
default=False,
help_text=_("Only applies to the native share button."),
)

def __str__(self):
Expand Down
111 changes: 0 additions & 111 deletions fragdenstaat_de/fds_cms/templates/fds_cms/share_buttons.html

This file was deleted.

3 changes: 2 additions & 1 deletion frontend/javascript/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'froide/frontend/javascript/snippets/copy-text'
import 'froide/frontend/javascript/snippets/form-ajax'
import 'froide/frontend/javascript/snippets/misc'
import 'froide/frontend/javascript/snippets/search'
import 'froide/frontend/javascript/snippets/share-links'
import 'froide/frontend/javascript/snippets/inline-edit-forms'
import 'froide/frontend/javascript/snippets/color-mode'

Expand All @@ -17,7 +18,7 @@ import './smooth-scroll'
import './top-banner'

if (document.body.dataset.sentry !== undefined) {
void import(/* webpackChunkName: "sentry" */ './sentry').then((mod) => {
void import('./sentry').then((mod) => {
if (document.body.dataset.sentry !== undefined) {
mod.init(document.body.dataset.sentry)
}
Expand Down
1 change: 0 additions & 1 deletion frontend/javascript/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import './misc/matomo'
import './misc/reference-forms'
import './misc/reveal-more'
import './misc/secpol-violation'
import './misc/share-links'
import './misc/shuffle-items'
import './misc/userfill-forms'
import './misc/video-modals'
79 changes: 0 additions & 79 deletions frontend/javascript/misc/share-links.ts

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ $fa-font-path: 'font-awesome/fonts';
@import 'froide/frontend/styles/components/redacted';
@import 'froide/frontend/styles/components/request-status';
@import 'froide/frontend/styles/components/type';
@import 'froide/frontend/styles/components/share-buttons';
@import 'froide/frontend/styles/components/print';

@import 'type';
Expand All @@ -132,7 +133,6 @@ $fa-font-path: 'font-awesome/fonts';
@import 'cms_utils';
@import 'cards';
@import 'campaigns';
@import 'share_buttons';
@import 'donations';
@import 'collapsible';
@import 'glider';
Expand Down
20 changes: 0 additions & 20 deletions frontend/styles/share_buttons.scss

This file was deleted.

0 comments on commit 2558c45

Please sign in to comment.