Skip to content

Commit

Permalink
sarab module and fixed icons and carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjan committed Oct 18, 2023
1 parent c6fc1fc commit f989c39
Show file tree
Hide file tree
Showing 9 changed files with 881 additions and 10 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CASES_DATA_DIR=/cases_data
811 changes: 811 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions docker-stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.8"
services:
nbviewer:
image: gregjan/nbviewer:latest
links:
- nbcache
ports:
- 8080:8080
env_file: .env
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
replicas: 1
volumes:
- "./nbviewer/cases_data:/cases_data"
nbcache:
image: memcached
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
10 changes: 6 additions & 4 deletions nbviewer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@ def nrfoot():

this_dir, this_filename = os.path.split(__file__)
FRONTPAGE_JSON = os.path.join(this_dir, "frontpage.json")
ACA_DOMAINS_JSON = os.path.join(this_dir, "cases_data/ACA_domains.json")
CT_PRACTICES_JSON = os.path.join(this_dir, "cases_data/CT_practices.json")
CASES_THEMES_JSON = os.path.join(this_dir, "cases_data/CASES_themes.json")
CASES_MODULES_JSON = os.path.join(this_dir, "cases_data/CASES_modules.json")
default_cases_data_dir = os.path.join(this_dir, "cases_data")
CASES_DATA_DIR = os.environ.get("CASES_DATA_DIR", default_cases_data_dir)
ACA_DOMAINS_JSON = os.path.join(CASES_DATA_DIR, "ACA_domains.json")
CT_PRACTICES_JSON = os.path.join(CASES_DATA_DIR, "CT_practices.json")
CASES_THEMES_JSON = os.path.join(CASES_DATA_DIR, "CASES_themes.json")
CASES_MODULES_JSON = os.path.join(CASES_DATA_DIR, "CASES_modules.json")
SOLR_URL = "http://localhost:8983/solr"


Expand Down
6 changes: 6 additions & 0 deletions nbviewer/cases_data/CASES_modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
"title": "#RickyRenuncia Project (Puerto Rico)",
"about": "CASES:democracy_decolonization"
},
{
"codeRepository": "https://github.com/cases-umd/WWII-FDR-Morgenthau-Pressing-the-Policy/blob/main/index.ipynb",
"@type": ["schema:LearningResource", "schema:SoftwareSourceCode" ],
"title": "WWII FDR Morgenthau: Pressing the Policy",
"about": "CASES:revealing_untold_stories"
},
{
"codeRepository": "https://github.com/cases-umd/Japanese-American-WWII/blob/master/index.ipynb",
"@type": ["schema:LearningResource", "schema:SoftwareSourceCode" ],
Expand Down
5 changes: 2 additions & 3 deletions nbviewer/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
class Custom404(BaseHandler):
"""Render our 404 template"""

def prepare(self):
# skip parent prepare() step, just render the 404
raise web.HTTPError(404)
def get(self):
self.finish(self.render_template("404.html"))


class IndexHandler(BaseHandler):
Expand Down
5 changes: 3 additions & 2 deletions nbviewer/static/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"requirejs": "~2.1",
"moment": "~2.8.4",
"bootstrap": "components/bootstrap#~3.3",
"font-awesome": "~4",
"pygments": "~2.0.0",
"reveal.js": "~3.1.0"
"reveal.js": "~3.1.0",
"tiny-slider": "~2.9.4",
"jquery-ui": "~1.12.1"
}
}
28 changes: 27 additions & 1 deletion nbviewer/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,33 @@
{% macro head_icon(url, name, icon, download=False) -%}
<li>
<a href="{{ from_base(url) }}" title="{{name}}" {%if download %}download{% endif %}>
<span class="fa fa-{{icon}} fa-2x menu-icon"></span>
<span class="menu-icon">
{% if 'code' == icon %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-file-earmark-code-fill" viewBox="0 0 16 16">
<path d="M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0zM9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1zM6.646 7.646a.5.5 0 1 1 .708.708L5.707 10l1.647 1.646a.5.5 0 0 1-.708.708l-2-2a.5.5 0 0 1 0-.708l2-2zm2.708 0 2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L10.293 10 8.646 8.354a.5.5 0 1 1 .708-.708z"/>
</svg>
{% endif %}
{% if 'server' == icon %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-patch-check-fill" viewBox="0 0 16 16">
<path d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01-.622-.636zm.287 5.984-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7 8.793l2.646-2.647a.5.5 0 0 1 .708.708z"/>
</svg>
{% endif %}
{% if 'github' == icon %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-github" viewBox="0 0 16 16">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>
</svg>
{% endif %}
{% if 'icon-binder' == icon %}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32">
<image width="32" height="32" x="0" y="0" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpKofKGtnomxeZy3noG6dZi+n3vCcpPDcpPGn3bLb4/Mb47UbIrVa4rYoGjdaIbeaIXhoWHmZYHobXvpcHjqdHXreHLroVrsfG/uhGnuh2bwj2Hxk17yl1vzmljzm1j0nlX1olL3AJXWAAAAbXRSTlMAEBAQHx8g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vf2EstUjordGwa/kx9mSJLr8mLLtCW8HHGJc2R5hS219IiF6PnTusOqcMl57gm0Z8kanKMAQg0qSyuZfn7zItsbGyO9QlnxY0eCuD1XL2ys/MsrQhltE7Ug0uFOzufJFE2PxBo/YAx8XPPdDwWN0MrDRYIZF0mSMKCNHgaIVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC"/>
</svg>
{% endif %}
{% if 'download' == icon %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-file-earmark-arrow-down-fill" viewBox="0 0 16 16">
<path d="M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0zM9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1zm-1 4v3.793l1.146-1.147a.5.5 0 0 1 .708.708l-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 0 1 .708-.708L7.5 11.293V7.5a.5.5 0 0 1 1 0z"/>
</svg>
{% endif %}
</span>
<span class="menu-text">{{name}}</span>
</a>
</li>
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def walk_subpkg(name):
+ walk_subpkg("static")
+ walk_subpkg("templates")
+ walk_subpkg("providers")
+ walk_subpkg("cases_data")
)
}

Expand Down

0 comments on commit f989c39

Please sign in to comment.