From 0e03798f6e8f2075fae224089f3f39bdade47b56 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 23 May 2016 16:24:32 +0800 Subject: [PATCH 01/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=88yeild=EF=BC=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- app/views/layouts/base_org2.html.erb | 38 +----- app/views/organizations/_show_type2.html.erb | 33 +++++ app/views/organizations/show.html.erb | 122 ++++++++++--------- 4 files changed, 102 insertions(+), 93 deletions(-) create mode 100644 app/views/organizations/_show_type2.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3ab62bbea..2ab724728 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.to_i == 1 && params[:org_subfield_id].nil? && params[:list] .nil? + if @organization.switch_type && 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 diff --git a/app/views/layouts/base_org2.html.erb b/app/views/layouts/base_org2.html.erb index 799aaa42b..e51a62e24 100644 --- a/app/views/layouts/base_org2.html.erb +++ b/app/views/layouts/base_org2.html.erb @@ -14,7 +14,7 @@ <%= javascript_include_tag 'attachments' %> <%#= call_hook :view_layouts_base_html_head %> - <%#= yield :header_tags -%> + <%= yield :header_tags -%> - <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> - <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> -<% end %> -<% if @org_activities %> - <%= render :partial => 'organizations/org_activities', - :locals => {:org_activities => @org_activities, - :page=> @page, - :org => @organization, - :org_act_count=> @org_activities.count} %> + <% end %> + + <% end %> + <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> + + <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> + <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> + <% end %> + <% if @org_activities %> + <%= render :partial => 'organizations/org_activities', + :locals => {:org_activities => @org_activities, + :page=> @page, + :org => @organization, + :org_act_count=> @org_activities.count} %> + <% end %> <% end %> @@ -70,3 +75,4 @@ + From ed7c6cbcfe62d37513f567eb517760f97e4a3b47 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 24 May 2016 09:40:16 +0800 Subject: [PATCH 02/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=A2=9E=E5=87=8Fstatus=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org_document_comments_controller.rb | 1 + app/models/org_document_comment.rb | 3 +- .../org_document_comments/_form.html.erb | 34 ++ app/views/org_document_comments/edit.html.erb | 29 -- app/views/org_document_comments/new.html.erb | 31 +- app/views/organizations/show.html.erb | 4 +- db/schema.rb | 436 +++++++++++++++++- 7 files changed, 454 insertions(+), 84 deletions(-) create mode 100644 app/views/org_document_comments/_form.html.erb diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index 82062d3dd..b012ba901 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -12,6 +12,7 @@ class OrgDocumentCommentsController < ApplicationController @org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id) @org_document_comment.title = params[:org_document_comment][:title] @org_document_comment.content = params[:org_document_comment][:content] + @org_document_comment.status = params[:org_document_comment][:status] == "on" ? 1 : 0 @org_document_comment.save_attachments(params[:attachments]) if params[:field_id] @org_document_comment.org_subfield_id = params[:field_id].to_i diff --git a/app/models/org_document_comment.rb b/app/models/org_document_comment.rb index 5aa3c1dab..dd070c825 100644 --- a/app/models/org_document_comment.rb +++ b/app/models/org_document_comment.rb @@ -1,5 +1,6 @@ class OrgDocumentComment < ActiveRecord::Base - attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title,:sticky,:locked + # status: 1 模式二中置顶 0:模式二中正常显示 + attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status include Redmine::SafeAttributes include ApplicationHelper belongs_to :organization diff --git a/app/views/org_document_comments/_form.html.erb b/app/views/org_document_comments/_form.html.erb new file mode 100644 index 000000000..502da97ad --- /dev/null +++ b/app/views/org_document_comments/_form.html.erb @@ -0,0 +1,34 @@ +
+ +
+
+
+
+
+
+ + <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> +
+
+

+

+

+
+
置顶显示 : + (仅限模式二) +
+
+
+
+ <%= render :partial => 'org_document_comments/attachment', :locals => {:container => nil} %> +
+
+
+ +
+ 确定 + + 取消 +
+
+
\ No newline at end of file diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index 5997482fb..a36397677 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -28,36 +28,7 @@
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %> -
- -
-
-
-
-
- - <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> -
-
-

-

-

-
- -
-
- <%= render :partial => 'org_document_comments/attachment', :locals => {:container => @org_document} %> -
-
-
-
- 确定 - - 取消 -
-
-
<% end %>
\ No newline at end of file diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb index cf4ffddcf..ed327dece 100644 --- a/app/views/org_document_comments/new.html.erb +++ b/app/views/org_document_comments/new.html.erb @@ -37,35 +37,6 @@
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %> -
- -
-
-
-
-
-
- - <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> -
-
-

-

-

-
-
-
- <%= render :partial => 'org_document_comments/attachment', :locals => {:container => nil} %> -
-
-
- -
- 确定 - - 取消 -
-
-
+ <%= render :partial => "form" %> <% end %>
diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index db3849de9..c490efb85 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -1,5 +1,5 @@ -<%# 区分两种模式 %> -<% if @organization.switch_type %> +<%# 区分两种模式 params[:org_subfield_id] 不为空的时候则跳到栏目%> +<% if @organization.switch_type && params[:org_subfield_id].nil? %> <%= render :partial => 'show_type2' %> <% else %> <%= javascript_include_tag "jquery.infinitescroll.js" %> diff --git a/db/schema.rb b/db/schema.rb index 9c4b4b333..7462c304e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160519070718) do +ActiveRecord::Schema.define(:version => 20160523085440) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,6 +52,28 @@ ActiveRecord::Schema.define(:version => 20160519070718) do add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + create_table "application_settings", :force => true do |t| + t.integer "default_projects_limit" + t.boolean "signup_enabled" + t.boolean "signin_enabled" + t.boolean "gravatar_enabled" + t.text "sign_in_text" + t.datetime "created_at" + t.datetime "updated_at" + t.string "home_page_url" + t.integer "default_branch_protection", :default => 2 + t.boolean "twitter_sharing_enabled", :default => true + t.text "restricted_visibility_levels" + t.boolean "version_check_enabled", :default => true + t.integer "max_attachment_size", :default => 10, :null => false + t.integer "default_project_visibility" + t.integer "default_snippet_visibility" + t.text "restricted_signup_domains" + t.boolean "user_oauth_applications", :default => true + t.string "after_sign_out_path" + t.integer "session_expire_delay", :default => 10080, :null => false + end + create_table "applied_projects", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false @@ -77,6 +99,18 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "updated_at", :null => false end + create_table "apply_resources", :force => true do |t| + t.integer "status" + t.integer "user_id" + t.integer "attachment_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id" + t.string "container_type" + t.text "content" + t.integer "apply_user_id" + end + create_table "at_messages", :force => true do |t| t.integer "user_id" t.integer "at_message_id" @@ -144,6 +178,20 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.string "typeName", :limit => 50 end + create_table "audit_events", :force => true do |t| + t.integer "author_id", :null => false + t.string "type", :null => false + t.integer "entity_id", :null => false + t.string "entity_type", :null => false + t.text "details" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id" + add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type" + add_index "audit_events", ["type"], :name => "index_audit_events_on_type" + create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false @@ -241,6 +289,17 @@ ActiveRecord::Schema.define(:version => 20160519070718) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" + create_table "broadcast_messages", :force => true do |t| + t.text "message", :null => false + t.datetime "starts_at" + t.datetime "ends_at" + t.integer "alert_type" + t.datetime "created_at" + t.datetime "updated_at" + t.string "color" + t.string "font" + end + create_table "bug_to_osps", :force => true do |t| t.integer "osp_id" t.integer "relative_memo_id" @@ -540,6 +599,10 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.integer "visits", :default => 0 end + add_index "courses", ["id"], :name => "id", :unique => true + add_index "courses", ["tea_id"], :name => "tea_id" + add_index "courses", ["visits"], :name => "visits" + create_table "custom_fields", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 30, :default => "", :null => false @@ -601,6 +664,15 @@ ActiveRecord::Schema.define(:version => 20160519070718) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + create_table "deploy_keys_projects", :force => true do |t| + t.integer "deploy_key_id", :null => false + t.integer "project_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id" + create_table "discuss_demos", :force => true do |t| t.string "title" t.text "body" @@ -650,6 +722,16 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "created_at" end + create_table "emails", :force => true do |t| + t.integer "user_id", :null => false + t.string "email", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true + add_index "emails", ["user_id"], :name => "index_emails_on_user_id" + create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -672,6 +754,25 @@ ActiveRecord::Schema.define(:version => 20160519070718) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + create_table "events", :force => true do |t| + t.string "target_type" + t.integer "target_id" + t.string "title" + t.text "data" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "action" + t.integer "author_id" + end + + add_index "events", ["action"], :name => "index_events_on_action" + add_index "events", ["author_id"], :name => "index_events_on_author_id" + add_index "events", ["created_at"], :name => "index_events_on_created_at" + add_index "events", ["project_id"], :name => "index_events_on_project_id" + add_index "events", ["target_id"], :name => "index_events_on_target_id" + add_index "events", ["target_type"], :name => "index_events_on_target_type" + create_table "exercise_answers", :force => true do |t| t.integer "user_id" t.integer "exercise_question_id" @@ -774,6 +875,15 @@ ActiveRecord::Schema.define(:version => 20160519070718) do add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" + create_table "forked_project_links", :force => true do |t| + t.integer "forked_to_project_id", :null => false + t.integer "forked_from_project_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true + create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -903,6 +1013,17 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "updated_at", :null => false end + create_table "identities", :force => true do |t| + t.string "extern_uid" + t.string "provider" + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id" + add_index "identities", ["user_id"], :name => "index_identities_on_user_id" + create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1046,6 +1167,20 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.integer "private", :default => 0 end + create_table "keys", :force => true do |t| + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.text "key" + t.string "title" + t.string "type" + t.string "fingerprint" + t.boolean "public", :default => false, :null => false + end + + add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id" + add_index "keys", ["user_id"], :name => "index_keys_on_user_id" + create_table "kindeditor_assets", :force => true do |t| t.string "asset" t.integer "file_size" @@ -1057,6 +1192,27 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.integer "owner_type", :default => 0 end + create_table "label_links", :force => true do |t| + t.integer "label_id" + t.integer "target_id" + t.string "target_type" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id" + add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type" + + create_table "labels", :force => true do |t| + t.string "title" + t.string "color" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "labels", ["project_id"], :name => "index_labels_on_project_id" + create_table "member_roles", :force => true do |t| t.integer "member_id", :null => false t.integer "role_id", :null => false @@ -1107,23 +1263,47 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.integer "viewed_count", :default => 0 end - create_table "mess", :id => false, :force => true do |t| - t.string "课程名" - t.integer "课程ID", :default => 0, :null => false - t.string "教师姓", :default => "", :null => false - t.string "教师名", :limit => 30, :default => "", :null => false - t.string "主贴名", :default => "", :null => false - t.integer "主贴或回帖ID", :default => 0, :null => false - t.integer "回帖对应主贴ID" - t.integer "帖子点赞数" - t.integer "主贴回复数", :default => 0, :null => false - t.text "主贴或回帖内容" - t.datetime "发帖时间", :null => false - t.integer "发帖或回帖用户ID", :default => 0, :null => false - t.string "发帖或回帖用户姓", :default => "", :null => false - t.string "发帖或回帖用户名", :limit => 30, :default => "", :null => false + create_table "merge_request_diffs", :force => true do |t| + t.string "state" + t.text "st_commits", :limit => 2147483647 + t.text "st_diffs", :limit => 2147483647 + t.integer "merge_request_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" end + add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true + + create_table "merge_requests", :force => true do |t| + t.string "target_branch", :null => false + t.string "source_branch", :null => false + t.integer "source_project_id", :null => false + t.integer "author_id" + t.integer "assignee_id" + t.string "title" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "milestone_id" + t.string "state" + t.string "merge_status" + t.integer "target_project_id", :null => false + t.integer "iid" + t.text "description" + t.integer "position", :default => 0 + t.datetime "locked_at" + end + + add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" + add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" + add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id" + add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at" + add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" + add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch" + add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id" + add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch" + add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true + add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title" + create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1158,6 +1338,39 @@ ActiveRecord::Schema.define(:version => 20160519070718) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" + create_table "milestones", :force => true do |t| + t.string "title", :null => false + t.integer "project_id", :null => false + t.text "description" + t.date "due_date" + t.datetime "created_at" + t.datetime "updated_at" + t.string "state" + t.integer "iid" + end + + add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id" + add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date" + add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true + add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" + + create_table "namespaces", :force => true do |t| + t.string "name", :null => false + t.string "path", :null => false + t.integer "owner_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "type" + t.string "description", :default => "", :null => false + t.string "avatar" + end + + add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id" + add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true + add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" + add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true + add_index "namespaces", ["type"], :name => "index_namespaces_on_type" + create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -1183,6 +1396,31 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "updated_at", :null => false end + create_table "notes", :force => true do |t| + t.text "note" + t.string "noteable_type" + t.integer "author_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "project_id" + t.string "attachment" + t.string "line_code" + t.string "commit_id" + t.integer "noteable_id" + t.boolean "system", :default => false, :null => false + t.text "st_diff", :limit => 2147483647 + end + + add_index "notes", ["author_id"], :name => "index_notes_on_author_id" + add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" + add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id" + add_index "notes", ["created_at"], :name => "index_notes_on_created_at" + add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type" + add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" + add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" + add_index "notes", ["project_id"], :name => "index_notes_on_project_id" + add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at" + create_table "notificationcomments", :force => true do |t| t.string "notificationcommented_type" t.integer "notificationcommented_id" @@ -1192,6 +1430,49 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "updated_at", :null => false end + create_table "oauth_access_grants", :force => true do |t| + t.integer "resource_owner_id", :null => false + t.integer "application_id", :null => false + t.string "token", :null => false + t.integer "expires_in", :null => false + t.text "redirect_uri", :null => false + t.datetime "created_at", :null => false + t.datetime "revoked_at" + t.string "scopes" + end + + add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true + + create_table "oauth_access_tokens", :force => true do |t| + t.integer "resource_owner_id" + t.integer "application_id" + t.string "token", :null => false + t.string "refresh_token" + t.integer "expires_in" + t.datetime "revoked_at" + t.datetime "created_at", :null => false + t.string "scopes" + end + + add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true + add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id" + add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true + + create_table "oauth_applications", :force => true do |t| + t.string "name", :null => false + t.string "uid", :null => false + t.string "secret", :null => false + t.text "redirect_uri", :null => false + t.string "scopes", :default => "", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "owner_id" + t.string "owner_type" + end + + add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type" + add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true + create_table "onclick_times", :force => true do |t| t.integer "user_id" t.datetime "onclick_time" @@ -1282,6 +1563,7 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.boolean "locked", :default => false t.integer "sticky", :default => 0 t.integer "org_subfield_id" + t.integer "status", :default => 0 end create_table "org_member_roles", :force => true do |t| @@ -1348,6 +1630,23 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.integer "allow_teacher", :default => 0 end + create_table "permissions", :force => true do |t| + t.string "controller", :limit => 30, :default => "", :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "description", :limit => 60, :default => "", :null => false + t.boolean "is_public", :default => false, :null => false + t.integer "sort", :default => 0, :null => false + t.boolean "mail_option", :default => false, :null => false + t.boolean "mail_enabled", :default => false, :null => false + end + + create_table "permissions_roles", :id => false, :force => true do |t| + t.integer "permission_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + end + + add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" + create_table "phone_app_versions", :force => true do |t| t.string "version" t.text "description" @@ -1430,6 +1729,11 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "updated_at", :null => false end + create_table "project_import_data", :force => true do |t| + t.integer "project_id" + t.text "data" + end + create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1519,6 +1823,16 @@ ActiveRecord::Schema.define(:version => 20160519070718) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + create_table "protected_branches", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "developers_can_push", :default => false, :null => false + end + + add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id" + create_table "queries", :force => true do |t| t.integer "project_id" t.string "name", :default => "", :null => false @@ -1653,6 +1967,25 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.integer "is_teacher_score", :default => 0 end + create_table "services", :force => true do |t| + t.string "type" + t.string "title" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "active", :default => false, :null => false + t.text "properties" + t.boolean "template", :default => false + t.boolean "push_events", :default => true + t.boolean "issues_events", :default => true + t.boolean "merge_requests_events", :default => true + t.boolean "tag_push_events", :default => true + t.boolean "note_events", :default => true, :null => false + end + + add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id" + add_index "services", ["project_id"], :name => "index_services_on_project_id" + create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -1691,6 +2024,26 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "updated_at", :null => false end + create_table "snippets", :force => true do |t| + t.string "title" + t.text "content", :limit => 2147483647 + t.integer "author_id", :null => false + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "file_name" + t.datetime "expires_at" + t.string "type" + t.integer "visibility_level", :default => 0, :null => false + end + + add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id" + add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id" + add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at" + add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at" + add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" + add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level" + create_table "softapplications", :force => true do |t| t.string "name" t.text "description" @@ -1763,9 +2116,9 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.integer "absence_penalty", :default => 0 t.float "system_score", :default => 0.0 t.boolean "is_test", :default => false + t.float "work_score" t.integer "simi_id" t.integer "simi_value" - t.float "work_score" end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" @@ -1813,13 +2166,13 @@ ActiveRecord::Schema.define(:version => 20160519070718) do create_table "sub_domains", :force => true do |t| t.integer "org_subfield_id" - t.integer "priority", :default => 0 + t.integer "priority" t.string "name" t.string "field_type" - t.integer "hide", :default => 0 - t.integer "status", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "hide" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "subfield_subdomain_dirs", :force => true do |t| @@ -1829,6 +2182,17 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "updated_at", :null => false end + create_table "subscriptions", :force => true do |t| + t.integer "user_id" + t.integer "subscribable_id" + t.string "subscribable_type" + t.boolean "subscribed" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true + create_table "system_messages", :force => true do |t| t.integer "user_id" t.string "content" @@ -2068,6 +2432,17 @@ ActiveRecord::Schema.define(:version => 20160519070718) do add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" add_index "users", ["type"], :name => "index_users_on_type" + create_table "users_star_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id" + add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true + add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id" + create_table "versions", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :default => "", :null => false @@ -2119,6 +2494,23 @@ ActiveRecord::Schema.define(:version => 20160519070718) do t.datetime "updated_at", :null => false end + create_table "web_hooks", :force => true do |t| + t.string "url" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "type", :default => "ProjectHook" + t.integer "service_id" + t.boolean "push_events", :default => true, :null => false + t.boolean "issues_events", :default => false, :null => false + t.boolean "merge_requests_events", :default => false, :null => false + t.boolean "tag_push_events", :default => false + t.boolean "note_events", :default => false, :null => false + end + + add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id" + add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id" + create_table "wechat_logs", :force => true do |t| t.string "openid", :null => false t.text "request_raw" From 61eeee702ca2efe5d33803d65a97b98cbe3d61c7 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 24 May 2016 09:40:47 +0800 Subject: [PATCH 03/86] migrate --- .../20160523085440_add_status_to_org_document_comment.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/migrate/20160523085440_add_status_to_org_document_comment.rb diff --git a/db/migrate/20160523085440_add_status_to_org_document_comment.rb b/db/migrate/20160523085440_add_status_to_org_document_comment.rb new file mode 100644 index 000000000..e29426450 --- /dev/null +++ b/db/migrate/20160523085440_add_status_to_org_document_comment.rb @@ -0,0 +1,5 @@ +class AddStatusToOrgDocumentComment < ActiveRecord::Migration + def change + add_column :org_document_comments, :status, :integer, :default => false + end +end From 909d40b4eb462e4aa28a5242792580bec8dcbebd Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 24 May 2016 17:14:01 +0800 Subject: [PATCH 04/86] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6f3cca744..cff97e423 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2050,7 +2050,7 @@ class UsersController < ApplicationController @score = @b_sort == "desc" ? "asc" : "desc" user_project_ids = User.current.projects.map {|p| p.id} user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - if(params[:type].blank? || params[:type] == "1") # 我的资源 + if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) @@ -2064,7 +2064,7 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) end - elsif params[:type] == "6" # 公共资源 + elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @attachments = get_course_resources_public( user_course_ids, @order, @score) elsif params[:status] == "3" @@ -2203,7 +2203,7 @@ class UsersController < ApplicationController @score = @b_sort == "desc" ? "asc" : "desc" user_project_ids = User.current.projects.map {|p| p.id} user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - if(params[:type].blank? || params[:type] == "1") # 我的资源 + if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) @@ -2217,7 +2217,7 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) end - elsif params[:type] == "6" # 公共资源 + elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @attachments = get_course_resources_public( user_course_ids, @order, @score) elsif params[:status] == "3" @@ -2344,7 +2344,7 @@ class UsersController < ApplicationController @score = @b_sort == "desc" ? "asc" : "desc" user_project_ids = User.current.projects.map {|p| p.id} user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - if(params[:type].blank? || params[:type] == "1") # 我的资源 + if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) @@ -2358,7 +2358,7 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) end - elsif params[:type] == "6" # 公共资源 + elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @attachments = get_course_resources_public( user_course_ids, @order, @score) elsif params[:status] == "3" From d1e11d426010b93de1d3d9631241258ddcd6c940 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 25 May 2016 08:58:58 +0800 Subject: [PATCH 05/86] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=AE=A1=E6=9F=A5?= =?UTF-8?q?=E5=90=8E=E4=BB=A3=E7=A0=81=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 7 +------ app/helpers/application_helper.rb | 1 - app/models/attachment.rb | 2 +- app/views/users/apply_resource.js.erb | 4 ++-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index cff97e423..18093b790 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -443,12 +443,7 @@ class UsersController < ApplicationController # 资源分享请求弹框 def apply_resource - if User.current.logged? - @attachment = Attachment.find params[:attachment_id] - @state = 2 - else - @state = 1 - end + @attachment = Attachment.find params[:attachment_id] respond_to do |format| format.js end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4d92808d4..ce6d2259c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -70,7 +70,6 @@ module ApplicationHelper attach = Attachment.find(attachment_id) # 条件取否,result结果为true则不能下载 result = attach.is_public == 0 && attach.author != User.current && !attach.get_apply_resource_status(attach.id, User.current.id) && !attach_show_allow(attach) - return result end # Time 2015-03-24 15:27:29 diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 8f9ee2d85..aa4ef8670 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -143,7 +143,7 @@ class Attachment < ActiveRecord::Base def get_apply_resource_status attachment_id, author_id status = ApplyResource.where("attachment_id =? and user_id =?", attachment_id, author_id).first.try(:status) - status == 2 ? true :false + status == 2 end # add by nwb diff --git a/app/views/users/apply_resource.js.erb b/app/views/users/apply_resource.js.erb index 14a795fe5..601cafa11 100644 --- a/app/views/users/apply_resource.js.erb +++ b/app/views/users/apply_resource.js.erb @@ -1,6 +1,6 @@ -<% if @state == 1 %> +<% if !User.current.logged? %> alert("您还未登录"); -<% elsif @state == 2 %> +<% else %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/apply_resource', :locals => {:attachment => @attachment}) %>'); showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); From 2abb68c00cba170db035219d4e699e9d41456f56 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 25 May 2016 10:54:49 +0800 Subject: [PATCH 06/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E9=83=A8=E5=88=86=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org2.html.erb | 70 +------------------ app/views/organizations/_org2_footer.html.erb | 12 ++++ .../organizations/_org_avater_swap.html.erb | 8 +++ .../organizations/_org_field_menu.html.erb | 44 ++++++++++++ 4 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 app/views/organizations/_org2_footer.html.erb create mode 100644 app/views/organizations/_org_avater_swap.html.erb create mode 100644 app/views/organizations/_org_field_menu.html.erb diff --git a/app/views/layouts/base_org2.html.erb b/app/views/layouts/base_org2.html.erb index e51a62e24..c234fd288 100644 --- a/app/views/layouts/base_org2.html.erb +++ b/app/views/layouts/base_org2.html.erb @@ -62,66 +62,15 @@
-
    - <% @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 %> -
+ <%= render :partial => "org_field_menu", :locals => {:subfield_content => @subfield_content} %>
@@ -136,20 +85,7 @@
- -
- -
+ <%= render :partial => "org2_footer" %>
diff --git a/app/views/organizations/_org2_footer.html.erb b/app/views/organizations/_org2_footer.html.erb new file mode 100644 index 000000000..9ff7051c1 --- /dev/null +++ b/app/views/organizations/_org2_footer.html.erb @@ -0,0 +1,12 @@ +
+ +
\ No newline at end of file diff --git a/app/views/organizations/_org_avater_swap.html.erb b/app/views/organizations/_org_avater_swap.html.erb new file mode 100644 index 000000000..70bdf3b1b --- /dev/null +++ b/app/views/organizations/_org_avater_swap.html.erb @@ -0,0 +1,8 @@ +<% if @org_logo_attchment.blank? || !User.current.logged? %> + +<% else %> + +<% end %> +<% if User.current.admin_of_org?(@organization) %> + +<% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_field_menu.html.erb b/app/views/organizations/_org_field_menu.html.erb new file mode 100644 index 000000000..792bea87e --- /dev/null +++ b/app/views/organizations/_org_field_menu.html.erb @@ -0,0 +1,44 @@ +
    + <% 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 %> +
\ No newline at end of file From 415b624e0bba4456848995741f8076b7fc5216ad Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 25 May 2016 11:07:36 +0800 Subject: [PATCH 07/86] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_show_new_upload.html.erb | 4 +--- app/views/users/user_resource.html.erb | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/users/_show_new_upload.html.erb b/app/views/users/_show_new_upload.html.erb index b343aeae1..e63cf2af9 100644 --- a/app/views/users/_show_new_upload.html.erb +++ b/app/views/users/_show_new_upload.html.erb @@ -1,3 +1 @@ -<% if @type != "2" %> - -<% end %> + diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index d2e3242d8..3c70e6c33 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -58,7 +58,7 @@ -
  •  
  • +
  •  
  • <%= render :partial => 'user_resource_type_filter' %> From 0a8d21ea5579a52ba59be284c1ff7470af380fc1 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 25 May 2016 14:05:09 +0800 Subject: [PATCH 08/86] =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=95=E7=AB=AF=E5=8F=91=E9=80=81JS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resources_list.html.erb | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 26e8f922b..3f5138107 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -49,8 +49,6 @@ alert("您只能删除没有历史记录的资源,请重新选择后再删除。"); return; } - - if(data != "" && confirm('确认要删除这些资源吗?')) { $.post( '<%= user_resource_delete_user_path(User.current.id,:type=>@type,:status=>@status)%>', @@ -62,8 +60,6 @@ } } - - function show_send(){ $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} @@ -99,13 +95,26 @@ if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 $.ajax({ type: 'get', - url: '<%= search_user_project_user_path(User.current.id)%>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type%>", + url: '<%= search_user_project_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>", data:{send_type:'file'} }); - }else{ + }else if (lastSendType === '1'){ $.ajax({ type: 'get', - url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type%>", + url: '<%= search_user_course_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>", + data:{send_type:'file'} + }); + }else if (lastSendType === '3'){ + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>", + data:{send_type:'file'} + }); + } + else{ + $.ajax({ + type: 'get', + url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type %>", data:{send_type:'file'} }); From 74384d10a57832939d6eb1d75785e74dbf5f08bd Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 May 2016 10:06:25 +0800 Subject: [PATCH 09/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=20=E8=AE=BA=E5=9D=9B?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_document_comments/edit.html.erb | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index a36397677..fc3410eb0 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -27,8 +27,37 @@
    - <%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %> + <%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %> +
    + +
    +
    +
    +
    +
    + + <%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %> +
    +
    +

    +

    +

    +
    + +
    +
    + <%= render :partial => 'org_document_comments/attachment', :locals => {:container => @org_document} %> +
    +
    +
    +
    + 确定 + + 取消 +
    +
    +
    <% end %> -
    +
    \ No newline at end of file From 12ac353de97454634db40f99dc4213fe151ed19c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 27 May 2016 17:08:50 +0800 Subject: [PATCH 10/86] =?UTF-8?q?=E5=8C=97=E6=96=97=E6=96=B0base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org_custom.thml.erb | 67 ++++++++++++++++++++++ app/views/organizations/_math_js.html.erb | 11 ++++ 2 files changed, 78 insertions(+) create mode 100644 app/views/layouts/base_org_custom.thml.erb create mode 100644 app/views/organizations/_math_js.html.erb diff --git a/app/views/layouts/base_org_custom.thml.erb b/app/views/layouts/base_org_custom.thml.erb new file mode 100644 index 000000000..a453d1cd7 --- /dev/null +++ b/app/views/layouts/base_org_custom.thml.erb @@ -0,0 +1,67 @@ + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= stylesheet_link_tag 'org2','jquery/jquery-ui-1.9.2' %> + + <%#= call_hook :view_layouts_base_html_head %> + <%= yield :header_tags -%> + + <%=render :partial => "math_js" %> + + + + + +
    +
    +
    + +
    + +
    + <%= render :partial => "org_field_menu", :locals => {:subfield_content => @subfield_content} %> +
    +
    +
    +<%# 更新访问数,刷新的时候更新访问次数 %> +<% update_visiti_count @organization %> +<%# over %> + +
    + <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
    + +
    + <%= render :partial => "org2_footer" %> +
    + + +
    +<%# 弹框 %> + + +<%= call_hook :view_layouts_base_body_bottom %> +<%# JS提前加载 %> +<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> +<%= javascript_include_tag 'attachments' %> + + + + + + diff --git a/app/views/organizations/_math_js.html.erb b/app/views/organizations/_math_js.html.erb new file mode 100644 index 000000000..7ac522061 --- /dev/null +++ b/app/views/organizations/_math_js.html.erb @@ -0,0 +1,11 @@ + + + \ No newline at end of file From 389172e5b2ed9f641d21e1cbb1d0f11c7c168bbf Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 30 May 2016 10:45:00 +0800 Subject: [PATCH 11/86] =?UTF-8?q?CSS=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/org_custom.css | 136 ++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 public/stylesheets/org_custom.css diff --git a/public/stylesheets/org_custom.css b/public/stylesheets/org_custom.css new file mode 100644 index 000000000..790877660 --- /dev/null +++ b/public/stylesheets/org_custom.css @@ -0,0 +1,136 @@ +/* 门户样式重置 */ +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.5; background:#fff;} +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:#3b94d6;} + + + +/* 公共 */ +.clear:after {content:".";height:0;visibility:hidden;display:block;clear:both;} +.fl{ float:left;} +.fr{ float:right;} +.cl{ clear:both; overflow:hidden;} +.mt5{ margin-top:5px;} +.mt10{ margin-top:10px;} +.mb5{ margin-bottom:5px;} +.mb10{ margin-bottom:10px;} +.ml5{ margin-left:5px;} +.ml10{ margin-left:10px;} +.ml15{ margin-left:15px;} +.mr5{ margin-right:5px;} +.mr10{ margin-right:15px;} +.mr15{ margin-right:10px;} +a.c_red{color:#df0600;} +.c_red{color:#df0600;} +/* 门户首页 */ +#por_header{ width:100%; height:70px; background-color:#3b94d6; } +.por_header_con{ width:1000px; margin:0 auto;} +.por_logo{ margin-top:5px;} +.por_login li{ float:left;} +.por_login li a{ display:block; padding:0 15px; height:70px; line-height:70px;font-size:16px; color:#fff; } +.por_login li a:hover{ background-color:#1173bc;} +.por_search{ margin-top:15px; margin-right:20px;} +.pro_input_search{ background-color:#daeefc; height:36px; width:355px; border:none; padding:0 5px; color:#3b94d6;} +a.por_search_btn{ display:block;background:#daeefc url(../images/icons_por.png) 0 8px no-repeat; width:25px; height:36px;} +a:hover.por_search_btn{background:#daeefc url(../images/icons_por.png) -35px 8px no-repeat; } + +#por_container{ width:1000px; margin:10px auto;} +.por_left{ width:685px; margin-right:15px; float:left; } +.por_right{ width:300px; float:left;} +.por_nav{ width:1000px; overflow:hidden; position:relative;height:53px; border-bottom:7px solid #ccc; margin-bottom:10px;} +a.por_edit_index{ position:absolute; font-size:14px; right:5px; top:15px;} +.por_nav ul li{ float:left;} +.por_nav ul li a{ display: block; height:53px; padding:0 20px; line-height:53px; font-size:18px; color:#333;} +.por_nav ul li a:hover{ border-bottom:7px solid #3b94d6;} +.por_icons_hot{ background:url(../images/icons_por.png) 0 -78px no-repeat; height:22px; width:55px; padding-left:3px; color:#fff; font-size:12px; line-height:22px; font-weight:normal;} +.por_h2_index{ font-size:20px; font-weight:normal; color:#3b94d6; width:100%; border-bottom:1px solid #e8e5e5; height:40px; line-height:40px;} +a.por_more_index{ font-size:12px; color:#999; } +.por_hotbar_left li{ width:365px; padding:12px 5px 12px 0; border-bottom:1px dashed #e8e5e5;} +a.por_hot_title{ font-size:16px; display:block; font-weight:bold; width:365px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.por_hot_txt{ color:#666; line-height:20px;max-height:60px;overflow:hidden;text-overflow:ellipsis;} +.por_time{ color:#999;} +a.por_hot_name{color:#3b94d6;} +.por_hotbar_right{ border:1px solid #e8e5e5; padding:5px; margin-top:15px; width:300px;} +.por_hotbar_right img{ width:300px; height:246px;} +.por_hot_title_r{ font-size:16px; display:block; font-weight:bold; width:300px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.por_hot_txt_r{color:#666; line-height:20px;max-height:80px;overflow:hidden;text-overflow:ellipsis;} +.por_course{ } +.por_course_bar{ width:328px; margin:0 7px; padding:20px 0; border-bottom:1px solid #e8e5e5;} +a.por_course_title{font-size:14px; margin-bottom:10px; display:block; font-weight:bold; width:328px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.por_course_bar img{ width:140px; height:100px; } +.por_course_txt { width:180px; margin-left:5px;color:#666; line-height:20px;max-height:80px;overflow:hidden;text-overflow:ellipsis;} +a.por_course_time{color:#3b94d6; margin-left:5px;} +.por_post{ border-bottom:1px solid #e8e5e5; padding-bottom:5px;} +.por_post_left{ width:394px; margin-top:15px;} +.por_post_leftbar img{ width:377px; height:163px;} +.por_post_leftbar { border-bottom:1px dashed #e8e5e5; padding-bottom:5px; margin-bottom:10px;} +a.por_post_title{font-size:18px; display:block; width:377px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.por_post_txt{color:#666; line-height:20px;max-height:40px;overflow:hidden;text-overflow:ellipsis; } +.post_icons_grey{ width:5px; height:5px; margin:10px 5px 0 0; background-color:#b3b3b3; display:block; line-height:20px;} +.por_post_list li{ height:20px; height:30px;} +.por_post_list li a{ font-size:14px; } +a.por_hidden_w390{ display:block; width:390px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +a.por_hidden_w270{ display:block; width:280px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.por_post_right{ width:280px; border-left:1px solid #e8e5e5; margin-top:15px; padding-left:10px;} +.por_news_list li{ padding:15px 0; border-bottom:1px dashed #e8e5e5;} +.por_users_img{ width:40px; height:40px; border:1px solid #e8e5e5;} +.por_news_txt{ width:245px; margin-left:10px;} +.por_news_p{ line-height:20px;max-height:40px;overflow:hidden;text-overflow:ellipsis; } +a.por_zan{ background:url(../images/icons_por.png) 0 -41px no-repeat; height:15px; width:20px; display:block; padding-left:15px; line-height:20px; color:#999;} +a.por_zan:hover{background:url(../images/icons_por.png) -34px -42px no-repeat; color:#3b94d6; } +.por_hidden_w205{ font-size:14px; display:block; width:205px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.por_projects{border-bottom:1px solid #e8e5e5; padding-bottom:10px; margin-top:10px;} +.por_projects ul li{ padding:5px 0;} +.por_projects ul{ margin-top:5px;} +.por_project_p{ line-height:20px;max-height:40px;overflow:hidden;text-overflow:ellipsis; margin-top:5px; margin-left:10px; color:#666; } +.por_project_li{border-bottom:1px dashed #ccc; padding-bottom:10px; margin-bottom:5px;} +.por_time a{ color:#3b94d6;} +.por_teachers{ margin-top:20px; } +#por_teachers_nav {border-bottom:1px solid #d0d0d0; height:31px;} +#por_teachers_nav li {float:left; padding:0px 5px; text-align:center; } +#por_teachers_nav li a{font-size:20px;} +.por_teachers_hover {border:1px solid #d0d0d0; border-bottom:1px solid #fff; } +.por_teachers_hover a{color:#3b94d6;} +.por_teachers_nomal {border-bottom:none; } +.por_teachers_nomal a{color:#999;} +.undis {display:none;} +.dis {display:block;} +a.por_more_teacher{ font-size:12px; } +.por_teachers_li{ margin-top:10px;} +.por_teachers_li li{ padding:10px 0;border-bottom:1px solid #e8e5e5;} +.por_teachers_img{ width:60px; height:60px; -webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;} +a.por_teachers_name{ display:block; width:80px; font-size:18px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.por_teachers_p{ font-size:14px; color:#999; width:150px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.por_teachers_span{ color:#999;} +.por_teachers_span a{ margin:0 5px; color:#999;} +.por_footer{ padding:35px 0; width:100%; background-color:#efeded; margin-top:30px;} +.por_footer_con{ width:1000px; margin:0 auto;} +.por_footer_con ul{ width:350px; margin:0 auto;} +.por_footer_con ul li{ float:left; text-align:center;} +.por_footer_con ul li a{ font-size:14px;} +.por_footer_con ul li a span{ color:#999; margin:0 15px ;} +.por_footer_con p{ text-align:center; margin-top:20px; color:#777;} + +.por_index_position{ position:relative;} +a.por_xiang_index{ position:absolute; color:red; background:#fff; top:40px; left:292px;} + + + + + + + + + + + + + + + + + From 46e4f2c14321f744d416f8236994c8254ed499a9 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 30 May 2016 14:23:52 +0800 Subject: [PATCH 12/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=96=B0base=E6=A1=86?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- app/views/layouts/_org_custom_footer.html.erb | 10 +++ ...stom.thml.erb => base_org_custom.html.erb} | 40 +++-------- .../organizations/_org_custom_header.html.erb | 67 +++++++++++++++++++ .../organizations/_org_custom_left1.html.erb | 0 .../organizations/_org_custom_left2.html.erb | 0 .../organizations/_org_custom_left3.html.erb | 0 .../organizations/_org_custom_right1.html.erb | 0 .../organizations/_org_custom_right2.html.erb | 0 .../organizations/_org_custom_right3.html.erb | 0 app/views/organizations/show.html.erb | 2 +- public/stylesheets/org_custom.css | 24 +++---- 12 files changed, 100 insertions(+), 45 deletions(-) create mode 100644 app/views/layouts/_org_custom_footer.html.erb rename app/views/layouts/{base_org_custom.thml.erb => base_org_custom.html.erb} (50%) create mode 100644 app/views/organizations/_org_custom_header.html.erb create mode 100644 app/views/organizations/_org_custom_left1.html.erb create mode 100644 app/views/organizations/_org_custom_left2.html.erb create mode 100644 app/views/organizations/_org_custom_left3.html.erb create mode 100644 app/views/organizations/_org_custom_right1.html.erb create mode 100644 app/views/organizations/_org_custom_right2.html.erb create mode 100644 app/views/organizations/_org_custom_right3.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 2ab724728..3cf36a781 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -91,7 +91,7 @@ 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 - render :layout => 'base_org2' + render :layout => 'base_org_custom' else render_403 end diff --git a/app/views/layouts/_org_custom_footer.html.erb b/app/views/layouts/_org_custom_footer.html.erb new file mode 100644 index 000000000..a9c4a7e36 --- /dev/null +++ b/app/views/layouts/_org_custom_footer.html.erb @@ -0,0 +1,10 @@ + diff --git a/app/views/layouts/base_org_custom.thml.erb b/app/views/layouts/base_org_custom.html.erb similarity index 50% rename from app/views/layouts/base_org_custom.thml.erb rename to app/views/layouts/base_org_custom.html.erb index a453d1cd7..4a9ba4dce 100644 --- a/app/views/layouts/base_org_custom.thml.erb +++ b/app/views/layouts/base_org_custom.html.erb @@ -9,36 +9,18 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'org2','jquery/jquery-ui-1.9.2' %> - - <%#= call_hook :view_layouts_base_html_head %> + <%= stylesheet_link_tag 'org_custom', 'new_user', 'public','jquery/jquery-ui-1.9.2' %> + <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> <%=render :partial => "math_js" %> - - - - -
    -
    -
    - -
    - -
    - <%= render :partial => "org_field_menu", :locals => {:subfield_content => @subfield_content} %> -
    -
    + +<% update_visiti_count @organization %> +
    + <%= render :partial => 'org_custom_header' %>
    -<%# 更新访问数,刷新的时候更新访问次数 %> -<% update_visiti_count @organization %> -<%# over %> +
    <%= render_flash_messages %> @@ -46,10 +28,8 @@ <%= call_hook :view_layouts_base_content %>
    -
    - <%= render :partial => "org2_footer" %> -
    - +
    + <%= render :partial => "layouts/org_custom_footer" %>
    <%# 弹框 %> @@ -60,7 +40,7 @@ <%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> <%= javascript_include_tag 'attachments' %> - + diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb new file mode 100644 index 000000000..027e4e8ec --- /dev/null +++ b/app/views/organizations/_org_custom_header.html.erb @@ -0,0 +1,67 @@ +
    +
    + + <% if User.current.logged? %> + + <% else %> + + <% end %> + +
    +
    +
    + + + + \ No newline at end of file diff --git a/app/views/organizations/_org_custom_left1.html.erb b/app/views/organizations/_org_custom_left1.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/_org_custom_left2.html.erb b/app/views/organizations/_org_custom_left2.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/_org_custom_left3.html.erb b/app/views/organizations/_org_custom_left3.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/_org_custom_right1.html.erb b/app/views/organizations/_org_custom_right1.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/_org_custom_right2.html.erb b/app/views/organizations/_org_custom_right2.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/_org_custom_right3.html.erb b/app/views/organizations/_org_custom_right3.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index c490efb85..ba18438e5 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -1,6 +1,6 @@ <%# 区分两种模式 params[:org_subfield_id] 不为空的时候则跳到栏目%> <% if @organization.switch_type && params[:org_subfield_id].nil? %> - <%= render :partial => 'show_type2' %> + <%#= render :partial => 'show_type2' %> <% else %> <%= javascript_include_tag "jquery.infinitescroll.js" %> diff --git a/public/stylesheets/org_custom.css b/public/stylesheets/org_custom.css index 790877660..ce4bff32f 100644 --- a/public/stylesheets/org_custom.css +++ b/public/stylesheets/org_custom.css @@ -7,8 +7,6 @@ ol,ul,li{ list-style-type:none} a:link,a:visited{color:#000;text-decoration:none;} a:hover,a:active{color:#3b94d6;} - - /* 公共 */ .clear:after {content:".";height:0;visibility:hidden;display:block;clear:both;} .fl{ float:left;} @@ -24,11 +22,11 @@ a:hover,a:active{color:#3b94d6;} .mr5{ margin-right:5px;} .mr10{ margin-right:15px;} .mr15{ margin-right:10px;} -a.c_red{color:#df0600;} -.c_red{color:#df0600;} + /* 门户首页 */ -#por_header{ width:100%; height:70px; background-color:#3b94d6; } -.por_header_con{ width:1000px; margin:0 auto;} +#por_header{ width:100%; } +.por_header_top{ width:100%; height:70px; background:#3b94d6; } +.por_header_con{ width:1000px; margin:0 auto; height:70px; } .por_logo{ margin-top:5px;} .por_login li{ float:left;} .por_login li a{ display:block; padding:0 15px; height:70px; line-height:70px;font-size:16px; color:#fff; } @@ -37,15 +35,17 @@ a.c_red{color:#df0600;} .pro_input_search{ background-color:#daeefc; height:36px; width:355px; border:none; padding:0 5px; color:#3b94d6;} a.por_search_btn{ display:block;background:#daeefc url(../images/icons_por.png) 0 8px no-repeat; width:25px; height:36px;} a:hover.por_search_btn{background:#daeefc url(../images/icons_por.png) -35px 8px no-repeat; } +.por_nav{ width:1000px; height:70px; overflow:hidden; margin: 0 auto; position:relative; } +a.por_edit_index{ position:absolute; font-size:14px; right:5px; top:20px;} +.por_nav ul{ border-bottom:7px solid #ccc; height:63px;} +.por_nav ul li{ float:left; } +.por_nav ul li a{ display: block; height:63px; padding:0 20px; line-height:63px; font-size:18px; color:#333; } +.por_nav ul li a:hover{ border-bottom:7px solid #3b94d6; } +.por_index_act{border-bottom:7px solid #3b94d6; } #por_container{ width:1000px; margin:10px auto;} .por_left{ width:685px; margin-right:15px; float:left; } .por_right{ width:300px; float:left;} -.por_nav{ width:1000px; overflow:hidden; position:relative;height:53px; border-bottom:7px solid #ccc; margin-bottom:10px;} -a.por_edit_index{ position:absolute; font-size:14px; right:5px; top:15px;} -.por_nav ul li{ float:left;} -.por_nav ul li a{ display: block; height:53px; padding:0 20px; line-height:53px; font-size:18px; color:#333;} -.por_nav ul li a:hover{ border-bottom:7px solid #3b94d6;} .por_icons_hot{ background:url(../images/icons_por.png) 0 -78px no-repeat; height:22px; width:55px; padding-left:3px; color:#fff; font-size:12px; line-height:22px; font-weight:normal;} .por_h2_index{ font-size:20px; font-weight:normal; color:#3b94d6; width:100%; border-bottom:1px solid #e8e5e5; height:40px; line-height:40px;} a.por_more_index{ font-size:12px; color:#999; } @@ -115,8 +115,6 @@ a.por_teachers_name{ display:block; width:80px; font-size:18px;overflow:hidden; .por_footer_con ul li a span{ color:#999; margin:0 15px ;} .por_footer_con p{ text-align:center; margin-top:20px; color:#777;} -.por_index_position{ position:relative;} -a.por_xiang_index{ position:absolute; color:red; background:#fff; top:40px; left:292px;} From 9cc749bd57dbd97558d549aae8bf3331ec149f67 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 30 May 2016 14:38:57 +0800 Subject: [PATCH 13/86] =?UTF-8?q?=E9=97=A8=E6=88=B7=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org_custom.html.erb | 2 +- .../organizations/_org_custom_header.html.erb | 2 +- public/stylesheets/org_custom.css | 25 ------------------- public/stylesheets/public.css | 4 ++- 4 files changed, 5 insertions(+), 28 deletions(-) diff --git a/app/views/layouts/base_org_custom.html.erb b/app/views/layouts/base_org_custom.html.erb index 4a9ba4dce..4742eab4f 100644 --- a/app/views/layouts/base_org_custom.html.erb +++ b/app/views/layouts/base_org_custom.html.erb @@ -15,7 +15,7 @@ <%=render :partial => "math_js" %> - + <% update_visiti_count @organization %>
    <%= render :partial => 'org_custom_header' %> diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb index 027e4e8ec..349aef8c6 100644 --- a/app/views/organizations/_org_custom_header.html.erb +++ b/app/views/organizations/_org_custom_header.html.erb @@ -43,7 +43,7 @@
  • 学生英雄榜
  • 学生英雄榜
  • - 配置 + 配置
    diff --git a/public/stylesheets/org_custom.css b/public/stylesheets/org_custom.css index ce4bff32f..85f056438 100644 --- a/public/stylesheets/org_custom.css +++ b/public/stylesheets/org_custom.css @@ -1,28 +1,3 @@ -/* 门户样式重置 */ -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.5; background:#fff;} -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:#3b94d6;} - -/* 公共 */ -.clear:after {content:".";height:0;visibility:hidden;display:block;clear:both;} -.fl{ float:left;} -.fr{ float:right;} -.cl{ clear:both; overflow:hidden;} -.mt5{ margin-top:5px;} -.mt10{ margin-top:10px;} -.mb5{ margin-bottom:5px;} -.mb10{ margin-bottom:10px;} -.ml5{ margin-left:5px;} -.ml10{ margin-left:10px;} -.ml15{ margin-left:15px;} -.mr5{ margin-right:5px;} -.mr10{ margin-right:15px;} -.mr15{ margin-right:10px;} - /* 门户首页 */ #por_header{ width:100%; } .por_header_top{ width:100%; height:70px; background:#3b94d6; } diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 2ca221d5c..115e48223 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -270,6 +270,8 @@ a.linkGrey6 {color:#484848 !important;} a.linkGrey6:hover {color:#ffffff !important;} a.linkGrey7 {color:#888888;} a.linkGrey7:hover {color:#269ac9;} +a.link-black {color:#000;} +a.link-black:hover {color:#3b94d6;} a.bBlue {background-color:#3498db;} a.bBlue:hover {background-color:#297fb8;} a.submit_btn {border:1px solid #3498db; padding:3px 10px; border-radius:3px; color:#3498db;} @@ -1139,4 +1141,4 @@ a.st_down{ display: block; width:8px; float:left; height:13px; background:url(.. .likeNum{color: #7f7f7f} /*弹框*/ -.apply_content{ border:1px solid #ddd;line-height: 16px; height:80px;width:420px; background:#fff; margin-bottom:10px;} +.apply_content{ border:1px solid #ddd;line-height: 16px; height:80px;width:420px; background:#fff; margin-bottom:10px;} From 698e4bd7b3a1a5c855e6aafd6a0dc11368098bf2 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 30 May 2016 14:41:53 +0800 Subject: [PATCH 14/86] header --- app/views/layouts/base_org_custom.html.erb | 2 +- .../organizations/_org_custom_header.html.erb | 52 ++++++++++++++----- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/app/views/layouts/base_org_custom.html.erb b/app/views/layouts/base_org_custom.html.erb index 4a9ba4dce..355ec23ec 100644 --- a/app/views/layouts/base_org_custom.html.erb +++ b/app/views/layouts/base_org_custom.html.erb @@ -18,7 +18,7 @@ <% update_visiti_count @organization %>
    - <%= render :partial => 'org_custom_header' %> + <%= render :partial => 'org_custom_header', :locals => {:subfield_content => @subfield_content} %>
    diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb index 027e4e8ec..4be46e789 100644 --- a/app/views/organizations/_org_custom_header.html.erb +++ b/app/views/organizations/_org_custom_header.html.erb @@ -30,20 +30,45 @@
    - 配置 + <% if User.current.admin_of_org?(@organization) %> + 配置 + <% end %>
    @@ -57,7 +82,6 @@ $("#homepageProfileMenuIcon").removeClass("homepageProfileMenuIconhover"); $("#topnav_login_list").hide(); }); - function signout(){ $.post( '<%= signout_path%>', From 471ed7cbd230355be723404a01ea9540826c7a9a Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 30 May 2016 14:58:46 +0800 Subject: [PATCH 15/86] =?UTF-8?q?=E7=BB=84=E7=BB=87logo=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=A0=B7=E5=BC=8F=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_org_custom_header.html.erb | 2 +- public/images/org_custom/homepageImage.jpg | Bin 0 -> 2756 bytes public/images/org_custom/icons_por.png | Bin 0 -> 19736 bytes public/images/org_custom/por_img.jpg | Bin 0 -> 39793 bytes public/images/org_custom/porlogo.png | Bin 0 -> 21343 bytes public/stylesheets/org_custom.css | 10 +++++----- 6 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 public/images/org_custom/homepageImage.jpg create mode 100644 public/images/org_custom/icons_por.png create mode 100644 public/images/org_custom/por_img.jpg create mode 100644 public/images/org_custom/porlogo.png diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb index 166b4991e..4d00550a8 100644 --- a/app/views/organizations/_org_custom_header.html.erb +++ b/app/views/organizations/_org_custom_header.html.erb @@ -1,6 +1,6 @@
    - + <%= image_tag(url_to_avatar(@organization), width:"67", height: "61", :id => 'nh_user_tx', :class => "por_logo fl ", :target => "_blank") %> <% if User.current.logged? %>
    - -
    +<%# 内容开始 %> +
    <%= render_flash_messages %> <%= yield %> <%= call_hook :view_layouts_base_content %>
    - -
    - <%= render :partial => "layouts/org_custom_footer" %>
    - +<%# 内容结束 %> +<%# 页面底部 %> +
    <%= render :partial => "layouts/org_custom_footer" %>
    <%# 弹框 %> @@ -42,6 +41,3 @@ - - - diff --git a/app/views/organizations/_org_custom_left1.html.erb b/app/views/organizations/_org_custom_left1.html.erb index e69de29bb..4410f9545 100644 --- a/app/views/organizations/_org_custom_left1.html.erb +++ b/app/views/organizations/_org_custom_left1.html.erb @@ -0,0 +1,27 @@ +
    +

    网站头条更多>

    +
      +
    • + 热门推荐阿里前副总裁:阿里巴巴给我上的10 +

      1分钟前 窦豆

      +

      本文选自阿本文选自阿里本文选自阿里本文选自阿里本文选自阿里本文选自阿里里巴巴前副总裁、首任美籍高管波特·埃里斯曼《阿里传》在这本书里,波特概括了他在阿里巴巴任职的8年中,学到的40堂课这40堂课简单明了地概括了马云的经营理念,以及阿里终成帝国的必

      +
    • +
    • + 热门推荐阿里前副总裁:阿里巴巴给我上的10 +

      1分钟前 窦豆

      +

      本文选自阿本文选自阿里本文选自阿里本文选自阿里本文选自阿里本文选自阿里里巴巴前副总裁、首任美籍高管波特·埃里斯曼《阿里传》在这本书里,波特概括了他在阿里巴巴任职的8年中,学到的40堂课这40堂课简单明了地概括了马云的经营理念,以及阿里终成帝国的必

      +
    • +
    • + 阿里前副总裁里前副总裁:里前副总裁:里前副总裁::阿里巴巴给我上的10 +

      1分钟前 窦豆

      +

      本文选自阿本文选自阿里本文选自阿里本文选自阿里本文选自阿里本文选自阿里里巴巴前副总裁、首任美籍高管波特·埃里斯曼《阿里传》在这本书里,波特概括了他在阿里巴巴任职的8年中,学到的40堂课这40堂课简单明了地概括了马云的经营理念,以及阿里终成帝国的必

      +
    • +
    +
    + + 阿里前副总裁里前副总裁:里前副总裁:里前副总裁::阿里巴巴给我上的10 +

    1分钟前 窦豆

    +

    本文选自阿本文选自阿里本文选自阿里本文选自阿里本文选自阿里本文选自阿里里巴巴前副总裁、首任美籍高管波特·埃里斯曼《阿里传》在这本书里,波特概括了他在阿里巴巴任职的8年中,学到的40堂课这40堂课简单明了地概括了马云的经营理念,以及阿里终成帝国的必

    +
    +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_org_custom_left2.html.erb b/app/views/organizations/_org_custom_left2.html.erb index e69de29bb..649a1dd55 100644 --- a/app/views/organizations/_org_custom_left2.html.erb +++ b/app/views/organizations/_org_custom_left2.html.erb @@ -0,0 +1,28 @@ +
    +

    精品课程更多>

    +
    + 2016春计算机程序设计(Z2算机程序设计(Z2班)算机程序设计(Z2班)班) + +

    学习程序设计,要学习语言的语法更重要的是求解问题的算法思想。语法的学习需要多尝试,算法的算机程序设计(Z2班)算机程序设计(Z2班)算机程序设计(Z2班)学习需要多思考。学习程序设计

    + 2016春季学期 +
    +
    + 2016春计算机程序设计(Z2班) + +

    学习程序设计,要学习语言的语法更重要的是求解问题的算法思想。语法的学习需要多尝试,算法的学习需要多思考。学习程序设计

    + 2016春季学期 +
    +
    + 2016春计算机程序设计(Z2班) + +

    学习程序设计,要学习语言的语法更重要的是求解问题的算法思想。语法的学习需要多尝试,算法的学习需要多思考。学习程序设计

    + 2016春季学期 +
    +
    + 2016春计算机程序设计(Z2班) + +

    学习程序设计,要学习语言的语法更重要的是求解问题的算法思想。语法的学习需要多尝试,算法的学习需要多思考。学习程序设计

    + 2016春季学期 +
    +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_org_custom_left3.html.erb b/app/views/organizations/_org_custom_left3.html.erb index e69de29bb..db20d42a1 100644 --- a/app/views/organizations/_org_custom_left3.html.erb +++ b/app/views/organizations/_org_custom_left3.html.erb @@ -0,0 +1,37 @@ +
    +

    精华帖子更多>

    +
    +
    + + 阿里前副总裁里前副总裁:里前副总裁:里前副总裁::阿里巴巴给我上的10 +

    1分钟前 窦豆

    +

    本文选自阿本文选自阿里本文选自阿里本文选自阿里本文选自阿里本文选自阿里里巴巴前副总裁、首任美籍高管波特·埃里斯曼《阿里传》在这本书里,波特概括了他在阿里巴巴任职的8年中,学到的40堂课这40堂课简单明了地概括了马云的经营理念,以及阿里终成帝国的必

    +
    + +
    +
    + +
    +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_org_custom_right1.html.erb b/app/views/organizations/_org_custom_right1.html.erb index e69de29bb..6fc24555f 100644 --- a/app/views/organizations/_org_custom_right1.html.erb +++ b/app/views/organizations/_org_custom_right1.html.erb @@ -0,0 +1,71 @@ +
    +

    最新动态更多>

    +
      +
    • + +
      +

      + 叮当当  :  + Trustie社区新版上线了必须支持一下,比以前好用很多.... +

      +

      1分钟前 500

      +
      +
      +
    • +
    • + +
      +

      + 叮当叮当叮当叮当  :  + Trustie社区新版上线了必须支持一下,比以前好用很多了。Trustie社区新版上线了必须支持一下,比以前好用很多了... +

      +

      1分钟前 500

      +
      +
      +
    • +
    • + +
      +

      + 叮当叮当叮当叮当  :  + Trustie社区新版上线了必须支持一下,比以前好用很多了。Trustie社区新版上线了必须支持一下,比以前好用很多了... +

      +

      1分钟前 500

      +
      +
      +
    • +
    • + +
      +

      + 当叮当  :  + Trustie社区新版上线了必须支持一下,比以前好用很多了。Trustie社区新版上线了必须支持一下,比以前好用很多了... +

      +

      1分钟前 500

      +
      +
      +
    • +
    • + +
      +

      + 叮当叮当叮当叮当  :  + Trustie社区新版上线了必须支持一下很多了... +

      +

      1分钟前 500

      +
      +
      +
    • +
    • + +
      +

      + 叮当叮当叮当叮当  :  + Trustie社区新版上线了必须支持一下,比以前好用很多了。Trustie社区新版上线了必须支持一下,比以前好用很多了... +

      +

      1分钟前 500

      +
      +
      +
    • +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_org_custom_right2.html.erb b/app/views/organizations/_org_custom_right2.html.erb index e69de29bb..3cef2f622 100644 --- a/app/views/organizations/_org_custom_right2.html.erb +++ b/app/views/organizations/_org_custom_right2.html.erb @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/app/views/organizations/_org_custom_right3.html.erb b/app/views/organizations/_org_custom_right3.html.erb index e69de29bb..698a2ea25 100644 --- a/app/views/organizations/_org_custom_right3.html.erb +++ b/app/views/organizations/_org_custom_right3.html.erb @@ -0,0 +1,91 @@ +
    + +
    + +
    +
    + +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_show_custom.html.erb b/app/views/organizations/_show_custom.html.erb new file mode 100644 index 000000000..fbcc0c5f3 --- /dev/null +++ b/app/views/organizations/_show_custom.html.erb @@ -0,0 +1,31 @@ +
    + <% @subfield_content.each do |field| %> + <% if field.status.to_i == 1 %> + <%= render :partial => 'organizations/org_custom_left1', :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_custom_left3', :locals => {:field => field} %> +
    +
    + <% elsif field.status.to_i == 2 %> + <%= render :partial => 'organizations/org_custom_left2', :locals => {:field => field} %> + <% end %> + <% end %> +
    + +
    + <% @subfield_content.each do |field| %> + <% if field.status.to_i == 4 %> + <%= render :partial => 'organizations/org_custom_right1', :locals => {:field => field} %> + <% elsif field.status.to_i == 5 %> + <%= render :partial => 'organizations/org_custom_right2', :locals => {:field => field} %> + <% elsif field.status.to_i == 6 %> + <%= render :partial => 'organizations/org_custom_right3', :locals => {:field => field} %> + <%# elsif field.status.to_i == 23 %> + <%#= render :partial => 'organizations/org_subfield_rightM2', :locals => {:field => field} %> + <% end %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index ba18438e5..72e95ded9 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -1,6 +1,6 @@ <%# 区分两种模式 params[:org_subfield_id] 不为空的时候则跳到栏目%> <% if @organization.switch_type && params[:org_subfield_id].nil? %> - <%#= render :partial => 'show_type2' %> + <%= render :partial => 'show_custom' %> <% else %> <%= javascript_include_tag "jquery.infinitescroll.js" %> diff --git a/public/stylesheets/org_custom.css b/public/stylesheets/org_custom.css index cb3400031..6f68ba47f 100644 --- a/public/stylesheets/org_custom.css +++ b/public/stylesheets/org_custom.css @@ -78,7 +78,7 @@ a.por_more_teacher{ font-size:12px; } .por_teachers_li{ margin-top:10px;} .por_teachers_li li{ padding:10px 0;border-bottom:1px solid #e8e5e5;} .por_teachers_img{ width:60px; height:60px; -webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;} -a.por_teachers_name{ display:block; width:80px; font-size:18px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +a.por_teachers_name{ display:block; width:75px; font-size:18px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} .por_teachers_p{ font-size:14px; color:#999; width:150px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} .por_teachers_span{ color:#999;} .por_teachers_span a{ margin:0 5px; color:#999;} From c333a0c55d1656740a1a656d2b1c6432fe42c492 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 31 May 2016 10:31:08 +0800 Subject: [PATCH 17/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E6=8F=90=E4=BE=9B=E5=AD=A6=E9=9C=B8=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 | 8 ++-- app/controllers/organizations_controller.rb | 42 ++++++++++++----- app/helpers/organizations_helper.rb | 5 ++- app/models/org_subfield.rb | 2 + app/models/organization.rb | 4 +- app/views/org_subfields/create.js.erb | 2 +- app/views/org_subfields/destroy.js.erb | 2 +- .../organizations/_org_custom_admin.html.erb | 12 +++++ .../organizations/_org_custom_header.html.erb | 2 +- .../organizations/_org_students_list.html.erb | 45 +++++++++++++++++++ .../_setting_excellent_students.html.erb | 12 +++++ .../organizations/_subfield_list.html.erb | 2 +- .../reset_excellent_teacher.js.erb | 2 +- app/views/organizations/setting.html.erb | 14 +++--- app/views/organizations/students.html.erb | 30 +++++++++++++ app/views/organizations/students.js.erb | 3 ++ config/routes.rb | 3 ++ ...531021244_add_excellent_student_to_user.rb | 5 +++ db/schema.rb | 3 +- 19 files changed, 167 insertions(+), 31 deletions(-) create mode 100644 app/views/organizations/_org_custom_admin.html.erb create mode 100644 app/views/organizations/_org_students_list.html.erb create mode 100644 app/views/organizations/_setting_excellent_students.html.erb create mode 100644 app/views/organizations/students.html.erb create mode 100644 app/views/organizations/students.js.erb create mode 100644 db/migrate/20160531021244_add_excellent_student_to_user.rb diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index c628b25fc..01a36d5b9 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -15,11 +15,9 @@ class OrgSubfieldsController < ApplicationController end end @subfield.update_attributes(:field_type => params[:field_type]) - # 如果栏目是教师,不参入类型的配置,定义为右三模式 - # 新增模块命名规则,左边1开头,右边2开头,以前的不变 - # eg:23 右三 - if params[:field_type] == "Comptec" - @subfield.update_attributes(:status => 23) + # 如果栏目是教师或学生,不参入类型的配置,默认定义为右三模式 + if params[:field_type] == "Comptec" || params[:field_type] == "Compstu" + @subfield.update_attribute(:status, 6) end else @res = false diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3cf36a781..fc0a8b35e 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -28,7 +28,7 @@ class OrganizationsController < ApplicationController helper :project_score helper :issues include UsersHelper - before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers] + before_filter :find_organization, :only => [:show, :members, :apply_subdomain, :select_org_layout, :teachers, :students] layout 'base_org' def index @@ -159,7 +159,7 @@ class OrganizationsController < ApplicationController end def teachers - unless @organization.allow_set_teachers + unless User.current.admin? render_403 return end @@ -169,12 +169,6 @@ class OrganizationsController < ApplicationController if @type == "courses" || @type.nil? @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 == "students" - @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 == "resources" - @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from attachments where attachments.author_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" @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 u.excellent_teacher =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") @@ -192,6 +186,34 @@ class OrganizationsController < ApplicationController end end + def students + unless User.current.admin? + render_403 + return + end + 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? + @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" + @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 u.excellent_student =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") + end + limit = 10 + # @is_remote = true + @students_count = @org_students.count + @atta_pages = Paginator.new @students_count, limit, params['page'] || 1 + @offset ||= @atta_pages.offset + #@curse_attachments_all = @all_attachments[@offset, @limit] + @org_students = paginateHelper @org_students, limit + respond_to do |format| + format.html + format.js + end + end + def searchmember_by_name members, name #searchPeopleByRoles(project, StudentRoles) mems = [] @@ -474,13 +496,13 @@ class OrganizationsController < ApplicationController # 设置为名师 def set_excellent_teacher @ex_teacher = User.find(params[:user]) - @ex_teacher.update_column(:excellent_teacher, 1) + params[:type] == "student" ? @ex_teacher.update_column(:excellent_student, 1) : @ex_teacher.update_column(:excellent_teacher, 1) end # 取消名师 def reset_excellent_teacher @ex_teacher = User.find(params[:user]) - @ex_teacher.update_column(:excellent_teacher, 0) + params[:type] == "student" ? @ex_teacher.update_column(:excellent_student, 0) : @ex_teacher.update_column(:excellent_teacher, 0) end def hide_org_subfield diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index ab3b3715c..7298841b1 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -140,10 +140,13 @@ module OrganizationsHelper org_acts end + def allow_to_create?(org, type) + !org_subfield_had_created?(org, type) && User.current.admin? + end + def org_subfield_had_created?(org, type) sub_field = org.org_subfields.select{|subfield| subfield.field_type == type} result = sub_field.length > 0 ? true : false - result end def org_subfield_type(field) diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index 1151426e3..76d472ad9 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -11,6 +11,8 @@ class OrgSubfield < ActiveRecord::Base acts_as_attachable after_create :create_board_sync after_destroy :update_priority + # status 为栏目定制决定参数,1 左一 2 左二 3 左三 4 右一 5 右二 6 右三 + # 创建资源栏目讨论区 def create_board_sync @board = self.boards.build diff --git a/app/models/organization.rb b/app/models/organization.rb index c35d0591d..7aa259528 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -24,11 +24,11 @@ class Organization < ActiveRecord::Base end def switch_type - self.show_mode.to_i == 1 ? true : false + self.show_mode.to_i == 1 end def allow_set_teachers - self.allow_teacher.to_i == 1 ? true : false + self.allow_teacher.to_i == 1 end def secdomain_name diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index 5cc6d5c91..f1661ba87 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -4,7 +4,7 @@ :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}) %>"); - $("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>"); + $("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>"); <% end %> $("#subfield_name").val(""); $("#sub_dir").val(""); \ No newline at end of file diff --git a/app/views/org_subfields/destroy.js.erb b/app/views/org_subfields/destroy.js.erb index c14eeae8f..60ce47fe6 100644 --- a/app/views/org_subfields/destroy.js.erb +++ b/app/views/org_subfields/destroy.js.erb @@ -3,4 +3,4 @@ $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organiza :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}) %>"); -$("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>"); \ No newline at end of file +$("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>"); \ No newline at end of file diff --git a/app/views/organizations/_org_custom_admin.html.erb b/app/views/organizations/_org_custom_admin.html.erb new file mode 100644 index 000000000..559b52b63 --- /dev/null +++ b/app/views/organizations/_org_custom_admin.html.erb @@ -0,0 +1,12 @@ +<% if allow_to_create?(@organization, "Comptec") %> +
  • + + +
  • +<% end %> +<% if allow_to_create?(@organization, "Compstu") %> +
  • + + +
  • +<% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb index 4d00550a8..fc556255a 100644 --- a/app/views/organizations/_org_custom_header.html.erb +++ b/app/views/organizations/_org_custom_header.html.erb @@ -67,7 +67,7 @@ <% end %> <% if User.current.admin_of_org?(@organization) %> - 配置 + 配置 <% end %>
    diff --git a/app/views/organizations/_org_students_list.html.erb b/app/views/organizations/_org_students_list.html.erb new file mode 100644 index 000000000..4f768d29f --- /dev/null +++ b/app/views/organizations/_org_students_list.html.erb @@ -0,0 +1,45 @@ +<% org_students.each do |org_student| %> + <% school = School.where("id =?", org_student.school_id).first %> +
    +
    +
    + <%= link_to image_tag(url_to_avatar(org_student), :width => "90", :height => "90"), user_url_in_org(org_student), :alt => "用户头像" %> +
    +
    +
    <%=link_to org_student.try(:realname).nil? ? org_student.try(:login) : org_student.try(:realname), user_url_in_org(org_student) %> + <% unless school.nil? %> + <%= school.name %> + <% end %> +
    +
    +
    <%= org_student.courses.count %>
    +
    课程数
    +
    +
    +
    +
    <%= org_teacher_resource_count(org_student) %>
    +
    资源数
    +
    +
    + <% if User.current.admin_of_org?(@organization) %> + <%= org_student.excellent_student ==0 ? "设为学霸" : "取消设置" %> + <% end %> +
    +
    +
    +<% end %> + + \ No newline at end of file diff --git a/app/views/organizations/_setting_excellent_students.html.erb b/app/views/organizations/_setting_excellent_students.html.erb new file mode 100644 index 000000000..696d85378 --- /dev/null +++ b/app/views/organizations/_setting_excellent_students.html.erb @@ -0,0 +1,12 @@ +<% if @organization.allow_set_teachers && !org_subfield_had_created?(@organization, "Comptec") %> +
  • + + +
  • +<% end %> +<% if User.current.admin? && !org_subfield_had_created?(@organization, "Compstu") %> +
  • + + +
  • +<% 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 f16e53b0e..9307f3eb0 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -92,7 +92,7 @@ <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %> | 编辑 - <% unless field.field_type == "Resource" || field.field_type == "Comptec" %> + <% unless field.field_type == "Resource" || field.field_type == "Comptec" || field.field_type == "Compstu" %> | diff --git a/app/views/organizations/reset_excellent_teacher.js.erb b/app/views/organizations/reset_excellent_teacher.js.erb index fdf160bc4..8b7c6cc71 100644 --- a/app/views/organizations/reset_excellent_teacher.js.erb +++ b/app/views/organizations/reset_excellent_teacher.js.erb @@ -1 +1 @@ -$("#hide_<%= @ex_teacher.id %>").text("设为名师"); \ No newline at end of file +$("#hide_<%= @ex_teacher.id %>").text(<%= params[:type]== "student" ? "设为学霸" : "设为名师"%>); \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 0c8af8471..1920213cb 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -87,11 +87,11 @@  允许游客下载 <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %> - <% if User.current.admin? %> -
    允许设置名师榜 : - class="ml3" /> -
    - <% end %> + + + + + 保存 <% end %> @@ -162,8 +162,8 @@
  • -
    - <%= render :partial => 'organizations/setting_excellent_teachers' %> +
    + <%= render :partial => 'organizations/org_custom_admin' %>
  • 新增
  • diff --git a/app/views/organizations/students.html.erb b/app/views/organizations/students.html.erb new file mode 100644 index 000000000..770967210 --- /dev/null +++ b/app/views/organizations/students.html.erb @@ -0,0 +1,30 @@ +
    +
    + <% if @type == "famous" %> + 学霸列表 + <% else %> + <%= @field.name %> + <% end %> +
    +
    +
    + +
    + <%=render 'organizations/org_students_list', :org_students => @org_students %> +
    +
    +
      + <%= pagination_links_full @atta_pages, @students_count, :per_page_links => false, :flag => true %> +
    +
    +
    \ No newline at end of file diff --git a/app/views/organizations/students.js.erb b/app/views/organizations/students.js.erb new file mode 100644 index 000000000..c65f8f861 --- /dev/null +++ b/app/views/organizations/students.js.erb @@ -0,0 +1,3 @@ +$("#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 diff --git a/config/routes.rb b/config/routes.rb index 2863d49a4..71b8f298e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,6 +77,7 @@ RedmineApp::Application.routes.draw do get 'more_org_courses' get 'search_courses' get 'teachers' + get 'students' post 'join_course_menu' post 'join_courses' get 'search_projects' @@ -94,7 +95,9 @@ RedmineApp::Application.routes.draw do post 'hide_org_subfield' post 'show_org_subfield' post 'set_excellent_teacher' + post 'set_excellent_student' post 'reset_excellent_teacher' + post 'reset_excellent_student' post 'agree_apply_subdomain' end end diff --git a/db/migrate/20160531021244_add_excellent_student_to_user.rb b/db/migrate/20160531021244_add_excellent_student_to_user.rb new file mode 100644 index 000000000..08378bca5 --- /dev/null +++ b/db/migrate/20160531021244_add_excellent_student_to_user.rb @@ -0,0 +1,5 @@ +class AddExcellentStudentToUser < ActiveRecord::Migration + def change + add_column :users, :excellent_student, :integer, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 7462c304e..f7d61f57c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160523085440) do +ActiveRecord::Schema.define(:version => 20160531021244) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -2426,6 +2426,7 @@ ActiveRecord::Schema.define(:version => 20160523085440) do t.integer "gid" t.integer "visits", :default => 0 t.integer "excellent_teacher", :default => 0 + t.integer "excellent_student", :default => 0 end add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" From c369b271a0d967dd2edb309ddbf91d27930c8f3f Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 31 May 2016 11:24:47 +0800 Subject: [PATCH 18/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E9=85=8D=E7=BD=AE=E5=90=8E=E7=9A=84=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=8A=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 8 ++++++++ app/views/org_subfields/create.js.erb | 3 +-- app/views/org_subfields/destroy.js.erb | 5 ++--- app/views/org_subfields/update.js.erb | 3 ++- app/views/org_subfields/update_priority.js.erb | 4 ++-- app/views/organizations/_org_left_subfield_list.html.erb | 8 +++++--- app/views/organizations/setting.html.erb | 2 +- app/views/sub_domains/create.js.erb | 2 +- app/views/sub_domains/destroy.js.erb | 2 +- app/views/sub_domains/domain_update_priority.js.erb | 2 +- app/views/sub_domains/update.js.erb | 3 ++- 11 files changed, 26 insertions(+), 16 deletions(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 7298841b1..4a712c0f0 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -132,6 +132,14 @@ module OrganizationsHelper end end + # 系统栏目只有管理员才能看到 + 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") }.sort_by {|os| os.priority} + end + end def get_subfield_acts field org_subfield = OrgSubfield.find(field.id) diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index f1661ba87..952ed7b2c 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -1,7 +1,6 @@ <% if @res %> $("#org_subfield_list").html(""); - $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', - :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); + $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); $("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>"); diff --git a/app/views/org_subfields/destroy.js.erb b/app/views/org_subfields/destroy.js.erb index 60ce47fe6..f61e1c100 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 => {:subfields => @organization.org_subfields.order("priority") }) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); -$("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>"); \ No newline at end of file +$("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>"); diff --git a/app/views/org_subfields/update.js.erb b/app/views/org_subfields/update.js.erb index 06982ccfc..c030b7767 100644 --- a/app/views/org_subfields/update.js.erb +++ b/app/views/org_subfields/update.js.erb @@ -1,3 +1,4 @@ $("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); $("#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 +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@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 index 475649aac..043e8acbd 100644 --- a/app/views/org_subfields/update_priority.js.erb +++ b/app/views/org_subfields/update_priority.js.erb @@ -1,2 +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 +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 4340213a4..12edd4201 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -101,13 +101,15 @@ <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> <% end %> <% else %> - <% if field.field_type == "Comptec" %> + <% if field.field_type == "Comptec" && User.current.admin? %> <%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> - <% else %> + <% elsif field.field_type == "Compstu" && User.current.admin? %> + <%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <% elsif field.field_type != "Comptec" && field.field_type != "Compstu" %> <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> <% end %> <% end %> - <% if User.current.logged? and User.current.admin_of_org?(organization) && field.field_type != "Comptec" %> + <% if User.current.logged? and User.current.admin_of_org?(organization) && field.field_type != "Comptec" && field.field_type != "Compstu" %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %> <% end %>
    diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 1920213cb..06420363a 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -172,7 +172,7 @@
    - <%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority")} %> + <%= render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)} %>
    diff --git a/app/views/sub_domains/create.js.erb b/app/views/sub_domains/create.js.erb index 0990e35de..d793efd6e 100644 --- a/app/views/sub_domains/create.js.erb +++ b/app/views/sub_domains/create.js.erb @@ -1,6 +1,6 @@ <% if @res %> $("#org_subfield_list").html(""); -$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); <% end %> diff --git a/app/views/sub_domains/destroy.js.erb b/app/views/sub_domains/destroy.js.erb index 913c400f7..4d8ef21de 100644 --- a/app/views/sub_domains/destroy.js.erb +++ b/app/views/sub_domains/destroy.js.erb @@ -1,4 +1,4 @@ $("#org_subfield_list").html(""); -$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#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/sub_domains/domain_update_priority.js.erb b/app/views/sub_domains/domain_update_priority.js.erb index 475649aac..e4de7c931 100644 --- a/app/views/sub_domains/domain_update_priority.js.erb +++ b/app/views/sub_domains/domain_update_priority.js.erb @@ -1,2 +1,2 @@ -$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields.order("priority")}) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#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/sub_domains/update.js.erb b/app/views/sub_domains/update.js.erb index 02810eee7..2c0af9c42 100644 --- a/app/views/sub_domains/update.js.erb +++ b/app/views/sub_domains/update.js.erb @@ -1,3 +1,4 @@ $("#subsubdomain_show_<%= @subdomain.id %>").html("<%= @subdomain.name %>"); $("#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 +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); \ No newline at end of file From 8f897cbf89a5395727e985628d7346c3f77dc096 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 31 May 2016 13:47:05 +0800 Subject: [PATCH 19/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E6=A8=A1=E5=BC=8F=EF=BC=8C=E4=BA=8C=E7=BA=A7=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/sub_domains_controller.rb | 3 ++ .../_org_left_subfield_list.html.erb | 29 ++++++++++++++++++- app/views/organizations/setting.html.erb | 2 +- app/views/sub_domains/_new.html.erb | 9 ------ app/views/sub_domains/create.js.erb | 3 -- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/app/controllers/sub_domains_controller.rb b/app/controllers/sub_domains_controller.rb index e32935789..438b67eec 100644 --- a/app/controllers/sub_domains_controller.rb +++ b/app/controllers/sub_domains_controller.rb @@ -18,6 +18,9 @@ class SubDomainsController < ApplicationController else @res = false end + respond_to do |format| + format.js + end end def update diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 12edd4201..b51b57afb 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -91,7 +91,34 @@ <% end %> <% else %>
    - <% if field.field_type == "Post" || field.field_type == "Complex" || field.field_type == "Compstu" || field.field_type == "Comptec" %> + <% if field.field_type == "Post" || field.field_type == "Complex" %> +
    + + <% 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 homepageMenuControl hidden", :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 homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> + <% end %> + <% else %> + <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :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 %> + <% elsif field.field_type == "Comptec" %>
    <% if !field.subfield_subdomain_dir.nil? %> diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 06420363a..775bc7e6a 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -184,7 +184,7 @@ function add_org_subfield_subdomain(){ if ($("#subfield_name_subdomain").val().trim() != "") $("#add_subfield_form_subdomain").submit(); - $("#org_subfield_list").html('<%= escape_javascript(render(:partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority")} )) %>'); + $("#org_subfield_list").html('<%= escape_javascript(render(:partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)})) %>'); } var $is_exist = false; function apply_subdomain(id, domain){ diff --git a/app/views/sub_domains/_new.html.erb b/app/views/sub_domains/_new.html.erb index 25b660750..865eae785 100644 --- a/app/views/sub_domains/_new.html.erb +++ b/app/views/sub_domains/_new.html.erb @@ -9,10 +9,6 @@ - - - -
  • @@ -20,8 +16,3 @@ <% end %>
    - - - \ No newline at end of file diff --git a/app/views/sub_domains/create.js.erb b/app/views/sub_domains/create.js.erb index d793efd6e..8c7b7f64a 100644 --- a/app/views/sub_domains/create.js.erb +++ b/app/views/sub_domains/create.js.erb @@ -1,8 +1,5 @@ <% if @res %> -$("#org_subfield_list").html(""); $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)}) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); <% end %> -$("#subfield_name").val(""); -$("#sub_dir").val(""); \ No newline at end of file From 6bfe344cbf8cfe0cf6b72af36590173f7a391c0b Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 31 May 2016 13:59:29 +0800 Subject: [PATCH 20/86] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=80=E5=B7=A6=E4=BE=A7=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_org_left_subfield_list.html.erb | 38 +++---------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index b51b57afb..e621df8bd 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -112,46 +112,20 @@ <%= render :partial => 'organizations/org_subdomain',:locals=>{:subdomains => field.sub_domains.reorder('priority').uniq, :org_subfield_id => field.id} %>
    - <% unless (field.sub_domains.count == 0 || !if_hidden_subdomain(field)) %>
  • <% end %> - <% elsif field.field_type == "Comptec" %> + <% elsif field.field_type == "Comptec" && User.current.admin? %>
    - - <% 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 homepageMenuControl hidden", :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 homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> - <% end %> - <% else %> - <% if field.field_type == "Comptec" && User.current.admin? %> - <%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> - <% elsif field.field_type == "Compstu" && User.current.admin? %> - <%= link_to "#{field.name}", students_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> - <% elsif field.field_type != "Comptec" && field.field_type != "Compstu" %> - <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> - <% end %> - <% end %> - <% if User.current.logged? and User.current.admin_of_org?(organization) && field.field_type != "Comptec" && field.field_type != "Compstu" %> - <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %> - <% end %> + <%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
    -