From 5e600380c7834e26c5fa11544cd4446b9b8d8eec Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Tue, 19 Aug 2014 15:10:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AF=BE=E7=A8=8B=E5=90=8D=E7=A7=B0=E4=B8=8E?= =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E8=B0=83=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_course_list.html.erb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index f590cf868..8d31f7c4c 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -6,11 +6,8 @@
- <% if (course.school == nil) %> -               - <% else %> - <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %> - <% end %> + <%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> @@ -19,7 +16,11 @@
[<%= get_course_term course %>] - <%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <% if (course.school == nil) %> +               + <% else %> + <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %> + <% end %> (<%= course.members.count %>人) <%# files_count = course.attachments.count.to_s %> (<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料) From a0a8868c249c474d808360922a37b439a2032641 Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Tue, 19 Aug 2014 15:44:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E8=AF=BE=E7=A8=8B=E9=A1=B9=E7=9B=AEtab=E9=A1=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_header.html.erb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 3116a9a68..b943cf565 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -44,6 +44,13 @@ <% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%> <% hasCourse=true%> + <% _bool=false %> + <% User.current.courses.each do |course| %> + <% if !course_endTime_timeout?(course) %> + <% _bool=true %> + <% end %> + <% end %> + <% if _bool %>
  • <%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
  • + <% end %> <% end -%> <% end %> -
  • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> + <% if User.current.projects.count>0 %> +
  • + <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> <% if hasCourse %>
  • + <% end %>
  • <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
  • From 4c57136a1d757102fac873beb442d6dcd8674dfc Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Wed, 20 Aug 2014 10:50:29 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 ++ app/controllers/words_controller.rb | 10 +++++++++- app/views/projects/feedback.html.erb | 17 ++++++++++++----- app/views/words/destroyJournal.js.erb | 3 +++ config/routes.rb | 2 ++ 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 app/views/words/destroyJournal.js.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ccbff8e50..ea37766b6 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -418,6 +418,8 @@ class ProjectsController < ApplicationController @jour = @jours[@offset, @limit] @state = false @base_courses_tag = @project.project_type + + respond_to do |format| format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.api diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 110f81537..af850d626 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -88,7 +88,15 @@ class WordsController < ApplicationController #format.api { render_api_ok } end end - + + def destroyJournal + @journalP=JournalsForMessage.find(params[:object_id]) + @journalP.destroy + respond_to do |format| + format.js + end + end + def new @jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id] if @jour diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index 5de3ceb4a..13e123b35 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -72,13 +72,20 @@ function checkMaxLength() { <% if reply_allow %> <%= link_to l(:label_projects_feedback_respond),'#', - {:focus => 'project_respond', - :onclick => "toggleAndSettingWordsVal($('##{id}'), - $('##{id} textarea'), - '#{l(:label_reply_plural)} #{journal.user.name}: '); + {:focus => 'project_respond', + :onclick => "toggleAndSettingWordsVal($('##{id}'), + $('##{id} textarea'), + '#{l(:label_reply_plural)} #{journal.user.name}: '); return false;"} %> <% end %> - + + <% if User.current.logged? %> + <% if journal.user_id==User.current.id|| User.current.admin? %> + <%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id}, + :remote => true, :title => l(:button_delete)) %> + <% end %> + <% end %> +
    <% if reply_allow %> diff --git a/app/views/words/destroyJournal.js.erb b/app/views/words/destroyJournal.js.erb new file mode 100644 index 000000000..5c91c6053 --- /dev/null +++ b/app/views/words/destroyJournal.js.erb @@ -0,0 +1,3 @@ +<% if @journalP!=nil %> + $(".message-for-user").children("#word_li_<%=@journalP.id%>").remove(); +<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 9d9b9d13b..f93318c7d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -652,6 +652,7 @@ RedmineApp::Application.routes.draw do delete 'words/destroy', :to => 'words#destroy' get 'words/more', :to => 'words#more' get 'words/back', :to=> 'words#back' + get 'words/destroyJournal', :to => 'words#destroyJournal' ############## fq post 'calls/create', :to => 'bids#create' delete 'calls/destroy', :to => 'bids#destroy' @@ -746,6 +747,7 @@ RedmineApp::Application.routes.draw do match 'words/add_brief_introdution', :controller => 'words', :action => 'add_brief_introdution' + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| file = File.join(plugin_dir, "config/routes.rb") if File.exists?(file) From 73537a30cbd220d181c8dc0933b6913a63866664 Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Wed, 20 Aug 2014 11:39:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BA=BA=E4=B8=8D=E8=83=BD=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=E9=9D=9E=E5=85=AC?= =?UTF-8?q?=E5=BC=80=E8=B5=84=E6=BA=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- app/views/messages/_project_show.html.erb | 4 ++-- db/schema.rb | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 44d68de26..c58cd3f82 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -79,7 +79,7 @@ class AttachmentsController < ApplicationController else candown = @attachment.is_public == 1 end - if candown || User.current.admin? + if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 3bc9b6943..ad91c72f8 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -156,10 +156,10 @@ :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) ) if message.destroyable_by?(User.current) %> -
    + + -
    <%= textAreailizable message,:content,:attachments => message.attachments %> diff --git a/db/schema.rb b/db/schema.rb index 7d908db6f..cdedc6a2c 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 => 20140814062455) do +ActiveRecord::Schema.define(:version => 20140812065417) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -448,14 +448,14 @@ ActiveRecord::Schema.define(:version => 20140814062455) do end create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" + t.string "name", :null => false + t.string "description", :default => "" t.integer "topic_count", :default => 0 t.integer "memo_count", :default => 0 t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "groups_users", :id => false, :force => true do |t|