diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index dd237de17..43e95a0e9 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -38,6 +38,11 @@ class OrgDocumentCommentsController < ApplicationController def show @document = OrgDocumentComment.find(params[:id]) + @org_subfield = OrgSubfield.where(:id => @document.org_subfield_id).first + @subfield_content = @organization.org_subfields.order("priority") + respond_to do |format| + format.html {render :layout => @organization.switch_type ? 'base_org_custom' : 'base_org'} + end end def index @@ -91,7 +96,7 @@ class OrgDocumentCommentsController < ApplicationController def add_reply_in_doc @document = OrgDocumentComment.find(params[:id]).root @comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id]) - @comment.content = params[:org_comment][:org_content] + @comment.content = params[:org_content] @document.children << @comment @document.save respond_to do |format| diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index a0ef84798..ae1119609 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -28,8 +28,9 @@ class OrganizationsController < ApplicationController helper :project_score helper :issues include UsersHelper + include OrganizationsHelper before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers, :students, :projects, :courses] - before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts] + # before_filter :allow_as_admin, :only => [:students, :teachers, :projects, :courses, :acts] layout 'base_org' def index @@ -77,8 +78,12 @@ class OrganizationsController < ApplicationController def show # 组织新类型 show_mode:判断标准 1为新类型,0为旧 - if @organization.switch_type && params[:org_subfield_id].nil? && params[:list] .nil? + if @organization.switch_type && params[:list] .nil? if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + unless params[:org_subfield_id].nil? + @org_subfield = OrgSubfield.where(:id => params[:org_subfield_id]).first + @subfield_acts = get_subfield_acts(@org_subfield) + end @subfield_content = @organization.org_subfields.order("priority") shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id) shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id) @@ -102,7 +107,7 @@ class OrganizationsController < ApplicationController if @organization.org_subfields.where(:field_type => "Compact", :hide => 0).count > 0 @acts = UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'News', 'Message', 'Issue') and ((container_type = 'Course' and container_id in (#{course_ids.join(',')})) or (container_type = 'Project' and container_id in (#{project_ids.join(',')}))) - order by created_at desc limit 6;") + order by updated_at desc limit 6;") end render :layout => 'base_org_custom' else @@ -175,7 +180,7 @@ class OrganizationsController < ApplicationController q = params[:search].nil? ? "" : "#{params[:search].strip}" @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comptec").first : OrgSubfield.find(params[:org_subfield_id]) @type = params[:type] - if @type == "courses" || @type.nil? + if @type.blank? @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") elsif @type == "famous" @@ -199,7 +204,7 @@ class OrganizationsController < ApplicationController q = params[:search].nil? ? "" : "#{params[:search].strip}" @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id]) @type = params[:type] - if @type == "courses" || @type.nil? + if @type.blank? @org_students = User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity= 1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") elsif @type == "famous" @@ -235,7 +240,7 @@ class OrganizationsController < ApplicationController q = params[:search].nil? ? "" : "#{params[:search].strip}" @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comppro").first : OrgSubfield.find(params[:org_subfield_id]) @type = params[:type] - if @type.nil? + if @type.blank? @containers = Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count from projects p where p.status =1 and p.is_public =1 and name like '%#{q}%' order by project_count desc;") elsif @type == "famous" @@ -249,7 +254,7 @@ class OrganizationsController < ApplicationController q = params[:search].nil? ? "" : "#{params[:search].strip}" @field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Compstu").first : OrgSubfield.find(params[:org_subfield_id]) @type = params[:type] - if @type.nil? + if @type.blank? @containers = Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count from courses c where c.is_delete =0 and c.is_public =1 and name like '%#{q}%' order by course_count desc;") elsif @type == "famous" diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 531f0cb90..857f98afc 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -325,13 +325,10 @@ update def show ## TODO: the below will move to filter, done. - if !User.current.member_of?(@project) - if @project.hidden_repo - render_403 - return -1 - end + if !User.current.member_of?(@project) && @project.hidden_repo + render_403 + return end - @entries = @repository.entries(@path, @rev) @changeset = @repository.find_changeset_by_name(@rev) if request.xhr? diff --git a/app/controllers/sub_document_comments_controller.rb b/app/controllers/sub_document_comments_controller.rb index 80c14f004..2e0890e27 100644 --- a/app/controllers/sub_document_comments_controller.rb +++ b/app/controllers/sub_document_comments_controller.rb @@ -3,7 +3,7 @@ class SubDocumentCommentsController < ApplicationController before_filter :find_subfield_content, :only => [:show, :index] before_filter :authorize_allowed, :only => [:create, :add_reply] helper :attachments,:organizations - layout 'base_sub_domain' + layout 'base_org_custom' def new @sub_document_comment = SubDocumentComment.new @@ -41,7 +41,7 @@ class SubDocumentCommentsController < ApplicationController if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) @document = SubDocumentComment.find(params[:id]) respond_to do |format| - format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'} + format.html {render :layout => @organization.switch_type ? 'base_org_custom' : 'base_org'} end else render_403 @@ -58,7 +58,7 @@ class SubDocumentCommentsController < ApplicationController @offset ||= @atta_pages.offset @documents = paginateHelper @documents,20 respond_to do |format| - format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'} + format.html {render :layout => @organization.switch_type ? 'base_org_custom' : 'base_org'} end else render_403 diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index fa0d33f6e..60714f597 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -66,52 +66,87 @@ module OrganizationsHelper def org_user_by_type obj case obj.act_type when "Message" - user = obj.act.author + obj.act.author when "News" - user = obj.act.author + obj.act.author when "HomeworkCommon" - user = obj.act.user + obj.act.user when "Issue" - user = obj.act.author + obj.act.author end end def org_title_by_type obj case obj.act_type when "Message" - user = obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject + obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject when "News" - user = obj.act.title + obj.act.title when "HomeworkCommon" - user = obj.act.name + obj.act.name when "Issue" - user = obj.act.subject + obj.act.subject end end def org_content_by_type obj case obj.act_type when "Message" - user = obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content + obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content when "News" - user = obj.act.description + obj.act.description when "HomeworkCommon" - user = obj.act.description + obj.act.description when "Issue" - user = obj.act.description + obj.act.description end end def org_time_by_type obj case obj.act_type when "Message" - time = obj.act.updated_on + obj.act.updated_on when "News" - user = obj.act.created_on + obj.act.created_on when "HomeworkCommon" - user = obj.act.updated_at + obj.act.updated_at when "Issue" - user = obj.act.updated_on + obj.act.updated_on + end + end + + # 组织的栏目类型标题 + def subfield_title_type obj + case obj.org_act_type + when "OrgDocumentComment" + obj.org_act.title + when "Message" + obj.org_act.parent_id.nil? ? obj.org_act.subject : obj.org_act.parent.subject + when "News" + obj.org_act.title + end + end + + # 组织的栏目类型时间 + def subfield_time_type obj + case obj.org_act_type + when "OrgDocumentComment" + obj.org_act.updated_at + when "Message" + obj.org_act.updated_on + when "News" + obj.org_act.created_on + end + end + + def subfield_reply_count_type obj + case obj.org_act_type + when "OrgDocumentComment" + obj.org_act.children.count + when "Message" + obj.org_act.children.count + when "News" + obj.org_act.comments_count end end @@ -178,17 +213,19 @@ module OrganizationsHelper # 系统栏目只有管理员才能看到 def subfield_to_addmin?(org) - if User.current.admin? - @organization.org_subfields.order("priority") - else - @organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority} - end + # if User.current.admin? + @organization.org_subfields.order("priority") + # else + # @organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority} + # end end def get_subfield_acts field - org_subfield = OrgSubfield.find(field.id) - org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0 - org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc') + unless field.nil? + org_subfield = OrgSubfield.find(field.id) + org_subfield_ids = org_subfield.org_document_comments.map(&:id) << 0 + org_acts = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc') + end end def allow_to_create?(org, type) diff --git a/app/views/attachments/_attachment_history_download.html.erb b/app/views/attachments/_attachment_history_download.html.erb index c805960f0..c3e586fb1 100644 --- a/app/views/attachments/_attachment_history_download.html.erb +++ b/app/views/attachments/_attachment_history_download.html.erb @@ -13,7 +13,7 @@ <%= link_to truncate(@attachment.filename,length: 35, omission: '...'), download_named_attachment_path(@attachment.id, @attachment.filename), - :title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %> + :title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:280px;",:class => "linkBlue f14 fb link_file_a2 fl" %> 版本号:当前
diff --git a/app/views/layouts/_org_subdomain_footer.html.erb b/app/views/layouts/_org_subdomain_footer.html.erb new file mode 100644 index 000000000..dd991d900 --- /dev/null +++ b/app/views/layouts/_org_subdomain_footer.html.erb @@ -0,0 +1,13 @@ +
+ +
\ No newline at end of file diff --git a/app/views/layouts/base_org_custom.html.erb b/app/views/layouts/base_org_custom.html.erb index bfa76a221..8f071bfb2 100644 --- a/app/views/layouts/base_org_custom.html.erb +++ b/app/views/layouts/base_org_custom.html.erb @@ -9,16 +9,16 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'new_user', 'public', 'org_custom','jquery/jquery-ui-1.9.2' %> + <%= stylesheet_link_tag 'new_user', 'public', 'org_custom','jquery/jquery-ui-1.9.2', 'org2' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> - <%=render :partial => "math_js" %> + <%#=render :partial => "math_js" %> <% update_visiti_count @organization %>
- <%= render :partial => 'org_custom_header', :locals => {:subfield_content => @subfield_content} %> + <%= render :partial => 'organizations/org_custom_header', :locals => {:subfield_content => @subfield_content} %>
<%# 内容开始 %> diff --git a/app/views/layouts/base_sub_domain.html.erb b/app/views/layouts/base_sub_domain.html.erb index 871e2cdea..0e6509e70 100644 --- a/app/views/layouts/base_sub_domain.html.erb +++ b/app/views/layouts/base_sub_domain.html.erb @@ -160,30 +160,14 @@
- - + diff --git a/app/views/org_document_comments/_show_custom_org_document_comment.html.erb b/app/views/org_document_comments/_show_custom_org_document_comment.html.erb new file mode 100644 index 000000000..d3c98da13 --- /dev/null +++ b/app/views/org_document_comments/_show_custom_org_document_comment.html.erb @@ -0,0 +1,111 @@ +
+
+
您的位置:<%= link_to "首页", organization_path(@organization), :class => "sn-link-grey2" %> > + <%=link_to @org_subfield.name, organization_path(@organization, :org_subfield_id => @org_subfield.id), :class => "sn-link-grey2" %> > + <%= @document.title %> +
+
+
+

<%= @document.title %>

+
+

来源:<%= @org_subfield.name %> 发布时间:<%= format_date(@document.created_at) %>

+

<%= @document.content.html_safe %>

+
+
+ + <% if User.current.logged? %> + <% comments_for_doc = @document.children.reorder("created_at desc") %> + <% count = @document.children.count() %> +
+

留言板<%= count %>条留言

+ <%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'org_document_comments', :id => @document.id, :flag => true}, :html => {:multipart => true, :id => 'message_form', :class => "sn-reply-form", } do |f| %> + + <%#= f.kindeditor :sub_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor', :class => "sn-reply-text" %> +
+ 发表 +
+ + <%#= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %> + <% end %> + +
+

全部评论

+ +
+ <% comments_for_doc.each_with_index do |reply,i| %> +
+ + <%= link_to User.find(reply.creator_id).realname, user_url_in_org(reply.creator_id), :class => "sn-reply-username fl" %><%= time_from_now(reply.created_at) %> +
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id => reply.id, :content=> reply.content} %> + <%#= reply.content.html_safe unless reply.content.nil? %> +
+ +
+
+ <% end %> +
+ <% if count > 3 %> + + <% end %> +
+
+ <% end %> +
+ + \ No newline at end of file diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index c7adc39fb..dfa37bfb6 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -1,72 +1,75 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"create_kindeditor",'blog' %> - -
-
-
- <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> -
-
-
- <%= link_to User.find(@document.creator_id), user_url_in_org(@document.creator_id), :class => "newsBlue mr15" %> - TO  <%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %> - | - <% if @document.organization.home_id == @document.id %> - 首页 - <% else %> - 组织文章 - <% end %> -
-
<%= link_to @document.title, org_document_comment_path(:id => @document.id, :organization_id => @document.organization.id) %>
-
- 发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %>
- <% unless @document.content.blank? %> -
- <%= @document.content.html_safe %> +<% if @organization.switch_type %> + <%= render :partial => 'show_custom_org_document_comment' %> +<% else %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"create_kindeditor",'blog' %> + +
+
+
+ <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> +
+
+
+ <%= link_to User.find(@document.creator_id), user_url_in_org(@document.creator_id), :class => "newsBlue mr15" %> + TO  <%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %> + | + <% if @document.organization.home_id == @document.id %> + 首页 + <% else %> + 组织文章 + <% end %>
- <% end %> -
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %> - <%#= link_to_attachments_course @document, :author => false %> -
- - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(@document.organization_id) || User.current.id == @document.creator_id) %> -
-
    -
  • -
      -
    • - <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @document.organization_id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %> - 设为首页 - <% end %> -
    • -
    • - <%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %> -
    • -
    • - <%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :detail_page => 1), :method => 'delete', - :data => {:confirm => l(:text_are_you_sure)}, - :remote => true, :class => 'postOptionLink' %> + <% if User.current.admin? || User.current.admin_of_org?(Organization.find(@document.organization_id) || User.current.id == @document.creator_id) %> +
      +
        +
      • +
          +
        • + <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @document.organization_id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %> + 设为首页 + <% end %> +
        • +
        • + <%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %> +
        • +
        • + <%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :detail_page => 1), :method => 'delete', + :data => {:confirm => l(:text_are_you_sure)}, + :remote => true, :class => 'postOptionLink' %> +
        • +
      -
    • -
    -
-
- <% end %> -
-
- <% comments_for_doc = @document.children.reorder("created_at desc") %> - <% count = @document.children.count() %> +
+
+ <% end %> +
+
+ <% comments_for_doc = @document.children.reorder("created_at desc") %> + <% count = @document.children.count() %> -
- <%# if count > 0 %> +
+ <%# if count > 0 %>
回复 <%= count>0 ? "(#{count})" : "" %> @@ -123,50 +126,51 @@ <% end %>
- <%# end %> - <%# if User.current.logged?%> + <%# end %> + <%# if User.current.logged?%>
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'org_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %> - <%= f.kindeditor :org_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %> + <%= f.kindeditor :org_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %> <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %> <%= link_to l(:button_reply), "javascript:void(0)", :onclick => "message_content_editor.sync();$('#message_form').submit();", :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %> <% end %>
- <%# end %> -
-
+ <%# end %> +
+
- \ No newline at end of file + +<% end %> diff --git a/app/views/organizations/_org_container.html.erb b/app/views/organizations/_org_container.html.erb index 59ac4d95c..d91ed649e 100644 --- a/app/views/organizations/_org_container.html.erb +++ b/app/views/organizations/_org_container.html.erb @@ -16,7 +16,9 @@
资源
- <%= container.class == Course ? (container.is_excellent == 0 ? "设为精品" : "取消精品") : (container.hot ==0 ? "设为热门" : "取消热门") %> + <% if User.current.admin? %> + <%= container.class == Course ? (container.is_excellent == 0 ? "设为精品" : "取消精品") : (container.hot ==0 ? "设为热门" : "取消热门") %> + <% end %>
diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb index e05d52747..91ca5aafb 100644 --- a/app/views/organizations/_org_custom_header.html.erb +++ b/app/views/organizations/_org_custom_header.html.erb @@ -63,8 +63,28 @@ <% end %> + <% elsif field.field_type == "Comptec" %> +
  • + <%= link_to "#{field.name}", teachers_organization_path(@organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "sn-link-white", :target => "_blank" %> +
  • + <% elsif field.field_type == "Compstu" %> +
  • + <%= link_to "#{field.name}", students_organization_path(@organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "sn-link-white", :target => "_blank" %> +
  • + <% elsif field.field_type == "Comppro" %> +
  • + <%= link_to "#{field.name}", projects_organization_path(@organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "sn-link-white", :target => "_blank" %> +
  • + <% elsif field.field_type == "Compcou" %> +
  • + <%= link_to "#{field.name}", courses_organization_path(@organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "sn-link-white", :target => "_blank" %> +
  • + <% elsif field.field_type == "Compact" %> +
  • + <%= link_to "#{field.name}", acts_organization_path(@organization, :org_subfield_id => field.id), :class => "sn-link-white", :target => "_blank" %> +
  • <% elsif field.field_type == "Resource" && field.hide == 0 %> -
  • <%= link_to field.name, org_subfield_files_path(field), :class => "sn-link-white", :target => "_blank" %>
  • <% end %> diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 30234c300..ddc504640 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -117,27 +117,23 @@ <% end %> - <% elsif field.field_type == "Comptec" && User.current.admin? %> + <% elsif field.field_type == "Comptec" %>
    - <%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
    - <% elsif field.field_type == "Compstu" && User.current.admin? %> + <% elsif field.field_type == "Compstu" %>
    - <%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
    - <% elsif field.field_type == "Compstu" && User.current.admin? %> + <% elsif field.field_type == "Comppro" %>
    - <%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <%= link_to "#{field.name}", projects_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
    - <% elsif field.field_type == "Comppro" && User.current.admin? %> + <% elsif field.field_type == "Compcou" %>
    - <%= link_to "#{field.name}", projects_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <%= link_to "#{field.name}", courses_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
    - <% elsif field.field_type == "Compcou" && User.current.admin? %> -
    - <%= link_to "#{field.name}", courses_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> -
    - <% elsif field.field_type == "Compact" && User.current.admin? %> + <% elsif field.field_type == "Compact" %>
    <%= link_to "#{field.name}", acts_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
    diff --git a/app/views/organizations/_org_students_list.html.erb b/app/views/organizations/_org_students_list.html.erb index d3db6fbf6..482447c56 100644 --- a/app/views/organizations/_org_students_list.html.erb +++ b/app/views/organizations/_org_students_list.html.erb @@ -21,7 +21,7 @@
    资源数
    - <% if User.current.admin_of_org?(@organization) %> + <% if User.current.admin? %> <%= org_student.excellent_student ==0 ? "设为学霸" : "取消设置" %> <% end %> diff --git a/app/views/organizations/_org_teachers_list.html.erb b/app/views/organizations/_org_teachers_list.html.erb index f2523fb9f..90467d870 100644 --- a/app/views/organizations/_org_teachers_list.html.erb +++ b/app/views/organizations/_org_teachers_list.html.erb @@ -28,15 +28,8 @@
    资源数
    - <% if User.current.admin_of_org?(@organization) %> + <% if User.current.admin? %> <%= org_teacher.excellent_teacher==0?"设为名师":"取消设置" %> - - <% else %> - - - - - <% end %>
    diff --git a/app/views/organizations/_show_custom_org_subfield.html.erb b/app/views/organizations/_show_custom_org_subfield.html.erb new file mode 100644 index 000000000..10ac31637 --- /dev/null +++ b/app/views/organizations/_show_custom_org_subfield.html.erb @@ -0,0 +1,44 @@ +<% if @subfield_acts.blank? %> +<% else %> +
    +
    +
    +
    + 您的位置:<%= link_to "首页", organization_path(@organization), :class => "sn-link-grey2" %> > + <%= @org_subfield.name %> +
    +
    +
    +

    <%= @org_subfield.name %>

    +
      + <% @subfield_acts.each do |act| %> + <% title = subfield_title_type(act) %> + <% time = subfield_time_type(act) %> + <% reply_count = subfield_reply_count_type(act) %> + <% document = act.org_act %> +
    • +
      + <% if act.org_act_type == "OrgDocumentComment" %> + <%=link_to title, org_document_comment_path(act.org_act, :organization_id => @organization.id), :class => "sn-newslist-titile fl", :target => "_blank" %> + <% elsif act.org_act_type == "News" %> + <%=link_to title, news_path(act.org_act), :class => "sn-newslist-titile fl", :target => "_blank" %> + <% elsif act.org_act_type == "Message" %> + <%=link_to title, board_message_path(act.org_act.board.id, act.org_act.id), :class => "sn-newslist-titile fl", :target => "_blank" %> + <% end %> + <%= format_date(time) %> + 回复(<%= reply_count %>) +
      +
    • + <% end %> +
    + + + + + + + +
    +
    +
    +<% end %> diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 946043a62..aa1084304 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -89,7 +89,11 @@
  • <%= field.hide==0?"隐藏":"可见" %> | - <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %> + <% if (field.field_type == "Comptec" || field.field_type == "Compstu" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact") && !User.current.admin? %> + 默认 + <% else %> + <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %> + <% end %> | 编辑 <% unless field.field_type == "Resource" || field.field_type == "Comptec" || field.field_type == "Compstu" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact" %> diff --git a/app/views/organizations/courses.js.erb b/app/views/organizations/courses.js.erb index dc42c115c..48868be39 100644 --- a/app/views/organizations/courses.js.erb +++ b/app/views/organizations/courses.js.erb @@ -1,3 +1,3 @@ $("#org_container_list").html('<%= escape_javascript( render :partial => 'organizations/org_container', :locals => {:containers => @containers})%>'); -$("#pages").html('<%= pagination_links_full @atta_pages, @container_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); -$("#org_student_search").attr('href','<%= courses_organization_path(@organization, :type => @type) %>'); \ No newline at end of file +$("#pages").html('<%= pagination_links_full @atta_pages, @container_count, :per_page_links => false, :remote => true, :flag => true %>'); +//$("#org_student_search").attr('href','<%#= courses_organization_path(@organization, :type => @type) %>'); \ No newline at end of file diff --git a/app/views/organizations/projects.js.erb b/app/views/organizations/projects.js.erb index e8d4f244a..cf3216fdf 100644 --- a/app/views/organizations/projects.js.erb +++ b/app/views/organizations/projects.js.erb @@ -1,3 +1,2 @@ $("#org_container_list").html('<%= escape_javascript( render :partial => 'organizations/org_container', :locals => {:containers => @containers})%>'); -$("#pages").html('<%= pagination_links_full @atta_pages, @container_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); -$("#org_student_search").attr('href','<%= projects_organization_path(@organization, :type => @type) %>'); \ No newline at end of file +$("#pages").html('<%= pagination_links_full @atta_pages, @container_count, :per_page_links => false, :remote => true, :flag => true %>'); diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 72e95ded9..ab3120a5d 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -1,6 +1,11 @@ <%# 区分两种模式 params[:org_subfield_id] 不为空的时候则跳到栏目%> -<% if @organization.switch_type && params[:org_subfield_id].nil? %> - <%= render :partial => 'show_custom' %> +<% if @organization.switch_type %> + <% if params[:org_subfield_id].nil? %> + <%= render :partial => 'show_custom' %> + <% else %> + <%#= 单个栏目模式二中显示 %> + <%= render :partial => 'show_custom_org_subfield' %> + <% end %> <% else %> <%= javascript_include_tag "jquery.infinitescroll.js" %> diff --git a/app/views/organizations/students.js.erb b/app/views/organizations/students.js.erb index c65f8f861..7a427c1ac 100644 --- a/app/views/organizations/students.js.erb +++ b/app/views/organizations/students.js.erb @@ -1,3 +1,2 @@ $("#org_students_list").html('<%= escape_javascript( render :partial => 'organizations/org_students_list', :locals => {:org_students => @org_students})%>'); -$("#pages").html('<%= pagination_links_full @atta_pages, @students_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); -$("#org_student_search").attr('href','<%= students_organization_path(@organization, :type => @type) %>'); \ No newline at end of file +$("#pages").html('<%= pagination_links_full @atta_pages, @students_count, :per_page_links => false, :remote => true, :flag => true %>'); diff --git a/app/views/organizations/teachers.js.erb b/app/views/organizations/teachers.js.erb index cd7323a4a..04eecb810 100644 --- a/app/views/organizations/teachers.js.erb +++ b/app/views/organizations/teachers.js.erb @@ -1,3 +1,2 @@ $("#org_teachers_list").html('<%= escape_javascript( render :partial => 'organizations/org_teachers_list', :locals => {:org_teachers => @org_teachers})%>'); -$("#pages").html('<%= pagination_links_full @atta_pages, @teachers_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); -$("#org_teacher_search").attr('href','<%= teachers_organization_path(@organization, :type => @type) %>'); \ No newline at end of file +$("#pages").html('<%= pagination_links_full @atta_pages, @teachers_count, :per_page_links => false, :remote => true, :flag => true %>'); \ No newline at end of file diff --git a/public/stylesheets/org2.css b/public/stylesheets/org2.css index 3d46a9296..9e19fb5cb 100644 --- a/public/stylesheets/org2.css +++ b/public/stylesheets/org2.css @@ -1,14 +1,6 @@ @charset "utf-8"; /* CSS Document */ /* 样式重置 */ -body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} -body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.9; background:#f2f2f2;} -div,img,tr,td,table{ border:0;} -table,tr,td{border:0;cellspacing:0; cellpadding:0;} -ol,ul,li{ list-style-type:none} -a:link,a:visited{color:#000;text-decoration:none;} -a:hover,a:active{color:#24366e;} - .sn-fl {float:left;} .sn-fr {float:right;} .sn-cl {clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden} @@ -166,17 +158,17 @@ a.more-btn{ display:block; width:185px; height:30px; text-align:center; backgrou /* 内页新闻列表 */ .sn-inner-body{ width:100%; background-color:#fff;} -.sn-innner-content{ width:1200px; margin:0 auto;} +.sn-innner-content{ width:1000px; margin:0 auto;} .sn-inner-newsh2{ font-size:20px; font-weight:normal; padding-bottom:5px; border-bottom:1px dashed #eee;} .sn-circle{ margin:18px 5px 0 5px ;border:1px solid #24366e; width:5px; height:5px; -webkit-border-radius:50px; -moz-border-radius:50px; -o-border-radius:50px; border-radius:50px; } .sn-inner-newslist ul li{ line-height:42px; font-size:15px; border-bottom:1px solid #eee;} .sn-inner-newslist a{font-size:15px; color:#888;} .sn-inner-newslist a:hover{ color:#24366e;} -a.sn-newslist-titile{ font-size:15px;width:840px; display:block;overflow:hidden;white-space:nowrap; text-overflow:ellipsis;} +a.sn-newslist-titile{ font-size:15px;width:700px; display:block;overflow:hidden;white-space:nowrap; text-overflow:ellipsis;} a:hover.sn-newslist-reply,a:hover.sn-newslist-zan{ color:#379be9;} /* 内页新闻展示 */ -.sn-inner-newscon{ width:1200px; padding:5px 0 50px; border-bottom:1px solid #e8e8e8; margin-bottom:30px; color:#999; font-size:14px; } +.sn-inner-newscon{ width:1000px; padding:5px 0 50px; border-bottom:1px solid #e8e8e8; margin-bottom:30px; color:#999; font-size:14px; } .sn-inner-pcon{text-indent:2em; overflow:hidden;} .sn-inner-newscon img{ display:block; max-width:830px; margin:25px auto 5px;} .sn-inner-psmall{ color:#999; font-size:12px; margin-bottom:15px;} @@ -186,8 +178,8 @@ a:hover.sn-newslist-zan{ background:url(../images/zan.gif) 0 -21px no-repeat; } /* 留言 */ .sn-replybox{ margin-bottom:100px;} .sn-reply-h2{ font-size:18px; font-weight:normal; color:#24366e; margin-bottom:6px;} -.sn-reply-form{ width:1200px;height:180px; border:1px solid #e8e8e8; -webkit-border-radius:3px; -moz-border-radius:3px; -o-border-radius:3px; border-radius:3px; background:#fff; margin-bottom:20px; } -.sn-reply-text{ width:1200px; height:130px; background:#fff; border:none; resize:none;} +.sn-reply-form{ width:1000px;height:180px; border:1px solid #e8e8e8; -webkit-border-radius:3px; -moz-border-radius:3px; -o-border-radius:3px; border-radius:3px; background:#fff; margin-bottom:20px; } +.sn-reply-text{ width:1000px; height:130px; background:#fff; border:none; resize:none;} .sn-reply-btnbox{border-top:1px solid #e8e8e8; height:48px;} a.submit-btn{ display:block; color:#fff; text-align:center; font-size:14px; line-height:27px; width:79px; height:27px; -webkit-border-radius:3px; -moz-border-radius:3px; -o-border-radius:3px; border-radius:3px; background:#24366e; margin:8px 0 0 10px;} a:hover.submit-btn{ color:#16275c; color:#fff;} @@ -196,10 +188,10 @@ a:hover.submit-btn{ color:#16275c; color:#fff;} .sn-reply-userpic img{ width:40px; height:40px;-webkit-border-radius:50px; -moz-border-radius:50px; -o-border-radius:50px; border-radius:50px;} a.sn-reply-zan{ display:block; background:url(../images/zan.gif) 0 4px no-repeat; width:54px; height:16px; padding-left:12px; color:#999; } a:hover.sn-reply-zan{ background:url(../images/zan.gif) 0 -32px no-repeat; } -.sn-comment-listbox{ padding:23px 0; width:1200px;border-bottom:1px solid #e8e8e8;} +.sn-comment-listbox{ padding:23px 0; width:1000px;border-bottom:1px solid #e8e8e8;} a.sn-reply-username { color:#24366e; margin-right:15px; } -.sn-reply-usertxt{ width:1145px; font-size:14px; } -.sn-reply-more{ width:1200px; height:25px; background:#ddd; text-align:center; line-height:25px;} +.sn-reply-usertxt{ width:945px; font-size:14px; } +.sn-reply-more{ width:1000px; height:25px; background:#ddd; text-align:center; line-height:25px;} /*用户图像*/ .topnav_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 1px;}