Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

commentary_share_option_update #414

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion sefaria/local_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@


################ These are things you DO NOT NEED to touch unless you know what you are doing. ##############################
DEBUG = os.getenv("DEBUG", False)
DEBUG = os.getenv("DEBUG", True)

REMOTE_HOSTS = os.getenv('REMOTE_HOSTS', 'staging.pecha.org').replace(" ", "")

Expand Down
23 changes: 22 additions & 1 deletion static/js/TextList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class TextList extends Component {
<ConnectionButtons>
<OpenConnectionTabButton srefs={[link.sourceRef]} openInTabCallback={this.props.onTextClick}/>
<AddConnectionToSheetButton srefs={[link.sourceRef]} addToSheetCallback={this.props.setConnectionsMode}/>
<ShareConnectionButton srefs={[link.sourceRef]} setConnectionsMode={this.props.setConnectionsMode}/>
{Sefaria.is_moderator ?
<DeleteConnectionButton delUrl={"/api/links/" + link._id} connectionDeleteCallback={this.onDataChange}/> : null
}
Expand Down Expand Up @@ -357,6 +358,26 @@ const AddConnectionToSheetButton = ({srefs, addToSheetCallback, versions= {"en":
);
}


const ShareConnectionButton = ({srefs, setConnectionsMode}) => {
/*
ConnectionButton composite element. Goes inside a ConnectionButtons
Takes a ref(s) and callback to open sharing UI
*/
const handleShare = () => {
setConnectionsMode("Share", {"connectionRefs": srefs});
}

return (
<SimpleLinkedBlock
aclasses={"connection-button share-link"}
onClick={handleShare}
en={"Share"}
he={"རྒྱུད་སྤེལ།"}
/>
);
}

const ConnectionButtons = ({children}) =>{
/* This is basically just a composition container, and allows to apply css rules to a container for connection buttons.
can also be expanded to use a default set of connection buttons, if not children are present?
Expand All @@ -369,4 +390,4 @@ const ConnectionButtons = ({children}) =>{
}


export {TextList as default, ConnectionButtons, AddConnectionToSheetButton, OpenConnectionTabButton, DeleteConnectionButton};
export {TextList as default, ConnectionButtons, AddConnectionToSheetButton, OpenConnectionTabButton, DeleteConnectionButton, ShareConnectionButton};