Commit b2f394a5dd4f03ece344b3f550cf90e2b6dc4963
1 parent
f9af8348
check error not correct remove and sort items
Showing
5 changed files
with
103 additions
and
37 deletions
| ... | ... | @@ -859,7 +859,10 @@ jQuery(document).ready(function () { |
| 859 | 859 | ], |
| 860 | 860 | }); |
| 861 | 861 | |
| 862 | - $this.closest(".wrapper-block").find('> .panel-group').append($data); | |
| 862 | + $this | |
| 863 | + .closest(".wrapper-block") | |
| 864 | + .find("> .panel-group") | |
| 865 | + .append($data); | |
| 863 | 866 | |
| 864 | 867 | $data.find("input:file").each(function () { |
| 865 | 868 | ajaxFileUpload.initFileInput($(this)); |
| ... | ... | @@ -878,6 +881,10 @@ jQuery(document).ready(function () { |
| 878 | 881 | var $this = $(this), |
| 879 | 882 | url = $this.attr("href"); |
| 880 | 883 | |
| 884 | + $(".sort-repeat-row, .delete-repeat-row").addClass( | |
| 885 | + "not-possible-click" | |
| 886 | + ); | |
| 887 | + | |
| 881 | 888 | jQuery.ajax({ |
| 882 | 889 | type: "POST", |
| 883 | 890 | url: url, |
| ... | ... | @@ -885,6 +892,10 @@ jQuery(document).ready(function () { |
| 885 | 892 | if (data.status == "ok") { |
| 886 | 893 | $this.closest(".panel").remove(); |
| 887 | 894 | } |
| 895 | + | |
| 896 | + $(".sort-repeat-row, .delete-repeat-row").removeClass( | |
| 897 | + "not-possible-click" | |
| 898 | + ); | |
| 888 | 899 | }, |
| 889 | 900 | }); |
| 890 | 901 | |
| ... | ... | @@ -902,9 +913,12 @@ jQuery(document).ready(function () { |
| 902 | 913 | $currentItem = $this.closest(".panel"), |
| 903 | 914 | $prevItem = $currentItem.prev(), |
| 904 | 915 | $nextItem = $currentItem.next(), |
| 905 | - repeat_id = $this.data('repeat-id'), | |
| 906 | - parent_id = $this.data('parent-id'); | |
| 916 | + repeat_id = $this.data("repeat-id"), | |
| 917 | + parent_id = $this.data("parent-id"); | |
| 907 | 918 | |
| 919 | + $(".sort-repeat-row, .delete-repeat-row").addClass( | |
| 920 | + "not-possible-click" | |
| 921 | + ); | |
| 908 | 922 | |
| 909 | 923 | if ($this.hasClass("sort-up") && $prevItem) { |
| 910 | 924 | $currentItem.insertBefore($prevItem); |
| ... | ... | @@ -917,13 +931,20 @@ jQuery(document).ready(function () { |
| 917 | 931 | position = 1; |
| 918 | 932 | |
| 919 | 933 | $wrapper.children().each(function (index) { |
| 920 | - data.push({ position: position, index: $(this).data('id').split('_')[1] }); | |
| 934 | + data.push({ | |
| 935 | + position: position, | |
| 936 | + index: $(this).data("id").split("_")[1], | |
| 937 | + }); | |
| 921 | 938 | position += 1; |
| 922 | 939 | }); |
| 923 | 940 | jQuery.ajax({ |
| 924 | 941 | type: "POST", |
| 925 | 942 | url: $wrapper.data("update-url"), |
| 926 | - data: { data: data, repeat_id: repeat_id, parent_id: parent_id}, | |
| 943 | + data: { | |
| 944 | + data: data, | |
| 945 | + repeat_id: repeat_id, | |
| 946 | + parent_id: parent_id, | |
| 947 | + }, | |
| 927 | 948 | success: function (data) { |
| 928 | 949 | if ($this.hasClass("sort-up") && $prevItem) { |
| 929 | 950 | var prevItemId = $prevItem.data("id"), |
| ... | ... | @@ -938,6 +959,9 @@ jQuery(document).ready(function () { |
| 938 | 959 | $currentItem.data("id", nextItemId); |
| 939 | 960 | $nextItem.data("id", currentItemId); |
| 940 | 961 | } |
| 962 | + $(".sort-repeat-row, .delete-repeat-row").removeClass( | |
| 963 | + "not-possible-click" | |
| 964 | + ); | |
| 941 | 965 | }, |
| 942 | 966 | }); |
| 943 | 967 | ... | ... |
| 1 | 1 | .page-list { |
| 2 | - .dd3-content{ | |
| 2 | + .dd3-content { | |
| 3 | 3 | padding: 10px 100px 10px 65px; |
| 4 | 4 | } |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -.dd3-handle.dd3-page-list-handle{ | |
| 7 | +.dd3-handle.dd3-page-list-handle { | |
| 8 | 8 | height: 82px !important; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -.dd3-action{ | |
| 11 | +.dd3-action { | |
| 12 | 12 | position: absolute; |
| 13 | 13 | top: 0px; |
| 14 | 14 | right: 0; |
| 15 | - height: 82px; | |
| 16 | - .dropdown .btn{ | |
| 17 | - height: 82px; | |
| 15 | + height: 82px; | |
| 16 | + .dropdown .btn { | |
| 17 | + height: 82px; | |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | .dd3-disabled { |
| 22 | - .dd3-handle, .dd3-content {opacity:0.5;} | |
| 22 | + .dd3-handle, | |
| 23 | + .dd3-content { | |
| 24 | + opacity: 0.5; | |
| 25 | + } | |
| 23 | 26 | } |
| 24 | 27 | |
| 25 | -.dd-full-width{ | |
| 26 | - max-width:100% !important; | |
| 28 | +.dd-full-width { | |
| 29 | + max-width: 100% !important; | |
| 27 | 30 | } |
| 28 | 31 | |
| 29 | -.text-in-one-string{ | |
| 32 | +.text-in-one-string { | |
| 30 | 33 | white-space: nowrap; |
| 31 | 34 | overflow: hidden; |
| 32 | 35 | display: block; |
| ... | ... | @@ -34,39 +37,71 @@ |
| 34 | 37 | float: none; |
| 35 | 38 | } |
| 36 | 39 | |
| 37 | -.choose-lang{ | |
| 38 | - padding-left:20px; | |
| 40 | +.choose-lang { | |
| 41 | + padding-left: 20px; | |
| 39 | 42 | } |
| 40 | 43 | |
| 41 | -.tt-dataset{ | |
| 44 | +.tt-dataset { | |
| 42 | 45 | max-height: 200px; |
| 43 | - overflow-y: scroll; | |
| 46 | + overflow-y: scroll; | |
| 44 | 47 | } |
| 45 | 48 | |
| 46 | -.gray-theme.fr-toolbar .fr-command.fr-btn.fr-disabled, .gray-theme.fr-popup .fr-command.fr-btn.fr-disabled{ | |
| 47 | - | |
| 49 | +.gray-theme.fr-toolbar .fr-command.fr-btn.fr-disabled, | |
| 50 | +.gray-theme.fr-popup .fr-command.fr-btn.fr-disabled { | |
| 48 | 51 | } |
| 49 | 52 | |
| 50 | -.filter .btn-group-toggle > .btn{margin-bottom:30px;position:relative;background-color: #999999;border-color: #999999;} | |
| 51 | -.filter .btn-group-toggle > .btn .delete-tag-wrapper{position:absolute;top:-30px;left:0;width:100%;height:30px;} | |
| 52 | -.filter .btn-group-toggle > .btn a, .filter .btn-group-toggle > .btn a:hover{text-decoration:none;font-size:14px;line-height:14px;margin-top:10px;display:inline-block;} | |
| 53 | -.filter .btn-group-toggle > .btn .delete-tag-wrapper{display:none;} | |
| 54 | -.filter .btn-group-toggle > .btn:hover .delete-tag-wrapper{display:block;} | |
| 55 | -.filter .btn-group-toggle > .btn:hover{background-color: #5d9cec;border-color: #5d9cec;} | |
| 56 | -.checkbox-list{ | |
| 57 | - input{margin-right:3px;} | |
| 58 | - label{margin-right:10px;} | |
| 53 | +.filter .btn-group-toggle > .btn { | |
| 54 | + margin-bottom: 30px; | |
| 55 | + position: relative; | |
| 56 | + background-color: #999999; | |
| 57 | + border-color: #999999; | |
| 58 | +} | |
| 59 | +.filter .btn-group-toggle > .btn .delete-tag-wrapper { | |
| 60 | + position: absolute; | |
| 61 | + top: -30px; | |
| 62 | + left: 0; | |
| 63 | + width: 100%; | |
| 64 | + height: 30px; | |
| 65 | +} | |
| 66 | +.filter .btn-group-toggle > .btn a, | |
| 67 | +.filter .btn-group-toggle > .btn a:hover { | |
| 68 | + text-decoration: none; | |
| 69 | + font-size: 14px; | |
| 70 | + line-height: 14px; | |
| 71 | + margin-top: 10px; | |
| 72 | + display: inline-block; | |
| 73 | +} | |
| 74 | +.filter .btn-group-toggle > .btn .delete-tag-wrapper { | |
| 75 | + display: none; | |
| 76 | +} | |
| 77 | +.filter .btn-group-toggle > .btn:hover .delete-tag-wrapper { | |
| 78 | + display: block; | |
| 79 | +} | |
| 80 | +.filter .btn-group-toggle > .btn:hover { | |
| 81 | + background-color: #5d9cec; | |
| 82 | + border-color: #5d9cec; | |
| 83 | +} | |
| 84 | +.checkbox-list { | |
| 85 | + input { | |
| 86 | + margin-right: 3px; | |
| 87 | + } | |
| 88 | + label { | |
| 89 | + margin-right: 10px; | |
| 90 | + } | |
| 59 | 91 | } |
| 60 | 92 | |
| 61 | -.block{display:block !important;} | |
| 93 | +.block { | |
| 94 | + display: block !important; | |
| 95 | +} | |
| 62 | 96 | |
| 63 | -.card-header-back{ | |
| 97 | +.card-header-back { | |
| 64 | 98 | margin-bottom: 10px; |
| 65 | 99 | display: inline-block; |
| 66 | 100 | } |
| 67 | 101 | |
| 68 | 102 | .dropdown-item, |
| 69 | -.html-generator .html-content .col-inner .col-operation .dropdown-item a, .html-generator .html-content .row-inner .row-operation .dropdown-item a { | |
| 103 | +.html-generator .html-content .col-inner .col-operation .dropdown-item a, | |
| 104 | +.html-generator .html-content .row-inner .row-operation .dropdown-item a { | |
| 70 | 105 | display: block; |
| 71 | 106 | width: 100%; |
| 72 | 107 | padding: 0.25rem 1.5rem; |
| ... | ... | @@ -77,4 +112,9 @@ |
| 77 | 112 | white-space: nowrap; |
| 78 | 113 | background-color: transparent; |
| 79 | 114 | font-size: 14px !important; |
| 80 | - border: 0; } | |
| \ No newline at end of file | ||
| 115 | + border: 0; | |
| 116 | +} | |
| 117 | + | |
| 118 | +.not-possible-click { | |
| 119 | + pointer-events: none; | |
| 120 | +} | ... | ... |
| ... | ... | @@ -45,6 +45,7 @@ module Kanjai |
| 45 | 45 | template_part = @obj.page.page_template.template_parts.find_by_code(@obj.type_content) |
| 46 | 46 | |
| 47 | 47 | h = {} |
| 48 | + row_items = @obj.page_content_markers.where(repeat_id: params[:repeat_id], parent_id: params[:parent_id]).where.not(row_item: nil).pluck(:row_item).uniq.sort | |
| 48 | 49 | params[:data].each do |key, item| |
| 49 | 50 | h[item[:index].to_i] = item[:position].to_i |
| 50 | 51 | end |
| ... | ... | @@ -53,7 +54,8 @@ module Kanjai |
| 53 | 54 | |
| 54 | 55 | @obj.page_content_markers.where(repeat_id: params[:repeat_id], parent_id: params[:parent_id]).each do |item| |
| 55 | 56 | if h[item.row_item] |
| 56 | - item.update_column(:row_item, h[item.row_item]) | |
| 57 | + new_row_item_index = h[item.row_item] - 1 | |
| 58 | + item.update_column(:row_item, row_items[new_row_item_index]) | |
| 57 | 59 | end |
| 58 | 60 | end |
| 59 | 61 | ... | ... |
| 1 | 1 | <% uuid = SecureRandom.uuid %> |
| 2 | 2 | <% if @row_item.present? %> |
| 3 | - <div class="panel panel-default" data-id="<%= @row_item %>"> | |
| 3 | + <div class="panel panel-default" data-id="<%= uuid %>_<%= @row_item %>"> | |
| 4 | 4 | |
| 5 | 5 | <div class="panel-heading" style="margin-top:20px;margin-bottom:20px;" role="tab" id="heading_<%= @row_item %>"> |
| 6 | 6 | <h4> | ... | ... |