From b3fb7914e27009c511e520b290278ef792da02a7 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 28 Apr 2015 10:31:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E7=BC=96=E8=BE=91=E6=A1=86=E4=B8=8D=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88=EF=BC=9A=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E8=B7=B3=E8=BD=AC=E5=88=B0=E6=96=B0=E7=9A=84=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 3 +++ app/views/news/_course_form.html.erb | 10 +++++----- app/views/news/_course_show.html.erb | 14 +------------- app/views/news/edit.html.erb | 23 +++++++++++------------ 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index d41491349..f71a77ca7 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -152,6 +152,9 @@ class NewsController < ApplicationController end def edit + if @course + render :layout => "base_courses" + end end def update diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index b8b3e36a4..b757ab274 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -1,10 +1,10 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor" %> -
  • +
  • -
  • +
  • <% if is_new %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> @@ -18,12 +18,12 @@
  • -
  • - +
  • + <%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
  • -
  • +
  • <% if is_new %> <%= 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' %> diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 63e2ffb85..1160f09e3 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -8,16 +8,6 @@

    <%= l(:label_course_news) %>

    -<% if authorize_for_course('news', 'edit') %> - -<% end %> -
    <%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
    @@ -26,9 +16,7 @@ <%= link_to(l(:button_edit), edit_news_path(@news), - :class => 'talk_edit fr', - :accesskey => accesskey(:edit), - :onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %> + :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) %>
    diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index 3e9860feb..758976d1b 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -1,12 +1,11 @@ -

    <%=l(:label_news)%>

    - -<%= labelled_form_for @news, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> -<%= render :partial => 'form', :locals => { :f => f } %> -<%= submit_tag l(:button_save) %> -<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %> -<% end %> -
    - -<% content_for :header_tags do %> - <%= stylesheet_link_tag 'scm' %> -<% end %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +
    +

    <%= l(:label_course_news) %>

    +
    +
    + <%= 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 %> +
    +
    \ No newline at end of file