Add Brief intro. for all personal plugins

Add Share Setting for Personal Plugins ( if have old data must be add default value "field: is_hidden => false " )
Apply New UI to Member Plugin Edit Page
Personal Plugin Summary fix
Academic Info. list fix
This commit is contained in:
Spen authored and saurabhbhatia committed 2013-09-18 18:55:40 +08:00
1 parent b487740035
commit a067bcd304
159 files changed
+5145 -3453

No files matched your search

+105
View File
@@ -0,0 +1,105 @@
var ListCheck = function(element) {
this.element = $(element);
this.element.data('exists', true);
if(this.element.context.parentNode.tagName == "TD") {
this.elementWrap = $(this.element.context.parentNode);
this.elementWrap.addClass('listCheck');
} else if(this.element.context.parentNode.tagName == "TH") {
this.elementWrap = $(this.element.context.parentNode);
this.elementWrap.addClass('listCheckHead');
}
this.element.before('<i class="icon-check-empty" />');
};
$.fn.listCheck = function (callback) {
this.each(function (i) {
if(!$(this).data('exists')) {
new ListCheck(this);
};
});
this.on(clickEvent, function(e) {
if($(this).prop('checked')) {
$(this).siblings('i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
} else {
$(this).siblings('i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
};
if ($(this).closest('.listCheckHead').length) {
$('.listCheck .list-check').prop('checked', $(this).prop('checked'));
if($(this).prop('checked')) {
$('.listCheck i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
} else {
$('.listCheck i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
}
};
var _isCheck = $('tbody .list-check').filter(':checked').length,
_defaultLength = $('tbody .list-check').length;
if(_isCheck > 0 && _isCheck < _defaultLength) {
$('.listCheckHead i').removeClass('icon-check-empty icon-check').addClass('icon-minus');
} else if(!_isCheck) {
$('.listCheckHead i').removeClass('icon-minus icon-check').addClass('icon-check-empty');
} else {
$('.listCheckHead i').removeClass('icon-check-empty icon-minus').addClass('icon-check');
}
_isCheck ? $('.list-active-btn').removeClass('disabled').data('actionable', true) : $('.list-active-btn').addClass('disabled').data('actionable', false);
});
};
function clearCheck() {
$('.list-check').each(function() {
$(this).prop('checked', false);
})
}
function actionSuccess(e) {
$("tbody .list-check").each(function() {
switch(e) {
case 'list-be-hide':
$(this).filter(':checked').closest('tr').addClass('checkHide');
break;
case 'list-be-show':
$(this).filter(':checked').closest('tr').removeClass('checkHide');
break;
case 'list-be-remove':
$(this).filter(':checked').closest('tr').fadeOut(300, function() {
$(this).remove();
});
break;
};
$('.list-check').siblings('i').removeAttr('class').addClass('icon-check-empty').closest('tr').removeClass('checkHit');
});
clearCheck();
}
$(function() {
var $t = null,
_data = null;
clearCheck();
$('.list-check').listCheck();
$('.list-active-btn').data('actionable', false).on(clickEvent, function(e) {
$t = $(this)
_data = $(this).data()
_data.actionable ? $('#dialog').modal('show') : "";
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').modal('hide');
$('.list-active-btn').addClass('disabled').data('actionable', false);
e.preventDefault();
})
});
});
+28
View File
@@ -0,0 +1,28 @@
.table .listCheckHead,
.table .listCheck {
width: 30px;
vertical-align: middle;
padding: 0 0 0 10px!important;
}
.listCheckHead .list-check,
.listCheck .list-check {
position: absolute;
margin: -12px 0 0 -1px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
}
.listCheckHead i,
.listCheck i {
display: block;
}
.checkHide td {
background-color: #E6E6E6 !important;
color: #B9B9B9;
}
.checkHide a {
color: #B9B9B9;
}
.checkHit td {
background-color: #FFFEDB !important;
}
+9 -2
View File
@@ -3,9 +3,9 @@
color: #000;
text-decoration: none;
display: block;
overflow: hidden;
width: 100%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
@@ -364,6 +364,9 @@
#profile #module-navbar {
margin-left: 10px;
}
#profile #module-navbar .navbar {
margin-bottom: 15px;
}
#profile #member-module {
margin-left: 360px;
}
@@ -372,9 +375,13 @@
}
#profile #member-module #module-content .content {
right: 10px;
padding-bottom: 10px;
outline: none;
}
#profile #member-module #module-content .list-active {
padding-bottom: 8px;
/*border-bottom: 1px solid #DDD;*/
}
/* Responsive */
@media (max-width: 979px) {
+3
View File
@@ -26,6 +26,9 @@
margin-top: 4px;
margin-left: 10px;
}
.topnav .btn-group {
margin-left: 0;
}
/* Bottom Nav */
.bottomnav {
@@ -0,0 +1,83 @@
class Admin::PersonalPluginIntrosController < OrbitMemberController
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :is_admin?
def index
get_types
@plugin_intro = @types.where(:user_id => params[:user_id]).first
if @plugin_intro.blank?
@set_type = @types.new()
@url = eval("panel_#{@app_type_name}_back_end_#{@app_type}s_path(:user_id=>params[:user_id])")
@verb = :post
else
@set_type = @types.find(@plugin_intro.id)
@url = polymorphic_path(["panel_#{@app_type_name}_back_end", @plugin_intro])
@verb = :put
end
end
def show
end
def new
end
def edit
end
def create
get_types
@plugin_intro = @types.new(params[:plugin_intro])
respond_to do |format|
if @plugin_intro.save
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:plugin_intro][:user_id],:show_plugin_profile=>@reback_name)) }
end
end
end
def update
get_types
@plugin_intro = @types.find(params[:id])
respond_to do |format|
if @plugin_intro.update_attributes(params[:plugin_intro])
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:plugin_intro][:user_id],:show_plugin_profile=>@reback_name)) }
end
end
end
def destroy
end
protected
def get_types
@types = @app_type.classify.constantize
end
end
@@ -98,9 +98,11 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
if(!params[:show_plugin_profile].nil?)
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary'
@right_partial = OrbitApp::Plugin::Registration.find_by_app_name(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary'
@plugin_app_name = OrbitApp::Plugin::Registration.find_by_app_name(params[:show_plugin_profile]).name rescue nil
else
@right_partial = "plugin_summary"
@plugin_app_name = ''
end
# @user.attribute_values.each{|att_val|
+28
View File
@@ -0,0 +1,28 @@
class PersonalPluginIntro
include Mongoid::Document
include Mongoid::Timestamps
# include OrbitCoreLib::ObjectAuthable
# include OrbitCoreLib::ObjectDisable
# has_and_belongs_to_many :users
belongs_to :user
field :text, localize: true
field :brief_intro, :type => Boolean, :default => false
field :complete_list, :type => Boolean, :default => true
def pp_object
brief_intro
end
def self.from_id(id)
PersonalPluginIntro.find(id) rescue nil
end
def self.is_localized?(field_name)
self.fields[field_name.to_s].localized?
end
end
+3
View File
@@ -38,12 +38,15 @@ class User
has_and_belongs_to_many :sub_role_tags
has_many :user_actions, :dependent => :destroy
has_many :personal_plugin_intro
# has_and_belongs_to_many :statuses
has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles
has_and_belongs_to_many :role_statuses
has_and_belongs_to_many :role_categorys
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
before_create :initialize_desktop
@@ -0,0 +1,117 @@
<% # encoding: utf-8 %>
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<% end %>
<%= form_for(:plugin_intro, :url => @url, :method => @verb, html: {class: "form-horizontal main-forms previewable"} ) do |f| %>
<%= f.error_messages %>
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= I18n.t("module_name.#{@app_type_name}") %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<% end %>
<!-- frontend_page -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.frontend_page") %></label>
<div class="controls">
<%= f.check_box :brief_intro, :checked => @set_type.brief_intro %> <%= t("personal_plugins.brief_intro") %>
<%= f.check_box :complete_list, :checked => @set_type.complete_list %> <%= t("personal_plugins.complete_list") %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:content) %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :text_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@set_type.text_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>
<% end %>
@@ -1,46 +1,46 @@
<div class="item element">
<h3><i class="icons-book-2"></i>Module Name</h3>
<div class="detail w-a h-a">
<table class="table table-striped">
<thead>
<tr>
<th>模組</th>
<th class="span2">數量</th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>University</td>
<td class="span2">2,304</td>
</tr>
<tr>
<td>Master</td>
<td class="span2">783</td>
</tr>
<tr>
<td>Doctor</td>
<td class="span2">45</td>
</tr>
<tr>
<td>Staff</td>
<td class="span2">62</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-book-2"></i>Module Name</h3>
<div class="detail w-a h-a">
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:module) %></th>
<th class="span2"><%= t(:quantity) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<%
@plugins.each do |plugin|
if is_admin?
@data = plugin.app_name.classify.constantize.where(:create_user_id=>@user.id).count
else
@data = plugin.app_name.classify.constantize.where(:is_hidden=>false , :create_user_id=>@user.id).count
end
%>
<tr>
<td><%= plugin.name %></td>
<td class="span2"><%= @data %></td>
</tr>
<% end -%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@@ -5,7 +5,8 @@
<%= render :partial => "js_and_css"%>
<div id="filter" class="topnav clearfix">
<% content_for :right_nav do %>
<div class="searchClear pull-left" style="clear: left;">
<form action="" method="get">
<%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
@@ -34,8 +35,8 @@
</div>
</div>
</div>
<% end %>
<div id="list-view">
@@ -5,8 +5,9 @@
<%= render :partial => "js_and_css"%>
<div id="filter" class="topnav clearfix">
<div class="searchClear pull-left">
<% content_for :right_nav do %>
<div class="searchClear pull-left" style="clear: left;">
<form action="" method="get">
<%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
<input type="hidden" name="at" id="at" value="<%= params[:at] %>" />
@@ -35,7 +36,8 @@
</div>
</div>
</div>
<% end %>
<div id="list-view">
<ul id="member-abstract" class="clearfix">
@@ -5,8 +5,9 @@
<%= render :partial => "js_and_css"%>
<div id="filter" class="topnav clearfix">
<div class="searchClear pull-left">
<% content_for :right_nav do %>
<div class="searchClear pull-left" style="clear: left;">
<form action="" method="get">
<%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
<input type="hidden" name="at" id="at" value="<%= params[:at] %>" />
@@ -35,7 +36,8 @@
</div>
</div>
</div>
<% end %>
<div id="list-view">
<ul id="member-card" class="clearfix">
@@ -43,7 +43,7 @@
<div class="navbar">
<div class="navbar-inner">
<span class="brand">
<%= params[:show_plugin_profile].nil? ? t(:all_plugin_summary) : params[:show_plugin_profile] %>
<%= @plugin_app_name.nil? ? t(:all_plugin_summary) : @plugin_app_name %>
</span>
<ul class="nav pull-right">
<li class="divider-vertical"></li>
@@ -52,8 +52,8 @@
<ul class="dropdown-menu">
<% @plugins.each do |plugin| %>
<%= content_tag :li, :class=>(params[:show_plugin_profile] == plugin.name ? "active" : nil) do %>
<%= link_to plugin.name, :show_plugin_profile => plugin.name %>
<%= content_tag :li, :class=>(params[:show_plugin_profile] == plugin.app_name ? "active" : nil) do %>
<%= link_to plugin.name, :show_plugin_profile => plugin.app_name %>
<% end -%>
<% end -%>
+2 -2
View File
@@ -23,8 +23,8 @@
<section id="main-wrap">
<div class="wrap-inner">
<div id="filter" class="topnav clearfix">
<ul class="breadcrumb">
<li><a href="/orbit_4.0.1/admin/dashboards/dashboards.shtml">Dashboard</a> <span class="divider">/</span></li>
<ul class="breadcrumb text-info pull-left">
<li><a href="<%= admin_users_new_interface_index_path %>">Member</a> <span class="divider">/</span></li>
<li class="active">All</li>
</ul>
<%= yield :right_nav %>