Fix bug.
Add email regex feature. Edit defined_by_applicant feature. Add agree and disagree record time and let admin can click in backend page. Edit frontend select email feature. Remove items and enquiry_for_applicants page.
This commit is contained in:
1 parent
d0062fed8f
commit
10cb149fc7
18 files changed
+563
-105
No files matched your search
@@ -0,0 +1,131 @@
|
||||
<% unless @include_js_css_flag %>
|
||||
<%= javascript_include_tag "lib/checkbox.card.js" %>
|
||||
<%= stylesheet_link_tag 'basic/global' %>
|
||||
<%= stylesheet_link_tag 'member_select' %>
|
||||
<style>
|
||||
.modal-backdrop, .modal-backdrop.fade.in {
|
||||
opacity: 0.8;
|
||||
filter: alpha(opacity=80);
|
||||
}
|
||||
.modal-header {
|
||||
padding: 9px 15px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.modal-header h3 {
|
||||
margin: 0;
|
||||
line-height: 30px;
|
||||
font-weight: bold;
|
||||
color: inherit;
|
||||
text-rendering: optimizelegibility;
|
||||
}
|
||||
.modal-body input, .modal-body label {
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
line-height: 20px;
|
||||
}
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 10%;
|
||||
left: 50%;
|
||||
z-index: 1050;
|
||||
width: 560px;
|
||||
margin-left: -280px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #999;
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
*border: 1px solid #999;
|
||||
-webkit-border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
-webkit-box-shadow: 0 3px 7px rgb(0 0 0 / 30%);
|
||||
-moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 0 3px 7px rgb(0 0 0 / 30%);
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
.modal-body input[type="checkbox"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<% @include_js_css_flag = true %>
|
||||
<% end %>
|
||||
<% index = '' unless defined?(index) %>
|
||||
<div id="selected_<%=select_name rescue 'email_users'%>" class="selected_users <%=extra_class rescue ''%>">
|
||||
<% email_members.each do |email_member| %>
|
||||
<span class="alert alert-info selected_user" id="<%= email_member.id %>">
|
||||
<span class='close remove_user' onclick='removeUser<%=index%>($(this))'>x</span>
|
||||
<%= email_member.name %>
|
||||
<%= hidden_field_tag field, email_member.id %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<a class="btn btn-primary btn-small select_user_modal<%=index%>"><%= t('application_form.select') %></a>
|
||||
<script type="text/javascript">
|
||||
mail_users<%=index%> = Array();
|
||||
|
||||
$(function(){
|
||||
$.each($("#selected_<%=select_name rescue'email_users'%> .selected_user"),function(i){
|
||||
mail_users<%=index%>.push($(this).attr("id"));
|
||||
});
|
||||
|
||||
$(".select_user_modal<%=index%>").click(function(){
|
||||
if($("#select_user<%=index%>").length==0) {
|
||||
$("body").append("<span id='select_user<%=index%>'><%=escape_javascript(render(:partial=>'application_forms/select_emails', :locals=>{:member_profiles=>member_profiles,:@index=>(index)})) %></span>");
|
||||
$('.checkbox-card').cardCheck();
|
||||
}
|
||||
$("#member-filter").modal('show');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
var removeUser<%=index%> = function(user){
|
||||
var id = $(user).parent().attr('id');
|
||||
$("#select_user<%=index%> input[type='checkbox'][value=\""+id+"\"]").prop('checked', false).parent('.check-item').removeClass('active').css('display','');
|
||||
mail_users<%=index%> = $.grep(mail_users<%=index%>, function(value) {return value != id;});
|
||||
$(user).parent().remove();
|
||||
}
|
||||
Array.prototype.unique = function(){
|
||||
const distinct = (value, index, self) =>{
|
||||
return self.indexOf(value) === index;
|
||||
}
|
||||
return this.filter(distinct);
|
||||
}
|
||||
var updateUsers<%=index%> = function(){
|
||||
$("#select_user<%=index%> .check-item input[type='checkbox']:checked").each(function(i, v){
|
||||
mail_users<%=index%>.push($(v).val());
|
||||
});
|
||||
|
||||
$("#selected_<%=select_name rescue'email_users'%>").html("");
|
||||
mail_users<%=index%> = mail_users<%=index%>.unique();
|
||||
$.each(mail_users<%=index%>, function(i, user_id){
|
||||
var username = $("input[value='"+user_id+"']").parent().find(".user-name").html();
|
||||
$("#selected_<%=select_name rescue'email_users'%>").append(
|
||||
" <span class='alert alert-info selected_user' id='"+user_id+"'>"+
|
||||
"<span class='close remove_user' onclick='removeUser<%=index%>($(this))'>x</span>"+
|
||||
username+
|
||||
"<input type='hidden' name='<%= field %>' value='"+user_id+"' >"+
|
||||
"</span>"
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var updateModal<%=index%> = function(){
|
||||
$.each($("#selected_<%=select_name rescue'email_users'%> .selected_user"),function(){
|
||||
var user_id = $(this).attr('id');
|
||||
$("input[value='"+user_id+"']").parent("li").hide();
|
||||
});
|
||||
|
||||
$('.check-item').click(function(){
|
||||
var user_id = $(this).find("input[type='checkbox']").val();
|
||||
$(this).toggleClass("active");
|
||||
if($(this).hasClass("active")){
|
||||
mail_users<%=index%>.push(user_id);
|
||||
}else{
|
||||
mail_users<%=index%> = $.grep(mail_users<%=index%>, function(value) {return value != user_id;});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,50 @@
|
||||
<div id="member-filter" class="modal fade">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3><%= t('list.user') %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tabbable tabs-left">
|
||||
<fieldset class="clearfix">
|
||||
<div class="member-filter-result nano">
|
||||
<div class="content">
|
||||
<i class="icon-search"></i>
|
||||
<input class="search_names" placeholder="<%=t('users.name')%>" style="margin: 1em;">
|
||||
<div style="margin-bottom: 1em;"></div>
|
||||
<ul class="checkbox-card clearfix">
|
||||
<% member_profiles.each do |profile| %>
|
||||
<% next if profile.email.nil? %>
|
||||
<li class="check-item">
|
||||
<label>
|
||||
<%= image_tag profile.get_avatar, class: "user-pic" %>
|
||||
<span class="user-name"><%= profile.name %></span>
|
||||
</label>
|
||||
<%= check_box_tag 'email_user_ids[]', profile.id , false , :id => "email_user_ids_#{(profile.id rescue '')}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="form-actions condition">
|
||||
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="updateUsers<%=@index rescue ''%>()"><%= t(:submit) %></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.search_names').off('input').on('input',function(){
|
||||
var name = $(this).val();
|
||||
var $check_items = $(this).parent().find('.check-item');
|
||||
$check_items.each(function(i,item){
|
||||
if( $(item).find('.user-name').text().search(name) == -1){
|
||||
$(item).css('display','none');
|
||||
}else{
|
||||
$(item).css('display','');
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@@ -4,6 +4,7 @@
|
||||
@application_form_signup = data["application_form_signup"]
|
||||
@time_now = data["time_now"]
|
||||
@form_index = 0
|
||||
email_regex = @application_form.get_email_regex(true)
|
||||
if data["prefix_url"]
|
||||
prefix_url = data["prefix_url"]
|
||||
else
|
||||
@@ -107,6 +108,39 @@
|
||||
<div class="col-sm-10">
|
||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
function scrollIntoView(selector, offset = 0) {
|
||||
window.scroll(0, document.querySelector(selector).offsetTop - offset);
|
||||
}
|
||||
var email_regex = "<%=email_regex%>";
|
||||
if(email_regex.length != 0){
|
||||
email_regex = new RegExp(email_regex);
|
||||
var submit_flag = false;
|
||||
var $form = $("#new-application_form-signup");
|
||||
var email_field = $('#application_form_signup_email');
|
||||
if($form.length != 0 && email_field.length != 0){
|
||||
$form.submit(function(){
|
||||
if(!submit_flag){
|
||||
submit_flag = true;
|
||||
if(email_regex.test(email_field.val())){
|
||||
submit_flag = false;
|
||||
}else{
|
||||
email_field.css("border", "2px solid red");
|
||||
scrollIntoView('#application_form_signup_email');
|
||||
alert("<%=t('application_form.please_check_email_format')%>");
|
||||
email_field.one("input",function(){
|
||||
email_field.css("border", "");
|
||||
})
|
||||
submit_flag = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<% elsif signup_field.field_name == 'note' %>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-append">
|
||||
@@ -173,6 +207,39 @@
|
||||
<div class="col-sm-10">
|
||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
function scrollIntoView(selector, offset = 0) {
|
||||
window.scroll(0, document.querySelector(selector).offsetTop - offset);
|
||||
}
|
||||
var email_regex = "<%=email_regex%>";
|
||||
if(email_regex.length != 0){
|
||||
email_regex = new RegExp(email_regex);
|
||||
var submit_flag = false;
|
||||
var $form = $("#new-application_form-signup");
|
||||
var email_field = $('#application_form_signup_email');
|
||||
if($form.length != 0 && email_field.length != 0){
|
||||
$form.submit(function(){
|
||||
if(!submit_flag){
|
||||
submit_flag = true;
|
||||
if(email_regex.test(email_field.val())){
|
||||
submit_flag = false;
|
||||
}else{
|
||||
email_field.css("border", "2px solid red");
|
||||
scrollIntoView('#application_form_signup_email');
|
||||
alert("<%=t('application_form.please_check_email_format')%>");
|
||||
email_field.one("input",function(){
|
||||
email_field.css("border", "");
|
||||
})
|
||||
submit_flag = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
@@ -180,11 +247,12 @@
|
||||
<% if flag %>
|
||||
<div class="form-group">
|
||||
<label for="status" class="col-sm-2 control-label"><%= t("application_form.reviewers.#{k+1}") %></label>
|
||||
<div class="col-sm-10">
|
||||
<div class="col-sm-10">
|
||||
<% tmp = Array(@application_form.reviewer_ids_list[k]) %>
|
||||
<% if @application_form.reviewer_type_list[k]=='fixed' %>
|
||||
<%= MemberProfile.where(:id.in=>Array(@application_form.reviewer_ids_list[k])).collect{|m| m.name}.join(', ') %>
|
||||
<%= MemberProfile.where(:id.in=>tmp).collect{|m| m.name}.join(', ') %>
|
||||
<% else %>
|
||||
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}][]", email_members: [], index: "#{k+1}", select_name: "reviewer_ids_list_#{k}"} %>
|
||||
<%= render partial: 'application_forms/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}][]", email_members: [], member_profiles: (tmp.count == 0 ? MemberProfile.all : MemberProfile.where(:id.in=>tmp)), index: "#{k+1}", select_name: "reviewer_ids_list_#{k}"} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -306,11 +374,7 @@
|
||||
type : "get",
|
||||
success : function(data){
|
||||
if( data.success == true ){
|
||||
|
||||
alert("1tttt");
|
||||
}else{
|
||||
|
||||
alert("1ssss2");
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -338,3 +402,8 @@ alert("1ssss2");
|
||||
<%= t('application_form.sign_up_overdue') %>
|
||||
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
var email_regex = "<%=email_regex%>";
|
||||
if(email_regex.length != 0)
|
||||
email_regex = new RegExp(email_regex);
|
||||
</script>
|
||||
Reference in new issue
Block a user