Drag and drop to reorder users
This commit is contained in:
1 parent
1194bdd9b4
commit
21db2a2cba
21 files changed
+227
-301
No files matched your search
@@ -43,7 +43,7 @@ $(function(){
|
||||
placeholder: 'placeholder',
|
||||
startCollapsed: true,
|
||||
disableNesting: 'no-nest',
|
||||
stop: function(event, ui) {
|
||||
update: function(event, ui) {
|
||||
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: ui.item.index() } );
|
||||
}
|
||||
});
|
||||
|
||||
@@ -80,27 +80,22 @@ $(function() {
|
||||
_data.actionable ? $('#dialog').modal('show') : "";
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#dialog").on(clickEvent, '.delete-item', function() {
|
||||
var _v = [],
|
||||
_t = $t.attr("rel");
|
||||
|
||||
$("tbody .list-check:checked").each(function() {
|
||||
_v.push(this.value);
|
||||
$('.delete-item').on(clickEvent, function() {
|
||||
var _v = [];
|
||||
$("tbody .list-check").each(function() {
|
||||
this.checked && _v.push("ids[]="+this.value)
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url : _t,
|
||||
type:"get",
|
||||
data : {"ids":_v},
|
||||
dataType : "json",
|
||||
success : function(){
|
||||
actionSuccess(_data.checkAction);
|
||||
}
|
||||
})
|
||||
|
||||
var _t = $t.attr("rel");
|
||||
if(_t.indexOf("?") > -1) {
|
||||
$.ajax(_t + "&" + _v.join("&")).done(function() {
|
||||
actionSuccess(_data.checkAction)
|
||||
});
|
||||
} else {
|
||||
$.ajax(_t + "?" + _v.join("&")).done(function() {
|
||||
actionSuccess(_data.checkAction)
|
||||
});
|
||||
}
|
||||
$('#dialog').modal('hide');
|
||||
$('.list-active-btn').addClass('disabled').data('actionable', false);
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
function dragMode() {
|
||||
$('#card-list').sortable({
|
||||
placeholder: "highlight",
|
||||
update: function( event, ui ) {
|
||||
var _userPosition = {};
|
||||
_userPosition.position = $(ui.item).index();
|
||||
_userPosition.id = $(ui.item).data('user-id');
|
||||
$.ajax({
|
||||
url: "<%= Rails.application.routes.url_helpers.update_order_card_admin_users_new_interface_index_path %>",
|
||||
type: 'POST',
|
||||
dataType: 'script',
|
||||
data: {users: _userPosition}
|
||||
});
|
||||
}
|
||||
});
|
||||
$('#card-list').disableSelection();
|
||||
}
|
||||
|
||||
function typeMode() {
|
||||
var _userPosition = [];
|
||||
$('#list-view tbody tr').each(function(i) {
|
||||
$(this).data('user-index', i);
|
||||
});
|
||||
|
||||
$('#member-list').on(clickEvent, '.edit_position', function(e){
|
||||
var $input = $('<input type="text">'),
|
||||
$cross = $('<a class="btn btn-mini"><i class="icons-cross"/></a>');
|
||||
if($(this).siblings('input').length) {
|
||||
$(this).siblings('input').attr('type', 'text').after($cross);
|
||||
} else {
|
||||
$(this).after($cross);
|
||||
$(this).after($input);
|
||||
}
|
||||
$(this).hide();
|
||||
$input.val($(this).text());
|
||||
e.preventDefault();
|
||||
$cross.click(function(event) {
|
||||
$input.remove();
|
||||
$(this).siblings('a').show().end().remove();
|
||||
});
|
||||
});
|
||||
|
||||
$('.bottomnav').on(clickEvent, '.btn', function(e) {
|
||||
_userPosition = [];
|
||||
$('#member-list tbody input').each(function(i) {
|
||||
_userPosition.push([$(this).val(), $(this).siblings('a').data('user-id')]);
|
||||
});
|
||||
$.ajax({
|
||||
url: "<%= Rails.application.routes.url_helpers.update_order_list_admin_users_new_interface_index_path %>",
|
||||
type: 'POST',
|
||||
dataType: 'script',
|
||||
data: {users: _userPosition}
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
//= require basic
|
||||
//= require lib/jquery-ui-1.10.2.custom.min.js
|
||||
//= require jquery.ui.sortable
|
||||
//= require lib/jquery.ui.touch-punch.min.js
|
||||
//= require lib/jquery.mjs.nestedSortable.js
|
||||
//= require lib/items/items
|
||||
|
||||
@@ -125,6 +125,14 @@
|
||||
}
|
||||
|
||||
|
||||
#list-view .checkbox-card li {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 767px) {
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
/* Main List */
|
||||
.main-list {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.main-list tbody {
|
||||
border: 1px solid #dddddd;
|
||||
}
|
||||
.main-list thead {
|
||||
border: 1px solid #454545;
|
||||
}
|
||||
.main-list thead th {
|
||||
vertical-align: middle;
|
||||
background-color: #454545;
|
||||
white-space: nowrap;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.main-list tbody tr.disable td {
|
||||
color: #C5C5C5;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
.main-list tbody tr.disable td .label-info {
|
||||
background-color: #999999;
|
||||
}
|
||||
.main-list tbody tr.active td:first-child {
|
||||
position: relative;
|
||||
}
|
||||
.main-list tbody tr.active td:first-child:before {
|
||||
content: "";
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
left: -21px;
|
||||
top: 50%;
|
||||
margin-top: -6px;
|
||||
position: absolute;
|
||||
border-style: solid;
|
||||
border-width: 6px 0 6px 6px;
|
||||
border-color: transparent transparent transparent #333333;
|
||||
}
|
||||
.main-list td {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.main-list td input[type="text"] {
|
||||
margin-bottom: 0;
|
||||
margin-left: -.4em;
|
||||
margin-right: 3px;
|
||||
padding: 0 .3em;
|
||||
width: 4em;
|
||||
}
|
||||
.main-list td.action {
|
||||
vertical-align: middle;
|
||||
text-align: right;
|
||||
}
|
||||
.main-list td.preview img {
|
||||
width: 100%;
|
||||
}
|
||||
.main-list td .banner-link {
|
||||
width: 100px;
|
||||
max-width: 120px;
|
||||
display: inline-block;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.main-list td .file-list {
|
||||
display: inline-block;
|
||||
margin: 0 0 -6px;
|
||||
}
|
||||
.main-list td .file-list:after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: block;
|
||||
height: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
.main-list td .file-type {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
}
|
||||
.main-list td .file-type a {
|
||||
background-color: #A6A6A6;
|
||||
color: #FFFFFF;
|
||||
margin-right: 10px;
|
||||
padding: 2px 5px 2px 3px;
|
||||
border-radius: 3px;
|
||||
text-decoration: none;
|
||||
text-shadow: 0px -1px 0px rgba(100, 100, 100, .6);
|
||||
}
|
||||
.main-list td .file-type i,
|
||||
.main-forms fieldset .input-area .controls .file-type i {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-bottom: -1px;
|
||||
display: inline-block;
|
||||
}
|
||||
.main-list td .file-type[class^="type-"] i,
|
||||
.main-list td .file-type[class*=" type-"] i,
|
||||
.main-forms fieldset .input-area .controls .file-type[class*=" type-"] i,
|
||||
.main-forms fieldset .input-area .controls .file-type[class^="type-"] i {
|
||||
background-image: url(/orbit_4.0.1/assets/images/file_type.png);
|
||||
}
|
||||
.file-type.type-pdf i {background-position: 0px 0px;}
|
||||
.file-type.type-psd i {background-position: -16px 0px;}
|
||||
.file-type.type-ai i {background-position: -32px 0px;}
|
||||
.file-type.type-fla i {background-position: -48px 0px;}
|
||||
.file-type.type-in i {background-position: -64px 0px;}
|
||||
.file-type.type-acc i {background-position: 0px -16px;}
|
||||
.file-type.type-do i {background-position: -16px -16px;}
|
||||
.file-type.type-xl i {background-position: -32px -16px;}
|
||||
.file-type.type-pp i {background-position: -48px -16px;}
|
||||
.file-type.type-zip i {background-position: -64px -16px;}
|
||||
.file-type.type-txt i {background-position: 0px -32px;}
|
||||
.file-type.type-jp i {background-position: -16px -32px;}
|
||||
.file-type.type-gif i {background-position: -32px -32px;}
|
||||
.file-type.type-png i {background-position: -48px -32px;}
|
||||
.file-type.type-audio i {background-position: -64px -32px;}
|
||||
|
||||
.main-list td .quick-edit {
|
||||
height: 24px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.main-list td .quick-edit .nav {
|
||||
display: none;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.main-list tr:hover .quick-edit .nav {
|
||||
display: block;
|
||||
}
|
||||
.main-list td .quick-edit .nav > li > a {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
border: 1px dotted #d1d1d1;
|
||||
}
|
||||
.main-list td .quick-edit .nav > li > a:hover {
|
||||
border: 1px dotted transparent;
|
||||
}
|
||||
.main-list thead tr.sort-header th a {
|
||||
padding: 8px;
|
||||
margin: -8px;
|
||||
display: block;
|
||||
color: #FFFFFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
.main-list thead tr.sort-header th.active a {
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 4px solid #08c;
|
||||
}
|
||||
.main-list .footable-row-detail td {
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
}
|
||||
.main-list .footable-row-detail td .footable-row-detail-inner {
|
||||
display: none;
|
||||
padding: 8px;
|
||||
position: relative;
|
||||
border-radius: 5px;
|
||||
margin: 0 8px 8px;
|
||||
background-color: #ededed;
|
||||
}
|
||||
.main-list .footable-row-detail td .footable-row-detail-inner:after {
|
||||
display: block;
|
||||
height: 0px;
|
||||
width: 0px;
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: 50%;
|
||||
margin-left: -3px;
|
||||
content: "";
|
||||
border-style: solid;
|
||||
border-width: 0 6px 6px 6px;
|
||||
border-color: transparent transparent #ededed transparent;
|
||||
}
|
||||
.main-list .footable-row-detail td .footable-row-detail-inner div {
|
||||
margin: 10px 0;
|
||||
}
|
||||
#preview .preview {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
/* For Retina */
|
||||
@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (max--moz-device-pixel-ratio: 2) {
|
||||
.main-list td .file-type[class^="type-"] i,
|
||||
.main-list td .file-type[class*=" type-"] i,
|
||||
.main-forms fieldset .input-area .controls .file-type[class*=" type-"] i,
|
||||
.main-forms fieldset .input-area .controls .file-type[class^="type-"] i {
|
||||
background-image: url(/orbit_4.0.1/assets/images/file_type@2x.png);
|
||||
background-size: 80px 48px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 480px) {
|
||||
.main-list td .quick-edit .nav {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,13 @@
|
||||
.main-list td {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.main-list td input[type="text"] {
|
||||
margin-bottom: 0;
|
||||
margin-left: -.4em;
|
||||
margin-right: 3px;
|
||||
padding: 0 .3em;
|
||||
width: 4em;
|
||||
}
|
||||
.main-list td.action {
|
||||
vertical-align: middle;
|
||||
text-align: right;
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
}
|
||||
|
||||
/* List */
|
||||
#list-view #member-list tr.highlight td {
|
||||
background-color: #FFFAE5;
|
||||
}
|
||||
#list-view #member-list tr.highlight td:first-child {
|
||||
padding: 0
|
||||
}
|
||||
#list-view #member-list .gender,
|
||||
#list-view #member-list td[class^="gender-"] {
|
||||
width: 5px;
|
||||
@@ -189,6 +195,10 @@
|
||||
#list-view #member-card > li:hover .member-avatar .action {
|
||||
visibility: visible;
|
||||
}
|
||||
#list-view #member-card .highlight {
|
||||
background-color: #F0F0F0;
|
||||
outline: 1px dashed #9E9E9E;
|
||||
}
|
||||
#list-view #member-card .member-avatar {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
.topnav .btn-group {
|
||||
margin-left: 0;
|
||||
}
|
||||
.topnav .view-switch {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
/* Bottom Nav */
|
||||
.bottomnav {
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
|
||||
#orbit-bar {
|
||||
margin: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-family: "Chivo";
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #333333;
|
||||
|
||||
Reference in new issue
Block a user