Skip to content

Commit

Permalink
Merge pull request #4547 from Yashs911/rename-bodyid
Browse files Browse the repository at this point in the history
Rename 'bodyid' to 'cssfile'
  • Loading branch information
cdrini authored Feb 23, 2021
2 parents 5d00b71 + 0428ace commit 9a0a6e4
Show file tree
Hide file tree
Showing 37 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion openlibrary/admin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def admin_processor(handler):
features.loadhook()

# required to give a special look and feel in site template
delegate.context.setdefault('bodyid', 'admin')
delegate.context.setdefault('cssfile', 'admin')
delegate.context.setdefault('usergroup', 'admin')

page = handler()
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/admin/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def delegate(self):

def handle(self, cls, args=(), librarians=False):
# Use admin theme
context.bodyid = "admin"
context.cssfile = "admin"

m = getattr(cls(), web.ctx.method, None)
if not m:
Expand Down
6 changes: 3 additions & 3 deletions openlibrary/plugins/openlibrary/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_homepage():
stats = None
blog_posts = get_blog_feeds()

# render tempalte should be setting ctx.bodyid
# render tempalte should be setting ctx.cssfile
# but because get_homepage is cached, this doesn't happen
# during subsequent called
page = render_template(
Expand All @@ -66,8 +66,8 @@ class home(delegate.page):
def GET(self):
cached_homepage = get_cached_homepage()
# when homepage is cached, home/index.html template
# doesn't run ctx.setdefault to set the bodyid so we must do so here:
web.template.Template.globals['ctx']['bodyid'] = 'home'
# doesn't run ctx.setdefault to set the cssfile so we must do so here:
web.template.Template.globals['ctx']['cssfile'] = 'home'
return web.template.TemplateResult(cached_homepage)

class random_book(delegate.page):
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/openlibrary/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class lists_home(delegate.page):
path = "/lists"

def GET(self):
delegate.context.setdefault('bodyid', 'lists')
delegate.context.setdefault('cssfile', 'lists')
return render_template("lists/home")

class lists(delegate.page):
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/worksearch/subjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def GET(self, key):
'lending_edition_s': '*'
})

delegate.context.setdefault('bodyid', 'subject')
delegate.context.setdefault('cssfile', 'subject')
if not subj or subj.work_count == 0:
web.ctx.status = "404 Not Found"
page = render_template('subjects/notfound.tmpl', key)
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (counts)

$ _x = ctx.setdefault('bodyid', 'admin')
$ _x = ctx.setdefault('cssfile', 'admin')
$ _x = ctx.setdefault('usergroup', 'admin')

$ stats = get_admin_stats()
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/ip/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with ()

$ _x = ctx.setdefault('bodyid', 'admin')
$ _x = ctx.setdefault('cssfile', 'admin')
$ _x = ctx.setdefault('usergroup', 'admin')

$var title: [Admin Center] IP Addresses
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/people/view.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (person, input={}, errors={})

$ _x = ctx.setdefault('bodyid', 'admin')
$ _x = ctx.setdefault('cssfile', 'admin')
$ _x = ctx.setdefault('usergroup', 'admin')

$var title: [Admin Center] $person.displayname
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/sponsorship.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (summary)

$ _x = ctx.setdefault('bodyid', 'admin')
$ _x = ctx.setdefault('cssfile', 'admin')
$ _x = ctx.setdefault('usergroup', 'admin')
$ sort_facet = input(sort='status').sort

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/barcodescanner.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$var title: $_('Barcode Scanner (Beta)')

$ ctx.setdefault('bodyid', 'barcodescanner')
$ ctx.setdefault('cssfile', 'barcodescanner')

<div id="page-barcodescanner">
<div id="interactive" class="viewport"></div>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/books/daisy.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$var title: $page.title

$ _x = ctx.setdefault('bodyid', 'plain')
$ _x = ctx.setdefault('cssfile', 'plain')

$ daisy = "//archive.org/download/XXX/XXX_daisy.zip"

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/borrow_admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$var title: $page.title

$ _x = ctx.setdefault('bodyid', 'plain')
$ _x = ctx.setdefault('cssfile', 'plain')

$ available_loans = page.get_available_loans()

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/borrow_admin_no_update.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$var title: $page.title

$ _x = ctx.setdefault('bodyid', 'plain')
$ _x = ctx.setdefault('cssfile', 'plain')

$ available_loans = page.get_available_loans()

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/covers/add.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (doc, data={}, status=None)

$putctx('bodyid', 'form')
$putctx('cssfile', 'form')
$putctx('robots', 'noindex,nofollow')

$if doc.type.key == "/type/author":
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/covers/manage.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (key, images)

$putctx("bodyid", "form")
$putctx("cssfile", "form")
$putctx('robots', 'noindex,nofollow')

<div class="imageIntro">
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/covers/saved.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (image, showinfo=True)

$putctx("bodyid", "form")
$putctx("cssfile", "form")

<script type="text/javascript">
<!--
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/design.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with()
$# /developers/design
$ _x = ctx.setdefault('bodyid', 'design')
$ _x = ctx.setdefault('cssfile', 'design')

<div class="design-pattern-library">
<h1>Design Pattern Library</h1>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/edit_yaml.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (key, data)

$putctx('bodyid', 'edit')
$putctx('cssfile', 'edit')

$var title: $key

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/home/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (stats=None, blog_posts=None, test=False)

$ _x = ctx.setdefault('bodyid', 'home')
$ _x = ctx.setdefault('cssfile', 'home')
$var title: $_("Welcome to Open Library")

$ meta_description = "Open Library is an open, editable library catalog, building towards a web page for every book ever published."
Expand Down
6 changes: 3 additions & 3 deletions openlibrary/templates/site/body.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$def with (page)

$ bodyid = ctx.get('bodyid', 'user')
$ cssfile = ctx.get('cssfile', 'user')
$ bodyclass = ctx.get('bodyclass', [])
$ show_banners = bodyid != 'form'
$ show_banners = cssfile != 'form'
$ bodyattrs = ctx.get('bodyattrs', [])

<body class="$(' '.join(bodyclass))" $:(' '.join(bodyattrs))>
Expand All @@ -17,7 +17,7 @@
$:render_template("site/alert")
$:render_template("lib/nav_head", None)
$# don't render test-body-mobile for iframes
<div $:('id="test-body-mobile"' if bodyid != 'form' else '')>
<div $:('id="test-body-mobile"' if cssfile != 'form' else '')>
$if show_banners:
$#print errors (hidden by default as styles are loaded via JS)
<div class="flash-messages" style="display: none;">
Expand Down
4 changes: 2 additions & 2 deletions openlibrary/templates/site/footer.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
$def with (page=None)

$ bodyid = ctx.get('bodyid', 'user')
$ cssfile = ctx.get('cssfile', 'user')

<div class="clearfix"></div>

$if bodyid == 'user' or 'admin':
$if cssfile == 'user' or 'admin':
$if ("stats" in ctx.features) and query_param('debug'):
$:render_template("site/stats")
$:render_template("lib/nav_foot", page)
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/site/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<link href="/static/images/openlibrary-180x180.png" rel="apple-touch-icon" sizes="180x180" />
<link href="/static/images/openlibrary-192x192.png" rel="icon" sizes="192x192" />
<link href="/static/images/openlibrary-128x128.png" rel="icon" sizes="128x128" />
$ style = 'build/page-%s.css'%ctx.get('bodyid', 'user')
$ style = 'build/page-%s.css'%ctx.get('cssfile', 'user')
<link href="$static_url(style)" rel="stylesheet" type="text/css" />


Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/about/edit.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (page)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_("Edit %(title)s", title=page.key)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/doc/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$ _t = i18n.get_namespace('/type/doc')
$ _ = i18n.get_namespace('/mode/edit')

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_.edit_title(page.key)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/edition/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
$ book_description = (edition and edition.description) or (work and work.description)
$ edition_count = work.edition_count if work and work.edition_count else 1
$ meta_cover_url = item_image((edition or work).get_cover_url("L"), default="https://openlibrary.org/images/icons/avatar_book-sm.png")
$ _x = ctx.setdefault('bodyid', 'book')
$ _x = ctx.setdefault('cssfile', 'book')

$var title: $title

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/i18n/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$ lang = page.key.split('.')[-1]
$ namespace = find_i18n_namespace(page.key)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_("Edit %(title)s", title=page.key)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/list/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$var title: $list.name

$putctx('bodyid', 'form')
$putctx('cssfile', 'form')

$ page = safeint(query_param('page'), 1) - 1
$ page_size = 10
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/macro/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$ _t = i18n.get_namespace('/type/macro')
$ _ = i18n.get_namespace('/mode/edit')

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_.edit_title(page.key)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/macro/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

$:macros.databarTemplate(page)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$:render_template("lib/view_head", page)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/page/edit.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (page)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_("Edit %(title)s", title=page.title or page.key)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/permission/edit.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (page)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_("Edit %(title)s", title=page.key)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/rawtext/edit.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (page)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_("Edit %(title)s", title=page.key)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/rawtext/view.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (page)

$ _x = ctx.setdefault("bodyid", "edit")
$ _x = ctx.setdefault("cssfile", "edit")

$var title: $page.title

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/template/edit.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (page)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_("Edit %(title)s", title=page.key)

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/template/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$ title = page.title or page.key

$ _x = ctx.setdefault("bodyid", "edit")
$ _x = ctx.setdefault("cssfile", "edit")

$var title: $title

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/user/edit.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (page)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: Editing $page.displayname

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/usergroup/edit.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (page)

$ _x = ctx.setdefault('bodyid', 'edit')
$ _x = ctx.setdefault('cssfile', 'edit')

$var title: $_("Edit %(title)s", title=page.key)

Expand Down

0 comments on commit 9a0a6e4

Please sign in to comment.