Commit 9b4c827a711057a15977b72c5708f55e8fabb6bf
1 parent
3b923200
add choose and remove file buttons for content type
Showing
2 changed files
with
12 additions
and
12 deletions
| @@ -1670,9 +1670,9 @@ jQuery(document).ready(function(){ | @@ -1670,9 +1670,9 @@ jQuery(document).ready(function(){ | ||
| 1670 | 1670 | ||
| 1671 | $(document).on('click', '.content-choose-image', function(){ | 1671 | $(document).on('click', '.content-choose-image', function(){ |
| 1672 | var $this = $(this), | 1672 | var $this = $(this), |
| 1673 | - $previewWrapper = $this.closest('.btn-group').next(); | 1673 | + $previewWrapper = $this.closest('.btn-group').prev(); |
| 1674 | chooseImageLayer($this.attr('href'), function(img_link, file_type){ | 1674 | chooseImageLayer($this.attr('href'), function(img_link, file_type){ |
| 1675 | - $this.closest('.btn-group').prev().val(img_link); | 1675 | + $this.closest('.btn-group').prev().prev().val(img_link); |
| 1676 | if(file_type == 'image'){ | 1676 | if(file_type == 'image'){ |
| 1677 | var $preview = $('<div class="image-preview-block without-border">' + | 1677 | var $preview = $('<div class="image-preview-block without-border">' + |
| 1678 | '<div class="image-preview">' + | 1678 | '<div class="image-preview">' + |
| @@ -1691,9 +1691,9 @@ jQuery(document).ready(function(){ | @@ -1691,9 +1691,9 @@ jQuery(document).ready(function(){ | ||
| 1691 | 1691 | ||
| 1692 | $(document).on('click', '.content-remove-image', function(){ | 1692 | $(document).on('click', '.content-remove-image', function(){ |
| 1693 | var $this = $(this), | 1693 | var $this = $(this), |
| 1694 | - $previewWrapper = $this.closest('.btn-group').next(); | 1694 | + $previewWrapper = $this.closest('.btn-group').prev(); |
| 1695 | 1695 | ||
| 1696 | - $this.closest('.btn-group').prev().val(''); | 1696 | + $this.closest('.btn-group').prev().prev().val(''); |
| 1697 | $previewWrapper.html(''); | 1697 | $previewWrapper.html(''); |
| 1698 | 1698 | ||
| 1699 | $(this).addClass('not-visible'); | 1699 | $(this).addClass('not-visible'); |
| @@ -10,10 +10,6 @@ | @@ -10,10 +10,6 @@ | ||
| 10 | <% end %> | 10 | <% end %> |
| 11 | <% if form2.object.get_marker_type(@type_content) == 'file' %> | 11 | <% if form2.object.get_marker_type(@type_content) == 'file' %> |
| 12 | <%= form2.hidden_field :text_value %> | 12 | <%= form2.hidden_field :text_value %> |
| 13 | - <div class="btn-group"> | ||
| 14 | - <%= link_to 'Choose Image', get_files_admin_images_url, class: 'btn btn-primary content-choose-image' %> | ||
| 15 | - <%= link_to 'Remove Image', get_files_admin_images_url, class: "btn btn-danger content-remove-image #{form2.object.text_value.present? ? '' : 'not-visible'}" %> | ||
| 16 | - </div> | ||
| 17 | <div class="preview"> | 13 | <div class="preview"> |
| 18 | <% if form2.object.text_value.present? %> | 14 | <% if form2.object.text_value.present? %> |
| 19 | <% if Kanjai::PageContentMarker.image?(form2.object.text_value) %> | 15 | <% if Kanjai::PageContentMarker.image?(form2.object.text_value) %> |
| @@ -27,6 +23,10 @@ | @@ -27,6 +23,10 @@ | ||
| 27 | <% end %> | 23 | <% end %> |
| 28 | <% end %> | 24 | <% end %> |
| 29 | </div> | 25 | </div> |
| 26 | + <div class="btn-group"> | ||
| 27 | + <%= link_to 'Choose Image', get_files_admin_images_url, class: 'btn btn-primary content-choose-image' %> | ||
| 28 | + <%= link_to 'Remove Image', get_files_admin_images_url, class: "btn btn-danger content-remove-image #{form2.object.text_value.present? ? '' : 'not-visible'}" %> | ||
| 29 | + </div> | ||
| 30 | <% end %> | 30 | <% end %> |
| 31 | <% if form2.object.get_marker_type(@type_content) == 'form' %> | 31 | <% if form2.object.get_marker_type(@type_content) == 'form' %> |
| 32 | <div> | 32 | <div> |
| @@ -107,10 +107,6 @@ | @@ -107,10 +107,6 @@ | ||
| 107 | <% end %> | 107 | <% end %> |
| 108 | <% if form2.object.get_marker_type(@type_content) == 'file' %> | 108 | <% if form2.object.get_marker_type(@type_content) == 'file' %> |
| 109 | <%= form2.hidden_field :text_value %> | 109 | <%= form2.hidden_field :text_value %> |
| 110 | - <div class="btn-group"> | ||
| 111 | - <%= link_to 'Choose Image', get_files_admin_images_url, class: 'btn btn-primary content-choose-image' %> | ||
| 112 | - <%= link_to 'Remove Image', get_files_admin_images_url, class: "btn btn-danger content-remove-image #{form2.object.text_value.present? ? '' : 'not-visible'}" %> | ||
| 113 | - </div> | ||
| 114 | <div class="preview"> | 110 | <div class="preview"> |
| 115 | <% if form2.object.text_value.present? %> | 111 | <% if form2.object.text_value.present? %> |
| 116 | <% if Kanjai::PageContentMarker.image?(form2.object.text_value) %> | 112 | <% if Kanjai::PageContentMarker.image?(form2.object.text_value) %> |
| @@ -124,6 +120,10 @@ | @@ -124,6 +120,10 @@ | ||
| 124 | <% end %> | 120 | <% end %> |
| 125 | <% end %> | 121 | <% end %> |
| 126 | </div> | 122 | </div> |
| 123 | + <div class="btn-group"> | ||
| 124 | + <%= link_to 'Choose Image', get_files_admin_images_url, class: 'btn btn-primary content-choose-image' %> | ||
| 125 | + <%= link_to 'Remove Image', get_files_admin_images_url, class: "btn btn-danger content-remove-image #{form2.object.text_value.present? ? '' : 'not-visible'}" %> | ||
| 126 | + </div> | ||
| 127 | <% end %> | 127 | <% end %> |
| 128 | 128 | ||
| 129 | </div> | 129 | </div> |