Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/OpenPecha/Pecha.org into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lungsangg committed Jul 16, 2024
2 parents 622bd1b + 72c5106 commit 6a75a48
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 15 deletions.
2 changes: 1 addition & 1 deletion sefaria/model/topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Topic(abst.SluggedAbstractMongoRecord, AbstractTitledObject):
"image_uri": {
"type": "string",
"required": True,
"regex": "^https://storage\.googleapis\.com/pecha\-topic\-pictures/topics/.*?"
"regex": "^https://storage\.googleapis\.com/pecha\-topic\-picture/topics/.*?"
},
"image_caption": {
"type": "dict",
Expand Down
52 changes: 47 additions & 5 deletions static/css/s2.css
Original file line number Diff line number Diff line change
Expand Up @@ -4346,6 +4346,14 @@ details .open-details::before {
border-bottom: solid 1px #CCC;
}

.language-block .status {
border-bottom: solid 1px #CCC;
}

.language-block .versionDoneStatus {
border-bottom: solid 1px #CCC;
}

.bookPage .versionsBox .versionBlock {
padding-top: 20px;
padding-bottom: 34px;
Expand All @@ -4364,7 +4372,7 @@ details .open-details::before {
color: black;
}

.versionBlock .versionBlockHeading .versionLanguage {
.versionBlock .versionBlockHeading .versionLanguage, .status {
display: none;
}

Expand All @@ -4381,6 +4389,19 @@ details .open-details::before {
padding: 5px 10px;
}

.versionDetails .status {
display: initial;
margin-inline-start: auto;
font-style: normal;
font-weight: normal;
font-size: 14px;
line-height: 18px;
color: #ffffff;
background: var(--pecha-red);
border-radius: 25px;
padding: 5px 10px;
}

.aboutBox .versionBlock .versionTitle:hover {
text-decoration: none;
}
Expand Down Expand Up @@ -11207,7 +11228,7 @@ body #keyboardInputMaster tbody tr td table tbody tr td.pressed {
border-radius: 2px;
}

.versionsBox .versionLanguage {
.versionsBox .versionLanguage, .status {
padding-bottom: 15px;
letter-spacing: 1px;
font-style: normal;
Expand All @@ -11217,15 +11238,15 @@ body #keyboardInputMaster tbody tr td table tbody tr td.pressed {
color: #666666;
}

.interface-hebrew .versionsBox .versionLanguage {
.interface-hebrew .versionsBox .versionLanguage, .status {
direction: ltr;
}

.versionsBox div:not(:first-child) .versionLanguage {
.versionsBox div:not(:first-child) .versionLanguage,.status {
padding-top: 25px;
}

.versionsBox .versionLanguage .versionCount {
.versionsBox .versionLanguage, .status .versionCount {
color: #999;
}

Expand Down Expand Up @@ -14962,6 +14983,27 @@ span.ref-link-color-3 {
cursor: pointer;
}

/*text completion status*/

.label {
color: white;
position: absolute;
top: 5px;
left: 50%;
transform: translateX(-50%);
padding: 3px 8px 0px 8px;
border-radius: 20px;
font-size: 18px;
}

.success {background-color: #04AA6D;} /* Green */
.info {background-color: #2196F3;} /* Blue */
.warning {background-color: #ff9800;} /* Orange */
.danger {background-color: var(--pecha-red);} /* Red */
.other {background-color: #e7e7e7; color: black;} /* Gray */

/*text completion status*/

.image-in-text {
display: flex;
justify-content: center;
Expand Down
2 changes: 1 addition & 1 deletion static/js/ReaderPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ class ReaderPanel extends Component {
/>}

{(items.length > 0 && !menu) ?
<div className="readerContent" style={style}>
<div className="readerContent" style={style}>
{items}
</div> : null}

Expand Down
41 changes: 38 additions & 3 deletions static/js/TextColumn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,41 @@ class TextColumn extends Component {
const ref = $segment.attr("data-ref");
this.props.setTextListHighlight(ref, shouldShowHighlight);
}

setTextCompletionStatus(versions){
if (this.props.interfaceLang == "hebrew") {

if (versions[0].iscompleted == "done") {
return null
} else {
return (
<span class="label danger">{"སྒྲིག་བཞིན་ཡོད།"}</span>
)
}
} else {
if (versions[0].iscompleted == "done") {
return null
} else {
return (
<span class="label danger">{"In progress"}</span>
)
}
}

}

render() {
let classes = classNames({textColumn: 1, connectionsOpen: this.props.mode === "TextAndConnections"});
const index = Sefaria.index(Sefaria.parseRef(this.props.srefs[0]).index);
const versions = Sefaria.getRefFromCache(this.props.srefs[0])?.versions;
const isDictionary = (index && index.categories[0] === "Reference");
let content = this.props.srefs.map((sref) => {
const oref = Sefaria.getRefFromCache(sref);

const isCurrentlyVisible = oref && this.props.currentlyVisibleRef === oref.sectionRef;
return (<TextRange
return (
<div>
<TextRange
panelPosition ={this.props.panelPosition}
sref={sref}
isCurrentlyVisible={isCurrentlyVisible}
Expand Down Expand Up @@ -395,10 +422,13 @@ class TextColumn extends Component {
navigatePanel={this.props.navigatePanel}
translationLanguagePreference={this.props.translationLanguagePreference}
updateCurrVersionsToMatchAPIResult={this.props.updateCurrVersionsToMatchAPIResult}
key={sref} />);
key={sref} />
</div>

);
});

let pre, post, bookTitle;
let pre, post, bookTitle, textStatus;
if (content.length) {
// Add Next and Previous loading indicators
const first = Sefaria.ref(this.props.srefs[0]);
Expand All @@ -421,9 +451,14 @@ class TextColumn extends Component {
post = hasNext && this.state.showScrollPlaceholders ?
<LoadingMessage className="base next" key={"next"}/> :
<LoadingMessage message={" "} heMessage={" "} className="base next final" key={"next"}/>;
textStatus = versions ?
this.setTextCompletionStatus(versions): null

}

return (<div className={classes} onMouseUp={this.handleTextSelection} onClick={this.handleClick} onMouseDown={this.handleDoubleClick}>

{textStatus}
{pre}
{content}
{post}
Expand Down
4 changes: 2 additions & 2 deletions static/js/TextRange.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ class TextRange extends Component {
Sefaria.getText(this.props.sref, settings).then(this.onTextLoad);
} else if (!!data && this.props.isCurrentlyVisible) {
this._updateCurrVersions(data.versionTitle, data.heVersionTitle);
}
}
return data;
}
onTextLoad(data) {
// Initiate additional API calls when text data first loads
// Initiate additional API calls when text data first loads
this.textLoading = false;
if (this.props.basetext && this.props.sref !== data.ref) {
// Replace ReaderPanel contents ref with the normalized form of the ref, if they differ.
Expand Down
31 changes: 28 additions & 3 deletions static/js/VersionBlock/VersionBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,27 @@ class VersionBlock extends Component {
hasExtendedNotes(){
return !!(this.props.version.extendedNotes || this.props.version.extendedNotesHebrew);
}
setTextCompletionStatus(){
if (Sefaria.interfaceLang == "hebrew") {

if (this.props.version.iscompleted == "done") {
return null
} else {
return (
<div className="status sans-serif danger">{"སྒྲིག་བཞིན་ཡོད།"}</div>
)
}
} else {
if (this.props.version.iscompleted == "done") {
return null
} else {
return (
<div className="status sans-serif danger">{"In progress"}</div>
)
}
}

}

render() {
if(this.props.version.title == "Sheet") return null //why are we even getting here in such a case??;
Expand All @@ -206,14 +227,15 @@ class VersionBlock extends Component {
this.props.currObjectVersions, this.props.openVersionInSidebar);
const openVersionInMainPanel = VersionBlockUtils.openVersionInMainPanel.bind(null, this.props.currentRef,
this.props.version, this.props.currObjectVersions, this.props.rendermode, this.props.firstSectionRef, this.props.openVersionInReader);

let textStatus = this.setTextCompletionStatus()

if (this.state.editing && Sefaria.is_moderator) {
// Editing View
let close_icon = (Sefaria.is_moderator)?<i className="fa fa-times-circle" aria-hidden="true" onClick={this.closeEditor}/>:"";

let licenses = Object.keys(Sefaria.getLicenseMap());
licenses = licenses.includes(v.license) ? licenses : [v.license].concat(licenses);

return (
<div className = "versionBlock">
<div className="error">{this.state.error}</div>
Expand Down Expand Up @@ -290,9 +312,11 @@ class VersionBlock extends Component {
/>
</div>
<i className={`fa fa-pencil versionEditIcon ${(Sefaria.is_moderator && this.props.rendermode == "book-page") ? "enabled" : ""}`} aria-hidden="true" onClick={this.openEditor}/>
{this.props.version.iscompleted !=="done" ? <div className="versionLanguage sans-serif">{this.props.version.iscompleted.toUpperCase()}</div>: null}
{/* {this.props.version.iscompleted !=="done" ? <div className="versionLanguage sans-serif">{this.props.version.iscompleted.toUpperCase()}</div>: null} */}

<div className="versionLanguage sans-serif">{showLanguagLabel ? Sefaria._(Sefaria.translateISOLanguageCode(v.actualLanguage)) : ""}</div>
</div>

<div className="versionSelect sans-serif">
<VersionBlockSelectButton
isSelected={this.props.isCurrent}
Expand All @@ -313,6 +337,7 @@ class VersionBlock extends Component {
{ !v.merged ?
<div className="versionDetails sans-serif">
<VersionInformation currentRef={this.props.currentRef} version={v}/>
{textStatus}
<VersionImage version={v}/>
</div> : null
}
Expand Down
2 changes: 2 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@
</script>
{% endif %}

<meta name="google-site-verification" content="IQIF71Vtc74ylIZ1EWMuaQTsk6CyjXLosHkyDNIASic" />


</head>

Expand Down

0 comments on commit 6a75a48

Please sign in to comment.