Merge branch 'development' of https://github.com/Rulingcom/orbit into 0917_ntu_mb
Bring Development Related Changes to ntu_mb
This commit is contained in:
commit
096aec3406
58 files changed
+438
-258
No files matched your search
@@ -29,6 +29,9 @@
|
||||
//column="true" this option is only for column layout... the columns will be formed on this column=true attribute and it should be a div
|
||||
//item=true this attribute should be present in the li tag. li with this attribute are considered as a separate item.
|
||||
|
||||
//enableLanguageSelect( dom ) children <a> will be binded with language, data-lang = string ex "en"|"zh_tw" will toggle all data-langunage throughout the page
|
||||
//enableSharing( dom ) children <a> will be binded with share, data-mode = string ex "public"|"private" will change the mode for all the selected items. the dom with class should have data-link = url data-var = vaiable_name, default will be mode
|
||||
|
||||
|
||||
$.extend($.expr[':'], {
|
||||
'containsi': function (elem, i, match, array) {
|
||||
@@ -1881,6 +1884,35 @@ var orbitDesktop = function(dom){
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
this.enableSharing = function( dom ){
|
||||
var el = $( dom ),
|
||||
variable = ( el.data( 'var' ) ? el.data( "var" ) : "mode"),
|
||||
_url = el.data( 'link' ) + "?" + variable + "=",
|
||||
classes = [];
|
||||
|
||||
el.find( "a" ).each( function(){
|
||||
classes.push( $( this ).attr( "item-class" ) ? $( this ).attr( "item-class" ) : $( this ).data( 'mode' ) );
|
||||
})
|
||||
|
||||
el.find( "a" ).click( function(){
|
||||
var ids = [],
|
||||
mode = $( this ).data( 'mode' ),
|
||||
inject_class = $( this ).attr( 'item-class' ) ? $( this ).attr( 'item-class' ) : mode;
|
||||
|
||||
$( ".overview li[item=true] a.icon-check" ).each( function(){
|
||||
ids.push( $( this ).data( 'id' ) );
|
||||
$( "li[data-id="+ $( this ).data( 'id' ) +"]").removeClass( classes.join( " " ) ).addClass( inject_class );
|
||||
})
|
||||
$.ajax({
|
||||
url : _url + mode,
|
||||
data : {"ids" : ids},
|
||||
datatype : "json",
|
||||
})
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
this.minimizeBarManager = function(){
|
||||
var minimizedApps = [],
|
||||
minimizeBar = $("#minimizebar");
|
||||
|
||||
@@ -81,25 +81,26 @@ $(function() {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#dialog").on('show', function (e) {
|
||||
$(this).find('.delete-item').on(clickEvent, function() {
|
||||
var _v = [];
|
||||
$("tbody .list-check").each(function() {
|
||||
this.checked && _v.push("ids[]="+this.value)
|
||||
});
|
||||
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").on(clickEvent, '.delete-item', function() {
|
||||
var _v = [],
|
||||
_t = $t.attr("rel");
|
||||
|
||||
$("tbody .list-check:checked").each(function() {
|
||||
_v.push(this.value);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url : _t,
|
||||
type:"get",
|
||||
data : {"ids":_v},
|
||||
dataType : "json",
|
||||
success : function(){
|
||||
actionSuccess(_data.checkAction);
|
||||
}
|
||||
$('#dialog').modal('hide');
|
||||
$('.list-active-btn').addClass('disabled').data('actionable', false);
|
||||
e.preventDefault();
|
||||
})
|
||||
});
|
||||
|
||||
$('#dialog').modal('hide');
|
||||
$('.list-active-btn').addClass('disabled').data('actionable', false);
|
||||
})
|
||||
|
||||
});
|
||||
@@ -19,6 +19,14 @@
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
.form_fix {
|
||||
textarea {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
input {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
// fixed width column with 12px gutter
|
||||
// 276px width for 8 columns
|
||||
// 420px width for 12 columns
|
||||
|
||||
@@ -323,6 +323,29 @@ a.admtxt.admbg2:hover {
|
||||
float: left; }
|
||||
.docklist .d_cate:hover .dock_child {
|
||||
display: block; }
|
||||
.disable {
|
||||
opacity: .3;
|
||||
}
|
||||
.disable a {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.private {
|
||||
position: relative;
|
||||
padding-right: 10px;
|
||||
width: 300px;
|
||||
opacity: .3 !important;
|
||||
}
|
||||
.private:after {
|
||||
content: "\e073";
|
||||
display: inline-block;
|
||||
font-family: 'entypo';
|
||||
font-size: 1.5em;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
text-decoration: inherit;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.fn_des.admtxt {
|
||||
line-height: 60px;
|
||||
@@ -714,7 +737,8 @@ a.admtxt.admbg2:hover {
|
||||
|
||||
/* list item */
|
||||
.list_t_item {
|
||||
overflow: hidden; }
|
||||
overflow: hidden;
|
||||
height: 100px; }
|
||||
|
||||
.list_t_title {
|
||||
padding-bottom: 6px;
|
||||
@@ -748,7 +772,8 @@ a.admtxt.admbg2:hover {
|
||||
-webkit-text-size-adjust: none; }
|
||||
.list_item_function a :first-child {
|
||||
margin-left: 0; }
|
||||
.datalist_item:hover .list_item_function {
|
||||
.datalist_item:hover .list_item_function,
|
||||
.list_t_item:hover .list_item_function {
|
||||
bottom: 0; }
|
||||
|
||||
/* App */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -240,6 +240,32 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def edit_order
|
||||
@users = User.not_guest_user
|
||||
end
|
||||
|
||||
def update_order
|
||||
if params[:users].present?
|
||||
params[:users].values.sort.each do |pair|
|
||||
to_go = pair[0].to_i
|
||||
if to_go > 0
|
||||
user_at_position = User.where(position: to_go - 1).first
|
||||
user = User.find(pair[1])
|
||||
if user_at_position && !user_at_position == user
|
||||
if user.position > user_at_position.position
|
||||
user.move_above(user_at_position)
|
||||
else
|
||||
user.move_below(user_at_position)
|
||||
end
|
||||
elsif to_go > User.count
|
||||
user.move_to_bottom
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@users = User.not_guest_user
|
||||
end
|
||||
|
||||
protected
|
||||
def get_tags
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
class User
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Tree
|
||||
include Mongoid::Tree::Ordering # use mongoid-tree because mongoid-ordering needs mongoid(~>3.0)
|
||||
include Mongoid::Timestamps
|
||||
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable #, :timeoutable
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<% if is_admin? %>
|
||||
<%= link_to(new_admin_users_new_interface_path,:class=> "btn btn-primary pull-right") do%>
|
||||
<i class="icon-plus"></i><%= t(:add)%>
|
||||
<% end -%>
|
||||
<%end -%>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @users, :params => {:inner => false}%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<% if is_admin? %>
|
||||
<%= link_to t(:edit_order), edit_order_admin_users_new_interface_index_path, :class => "btn btn-primary" %>
|
||||
<%= link_to(new_admin_users_new_interface_path,:class=> "btn btn-primary") do %>
|
||||
<i class="icon-plus"></i><%= t(:add) %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @users, :params => {:inner => false} %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<%
|
||||
if user_edit_order.sex == 'male'
|
||||
@user_sex = 'gender-man'
|
||||
elsif user_edit_order.sex == 'female'
|
||||
@user_sex = 'gender-woman'
|
||||
else
|
||||
@user_sex = 'gender-none'
|
||||
end
|
||||
%>
|
||||
<tr id="<%= dom_id user_edit_order %>">
|
||||
<td class="<%= @user_sex %>"></td>
|
||||
<td><%= link_to user_edit_order.position + 1, '#', class: 'edit_position', 'data-user-id' => user_edit_order.id %></td>
|
||||
<td><%= link_to user_edit_order.name, admin_users_new_interface_path(user_edit_order) %></td>
|
||||
<td><%= user_edit_order.email %></td>
|
||||
</tr>
|
||||
@@ -0,0 +1,65 @@
|
||||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'admin/users_new_interface/side_bar' %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_css do -%>
|
||||
<%= stylesheet_link_tag "lib/member" %>
|
||||
<% end -%>
|
||||
|
||||
<div id="list-view">
|
||||
<table id="member-list" class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<th class="gender"></th>
|
||||
<th class="span2"><a href="#"><%= t(:position) %></a></th>
|
||||
<th class="span4"><a href="#"><%= t(:name) %></a></th>
|
||||
<th><a href="#"><%= t(:email) %></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render partial: "user_edit_order", collection: @users %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to t(:update_), '#', class: "btn btn-primary pull-right" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<script>
|
||||
$(function(){
|
||||
var _userPosition = [];
|
||||
$('#member-list').on(clickEvent, '.edit_position', function(e){
|
||||
var $input = $('<input type="text">');
|
||||
var $cross = $('<a class="btn btn-mini"><i class="icons-cross"/></a>');
|
||||
$(this).after($cross);
|
||||
$(this).after($input);
|
||||
$(this).hide();
|
||||
$input.val($(this).text()).attr('id', $(this).data('user-id'));
|
||||
e.preventDefault();
|
||||
$cross.click(function(event) {
|
||||
$input.remove();
|
||||
$(this).siblings('a').show().end().remove();
|
||||
});
|
||||
});
|
||||
|
||||
$('.bottomnav').on(clickEvent, '.btn', function(e) {
|
||||
$('#member-list tbody input').each(function() {
|
||||
_userPosition.push([$(this).val(), $(this).attr('id')])
|
||||
});
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: '<%= update_order_admin_users_new_interface_index_path %>',
|
||||
type: 'POST',
|
||||
dataType: 'script',
|
||||
data: {users: _userPosition}
|
||||
}).done(function() {
|
||||
_userPosition = [];
|
||||
console.log(_userPosition)
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
@@ -5,7 +5,6 @@
|
||||
<%= render :partial => "js_and_css"%>
|
||||
|
||||
<% content_for :page_specific_javascript do -%>
|
||||
<%= javascript_include_tag "lib/jquery.lite.image.resize.js" %>
|
||||
<%= javascript_include_tag "lib/member/member.js" %>
|
||||
<%= javascript_include_tag "lib/footable-0.1.js" %>
|
||||
<% end -%>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
$('#list-view table tbody').html("<%= j render partial: 'user_edit_order', collection: @users %>")
|
||||
@@ -1,4 +1,4 @@
|
||||
<script type='text/javascript' src='/assets/jquery.cycle.all.latest.js'></script>
|
||||
<%= javascript_include_tag "lib/jquery.cycle.all.latest.js"%>
|
||||
<div style='position:relative'>
|
||||
<ul id='banner_nav' class='clear banner_nav-<%= @ad_banner.title.dehumanize %>'></ul>
|
||||
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'>
|
||||
@@ -24,4 +24,4 @@ $(document).ready(function(){
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
Reference in new issue
Block a user