From 84703a3e0174a646fb5d98c064e10d24e0ab5628 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 18 Mar 2016 16:35:36 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=B7=BB=E5=8A=A0=E6=88=90=E5=91=98=EF=BC=8C?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E4=BD=BF=E7=94=A8https://www=E5=BD=A2?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 ++++ app/helpers/org_member_helper.rb | 2 +- app/views/organizations/setting.html.erb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a5cdb1a1..0c2b14277 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3044,3 +3044,7 @@ def is_default_field? field (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default' end +def host_with_protocol + return Setting.protocol + "://" + Setting.host_name +end + diff --git a/app/helpers/org_member_helper.rb b/app/helpers/org_member_helper.rb index fd70a0516..e16051eaf 100644 --- a/app/helpers/org_member_helper.rb +++ b/app/helpers/org_member_helper.rb @@ -9,7 +9,7 @@ module OrgMemberHelper principals = paginateHelper scope,10 s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| - link_to text, org_member_autocomplete_org_member_index_path(parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js')), :remote => true + link_to text, host_with_protocol + "/org_member/org_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js').to_query, :remote => true } s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 3ef5d547c..af06c4c22 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -96,7 +96,7 @@

添加成员

<%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%> - <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %> + <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<%= find_user_not_in_current_org_by_name(@project) %>
From 4fa128841174d4eba336f33e7bfd58bedeb96468 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 21 Mar 2016 12:29:25 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E5=90=8E=EF=BC=8C=E6=A0=8F=E7=9B=AE=E5=AD=90?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E8=BE=93=E5=85=A5=E6=A1=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_subfields/create.js.erb | 7 +++---- app/views/organizations/setting.html.erb | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index 84b69717a..3e08d9f9e 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -4,7 +4,6 @@ :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); - $("#subfield_name").val(""); -<% else %> - $("#subfield_name").val(""); -<% end %> \ No newline at end of file +<% end %> +$("#subfield_name").val(""); +$("#sub_dir").val(""); \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index af06c4c22..854c7d12e 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -129,7 +129,7 @@

域名目录(用户自定义url,可选)

<% if domain %> - <%= domain.subname %>.trustie.net/ + <%= domain.subname %>.trustie.net/ <% else %> 您还没有子域名,请先在左侧信息栏申请子域名 <% end %> From 675b1ad40392e805a84c67a5d28d622940208e6e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 22 Mar 2016 13:51:19 +0800 Subject: [PATCH 3/5] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E8=BE=93=E5=85=A5=E7=BB=84=E7=BB=87=E5=90=8D?= =?UTF-8?q?=E5=AD=97=E3=80=81=E5=AD=90=E6=A0=8F=E7=9B=AE=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8E=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=8F=98?= =?UTF-8?q?=E6=88=90=E5=B0=8F=E5=86=99=E5=AD=97=E6=AF=8D=EF=BC=9B2.?= =?UTF-8?q?=E5=B0=86=E6=89=80=E6=9C=89=E5=AD=90=E5=9F=9F=E5=90=8D=E5=8F=8A?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E7=9B=AE=E5=BD=95=E6=94=B9=E6=88=90=E5=B0=8F?= =?UTF-8?q?=E5=86=99=EF=BC=9B3.=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AD=90=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=82=B9?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A=EF=BC=8C=E8=BE=93=E5=85=A5=E6=A1=86=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BF=9D=E6=8C=81=E4=B8=8D=E5=8F=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 2 +- .../organizations/_subfield_list.html.erb | 11 +++++- app/views/organizations/setting.html.erb | 35 +++++++++++++------ ...2032610_change_domain_name_to_lowercase.rb | 14 ++++++++ 4 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 db/migrate/20160322032610_change_domain_name_to_lowercase.rb diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index ba4c1f18f..bc339319b 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -11,7 +11,7 @@ class OrgSubfieldsController < ApplicationController sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+ "and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'" if SubfieldSubdomainDir.find_by_sql(sql).count == 0 - SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir]) + SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase) end end @subfield.update_attributes(:field_type => params[:field_type]) diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 0d490df77..133217c70 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -54,7 +54,7 @@
<% end %> <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %> @@ -85,6 +85,9 @@ url: "/org_subfields/" + field_id + "?name=" + input_value, type: 'put' }); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); + } } $(show_id).show(); $(edit_id).hide(); @@ -109,6 +112,9 @@ url: "/org_subfields/" + field_id + "/update_sub_dir?sub_dir_name=" + input_value, type: 'put' }); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); + } } $(show_id).show(); $(edit_id).hide(); @@ -134,6 +140,9 @@ type: 'put' }); } + else{ + $(edit_id).children("input").val($(show_id).html().trim()); + } } else { diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 854c7d12e..ce02a0557 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -57,7 +57,7 @@
组织URL:
http:// - + .trustie.net申请 <% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %> <% if domain.present? and record.present? and record.content == domain.subname %> @@ -129,9 +129,9 @@

域名目录(用户自定义url,可选)

<% if domain %> - <%= domain.subname %>.trustie.net/ + <%= domain.subname %>.trustie.net/ <% else %> - 您还没有子域名,请先在左侧信息栏申请子域名 + 您还没有子域名,请先在左侧信息栏申请子域名 <% end %>
@@ -195,12 +195,25 @@ } } -// $(document).ready(function(){ -// if ( $("#is_public").attr("checked") != true){ -// alert($(this).attr("checked")); -// $("#allow_download").attr("checked", false); -// $("#allow_download").attr("disabled", true); -// $("#allow_down_hint").html(""); -// } -// }); + //输入子域名或者二级目录,自动将输入换成小写 + function observe_input_to_lowercase(id){ + $(id).each(function(){ + var $this = $(this); + var old_input = $this.val(); + var check=function(){ + var val = $this.val(); + if ( old_input != val){ + $this.val(val.toLowerCase()); + old_input = val.toLowerCase(); + } + }; + var reset = function() { + if (timer) { + clearInterval(timer); + } + }; + var timer = setInterval(check, 300); + $this.bind('blur', reset); + }); + } \ No newline at end of file diff --git a/db/migrate/20160322032610_change_domain_name_to_lowercase.rb b/db/migrate/20160322032610_change_domain_name_to_lowercase.rb new file mode 100644 index 000000000..35a82477d --- /dev/null +++ b/db/migrate/20160322032610_change_domain_name_to_lowercase.rb @@ -0,0 +1,14 @@ +class ChangeDomainNameToLowercase < ActiveRecord::Migration + def up + Secdomain.all.each do |domain| + domain.update_attribute(:subname, domain.subname.downcase) + end + + SubfieldSubdomainDir.all.each do |dir| + dir.update_attribute(:name, dir.name.downcase) + end + end + + def down + end +end From fcb189d874d854938cfba19ec276b60f1b38936f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 22 Mar 2016 14:10:36 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E7=9A=84=E9=A1=BA=E5=BA=8F=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_subfield_list.html.erb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 133217c70..d907ac33e 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -134,19 +134,13 @@ function update_priority(show_id, edit_id, field_id, input_value){ var re = /^[0-9]*[1-9]*[0-9]$/ if(re.test(input_value) && $(show_id).html().trim() != input_value.trim() && input_value.trim() != ''){ - if(confirm("确定修改为" + input_value + "?")){ - $.ajax({ - url: "/org_subfields/" + field_id + "/update_priority?priority=" + input_value, - type: 'put' - }); - } - else{ - $(edit_id).children("input").val($(show_id).html().trim()); - } + $.ajax({ + url: "/org_subfields/" + field_id + "/update_priority?priority=" + input_value, + type: 'put' + }); } - else - { - $(edit_id).find("input").val($(show_id).html().trim()); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); } $(show_id).show(); $(edit_id).hide(); From 6b3e9ba4b307d3056b6a60be4608a5b929e3239e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 23 Mar 2016 14:29:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E7=82=B9=E5=87=BB=E7=A7=81=E6=9C=89=E6=88=96?= =?UTF-8?q?=E8=80=85=E5=85=AC=E5=BC=80=E9=80=89=E9=A1=B9=EF=BC=8C=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E6=B8=B8=E5=AE=A2=E4=B8=8B=E8=BD=BD=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=8F=8A=E6=97=B6=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index e12bf3849..b0c961d82 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -30,7 +30,7 @@
  • - + (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)