项目留言删除功能

This commit is contained in:
linhk 2014-08-20 10:50:29 +08:00
parent a0a8868c24
commit 4c57136a1d
5 changed files with 28 additions and 6 deletions

View File

@ -418,6 +418,8 @@ class ProjectsController < ApplicationController
@jour = @jours[@offset, @limit] @jour = @jours[@offset, @limit]
@state = false @state = false
@base_courses_tag = @project.project_type @base_courses_tag = @project.project_type
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.html{render :layout => 'base_courses' if @base_courses_tag==1}
format.api format.api

View File

@ -88,7 +88,15 @@ class WordsController < ApplicationController
#format.api { render_api_ok } #format.api { render_api_ok }
end end
end end
def destroyJournal
@journalP=JournalsForMessage.find(params[:object_id])
@journalP.destroy
respond_to do |format|
format.js
end
end
def new def new
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id] @jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
if @jour if @jour

View File

@ -72,13 +72,20 @@ function checkMaxLength() {
<span> <span>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:label_projects_feedback_respond),'#', <%= link_to l(:label_projects_feedback_respond),'#',
{:focus => 'project_respond', {:focus => 'project_respond',
:onclick => "toggleAndSettingWordsVal($('##{id}'), :onclick => "toggleAndSettingWordsVal($('##{id}'),
$('##{id} textarea'), $('##{id} textarea'),
'#{l(:label_reply_plural)} #{journal.user.name}: '); '#{l(:label_reply_plural)} #{journal.user.name}: ');
return false;"} %> return false;"} %>
<% end %> <% end %>
</span>
<% 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 %>
</span>
</span> </span>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<% if reply_allow %> <% if reply_allow %>

View File

@ -0,0 +1,3 @@
<% if @journalP!=nil %>
$(".message-for-user").children("#word_li_<%=@journalP.id%>").remove();
<% end %>

View File

@ -652,6 +652,7 @@ RedmineApp::Application.routes.draw do
delete 'words/destroy', :to => 'words#destroy' delete 'words/destroy', :to => 'words#destroy'
get 'words/more', :to => 'words#more' get 'words/more', :to => 'words#more'
get 'words/back', :to=> 'words#back' get 'words/back', :to=> 'words#back'
get 'words/destroyJournal', :to => 'words#destroyJournal'
############## fq ############## fq
post 'calls/create', :to => 'bids#create' post 'calls/create', :to => 'bids#create'
delete 'calls/destroy', :to => 'bids#destroy' 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' match 'words/add_brief_introdution', :controller => 'words', :action => 'add_brief_introdution'
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
file = File.join(plugin_dir, "config/routes.rb") file = File.join(plugin_dir, "config/routes.rb")
if File.exists?(file) if File.exists?(file)