Revert "add Member frontend page selection options and fix backend role filter page"

This reverts commit ea3f9c8163.
This commit is contained in:
saurabhbhatia committed 2013-11-15 16:58:11 +08:00
1 parent ea3f9c8163
commit dc5ef21516
20 files changed
+107 -228

No files matched your search

@@ -39,8 +39,10 @@ if($.support.touch) {
if(!$(this).closest('div').hasClass('togglebox')) {
$(this).wrap('<div class="toggle-control"/>');
if($(this).attr('type') == "hidden" && $(this).attr('value') == 'true') {
console.log('true')
$(this).wrap('<div class="togglebox disable" />');
} else {
console.log('false')
$(this).wrap('<div class="togglebox" />');
}
$('<label><b></b></label>').insertAfter($(this));
@@ -71,6 +73,7 @@ if($.support.touch) {
$(this).parent('.togglebox').removeClass('disable').closest('li').removeClass('disabled');
};
} else {
console.log($(this))
if($(this).prop('checked')) {
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
};
@@ -540,6 +543,7 @@ function changeStatusHidden() {
// Document Ready
$(function() {
console.log('true')
showFiltersOnPageRefresh();
new ini();
+1 -2
View File
@@ -3,5 +3,4 @@
//= require lib/all-list
//= require lib/jquery.fastLiveFilter.js
//= require lib/checkbox.card.js
//= require lib/jquery.form.js
//= require lib/member/member-role.js
//= require lib/jquery.form.js
+2 -12
View File
@@ -40,18 +40,8 @@ class Admin::ItemsController < OrbitBackendController
m["main"] = [module_app.label, module_app.id.to_s]
m["sub"] = module_app.app_pages.map{|name, data| [t(data["i18n"]), name]} rescue []
m["sub"] << [I18n.t('default_widget.default_widget'),'default_widget'] if module_app.has_default_widget?
if module_app.key == 'member'
m["category"] = RoleStatus.where(:role_id=> RoleStatus.get_role_data("teacher") ).map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = RoleCategory.where(:role_id=> RoleCategory.get_role_data("teacher") ).map{|category| [category.title, category.id.to_s] } rescue ''
elsif module_app.key == 'member_staff'
m["category"] = RoleStatus.where(:role_id=> RoleStatus.get_role_data("staff") ).map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = RoleCategory.where(:role_id=> RoleCategory.get_role_data("staff") ).map{|category| [category.title, category.id.to_s] } rescue ''
else
m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue ''
end
m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue ''
m["count"] = module_app.get_registration.get_data_count.to_a
module_apps << m
end
+2 -13
View File
@@ -68,19 +68,8 @@ class Admin::PagePartsController < OrbitBackendController
m = {}
m["main"] = [module_app.label, module_app.id.to_s]
m["sub"] = module_app.widgets.map{|name, data| [t(data["i18n"]), name]} rescue []
if module_app.key == 'member'
m["category"] = RoleStatus.can_display.where(:role_id=> RoleStatus.get_role_data("teacher") ).map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = RoleCategory.can_display.where(:role_id=> RoleCategory.get_role_data("teacher") ).map{|category| [category.title, category.id.to_s] } rescue ''
elsif module_app.key == 'member_staff'
m["category"] = RoleStatus.can_display.where(:role_id=> RoleStatus.get_role_data("staff") ).map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = RoleCategory.can_display.where(:role_id=> RoleCategory.get_role_data("staff") ).map{|category| [category.title, category.id.to_s] } rescue ''
else
m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue ''
end
m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue ''
m["count"] = module_app.get_registration.get_data_count.to_a
module_apps << m
end
-2
View File
@@ -3,8 +3,6 @@ class RoleCategory < RoleFilter
has_and_belongs_to_many :users
belongs_to :role
scope :can_display,where(disable: false)
def self.get_role_data(role_key)
@role = Role.where(:key =>role_key).first
+8 -9
View File
@@ -186,21 +186,20 @@ class User
}.uniq!
end
def self.get_member_list_attribute_field(role_type,field_key)
def self.get_member_list_attribute_field_name(role_type,field_key)
@attribute = ::Attribute.where(:key => role_type).first
return ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
return ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first.title
end
def self.get_member_list_attribute_value(user_id,field_id)
# @attribute = ::Attribute.where(:key => role_type).first
# @AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
return ::AttributeValue.where(attribute_field_id: field_id, :user_id => user_id).first
def self.get_member_list_attribute_value(user_id,role_type,field_key)
@attribute = ::Attribute.where(:key => role_type).first
@AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first
end
def self.get_role_member_data_by_sort(role, field_key, role_status_id)
def self.get_role_member_data_by_sort(role_status_id)
a = Array.new
attribute_field_data = get_member_list_attribute_field(role,field_key)
where(:role_status_ids=>role_status_id).desc(:_id).collect{|t| a << [ get_member_list_attribute_value(t.id,attribute_field_data.id)['val'].to_i, t ] }
where(:role_status_ids=>role_status_id).desc(:_id).collect{|t| a << [ get_member_list_attribute_value(t.id,"staff","job_title")['val'].to_i, t ] }
member_data = a.sort
member_data_tmp = member_data.collect {|v| v[1] }
end
@@ -18,7 +18,7 @@
<td class="action span3">
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= attribute.disabled ? 'disabled' : '' %>">
<%= check_box_tag 'accept', attribute.disabled ? 'fasle' : 'true', false ,{ :class => 'toggle-check role_filter_checked', :data=>{:deploy=>"right"}, :data=>{:path=> eval("admin_#{@attribute_type}_toggle_path(attribute)")}, :checked=> attribute.disabled} %>
<%= link_to (check_box_tag 'accept', false , :class => 'toggle-check', :data=>{:deploy=>"right"}) , eval("admin_#{@attribute_type}_toggle_path(attribute)"), method: :post, remote: true, class: "switch" %>
<label><b></b></label>
</div>
</div>
+1 -2
View File
@@ -1,4 +1,3 @@
// $("#attributes_index").html("<%= j render 'admin/attributes/index' %>")
location.reload();
$("#attributes_index").html("<%= j render 'admin/attributes/index' %>")
$.pageslide.close();
openSlide();
@@ -1,5 +1,5 @@
<tr id="<%= dom_id role_filter %>" class="<%= role_filter.disable ? 'disable' : '' %>">
<tr id="<%= dom_id role_filter %>" class="<% role_filter.disable ? 'disable' : '' %>">
<td><span class="label label-info"><%= role_filter.key %></span></td>
<% if @types.is_localized?(:title) %>
<% @site_valid_locales.each_with_index do |locale, i| %>
@@ -18,7 +18,15 @@
<td><%= role_filter.title %></td>
<% end %>
<td class="action dsrgsdgsdg">
<%= check_box_tag 'accept', role_filter.disable ? 'fasle' : 'true', false ,{ :class => 'toggle-check role_filter_checked', :data=>{:deploy=>"right"}, :data=>{:path=> eval("admin_#{@app_type == 'role_statuses' ? 'role_status' : @app_type }_toggle_path(role_filter)")}, :checked=> role_filter.disable} %>
<td class="action">
<%#= link_to role_filter.disable ? t(:disable) : t(:enable), polymorphic_path([:admin, role_filter]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"btn btn-mini btn-success", :type=>"button" %>
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= role_filter.disable ? 'disabled' : '' %>">
<%= link_to (check_box_tag 'accept', false , :class => 'toggle-check', :data=>{:deploy=>"right"}) , eval("admin_#{@app_type == 'role_statuses' ? 'role_status' : @app_type }_toggle_path(role_filter)"), method: :post, remote: true, class: "switch" %>
<label><b></b></label>
</div>
</div>
</td>
</tr>
+9 -2
View File
@@ -1,4 +1,3 @@
<% content_for :side_bar do %>
<%= render :partial => 'admin/users_new_interface/side_bar' %>
<% end %>
@@ -10,6 +9,14 @@
<%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%>
<div id="filter" class="topnav clearfix">
<ul class="breadcrumb text-info pull-left">
<li><%= link_to( t("role"), admin_roles_path ) %> <span class="divider">/</span></li>
<li class="active">( <%= @role.title %> ) <%= t(@app_type_name) %></a></li>
</ul>
</div>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), eval("new_admin_#{@app_type == 'role_statuses' ? 'role_status' : @app_type }_path(:role_id=>params[:role_id])"), class: "btn btn-primary open-slide" %>
@@ -20,4 +27,4 @@
<%= render 'index' %>
</div>
<% @path = "/admin/#{@app_type == 'role_category' ? 'role_categorys' : @app_type }/" %>
+1 -2
View File
@@ -1,4 +1,3 @@
// $("#role_filters_index").html("<%= j render 'index' %>")
location.reload();
$("#role_filters_index").html("<%= j render 'index' %>")
$.pageslide.close();
openSlide();
+8
View File
@@ -2,6 +2,7 @@
<%= render :partial => 'admin/users_new_interface/side_bar' %>
<% end %>
<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
<%= stylesheet_link_tag "lib/pageslide.css" %>
@@ -9,6 +10,13 @@
<%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%>
<div id="filter" class="topnav clearfix">
<ul class="breadcrumb text-info pull-left">
<li><%= link_to( t("#{@attribute_type}"), admin_roles_path ) %>/</span></li>
<li class="active"><%= @attribute.title %></a></li>
</ul>
</div>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i,t("new.sub_role"),:class=>"icon-plus"),eval("admin_#{@attribute_type}_add_sub_role_path(@attribute)"),:class=>"btn btn-primary open-slide"%>
@@ -1 +1 @@
<%=render :partial=>"role",:collection=>Role.where(:disabled=>false).asc("_id")%>
<%=render :partial=>"role",:collection=>Role.all.asc("_id")%>
-8
View File
@@ -24,16 +24,8 @@
<div class="wrap-inner">
<div id="filter" class="topnav clearfix">
<ul class="breadcrumb text-info pull-left">
<% if !@role.blank? %>
<li><%= link_to( t("role"), admin_roles_path ) %> <span class="divider">/</span></li>
<li class="active">( <%= @role.title %> ) <%= t(@app_type_name) %></a></li>
<% elsif !@attribute.blank? %>
<li><%= link_to( t("#{@attribute_type}"), admin_roles_path ) %>/</span></li>
<li class="active"><%= @attribute.title %></a></li>
<% else %>
<li><a href="<%= admin_users_new_interface_index_path %>">Member</a> <span class="divider">/</span></li>
<li class="active">All</li>
<% end %>
</ul>
<%= yield :right_nav %>
</div>