popup mark dialog whenever click + sign
This commit is contained in:
parent
d2bfbb727f
commit
b36ba0aa07
16 changed files with 49 additions and 80 deletions
|
@ -25,3 +25,5 @@
|
|||
<link rel="stylesheet" href="{% static 'lib/css/collection.css' %}">
|
||||
<link rel="search"type="application/opensearchdescription+xml" title="{{ site_name }}" href="{% static 'opensearch.xml' %}">
|
||||
<script src="{% static 'catalog.js' %}"></script>
|
||||
<script src="{% static 'lib/js/tag-input.js' %}"></script>
|
||||
<link href="{% static 'lib/css/tag-input.css' %}" type="text/css" media="all" rel="stylesheet">
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
{% endblock %}
|
||||
<title>{{ site_name }} - {% trans item.category.label %} | {{ item.title }}</title>
|
||||
{% include "common_libs.html" with jquery=1 %}
|
||||
<script src="{% static 'lib/js/tag-input.js' %}"></script>
|
||||
<link href="{% static 'lib/css/tag-input.css' %}" type="text/css" media="all" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -15,20 +15,14 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ site_name }} - {% trans '搜索结果' %}</title>
|
||||
<script src="https://cdn.staticfile.org/jquery/3.6.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/htmx/1.8.4/htmx.min.js"></script>
|
||||
<script src="{% static 'lib/js/rating-star.js' %}"></script>
|
||||
<script src="{% static 'js/rating-star-readonly.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'css/boofilsic.min.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'lib/css/rating-star.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'lib/css/collection.css' %}">
|
||||
{% include "common_libs.html" with jquery=1 %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div id="content-wrapper">
|
||||
{% include 'partial/_navbar.html' %}
|
||||
|
||||
|
||||
<section id="content">
|
||||
<div class="grid">
|
||||
<div class="grid__main">
|
||||
|
@ -38,11 +32,11 @@
|
|||
{% if request.GET.q %}
|
||||
<h5 class="entity-list__title">“{{ request.GET.q }}” {% trans '的搜索结果' %}</h5>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if request.GET.tag %}
|
||||
<h5 class="entity-list__title">{% trans '含有标签' %} “{{ request.GET.tag }}” {% trans '的结果' %}</h5>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<ul class="entity-list__entities">
|
||||
{% for item in items %}
|
||||
{% with "list_item_"|add:item.class_name|add:".html" as template %}
|
||||
|
@ -77,32 +71,32 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div class="pagination" >
|
||||
|
||||
|
||||
{% if pagination.has_prev %}
|
||||
<a href="?page=1&{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}" class="pagination__nav-link pagination__nav-link">«</a>
|
||||
<a href="?page={{ pagination.previous_page }}&{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}" class="pagination__nav-link pagination__nav-link--right-margin pagination__nav-link">‹</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% for page in pagination.page_range %}
|
||||
|
||||
|
||||
{% if page == pagination.current_page %}
|
||||
<a href="?page={{ page }}&{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}" class="pagination__page-link pagination__page-link--current">{{ page }}</a>
|
||||
{% else %}
|
||||
<a href="?page={{ page }}&{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}" class="pagination__page-link">{{ page }}</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% if pagination.has_next %}
|
||||
<a href="?page={{ pagination.next_page }}&{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}" class="pagination__nav-link pagination__nav-link--left-margin">›</a>
|
||||
<a href="?page={{ pagination.last_page }}&{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}" class="pagination__nav-link">»</a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% include "search_sidebar.html" %}
|
||||
</div>
|
||||
</section>
|
||||
|
@ -110,8 +104,8 @@
|
|||
{% include 'partial/_footer.html' %}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
document.body.addEventListener('htmx:configRequest', (event) => {
|
||||
event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
{% load static %}
|
||||
{% if sentry_dsn %}
|
||||
<script src="https://browser.sentry-cdn.com/7.7.0/bundle.min.js"></script>
|
||||
<script>
|
||||
if (window.Sentry) Sentry.init({
|
||||
dsn: "{{ sentry_dsn }}",
|
||||
release: "{{ version_hash }}",
|
||||
environment: "{{ settings_module }}",
|
||||
tracesSampleRate: 1.0,
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% if jquery %}
|
||||
<script src="https://cdn.staticfile.org/jquery/3.6.1/jquery.min.js"></script>
|
||||
{% else %}
|
||||
<script src="https://cdn.staticfile.org/cash/8.1.1/cash.min.js"></script>
|
||||
{% endif %}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/htmx/1.8.4/htmx.min.js"></script>
|
||||
<script src="{% static 'lib/js/hyperscript-0.9.7.min.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'css/boofilsic.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'lib/css/rating-star.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'lib/css/collection.css' %}">
|
||||
<link rel="search"type="application/opensearchdescription+xml" title="{{ site_name }}" href="{% static 'opensearch.xml' %}">
|
|
@ -557,9 +557,7 @@ class ShelfManager:
|
|||
self.shelf_list[qt] = Shelf.objects.create(owner=self.owner, shelf_type=qt)
|
||||
|
||||
def locate_item(self, item) -> ShelfMember:
|
||||
return ShelfMember.objects.filter(
|
||||
item=item, parent__in=list(self.shelf_list.values())
|
||||
).first()
|
||||
return ShelfMember.objects.filter(item=item, owner=self.owner).first()
|
||||
|
||||
def move_item(self, item, shelf_type, visibility=0, metadata=None):
|
||||
# shelf_type=None means remove from current shelf
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<title>{{ site_name }} {% trans '收藏单' %} - {{ collection.title }}</title>
|
||||
|
||||
{% include "partial/_common_libs.html" with jquery=1 %}
|
||||
{% include "common_libs.html" with jquery=1 %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ site_name }} - {{ title }}</title>
|
||||
{% include "partial/_common_libs.html" with jquery=1 %}
|
||||
{% include "common_libs.html" with jquery=1 %}
|
||||
<style type="text/css">
|
||||
#id_collaborative li, #id_visibility li {display: inline-block !important;}
|
||||
</style>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<img src="{{ item.cover|thumb:'normal' }}" alt="" class="entity-list__entity-img">
|
||||
</a>
|
||||
{% if not action.taken %}
|
||||
<a class="entity-list__entity-action-icon" hx-post="{{ action.url }}" title="加入想读">➕</a>
|
||||
<a title="加入想读" class="entity-list__entity-action-icon" hx-get="{% url 'journal:mark' item.uuid %}?shelf_type=wishlist" class="edit" hx-target="body" hx-swap="beforeend">➕</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
@ -127,7 +127,7 @@
|
|||
<ul class="entity-marks__mark-list">
|
||||
<li class="entity-marks__mark">
|
||||
<p class="entity-marks__mark-content" hx-target="this" hx-swap="innerHTML">
|
||||
|
||||
|
||||
{% if collection_member.note %} {{ collection_member.note }} {% endif %}
|
||||
{% if collection_edit %}
|
||||
<a class="action-icon" hx-get="{% url 'journal:collection_update_item_note' collection.uuid item.uuid %}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M19,20H5a1,1,0,0,0,0,2H19a1,1,0,0,0,0-2Z"/><path d="M5,18h.09l4.17-.38a2,2,0,0,0,1.21-.57l9-9a1.92,1.92,0,0,0-.07-2.71h0L16.66,2.6A2,2,0,0,0,14,2.53l-9,9a2,2,0,0,0-.57,1.21L4,16.91a1,1,0,0,0,.29.8A1,1,0,0,0,5,18ZM15.27,4,18,6.73,16,8.68,13.32,6Zm-8.9,8.91L12,7.32l2.7,2.7-5.6,5.6-3,.28Z"/></g></svg></a>
|
||||
|
@ -139,4 +139,4 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
</li>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{% endif %}
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ site_name }} - {{ user.mastodon_username }}的评论" href="{{ request.build_absolute_uri }}feed/reviews/">
|
||||
|
||||
{% include "partial/_common_libs.html" with jquery=1 %}
|
||||
{% include "common_libs.html" with jquery=1 %}
|
||||
|
||||
<script src="{% static 'js/mastodon.js' %}" defer></script>
|
||||
<script src="{% static 'js/home.js' %}" defer></script>
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
{% for category, category_shelves in shelf_list.items %}
|
||||
{% for shelf_type, shelf in category_shelves.items %}
|
||||
|
||||
|
||||
<div class="entity-sort" id="{{ category }}_{{ shelf_type }}">
|
||||
<h5 class="entity-sort__label">
|
||||
{{ shelf.title }}
|
||||
|
@ -52,7 +52,7 @@
|
|||
{% for member in shelf.members %}
|
||||
<li class="entity-sort__entity">
|
||||
<a href="{% if shelf_type == 'reviewed' %}{{ member.url }}{% else %}{{ member.item.url }}{% endif %}">
|
||||
<img src="{{ member.item.cover.url }}" alt="{{ member.item.title }}" class="entity-sort__entity-img">
|
||||
<img src="{{ member.item.cover.url }}" alt="{{ member.item.title }}" class="entity-sort__entity-img">
|
||||
<div class="entity-sort__entity-name" title="{{ member.item.title }}"> {{ member.item.title }}</div>
|
||||
</a>
|
||||
</li>
|
||||
|
@ -63,7 +63,7 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
<div class="entity-sort" id="collection_created">
|
||||
<h5 class="entity-sort__label">
|
||||
|
@ -172,7 +172,7 @@
|
|||
<script src="{% static 'js/sort_layout.js' %}"></script>
|
||||
{% endif %}
|
||||
|
||||
{{ layout|json_script:"layout-data" }}
|
||||
{{ layout|json_script:"layout-data" }}
|
||||
<script>
|
||||
const initialLayoutData = JSON.parse(document.getElementById('layout-data').textContent);
|
||||
// initialize sort element visibility and order
|
||||
|
@ -200,4 +200,4 @@
|
|||
{% include "partial/_announcement.html" %}
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -8,12 +8,13 @@ register = template.Library()
|
|||
@register.simple_tag(takes_context=True)
|
||||
def wish_item_action(context, item):
|
||||
user = context["request"].user
|
||||
action = {}
|
||||
if user and user.is_authenticated:
|
||||
action = {
|
||||
"taken": user.shelf_manager.locate_item(item) is not None,
|
||||
"url": reverse("journal:wish", args=[item.uuid]),
|
||||
}
|
||||
return action
|
||||
return action
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<img src="{{ activity.action_object.item.cover|thumb:'normal' }}" alt="" class="entity-list__entity-img" style="min-width:80px;max-width:80px">
|
||||
</a>
|
||||
{% if not action.taken %}
|
||||
<a class="entity-list__entity-action-icon" hx-post="{{ action.url }}">➕</a>
|
||||
<a title="加入想读" class="entity-list__entity-action-icon" hx-get="{% url 'journal:mark' activity.action_object.item.uuid %}?shelf_type=wishlist" class="edit" hx-target="body" hx-swap="beforeend">➕</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="entity-list__entity-text">
|
||||
|
|
|
@ -10,13 +10,12 @@
|
|||
{% load user_actions %}
|
||||
|
||||
{% wish_item_action activity.action_object.item as action %}
|
||||
|
||||
<div class="entity-list__entity-img-wrapper">
|
||||
<a href="{{ activity.action_object.item.url }}">
|
||||
<img src="{{ activity.action_object.item.cover|thumb:'normal' }}" alt="" class="entity-list__entity-img" style="min-width:80px;max-width:80px">
|
||||
</a>
|
||||
{% if not action.take %}
|
||||
<a class="entity-list__entity-action-icon" hx-post="{{ action.url }}">➕</a>
|
||||
{% if not action.taken %}
|
||||
<a title="加入想读" class="entity-list__entity-action-icon" hx-get="{% url 'journal:mark' activity.action_object.item.uuid %}?shelf_type=wishlist" class="edit" hx-target="body" hx-swap="beforeend">➕</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="entity-list__entity-text">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ site_name }} - 数据管理</title>
|
||||
{% include "partial/_common_libs.html" with jquery=1 %}
|
||||
{% include "common_libs.html" with jquery=1 %}
|
||||
<script src="{% static 'js/mastodon.js' %}"></script>
|
||||
<script src="{% static 'js/home.js' %}"></script>
|
||||
</head>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<meta property="og:url" content="{{ request.build_absolute_uri }}">
|
||||
<meta property="og:image" content="{{ request.scheme }}://{{ request.get_host }}{% static 'img/logo_square.jpg' %}">
|
||||
<title>{{ site_name }} - {% trans '登录' %}</title>
|
||||
{% include "partial/_common_libs.html" %}
|
||||
{% include "common_libs.html" %}
|
||||
<link rel="stylesheet" href="https://cdn.staticfile.org/milligram/1.4.1/milligram.min.css">
|
||||
<link rel="stylesheet" href="{% static 'css/boofilsic_edit.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/boofilsic_box.css' %}">
|
||||
|
@ -68,7 +68,7 @@
|
|||
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
|
||||
<input type='submit' value="{% trans '授权登录' %}" id="loginButton" disabled />
|
||||
<script type="text/javascript">if (Cookies.get('mastodon_domain')) $('#domain').val(Cookies.get('mastodon_domain'));</script>
|
||||
{% else %}
|
||||
{% else %}
|
||||
<select name="domain" placeholder="test">
|
||||
{% for site in sites %}
|
||||
<option value="{{ site.domain_name }}" data-client-id="{{ site.client_id }}">@{{ site.domain_name }}</option>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ site_name }} - 设置</title>
|
||||
{% include "partial/_common_libs.html" %}
|
||||
{% include "common_libs.html" %}
|
||||
<script src="{% static 'js/mastodon.js' %}"></script>
|
||||
<script src="{% static 'js/home.js' %}"></script>
|
||||
</head>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<title>{{ site_name }} - {% trans '关注的人' %}</title>
|
||||
{% endif %}
|
||||
|
||||
{% include "partial/_common_libs.html" with jquery=1 %}
|
||||
{% include "common_libs.html" with jquery=1 %}
|
||||
|
||||
<script src="{% static 'js/mastodon.js' %}"></script>
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="grid__aside grid__aside--reverse-order grid__aside--tablet-column">
|
||||
<div class="aside-section-wrapper aside-section-wrapper--no-margin">
|
||||
<div class="user-profile" id="userInfoCard">
|
||||
|
@ -70,15 +70,15 @@
|
|||
</div>
|
||||
<p class="user-profile__bio mast-brief"></p>
|
||||
<!-- <a href="#" class="follow">{% trans '关注TA' %}</a> -->
|
||||
|
||||
|
||||
{% if request.user != user %}
|
||||
<a href="{% url 'users:report' %}?user_id={{ user.id }}"
|
||||
class="user-profile__report-link">{% trans '举报用户' %}</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="relation-dropdown">
|
||||
<div class="relation-dropdown__button">
|
||||
<span class="icon-arrow">
|
||||
|
@ -89,7 +89,7 @@
|
|||
</div>
|
||||
<div class="relation-dropdown__body">
|
||||
<div class="aside-section-wrapper aside-section-wrapper--transparent aside-section-wrapper--collapse">
|
||||
|
||||
|
||||
<div class="user-relation" id="followings">
|
||||
<h5 class="user-relation__label">
|
||||
{% trans '关注的人' %}
|
||||
|
@ -105,7 +105,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="user-relation" id="followers">
|
||||
<h5 class="user-relation__label">
|
||||
{% trans '被他们关注' %}
|
||||
|
@ -121,11 +121,11 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -166,4 +166,4 @@
|
|||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Reference in a new issue