From 5d1d56fbb3b7371e55465f8b691380959475ad82 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 8 Mar 2016 16:44:03 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=94=B9=E6=88=90https://www.=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 70 +++++++++++++++++++ .../_org_course_homework.html.erb | 4 +- .../organizations/_org_project_issue.html.erb | 4 +- .../organizations/_project_create.html.erb | 10 +-- .../organizations/_project_message.html.erb | 7 +- .../organizations/_show_org_document.html.erb | 2 +- app/views/users/_show_detail_info.html.erb | 2 +- 7 files changed, 84 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c19c44935..2233aeb16 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2905,3 +2905,73 @@ def user_url_in_org(user_id) return "https://www.trustie.net/users/" + user_id.to_s end end + +def project_issues_url_in_org(project_id) + if Rails.env.development? + return "http://localhost:3000/projects/" + project_id.to_s + "/issues" + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/projects/" + project_id.to_s + "/issues" + else + return "https://www.trustie.net/projects/" + project_id.to_s + "/issues" + end +end + +def issue_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/issues/" + id.to_s + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/issues/" + id.to_s + else + return "https://www.trustie.net/issues/" + id.to_s + end +end + +def project_boards_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/projects/" + id.to_s + "/boards" + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/projects/" + id.to_s + "/boards" + else + return "https://www.trustie.net/projects/" + id.to_s + "/boards" + end +end + +def board_message_url_in_org(board_id, message_id) + if Rails.env.development? + return "http://localhost:3000/boards/" + board_id.to_s + "/topics/" + message_id.to_s + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/boards/" + board_id.to_s + "/topics/" + message_id.to_s + else + return "https://www.trustie.net/boards/" + board_id.to_s + "/topics/" + message_id.to_s + end +end + +def project_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/projects/" + id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/projects/" + id.to_s + else + return "https://www.trustie.net/projects/" + id.to_s + end +end + +def homework_common_index_url_in_org(course_id) + if Rails.env.development? + return "http://localhost:3000/homework_common?course=" + course_id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/homework_common?course=" + course_id.to_s + else + return "https://www.trustie.net/homework_common?course=" + course_id.to_s + end +end + +def student_work_index_url_in_org(homework_id) + if Rails.env.development? + return "http://localhost:3000/student_work?homework=" + homework_id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/student_work?homework=" + course_id.to_s + else + return "https://www.trustie.net/student_work?homework=" + course_id.to_s + end +end diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 0dd9fb725..8b28c7a60 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -12,10 +12,10 @@ <% else %> <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%> + <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_url_in_org(activity.course.id), :class => "newsBlue ml15"%> <% if activity.homework_detail_manual%> <% if activity.homework_detail_manual.comment_status == 1%> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 855a8053c..9b7dbfa8f 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -11,10 +11,10 @@ <% else %> <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> + <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_url_in_org(activity.project.id), :class => "newsBlue ml15"%>
- <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> + <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :class => "postGrey" %> <%#= get_issue_priority(activity.priority_id)[1] %> diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb index e13f4128b..5003fd0e2 100644 --- a/app/views/organizations/_project_create.html.erb +++ b/app/views/organizations/_project_create.html.erb @@ -3,21 +3,21 @@
- <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %>
<% if user.try(:realname) == ' ' %> - <%= link_to user, user_url_in_org(user), :class => "newsBlue mr15" %> + <%= link_to user, user_url_in_org(user.id), :class => "newsBlue mr15" %> <% else %> - <%= link_to user.try(:realname), user_url_in_org(user), :class => "newsBlue mr15" %> + <%= link_to user.try(:realname), user_url_in_org(user.id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> + <%= link_to project.to_s+" | 项目", project_url_in_org(project.id), :class => "newsBlue ml15" %>
- <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> + <%= link_to project.name, project_url_in_org(project.id), :class => "postGrey" %>
创建时间:<%= format_time(project.created_on) %> diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index 3b459f366..a818939d6 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -12,16 +12,15 @@ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%> + <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_url_in_org(activity.project.id), :class => "newsBlue ml15 mr5"%>
<% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class=> "postGrey" %> <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" - %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class=> "postGrey" %> <% end %>
diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 2584e4209..e3ed492a0 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -111,7 +111,7 @@
- <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current) %> + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %>
diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index f2a2faeb3..3ebcab21e 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -1,6 +1,6 @@
- <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像", :target => '_blank' %> + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像", :target => '_blank' %> <%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>
From 713c28c0b59155c772c5e59a00aeb386d5c56849 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 9 Mar 2016 10:25:57 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=93=8D=E4=BD=9C=E8=AF=BE=E7=A8=8B/?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E8=AE=BE=E7=BD=AE=E5=85=AC=E5=BC=80?= =?UTF-8?q?/=E7=A7=81=E6=9C=89=E5=B1=9E=E6=80=A7=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E8=A6=81?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/private_or_public.js.erb | 4 ++-- app/views/projects/set_public_or_private.js.erb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/courses/private_or_public.js.erb b/app/views/courses/private_or_public.js.erb index 10b787dd4..4e512a6a0 100644 --- a/app/views/courses/private_or_public.js.erb +++ b/app/views/courses/private_or_public.js.erb @@ -9,10 +9,10 @@ } <% else %> <% if @course.is_public? %> - $("#set_course_public_<%= @course.id %>").text("设为私有"); $("#show_course_<%= @course.id %>").attr("title","公开课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)"); <% else %> - $("#set_course_public_<%= @course.id %>").text("设为公开"); $("#show_course_<%= @course.id %>").attr("title","私有课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)"); <% end %> + $("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true}, + :id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>'); <% end %> \ No newline at end of file diff --git a/app/views/projects/set_public_or_private.js.erb b/app/views/projects/set_public_or_private.js.erb index dbca3f65c..282a17091 100644 --- a/app/views/projects/set_public_or_private.js.erb +++ b/app/views/projects/set_public_or_private.js.erb @@ -1,7 +1,7 @@ <% if @project.is_public? %> - $("#set_project_public_<%= @project.id %>").text("设为私有"); $("#show_project_<%= @project.id %>").attr("title","公开项目:<%= @project.name %>"); <% else %> - $("#set_project_public_<%= @project.id %>").text("设为公开"); $("#show_project_<%= @project.id %>").attr("title","私有项目:<%= @project.name %>"); -<% end %> \ No newline at end of file +<% end %> +$("#set_project_public_<%= @project.id %>").replaceWith('<%= escape_javascript(link_to @project.is_public? ? "设为私有" : "设为公开", {:controller => "projects", :action => "set_public_or_private", :id => @project.id,:user_page => true}, + :id => "set_project_public_"+ @project.id.to_s,:method => "post",:remote=>true,:confirm=>"您确定要设置为"+(@project.is_public? ? "私有" : "公开")+"吗") %>'); \ No newline at end of file From a51ca428be3e06b4c9222f8246d335b8103bace5 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 9 Mar 2016 18:06:28 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B0=83=E6=95=B4=E6=A0=8F=E7=9B=AE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A1=BA=E5=BA=8F=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 11 +- app/helpers/organizations_helper.rb | 4 + app/models/org_subfield.rb | 8 ++ app/models/organization.rb | 6 +- app/views/org_subfields/create.js.erb | 3 +- app/views/org_subfields/destroy.js.erb | 3 +- .../org_subfields/update_priority.js.erb | 2 + .../_org_left_subfield_list.html.erb | 129 +++++++++--------- .../organizations/_subfield_list.html.erb | 118 ++++++++++------ app/views/organizations/setting.html.erb | 3 +- config/routes.rb | 1 + ...09022930_set_priority_for_org_subfields.rb | 24 ++++ public/stylesheets/org.css | 1 + 13 files changed, 201 insertions(+), 112 deletions(-) create mode 100644 app/views/org_subfields/update_priority.js.erb create mode 100644 db/migrate/20160309022930_set_priority_for_org_subfields.rb diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 9337c5fd2..ba4c1f18f 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -5,9 +5,8 @@ class OrgSubfieldsController < ApplicationController def create if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0 @res = true - @subfield = OrgSubfield.create(:name => params[:name]) @organization = Organization.find(params[:organization_id]) - @organization.org_subfields << @subfield + @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1) if !params[:sub_dir].blank? 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]}'" @@ -15,7 +14,7 @@ class OrgSubfieldsController < ApplicationController SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir]) end end - @subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type]) + @subfield.update_attributes(:field_type => params[:field_type]) else @res = false end @@ -125,6 +124,12 @@ class OrgSubfieldsController < ApplicationController end end + def update_priority + @org_subfield = OrgSubfield.find(params[:id]) + @org_subfield.update_attribute(:priority, params[:priority].to_i) + @organization = @org_subfield.organization + end + def show_attachments obj @attachments = [] obj.each do |container| diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 69c355313..2f98e6783 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -28,4 +28,8 @@ module OrganizationsHelper end end + def is_default_field? field + (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default' + end + end diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index c62cbf4f8..8cec49686 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -9,6 +9,7 @@ class OrgSubfield < ActiveRecord::Base has_many :news, :dependent => :destroy acts_as_attachable after_create :create_board_sync + after_destroy :update_priority # 创建资源栏目讨论区 def create_board_sync @board = self.boards.build @@ -25,4 +26,11 @@ class OrgSubfield < ActiveRecord::Base def project end + + def update_priority + OrgSubfield.where("organization_id=? and priority>?", self.organization_id, self.priority).each do |field| + field.decrement(:priority) + field.save + end + end end \ No newline at end of file diff --git a/app/models/organization.rb b/app/models/organization.rb index fcb777fb6..248783a26 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -16,8 +16,8 @@ class Organization < ActiveRecord::Base end def add_default_subfields - OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default') - OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default') - OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default') + OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1) + OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2) + OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3) end end diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index d035ab5cd..84b69717a 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -1,8 +1,7 @@ <% if @res %> $("#org_subfield_list").html(""); $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', - :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"), - :subfields => @organization.org_subfields.where("field_type != 'default'") }) %>"); + :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(""); diff --git a/app/views/org_subfields/destroy.js.erb b/app/views/org_subfields/destroy.js.erb index 2ba03fc36..d069b1cd8 100644 --- a/app/views/org_subfields/destroy.js.erb +++ b/app/views/org_subfields/destroy.js.erb @@ -1,6 +1,5 @@ $("#org_subfield_list").html(""); $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', - :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"), - :subfields => @organization.org_subfields.where("field_type != 'default'") }) %>"); + :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}) %>"); \ No newline at end of file diff --git a/app/views/org_subfields/update_priority.js.erb b/app/views/org_subfields/update_priority.js.erb new file mode 100644 index 000000000..4f269da8f --- /dev/null +++ b/app/views/org_subfields/update_priority.js.erb @@ -0,0 +1,2 @@ +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields.order("priority")}) %>"); +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>") \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 449d95f4c..3db6ffb13 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -34,71 +34,76 @@ }) }) -<% org_activity_field = organization.org_subfields.where('field_type="default" and name="activity" and field_type="default"').first %> -<% org_course_field = organization.org_subfields.where('field_type="default" and name="course" and field_type="default"').first %> -<% org_project_field = organization.org_subfields.where('field_type="default" and name="project" and field_type="default"').first %> -
- <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> -
-
-
- 项目 - <% if User.current.logged? and User.current.admin_of_org?(organization) %> - <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> - <% end %> -
-
-
    - <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> -
-
-
-
-
- 课程 - <% if User.current.logged? and User.current.admin_of_org?(organization) %> - <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> - <% end %> -
-
-
    - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> -
-
-
-<% organization.org_subfields.where("field_type != 'default'").each do |field| %> -
- <% if field.field_type == "Post" %> - <% if !field.subfield_subdomain_dir.nil? %> - <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> - <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> +<% organization.org_subfields.order("priority").each do |field| %> + <% if is_default_field?(field) %> + <% case field.name %> + <% when 'activity' %> +
+ <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> +
+ <% when 'course' %> +
+
+ 课程 + <% if User.current.logged? and User.current.admin_of_org?(organization) %> + <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> + <% end %> +
+
+
    + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> +
+
+
+ <% when 'project' %> +
+
+ 项目 + <% if User.current.logged? and User.current.admin_of_org?(organization) %> + <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> + <% end %> +
+
+
    + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> +
+
+
+ <% end %> + <% else %> +
+ <% if field.field_type == "Post" %> + <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% end %> <% else %> - <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> + <% end %> + <% if User.current.member_of_org?organization %> + <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <% end %> <% else %> - <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> - <% end %> - <% if User.current.member_of_org?organization %> - <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> - <% end %> - <% else %> - <% if !field.subfield_subdomain_dir.nil? %> - <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> - <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> - <% else %> - <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% end %> + <% else %> + <%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> + <% end %> + <% if User.current.member_of_org?organization %> + <%= link_to "", subfield_upload_file_org_subfield_files_path(field.id, :in_org => 1),:method => "post", :remote => true, :class => "homepageMenuSetting fr", :title => "上传资源" %> + + <% end %> + <% end %> - <% else %> - <%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> - <% end %> - <% if User.current.member_of_org?organization %> - <%= link_to "", subfield_upload_file_org_subfield_files_path(field.id, :in_org => 1),:method => "post", :remote => true, :class => "homepageMenuSetting fr", :title => "上传资源" %> - - <% end %> - - <% end %> -
- +
+ + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index eed0dabf6..b90ba7565 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -1,4 +1,5 @@
    +
  • 顺序
  • 已有栏目
  • 状态
  • 类型
  • @@ -6,48 +7,64 @@
-<% default_fields.each do |field| %> - <% name = get_default_name(field) %> - -<% end %> - <% subfields.each do |field| %> -
    -
  • -
    <%= field.name %>
    - -
  • -
  • 新增
  • -
  • <%= field.field_type == "Post" ? "帖子" : "资源" %>
  • -
+ <% end %> <% end %>