Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #837 from kawazrepos/834
Browse files Browse the repository at this point in the history
画像のモーダルが記事中の全ての画像に適応されるようになった closes #834
  • Loading branch information
giginet committed Jan 4, 2015
2 parents 0b22259 + 9abd66b commit c760102
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/kawaz/apps/kfm/tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def test_parse_kfm_attachments(self):
value = parse_kfm(original)
expected = (
'<p><a href="/storage/attachments/kawaztan-material/kawaztan.png" '
'rel="lightbox" data-lightbox="screenshots">\n '
'data-lightbox="article">\n '
'<img src="/storage/attachments/kawaztan-material/kawaztan.png" '
'alt="kawaztan.png" style="max-width: 500px;" />\n'
'</a></p>'
Expand Down
10 changes: 10 additions & 0 deletions src/statics/coffee/lightbox.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$ ->
$imgs = $('.markdown img')
$imgs.each((index) ->
src = $(@).attr('src')
$existingWrapper = $(@).closest('a[data-lightbox]')
unless $existingWrapper.size()
$wrapper = $('<a>').attr('data-lightbox', 'article')
$wrapper.attr('href', src)
$(@).wrap($wrapper)
)
2 changes: 1 addition & 1 deletion src/templates/attachments/embed/image.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a href="{{ material.content_file.url }}" rel="lightbox" data-lightbox="screenshots">
<a href="{{ material.content_file.url }}" data-lightbox="article">
<img src="{{ material.content_file.url }}" alt="{{ material.filename }}" style="max-width: 500px;" />
</a>
1 change: 1 addition & 0 deletions src/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
<script type="text/coffeescript" src="{% static "coffee/tooltip.coffee" %}"></script>
<script type="text/coffeescript" src="{% static "coffee/post.coffee" %}"></script>
<script type="text/coffeescript" src="{% static "coffee/message.coffee" %}"></script>
<script type="text/coffeescript" src="{% static "coffee/lightbox.coffee" %}"></script>
{% endblock %}
{% endcompress %}
{% include "components/god_stamp.html" %}
Expand Down

0 comments on commit c760102

Please sign in to comment.