Browse Source

New sheet title formatting

Russel Neiss 3 months ago
parent
commit
09ed276baf
5 changed files with 25 additions and 22 deletions
  1. 5 1
      sourcesheets/views.py
  2. 10 15
      static/css/s2.css
  3. 9 3
      static/js/Sheet.jsx
  4. 0 2
      static/js/SheetMetadata.jsx
  5. 1 1
      static/js/sefaria/sefaria.js

+ 5 - 1
sourcesheets/views.py

@@ -632,7 +632,11 @@ def sheet_api(request, sheet_id):
 	API for accessing and individual sheet.
 	"""
 	if request.method == "GET":
-		sheet = get_sheet(int(sheet_id))
+		more_data = request.GET.get('more_data', '0')
+		if more_data == '1':
+			sheet = get_sheet_for_panel(int(sheet_id))
+		else:
+			sheet = get_sheet(int(sheet_id))
 		return jsonResponse(sheet, callback=request.GET.get("callback", None))
 
 	if request.method == "POST":

+ 10 - 15
static/css/s2.css

@@ -1139,13 +1139,15 @@ a.readerNavCategory {
   margin-bottom: 8px;
   letter-spacing: 1px;
 }
-.readerTextTableOfContents .tocTitle {
+.readerTextTableOfContents .tocTitle,
+.sheetContent .title {
   text-align: center;
   font-size: 28px;
   line-height: 1.3;
 }
 .readerTextTableOfContents .currentSection,
-.readerTextTableOfContents .authorStatement {
+.readerTextTableOfContents .authorStatement,
+.sheetContent .sheetMetaDataBox .authorStatement {
   font-size: 17px;
   color: #999;
   font-family: "proxima-nova", "Helvetica Neue", "Helvetica", sans-serif;
@@ -2449,7 +2451,7 @@ a.readerNavCategory {
 }
 .narrowColumn .textRange.basetext {
 }
-.textRange.basetext .title, .sheetContent .title{
+.textRange.basetext .title, .sheetContent .customSourceTitle{
   padding: 0 28px;
   margin: 24px 0;
   color: #999;
@@ -2461,7 +2463,7 @@ a.readerNavCategory {
 .dark .textRange.basetext .title, .dark .sheetContent .title {
   color: #ccc;
 }
-.textRange.basetext .title .titleBox, .sheetContent .title .titleBox {
+.textRange.basetext .title .titleBox, .sheetContent .customSourceTitle .titleBox {
   display: inline-block;
   border-bottom: 4px solid #E6E5E6;
   padding: 0 6px 3px;
@@ -4966,13 +4968,6 @@ span.purim-emoji img{
   width: 100%;
 }
 
-.readerPanel .sheetContent h3 {
-  margin-bottom: -15px;
-}
-
-
-
-
 .readerPanel.hebrew .sheetItem .he {
   display: block;
 }
@@ -4980,8 +4975,7 @@ span.purim-emoji img{
 .readerPanel.english .sheetItem .en {
   display: block;
 }
-
-.sheetsInPanel .title {
+.sheetContent .customSourceTitle {
   padding: 0 28px;
   margin: 24px 0;
   color: #999;
@@ -5060,6 +5054,7 @@ span.purim-emoji img{
 
 }
 
-.customSourceTitle {
-
+.sheetMetaDataBox {
+  margin: 40px auto;
+  text-align: center;
 }

+ 9 - 3
static/js/Sheet.jsx

@@ -84,6 +84,7 @@ class Sheet extends Component {
       content = (<LoadingMessage />);
     }
     else {
+
       content = (
           <SheetContent
             sources={sheet.sources}
@@ -92,6 +93,7 @@ class Sheet extends Component {
             onSegmentClick={this.props.onSegmentClick}
             highlightedNodes={this.props.highlightedNodes}
             scrollDir = {this.state.scrollDir}
+            authorStatement = {sheet.ownerName}
           />
       )
     }
@@ -255,7 +257,12 @@ class SheetContent extends Component {
 
     return (
       <div className="sheetContent">
-        <div className="title"><div className="titleBox" role="heading" aria-level="2"><span className="en">{this.props.title.stripHtml()}</span><span className="he">{this.props.title.stripHtml()}</span></div></div>
+        <div className="sheetMetaDataBox">
+            <div className="title" role="heading" aria-level="1"><span className="en">{this.props.title.stripHtml()}</span><span className="he">{this.props.title.stripHtml()}</span></div>
+
+            <div className="authorStatement">{this.props.authorStatement}</div>
+
+        </div>
         <div className="text">
             <div className="textInner">{sources}</div>
         </div>
@@ -275,7 +282,6 @@ class SheetSource extends Component {
       var linkScore = linkCount ? Math.min(linkCount + minOpacity, maxOpacity) / 100.0 : 0;
       var style = {opacity: linkScore};
 
-
       if (this.props.source.options) {
         var heSourceClasses = classNames({he: 1, forceDisplayOverrideEn: this.props.source.options.sourceLanguage == "english", forceDisplayOverrideHe: this.props.source.options.sourceLanguage == "hebrew", forceDisplayOverrideBi: this.props.source.options.sourceLanguage == "bilingual"});
         var enSourceClasses = classNames({en: 1, forceDisplayOverrideEn: this.props.source.options.sourceLanguage == "english", forceDisplayOverrideHe: this.props.source.options.sourceLanguage == "hebrew", forceDisplayOverrideBi: this.props.source.options.sourceLanguage == "bilingual"});
@@ -295,7 +301,7 @@ class SheetSource extends Component {
 
 
       <div className={this.props.highlightedNodes == this.props.source.node ? "sheetItem segment highlight" : "sheetItem segment"} onClick={this.sheetSourceClick} aria-label={"Click to see " + this.props.linkCount +  " connections to this source"} tabIndex="0" onKeyPress={function(e) {e.charCode == 13 ? this.sheetSourceClick(e):null}.bind(this)} >
-          {this.props.source.title ? <h3 className="customSourceTitle">{this.props.source.title.stripHtml()}</h3> : null}
+          {this.props.source.title ? <h3 className="customSourceTitle"><div class="titleBox">{this.props.source.title.stripHtml()}</div></h3> : null}
         <div className="segmentNumber sheetSegmentNumber sans">
           <span className="en"> <span className="segmentNumberInner">{this.props.sourceNum}</span> </span>
           <span className="he"> <span

+ 0 - 2
static/js/SheetMetadata.jsx

@@ -185,8 +185,6 @@ class SheetMetadata extends Component {
     var title = this.props.sheet.title;
     var authorStatement;
 
-    console.log(this.props)
-
     if (this.props.sheet.attribution) {
       authorStatement = this.props.sheet.attribution;
     }

+ 1 - 1
static/js/sefaria/sefaria.js

@@ -1449,7 +1449,7 @@ Sefaria = extend(Sefaria, {
       if (sheet) {
         if (callback) { callback(sheet); }
       } else {
-        var url = "/api/sheets/" + id;
+        var url = "/api/sheets/" + id +"?more_data=1";
          $.getJSON(url, function(data) {
             this._loadSheetByID[id] = data;
             if (callback) { callback(data); }