diff --git a/app/assets/javascripts/sub_document_comments.js.coffee b/app/assets/javascripts/sub_document_comments.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/sub_document_comments.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/sub_domains.js.coffee b/app/assets/javascripts/sub_domains.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/sub_domains.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/sub_document_comments.css.scss b/app/assets/stylesheets/sub_document_comments.css.scss new file mode 100644 index 000000000..c88f77750 --- /dev/null +++ b/app/assets/stylesheets/sub_document_comments.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the sub_document_comments controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/sub_domains.css.scss b/app/assets/stylesheets/sub_domains.css.scss new file mode 100644 index 000000000..7a751c0d9 --- /dev/null +++ b/app/assets/stylesheets/sub_domains.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the sub_domains controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index f3c01f21e..bd4f87ffb 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -76,7 +76,7 @@ class OrganizationsController < ApplicationController def show # 组织新类型 show_mode:判断标准 1为新类型,0为旧 - if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:list] .nil? + if @organization.show_mode.to_i == 1 && params[:org_subfield_id].nil? && params[:list] .nil? if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) # REDO:时间紧,暂时先这样 @org_logo_attchment = Attachment.find_by_sql("SELECT * from attachments WHERE container_id = #{@organization.id} and container_type = 'Organization' and attachtype = 0 and filename REGEXP '(.jpg|.png|.bmp|.gif|.jpeg)' ORDER BY created_on desc limit 1").first @@ -84,10 +84,6 @@ class OrganizationsController < ApplicationController @subfield_content = @organization.org_subfields.order("priority") @organization = Organization.find(params[:id]) - # @org_subfield = OrgSubfield.find(params[:org_subfield_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').page(params[:page] || 1).per(10) - 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) project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0 @@ -95,24 +91,6 @@ class OrganizationsController < ApplicationController course_types = "('Message','News','HomeworkCommon','Poll','Course')" @project_acts = get_project_activities_org @organization, project_ids @course_acts = get_course_activities_org @organization, course_ids - #@org_acts = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc') - #@project_acts = OrgActivity.where("(container_id =? and container_type =?) " + - # "or (container_type ='Project' and org_act_type in ('Issue','Message') and container_id in (#{project_ids.join(',')})) ", - # @organization.id, 'Organization').order('updated_at desc').limit(8) - - #@course_acts = OrgActivity.where("(container_id =? and container_type =?) " + - # "or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))", - # @organization.id, 'Organization').order('updated_at desc').limit(8) - - - - # 项目两种动态 - #@project_acts = get_project_activities_org @organization - - # 课程动态 - #@project_acts_issues = get_project_activities_org @organization - #@course_acts = get_course_activities_org @organization - render :layout => 'base_org_newstyle' else render_403 @@ -187,7 +165,7 @@ class OrganizationsController < ApplicationController def get_project_activities_org org, project_ids unless project_ids.blank? project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{project_ids.join(',')}) and container_type = 'project' - and org_act_type in ('Message', 'Issue') order by updated_at desc limit 8;") + and org_act_type in ('Message', 'Issue') order by updated_at desc limit 5;") else project_acts = nil end @@ -198,7 +176,7 @@ class OrganizationsController < ApplicationController def get_course_activities_org org, course_ids unless course_ids.blank? project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids.join(',')}) and container_type = 'course' - and org_act_type in ('HomeworkCommon', 'Poll', 'Message', 'News', 'Course') order by updated_at desc limit 8;") + and org_act_type in ('HomeworkCommon', 'Poll', 'Message', 'News', 'Course') order by updated_at desc limit 5;") else project_acts = nil end diff --git a/app/controllers/sub_document_comments_controller.rb b/app/controllers/sub_document_comments_controller.rb new file mode 100644 index 000000000..ed12ac8f7 --- /dev/null +++ b/app/controllers/sub_document_comments_controller.rb @@ -0,0 +1,206 @@ +class SubDocumentCommentsController < ApplicationController + before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index, :destroy, :edit] + before_filter :find_subfield_content, :only => [:show, :index] + helper :attachments,:organizations + layout 'base_sub_domain' + + def new + @sub_document_comment = SubDocumentComment.new + end + + + def create + @sub_document_comment = SubDocumentComment.new(:sub_domain_id => params[:sub_domain_id], :creator_id => User.current.id, :org_subfield_id => params[:org_subfield_id]) + @sub_document_comment.title = params[:sub_document_comment][:title] + @sub_document_comment.content = params[:sub_document_comment][:content] + # @sub_document_comment.save_attachments(params[:attachments]) + if params[:field_id] + @sub_document_comment.org_subfield_id = params[:field_id].to_i + end + if @sub_document_comment.save + flash.keep[:notice] = l(:notice_successful_create) + redirect_to org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id) + # EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @sub_document_comment.id, :created_at => @sub_document_comment.updated_at) + # if params[:field_id] + # @org_subfield = OrgSubfield.find(params[:field_id]) + # if @org_subfield.subfield_subdomain_dir.nil? + # redirect_to organization_path(@organization, :org_subfield_id => params[:field_id]) + # else + # redirect_to show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => @org_subfield.subfield_subdomain_dir.name) + # end + # else + # redirect_to organization_org_document_comments_path(@organization) + # end + else + redirect_to new_org_document_comment_path(:organization_id => @organization.id) + end + end + + def show + 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'} + end + else + render_403 + end + end + + def index + if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + @documents = @subdomain.sub_document_comments.where("parent_id is null").order("created_at desc") + @is_remote = true + @limit = 20 + @atta_count = @documents.count + @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + @offset ||= @atta_pages.offset + @documents = paginateHelper @documents,20 + respond_to do |format| + format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'} + end + else + render_403 + end + end + + def update + @org_document = OrgDocumentComment.find(params[:id]) + @org_document.update_attributes(:title => params[:org_document_comment][:title], :content => params[:org_document_comment][:content]) + Attachment.attach_files(@org_document, params[:attachments]) + # @org_document.save_attachments(params[:attachments]) + if @org_document.parent.nil? + act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", @org_document.id).first + act.update_attributes(:updated_at => @org_document.updated_at) + EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document.id, :created_at => Time.now) + end + respond_to do |format| + format.html { + if params[:flag].to_i == 0 + redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id) + else + if params[:flag].to_i == 1 + redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id) + else + redirect_to organization_path(@org_document.organization.id, :org_subfield_id => params[:org_subfield_id]) + end + end + } + end + end + + def edit + @sub_document = SubDocumentComment.find(params[:id]) + @flag = params[:flag] + end + + def add_reply + @document = SubDocumentComment.find(params[:id]).root + @subdomain = @document.sub_domain + @org_subfield = @subdomain.org_subfield + @organization = @org_subfield.organization + @act = OrgActivity.find(params[:id]) + @comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain, :creator_id => User.current.id, :reply_id => params[:id]) + @comment.content = params[:sub_content] + @document.children << @comment + @document.save + end + + def add_reply_in_doc + @document = SubDocumentComment.find(params[:id]).root + @subdomain = @document.sub_domain + @org_subfield = @subdomain.org_subfield + @organization = @org_subfield.organization + @comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain_id, :creator_id => User.current.id, :reply_id => params[:id]) + @comment.content = params[:flag] ? params[:sub_content] : params[:org_comment][:sub_content] + @document.children << @comment + @document.save + respond_to do |format| + format.html {redirect_to org_subfield_sub_domain_sub_document_comment_path(:id => @document.id, :org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id)} + end + end + + def destroy + @sub_document_comment = SubDocumentComment.find(params[:id]) + @sub_document_comment.destroy + rescue ActiveRecord::RecordNotFound + respond_to do |format| + # format.html{ + # redirect_to org_subfield_sub_domain_sub_document_comments_path(:id => params[:sub_domain_id], :org_subfield_id => params[:org_subfield_id]) + # } + format.js + end + end + + def delete_reply + @sub_document_comment = OrgDocumentComment.find(params[:id]) + @document = @sub_document_comment.root + org = @sub_document_comment.organization + @sub_document_comment.destroy + respond_to do |format| + format.html {redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)} + end + end + def quote + @org_comment = OrgDocumentComment.find(params[:id]) + @subject = @org_comment.content + @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:') + + @content = "> #{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}\n> " + @temp = OrgDocumentComment.new + #@course_id = params[:course_id] + @temp.content = "
#{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}
#{@org_comment.content.html_safe}
".html_safe + respond_to do | format| + format.js + end + end + + def reply + @document = OrgDocumentComment.find(params[:id]).root + @quote = params[:quote][:quote] + @org_document = OrgDocumentComment.new(:creator_id => User.current.id, :reply_id => params[:id]) + + # params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0 + # params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0 + @org_document.title = params[:org_document_comment][:title] + @org_document.content = params[:org_document_comment][:content] + @org_document.content = @quote + @org_document.content + #@org_document.title = "RE: #{@article.title}" unless params[:blog_comment][:title] + @document.children << @org_document + # @user_activity_id = params[:user_activity_id] + # user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first + # if user_activity + # user_activity.updated_at = Time.now + # user_activity.save + # end + # attachments = Attachment.attach_files(@org_document, params[:attachments]) + # render_attachment_warning_if_needed(@org_document) + #@article.save + # redirect_to user_blogs_path(:user_id=>params[:user_id]) + respond_to do |format| + format.html { + # if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的 + # redirect_to syllabus_course_path(:id=>params[:course_id]) + # else + redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id) + # end + + } + format.js + end + end + + private + def find_subdomain_and_subfield + @subdomain = SubDomain.find(params[:sub_domain_id]) + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @organization = @org_subfield.organization + rescue ActiveRecord::RecordNotFound + # source_subdomain_subfield not found + render_404 + end + + def find_subfield_content + @subfield_content = @organization.org_subfields.order("priority") + end +end diff --git a/app/controllers/sub_domains_controller.rb b/app/controllers/sub_domains_controller.rb new file mode 100644 index 000000000..e32935789 --- /dev/null +++ b/app/controllers/sub_domains_controller.rb @@ -0,0 +1,63 @@ +class SubDomainsController < ApplicationController + layout 'base_org' + before_filter :find_org_subfield_and_subdomain, :only => [:show, :index, :domain_update_priority, :destroy, :update, :hide_sub_domain, :show_sub_domain] + + def new + @subdomain = SubDomain.new + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @organization = @org_subfield.organization + end + + def create + if SubDomain.where("org_subfield_id=#{params[:org_subfield_id]} and name=?",params[:name]).count == 0 + @res = true + @subfield = OrgSubfield.find(params[:org_subfield_id]) + @organization = @subfield.organization + @subdomain = SubDomain.create(:name => params[:name], :org_subfield_id => params[:org_subfield_id], :priority => @subfield.sub_domains.blank? ? 1 : @subfield.sub_domains.order("priority").last.priority + 1) + @subdomain.update_column(:field_type, params[:field_type]) + else + @res = false + end + end + + def update + @subdomain.update_column(:name, params[:name]) + end + + def domain_update_priority + @subdomain.update_attribute(:priority, params[:priority].to_i) + end + + def destroy + @subdomain.destroy + end + + def show + render_404 + # @subfield_content = @organization.org_subfields.order("priority") + # render layout: @organization.switch_type ? 'base_sub_domain' : 'base_org' + end + + def index + + end + + def hide_sub_domain + @subdomain.update_attribute(:hide, 1) + end + + def show_sub_domain + @subdomain.update_attribute(:hide, 0) + end + + + private + def find_org_subfield_and_subdomain + @subfield = OrgSubfield.find(params[:org_subfield_id]) + @subdomain = SubDomain.find(params[:id]) + @organization = @subfield.organization + rescue ActiveRecord::RecordNotFound + # source_subdomain not found + render_404 + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d2f3ad456..98f0668fc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -37,6 +37,12 @@ module ApplicationHelper container.update_column(:visits, container.visits + 1) end + def if_hidden_subdomain field + domains = field.sub_domains.select{|domain| domain.hide.to_i == 0} + result = domains.length > 0 ? true : false + return result + end + # Time 2015-03-24 15:27:29 # Author lizanle # Description 从硬盘上删除对应的资源文件 diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index b3b014de1..2eb4658c5 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -5,17 +5,17 @@ module OrganizationsHelper def find_user_not_in_current_org_by_name org - if params[:q] && params[:q].lstrip.rstrip != "" - scope = Principal.active.sorted.not_member_of_org(org).like(params[:q]) - else - scope = [] - end - 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 - } - s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) + if params[:q] && params[:q].lstrip.rstrip != "" + scope = Principal.active.sorted.not_member_of_org(org).like(params[:q]) + else + scope = [] + end + 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 + } + s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end def get_default_name field @@ -63,14 +63,89 @@ module OrganizationsHelper def subfield_status_option type = [] option1 = [] - option1 << "列表" + option1 << "左上" option1 << "1" type << option1 - option2 = [] - option2 << "图片" - option2 << "0" - type << option2 + # option2 = [] + # option2 << "中一" + # option2 << "2" + # type << option2 + option3 = [] + option3 << "中上" + option3 << "3" + type << option3 + option4 = [] + option4 << "中下" + option4 << "4" + type << option4 + option5 = [] + option5 << "左下" + option5 << "5" + type << option5 + option6 = [] + option6 << "右上" + option6 << "6" + type << option6 + option7 = [] + option7 << "右中" + option7 << "7" + type << option7 + option8 = [] + option8 << "右下" + option8 << "8" + type << option8 type end + # 课程和项目不参与某些模块的排列 + def subfield_status_option_default + type = [] + option1 = [] + option1 << "左上" + option1 << "1" + type << option1 + option3 = [] + option3 << "中上" + option3 << "3" + type << option3 + option4 = [] + option4 << "中下" + option4 << "4" + type << option4 + option6 = [] + option6 << "右上" + option6 << "6" + type << option6 + type + end + + def subfield_list_type subfield + case subfield.to_i + when 1 + resulet = "左上" + when 2 + resulet = "中一" + when 3 + resulet = "中二" + when 4 + resulet = "中下" + when 5 + resulet = "左下" + when 6 + resulet = "右上" + when 7 + resulet = "右中" + when 8 + resulet = "右下" + 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') + org_acts + end + end diff --git a/app/helpers/sub_document_comments_helper.rb b/app/helpers/sub_document_comments_helper.rb new file mode 100644 index 000000000..c1f2a4de1 --- /dev/null +++ b/app/helpers/sub_document_comments_helper.rb @@ -0,0 +1,2 @@ +module SubDocumentCommentsHelper +end diff --git a/app/helpers/sub_domains_helper.rb b/app/helpers/sub_domains_helper.rb new file mode 100644 index 000000000..ee1c18e71 --- /dev/null +++ b/app/helpers/sub_domains_helper.rb @@ -0,0 +1,5 @@ +module SubDomainsHelper + include OrganizationsHelper + + +end diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index 8cec49686..1151426e3 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -7,6 +7,7 @@ class OrgSubfield < ActiveRecord::Base has_many :messages, :through => :org_subfield_messages has_many :boards, :dependent => :destroy has_many :news, :dependent => :destroy + has_many :sub_domains, :dependent => :destroy acts_as_attachable after_create :create_board_sync after_destroy :update_priority diff --git a/app/models/organization.rb b/app/models/organization.rb index 427cd4c10..8f9d290eb 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -22,4 +22,8 @@ class Organization < ActiveRecord::Base 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 + + def switch_type + self.show_mode.to_i == 1 ? true : false + end end diff --git a/app/models/sub_document_comment.rb b/app/models/sub_document_comment.rb new file mode 100644 index 000000000..924c6e8ad --- /dev/null +++ b/app/models/sub_document_comment.rb @@ -0,0 +1,32 @@ +class SubDocumentComment < ActiveRecord::Base + attr_accessible :content, :creator_id, :locked, :org_subfield_id, :parent_id, :reply_id, :sticky, :sub_domain_id, :title + + include Redmine::SafeAttributes + include ApplicationHelper + belongs_to :sub_domain + belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id' + acts_as_tree :order => "#{SubDocumentComment.table_name}.sticky asc, #{SubDocumentComment.table_name}.created_at desc" + acts_as_attachable + has_many :org_acts, :class_name => 'OrgActivity',:as =>:org_act ,:dependent => :destroy + after_create :document_save_as_sub_activity + after_update :update_activity + + #动态的更新 + private + def update_activity + org_activity = OrgActivity.where("org_act_type='SubDocumentComment' and org_act_id =?", id).first + if org_activity + org_activity.updated_at = Time.now + org_activity.save + end + end + + def document_save_as_sub_activity + if(self.parent().nil?) + self.org_acts << OrgActivity.new(:user_id => User.current.id, :container_id => self.sub_domain.id, :container_type => 'SubDomain') + else + act = OrgActivity.where("org_act_type='SubDocumentComment' and org_act_id =?", self.root.id).first + act.update_attributes(:updated_at => self.updated_at) + end + end +end diff --git a/app/models/sub_domain.rb b/app/models/sub_domain.rb new file mode 100644 index 000000000..831edf17d --- /dev/null +++ b/app/models/sub_domain.rb @@ -0,0 +1,5 @@ +class SubDomain < ActiveRecord::Base + attr_accessible :field_type, :hide, :name, :org_subfield_id, :priority, :status + belongs_to :org_subfield, :foreign_key => :org_subfield_id + has_many :sub_document_comments +end diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index b2cfa9877..2a33a8acd 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -134,6 +134,7 @@
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> +
访问计数 <%= @organization.visits.to_i %>
diff --git a/app/views/layouts/base_org2.html.erb b/app/views/layouts/base_org2.html.erb index fc550c90f..6f0a5add9 100644 --- a/app/views/layouts/base_org2.html.erb +++ b/app/views/layouts/base_org2.html.erb @@ -1,192 +1,221 @@ - - - - - <%= h html_title %> - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= javascript_heads %> - <%= heads_for_theme %> - <%= stylesheet_link_tag 'org2','jquery/jquery-ui-1.9.2' %> - <%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> - <%= javascript_include_tag 'attachments' %> - <%#= call_hook :view_layouts_base_html_head %> - - <%#= yield :header_tags -%> - - - - - - - - - - - - - - - - -
-
- <%= render :partial => 'organizations/org_logined_header' %> -
- -
- -
-
    - <% @subfield_content.each do |field| %> - <% if is_default_field?(field) %> - <% case field.name %> - <% when 'activity' %> - - <% when 'course' %> - - <% when 'project' %> - - <% end %> - <% else %> - <% if field.field_type == "Post" && field.hide == 0 %> - - <% elsif field.field_type == "Resource" && field.hide == 0 %> - - <% end %> - <% end %> - <% end %> - <% if User.current.admin_of_org?(@organization) %> - - <% end %> -
-
-
-
-<%# 更新访问数,刷新的时候更新访问次数 %> -<% update_visiti_count @organization %> -<%# over %> - -
-
- <% @subfield_content.each do |field| %> - <% if field.status.to_i == 1 %> - <%= render :partial => 'organizations/org_subfield_leftT', :locals => {:field => field} %> - <% elsif field.status.to_i == 2 %> - <%#= render :partial => 'organizations/org_subfield_leftM', :locals => {:field => field} %> -
- <%= render :partial => 'organizations/org_subfield_leftM1', :locals => {:field => field} %> - <% elsif field.status.to_i == 3 %> - <%= render :partial => 'organizations/org_subfield_leftM2', :locals => {:field => field} %> -
-
- <% elsif field.status.to_i == 4 %> - <%= render :partial => 'organizations/org_subfield_leftMD', :locals => {:field => field} %> - <% elsif field.status.to_i == 5 %> - <%= render :partial => 'organizations/org_subfield_leftD', :locals => {:field => field} %> - <% end %> - <% end %> -
- -
- <% @subfield_content.each do |field| %> - <% if field.status.to_i == 6 %> - <%= render :partial => 'organizations/org_subfield_rightT', :locals => {:field => field} %> - <% elsif field.status.to_i == 7 %> - <%= render :partial => 'organizations/org_subfield_rightM', :locals => {:field => field} %> - <% elsif field.status.to_i == 8 %> - <%= render :partial => 'organizations/org_subfield_rightD', :locals => {:field => field} %> - <% end %> - <% end %> -
-
-
- - - - -<%#= call_hook :view_layouts_base_body_bottom %> - - - + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= stylesheet_link_tag 'org2','jquery/jquery-ui-1.9.2' %> + <%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> + <%= javascript_include_tag 'attachments' %> + <%#= call_hook :view_layouts_base_html_head %> + + <%#= yield :header_tags -%> + + + + + + + + + + + + + + + + +
+
+ <%= render :partial => 'organizations/org_logined_header' %> +
+ +
+ +
+
    + <% @subfield_content.each do |field| %> + <% if is_default_field?(field) %> + <% case field.name %> + <% when 'activity' %> + + <% when 'course' %> + + <% when 'project' %> + + <% end %> + <% else %> + <% if field.field_type == "Post" && field.hide == 0 %> + + + + <% elsif field.field_type == "Resource" && field.hide == 0 %> + + <% end %> + <% end %> + <% end %> + <% if User.current.admin_of_org?(@organization) %> + + <% end %> +
+
+
+
+<%# 更新访问数,刷新的时候更新访问次数 %> +<% update_visiti_count @organization %> +<%# over %> + +
+
+ <% @subfield_content.each do |field| %> + <% if field.status.to_i == 1 %> + <%= render :partial => 'organizations/org_subfield_leftT', :locals => {:field => field} %> + <% elsif field.status.to_i == 3 %> + <%#= render :partial => 'organizations/org_subfield_leftM', :locals => {:field => field} %> +
+ <%= render :partial => 'organizations/org_subfield_leftM1', :locals => {:field => field} %> + <%= render :partial => 'organizations/org_subfield_leftM2', :locals => {:field => field} %> +
+
+ <% elsif field.status.to_i == 4 %> + <%= render :partial => 'organizations/org_subfield_leftMD', :locals => {:field => field} %> + <% elsif field.status.to_i == 5 %> + <%= render :partial => 'organizations/org_subfield_leftD', :locals => {:field => field} %> + <% end %> + <% end %> +
+ +
+ <% @subfield_content.each do |field| %> + <% if field.status.to_i == 6 %> + <%= render :partial => 'organizations/org_subfield_rightT', :locals => {:field => field} %> + <% elsif field.status.to_i == 7 %> + <%= render :partial => 'organizations/org_subfield_rightM', :locals => {:field => field} %> + <% elsif field.status.to_i == 8 %> + <%= render :partial => 'organizations/org_subfield_rightD', :locals => {:field => field} %> + <% end %> + <% end %> +
+
+
+ + + + +<%#= call_hook :view_layouts_base_body_bottom %> + + + diff --git a/app/views/layouts/base_sub_domain.html.erb b/app/views/layouts/base_sub_domain.html.erb new file mode 100644 index 000000000..4ed38ee5c --- /dev/null +++ b/app/views/layouts/base_sub_domain.html.erb @@ -0,0 +1,184 @@ + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= stylesheet_link_tag 'org2','jquery/jquery-ui-1.9.2' %> + <%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> + <%= javascript_include_tag 'attachments' %> + <%#= call_hook :view_layouts_base_html_head %> + + <%#= yield :header_tags -%> + + + + + + + + + + + + + + + +
+
+
+ <%= render :partial => 'organizations/org_logined_header' %> +
+ +
+ +
+
    + <% @subfield_content.each do |field| %> + <% if is_default_field?(field) %> + <% case field.name %> + <% when 'activity' %> + + <% when 'course' %> + + <% when 'project' %> + + <% end %> + <% else %> + <% if field.field_type == "Post" && field.hide == 0 %> + + + + <% elsif field.field_type == "Resource" && field.hide == 0 %> + + <% end %> + <% end %> + <% end %> + <% if User.current.admin_of_org?(@organization) %> + + <% end %> +
+
+
+
banner image + +
+
+
+
+<%# 更新访问数,刷新的时候更新访问次数 %> + <% update_visiti_count @organization %> +<%# over %> + + + + <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+ + +
+ + +<%#= call_hook :view_layouts_base_body_bottom %> + + + + + diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb index 219a05194..04cd83ef9 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -1,15 +1,15 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> -<% end %> - -<%= render :partial => 'new' %> -<% unless @documents.nil? %> - <% @documents.each do |document| %> - - <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> - <% end %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> + +<%= render :partial => 'new' %> +<% unless @documents.nil? %> + <% @documents.each do |document| %> + + <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> + <% end %> <% end %> \ 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 ebab8354c..95ef464d6 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -43,6 +43,13 @@ $(this).prev().css("color","#808080"); $(this).css("z-index", "1"); }) + + //二级菜单滑动时箭头方向控制 + $(".homepageLeftMenuMoreIcon").toggle(function(){ + $(this).css("background","url(/images/homepage_icon.png) 100px -624px no-repeat"); + },function(){ + $(this).css("background","url(/images/homepage_icon.png) -74px -240px no-repeat"); + }); }) @@ -83,35 +90,52 @@ <% 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}", 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 => "发布帖子"%> +
+ + <% 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", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <% end %> + <% else %> + <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <% end %> + <% if User.current.logged? and User.current.admin_of_org?(organization) %> + <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %> + <% end %> +
+ + + <% unless (field.sub_domains.count == 0 || !if_hidden_subdomain(field)) %> +
  • + +
  • <% 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" %> +
    + <% 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}", org_subfield_files_path(field), :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 %> - + <% 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 %>