课程通知评论编辑框不可用,解决方案:编辑跳转到新的页面

This commit is contained in:
sw 2015-04-28 10:31:55 +08:00
parent 261ebb916c
commit b3fb7914e2
4 changed files with 20 additions and 30 deletions

View File

@ -152,6 +152,9 @@ class NewsController < ApplicationController
end end
def edit def edit
if @course
render :layout => "base_courses"
end
end end
def update def update

View File

@ -1,10 +1,10 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<li class="ml45"> <li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label>
<input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>"> <input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<p id="title_notice_span" class="ml55"></p> <p id="title_notice_span" class="ml55"></p>
</li> </li>
<li class="ml45 mb10"> <li class="mb10">
<% if is_new %> <% if is_new %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label> <label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
@ -18,12 +18,12 @@
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ml45"> <li>
<label class="fl">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label> <label class="fl mt5">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<%= render :partial => 'attachments/new_form', :locals => {:container => @news} %> <%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class=" ml90" > <li class="ml40" >
<% if is_new %> <% if is_new %>
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %> <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %> <%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>

View File

@ -8,16 +8,6 @@
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_news) %></h2> <h2 class="project_h2"><%= l(:label_course_news) %></h2>
</div> </div>
<% if authorize_for_course('news', 'edit') %>
<div id="edit-news" style="display:none;">
<%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %>
<% end %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<div class="problem_main"> <div class="problem_main">
<%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %> <%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5"> <div class="problem_txt fl mt5">
@ -26,9 +16,7 @@
</h4> </h4>
<%= link_to(l(:button_edit), <%= link_to(l(:button_edit),
edit_news_path(@news), edit_news_path(@news),
:class => 'talk_edit fr', :class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
:accesskey => accesskey(:edit),
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %>
<%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %> <%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
<div class="cl"></div> <div class="cl"></div>
<div class="mb5 upload_img"> <div class="mb5 upload_img">

View File

@ -1,12 +1,11 @@
<h3><%=l(:label_news)%></h3> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<div class="project_r_h">
<%= labelled_form_for @news, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <h2 class="project_h2"><%= l(:label_course_news) %></h2>
<%= render :partial => 'form', :locals => { :f => f } %> </div>
<%= submit_tag l(:button_save) %> <div id="edit-news">
<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %> <%= labelled_form_for :news, @news, :url => news_path(@news),
<% end %> :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<div id="preview" class="wiki"></div> <%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %>
<% end %>
<% content_for :header_tags do %> <div id="preview" class="wiki"></div>
<%= stylesheet_link_tag 'scm' %> </div>
<% end %>