Commit 34e40dda666f10d314d45d51837ccc2a0fb4663b
1 parent
46d367fa
Exists in
master
and in
3 other branches
Adjusting double resource page opening and changing link resource to always open…
… in new window (model option)
Showing
2 changed files
with
6 additions
and
7 deletions
Show diff stats
links/views.py
| ... | ... | @@ -93,6 +93,8 @@ class CreateLinkView(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
| 93 | 93 | if not self.object.topic.visible and not self.object.topic.repository: |
| 94 | 94 | self.object.visible = False |
| 95 | 95 | |
| 96 | + self.object.show_window = True | |
| 97 | + | |
| 96 | 98 | self.object.save() |
| 97 | 99 | |
| 98 | 100 | pend_form = pendencies_form.save(commit = False) |
| ... | ... | @@ -256,6 +258,8 @@ class UpdateLinkView(LoginRequiredMixin, LogMixin, generic.edit.UpdateView): |
| 256 | 258 | |
| 257 | 259 | if not self.object.topic.visible and not self.object.topic.repository: |
| 258 | 260 | self.object.visible = False |
| 261 | + | |
| 262 | + self.object.show_window = True | |
| 259 | 263 | |
| 260 | 264 | self.object.save() |
| 261 | 265 | ... | ... |
topics/templates/resources/list.html
| ... | ... | @@ -14,15 +14,10 @@ |
| 14 | 14 | <input type="hidden" class="url_order" value="{% url 'topics:update_resource_order' %}" /> |
| 15 | 15 | |
| 16 | 16 | <h4 class="pull-left list-group-item-heading"> |
| 17 | - {% if resource|class_name == 'link' %} | |
| 18 | - <a href="{{resource|resource_link}}" class="resource_link" target="_blank"> {{resource.name}}</a> | |
| 19 | - {% else %} | |
| 20 | - <a href="{% url resource.access_link resource.slug %}" class="resource_link" {% if resource.show_window %}target="_blank"{% endif %}> | |
| 17 | + <a data-href="{% url resource.access_link resource.slug %}" class="resource_link" {% if resource.show_window %}target="_blank"{% endif %}> | |
| 21 | 18 | |
| 22 | 19 | {{ resource.name }} |
| 23 | 20 | </a> |
| 24 | - {% endif %} | |
| 25 | - | |
| 26 | 21 | </h4> |
| 27 | 22 | |
| 28 | 23 | {% if has_subject_permissions %} |
| ... | ... | @@ -66,7 +61,7 @@ |
| 66 | 61 | upd = $(this).find('a.edit').is(e.target); |
| 67 | 62 | |
| 68 | 63 | if (!arrow && !menu && !del && !upd && !btn) { |
| 69 | - var link = $(this).find('.resource_link').attr('href'), | |
| 64 | + var link = $(this).find('.resource_link').data('href'), | |
| 70 | 65 | target = $(this).find('.resource_link').attr('target'); |
| 71 | 66 | |
| 72 | 67 | if (typeof(target) != 'undefined') { | ... | ... |