forked from spen/seminar
Add feature that assign signups to multiple reviewers.
This commit is contained in:
parent
acf81edcf6
commit
d22ab9288c
|
@ -296,7 +296,7 @@ class SeminarMain
|
|||
end
|
||||
def map_seminar_signup_ids(old_seminar_signup_ids)
|
||||
if @records_all["seminar_signup_ids"].present?
|
||||
old_seminar_signup_ids.map{|seminar_signup_id| @records_all["seminar_signup_ids"][BSON::ObjectId(seminar_signup_id)]}
|
||||
old_seminar_signup_ids.map{|seminar_signup_id| @records_all["seminar_signup_ids"][BSON::ObjectId(seminar_signup_id)].to_s rescue ""}.select{|t| t.present?}
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
|
|
@ -73,8 +73,8 @@ class SeminarReview
|
|||
end
|
||||
def get_all_seminar_signup_ids(mode = nil)
|
||||
if (self.default_topics.include?("seminar_signup_contributes.description") && self.seminar_main.assign_mode == 1) || mode == 1
|
||||
final_assign_signup_ids = SeminarSession.where(:id.in=>self.seminar_session_ids).pluck(:seminar_signup_ids).flatten rescue []
|
||||
self.seminar_signup_ids - self.remove_seminar_signup_ids + final_assign_signup_ids
|
||||
final_assign_signup_ids = SeminarSession.where(:id.in=>self.seminar_session_ids).pluck(:seminar_signup_ids).flatten.map{|id| id.to_s} rescue []
|
||||
final_assign_signup_ids + self.seminar_signup_ids - self.remove_seminar_signup_ids
|
||||
else
|
||||
all_seminar_signup_ids
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<h3 class="pull-left"><%= @seminar.title %></h3>
|
||||
<div style="clear: both;"></div>
|
||||
<% org_seminar_signups = @seminar_signups %>
|
||||
<div style="float: left;width: 50%;">
|
||||
<div style="float: left;width: 50%;" class="left_block">
|
||||
<h4><%= t("seminar.reviewer") %></h4>
|
||||
<% reviewer_show_ids = @seminar.reviewer_show_ids %>
|
||||
<% if reviewer_show_ids.nil?
|
||||
|
@ -65,6 +65,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function add_obj(obj1,obj2){
|
||||
var keys = Object.keys(obj1);
|
||||
var obj = {};
|
||||
keys.forEach(function(k){
|
||||
obj[k] = obj1[k] + obj2[k];
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
function generate_pagination(reviewer_id,index=1,start=1,end=1,active=1){
|
||||
var pagination = $('<div class="pagination pagination-centered">');
|
||||
pagination.append('<div class="pagination"><ul></ul></div>');
|
||||
|
@ -153,13 +161,75 @@
|
|||
revert: true,
|
||||
handle: ".brand",
|
||||
connectWith: ".table tbody",
|
||||
start: function(event, ui){
|
||||
var target = $(event.target);
|
||||
if(target.find("tr[data-id]").length <= 1){
|
||||
target.find(".blank_tr").css("display","");
|
||||
}else{
|
||||
target.find(".blank_tr").css("display","none");
|
||||
}
|
||||
$(".reviewer_block").css("overflow","hidden");
|
||||
if($("#copy_mode_on:checked").length != 0){
|
||||
var clone_obj = ui.item.clone();
|
||||
clone_obj.attr("style","")
|
||||
ui.item.before(clone_obj)
|
||||
window.clone_obj = clone_obj;
|
||||
}else{
|
||||
window.clone_obj = undefined;
|
||||
}
|
||||
parent_left_block = ui.item.parents(".left_block");
|
||||
if(parent_left_block.length != 0){
|
||||
var parent_block = ui.item.parents(".reviewer_block");
|
||||
console.log(parent_left_block);
|
||||
parent_left_block.before(ui.item);
|
||||
window.parent_block = parent_block;
|
||||
ui.item.css("background","#ffffff");
|
||||
window.over_flag = false;
|
||||
}else{
|
||||
window.parent_block = undefined;
|
||||
}
|
||||
},
|
||||
sort: function(event, ui) {
|
||||
if(window.parent_block != undefined){
|
||||
var offset = ui.position;
|
||||
var parent_offset = window.parent_block.offset();
|
||||
if(!window.over_flag){
|
||||
offset = add_obj(ui.position,parent_offset);
|
||||
ui.item.offset(offset);
|
||||
}
|
||||
}
|
||||
},
|
||||
over: function( event, ui ) {
|
||||
if(window.parent_block != undefined && $(this).data("id") != window.parent_block.data("id")){
|
||||
window.over_flag = true;
|
||||
}
|
||||
},
|
||||
stop: function(event, ui){
|
||||
$(".reviewer_block").css("overflow","");
|
||||
ui.item.css("background","");
|
||||
},
|
||||
update: function(event, ui) {
|
||||
if(window.clone_obj != undefined){
|
||||
if(window.clone_obj.parent().data("id") == undefined){
|
||||
window.clone_obj.remove();
|
||||
}else if(window.clone_obj.parent().data("id") == ui.item.parent().data("id")){
|
||||
window.clone_obj.remove();
|
||||
}else if(ui.item.parent().data("id") == undefined){
|
||||
window.clone_obj.remove();
|
||||
}
|
||||
}
|
||||
var target = $(event.target);
|
||||
var mode = "";
|
||||
var id = target.data("id");
|
||||
var signup_id = ui.item.data("id");
|
||||
if(ui.item.parent().data("id") == id){
|
||||
if(target.find("tr[data-id=\""+signup_id+"\"]").length != 0){
|
||||
mode = "append";
|
||||
if(target.find("tr[data-id=\""+signup_id+"\"]").length > 1){
|
||||
var target_signups= target.find("tr[data-id=\""+signup_id+"\"]");
|
||||
for(var i=1;i<target_signups.length;i++){
|
||||
target_signups.eq(i).remove();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
mode = "remove";
|
||||
}
|
||||
|
@ -170,14 +240,17 @@
|
|||
}
|
||||
if(id != undefined){
|
||||
$.post("<%=admin_seminar_update_seminar_review_path%>",{id: id,mode: mode,signup_id: signup_id}).done(function(data){
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
|
||||
$("tbody").each(function(i,v){
|
||||
if($(v).find("tr[data-id]").length != 0){
|
||||
$(v).find("tr.blank_tr").css("display","none");
|
||||
}
|
||||
})
|
||||
init_func();
|
||||
})
|
||||
$(window).resize(function(){
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @include_blank && @seminar_signups.count == 0 %>
|
||||
<% if @include_blank %>
|
||||
<tr class="blank_tr">
|
||||
<% if @drag %>
|
||||
<td rowspan="3"></td>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div style="clear: both;"></div>
|
||||
<% org_seminar_signups = @seminar_signups %>
|
||||
<% session_translation = (@seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0]['name'][I18n.locale] rescue "Session") %>
|
||||
<div style="float: left;width: 50%;">
|
||||
<div style="float: left;width: 50%;" class="left_block">
|
||||
<h4><%= session_translation %></h4>
|
||||
<% session_show_ids = @seminar.session_show_ids %>
|
||||
<% if session_show_ids.nil?
|
||||
|
@ -66,6 +66,22 @@
|
|||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function add_obj(obj1,obj2){
|
||||
var keys = Object.keys(obj1);
|
||||
var obj = {};
|
||||
keys.forEach(function(k){
|
||||
obj[k] = obj1[k] + obj2[k];
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
function sub_obj(obj1,obj2){
|
||||
var keys = Object.keys(obj1);
|
||||
var obj = {};
|
||||
keys.forEach(function(k){
|
||||
obj[k] = obj1[k] - obj2[k];
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
function generate_pagination(session_id,index=1,start=1,end=1,active=1){
|
||||
var pagination = $('<div class="pagination pagination-centered">');
|
||||
pagination.append('<div class="pagination"><ul></ul></div>');
|
||||
|
@ -155,10 +171,43 @@
|
|||
handle: ".brand",
|
||||
connectWith: ".table tbody",
|
||||
start: function(event, ui){
|
||||
var target = $(event.target);
|
||||
if(target.find("tr[data-id]").length <= 1){
|
||||
target.find(".blank_tr").css("display","");
|
||||
}else{
|
||||
target.find(".blank_tr").css("display","none");
|
||||
}
|
||||
$(".session_block").css("overflow","hidden");
|
||||
parent_left_block = ui.item.parents(".left_block");
|
||||
if(parent_left_block.length != 0){
|
||||
var parent_block = ui.item.parents(".session_block");
|
||||
parent_left_block.before(ui.item);
|
||||
window.parent_block = parent_block;
|
||||
ui.item.css("background","#ffffff");
|
||||
window.over_flag = false;
|
||||
}else{
|
||||
window.parent_block = undefined;
|
||||
}
|
||||
},
|
||||
sort: function(event, ui) {
|
||||
if(window.parent_block != undefined){
|
||||
var offset = ui.position;
|
||||
var parent_offset = window.parent_block.offset();
|
||||
if(!window.over_flag){
|
||||
offset = add_obj(ui.position,parent_offset);
|
||||
ui.item.offset(offset);
|
||||
}
|
||||
}
|
||||
},
|
||||
over: function( event, ui ) {
|
||||
if(window.parent_block != undefined && $(this).data("id") != window.parent_block.data("id")){
|
||||
window.over_flag = true;
|
||||
}
|
||||
},
|
||||
stop: function(event, ui){
|
||||
$(".session_block").css("overflow","");
|
||||
ui.item.css("background","");
|
||||
console.log("stop")
|
||||
},
|
||||
update: function(event, ui) {
|
||||
var target = $(event.target);
|
||||
|
@ -184,7 +233,11 @@
|
|||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
|
||||
$("tbody").each(function(i,v){
|
||||
if($(v).find("tr[data-id]").length != 0){
|
||||
$(v).find("tr.blank_tr").css("display","none");
|
||||
}
|
||||
})
|
||||
init_func();
|
||||
})
|
||||
$(window).resize(function(){
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
|
||||
</script>
|
||||
<% if @can_edit %>
|
||||
<% if params[:type].blank?%>
|
||||
<label><input id="copy_mode_on" type="checkbox"><%=t("seminar.copy_mode_on")%></label>
|
||||
<% end %>
|
||||
<ul class="pull-right">
|
||||
<li><a href="?type=" class="btn <%='active' if params[:type] == ''%>"><%= t('seminar.dashboard') %></a></li>
|
||||
<li><a href="?type=" class="btn <%='active' if params[:type].blank? %>"><%= t('seminar.dashboard') %></a></li>
|
||||
<% if @seminar.enable_summary_choice %>
|
||||
<li><a href="?type=session" class="btn <%='active' if params[:type] == 'session'%>"><%= t('seminar.session_dashboard') %></a></li>
|
||||
<% end %>
|
||||
|
|
|
@ -20,6 +20,7 @@ en:
|
|||
verification_failed: Verification Failed #驗證碼錯誤
|
||||
|
||||
seminar:
|
||||
copy_mode_on: Copy mode on
|
||||
clone_signups: Clone Signups
|
||||
copy: Copy
|
||||
select_session: Select %{session}
|
||||
|
|
|
@ -20,6 +20,7 @@ zh_tw:
|
|||
verification_failed: 驗證碼錯誤
|
||||
|
||||
seminar:
|
||||
copy_mode_on: 啟用複製模式
|
||||
clone_signups: 複製報名人
|
||||
copy: 複製
|
||||
select_session: 選擇%{session}
|
||||
|
|
Loading…
Reference in New Issue