From 75f9f867e8ceed6bdca5437a6e61000bb839f167 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 8 Feb 2018 16:05:29 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=BD=BF=E7=94=A8editorMD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/statistics/_form.html.erb | 119 +++++++++++++++++++++------- public/images/user/richEditer.png | Bin 0 -> 24846 bytes public/stylesheets/css/common.css | 3 + 3 files changed, 92 insertions(+), 30 deletions(-) create mode 100644 public/images/user/richEditer.png diff --git a/app/views/statistics/_form.html.erb b/app/views/statistics/_form.html.erb index 92b3846a0..a30c5ac4e 100644 --- a/app/views/statistics/_form.html.erb +++ b/app/views/statistics/_form.html.erb @@ -1,15 +1,18 @@ +<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %> +<%= javascript_include_tag '/editormd/lib/marked.min.js','/editormd/lib/prettify.min.js','/editormd/lib/raphael.min.js','/editormd/lib/underscore.min.js','/editormd/lib/sequence-diagram.min.js', + '/editormd/lib/flowchart.min.js','/editormd/lib/jquery.flowchart.min.js','/editormd/editormd.js' %>
- <%= form_for(@statistic) do |f| %> + <%= form_for(@statistic) do |f| %> <% if @statistic.errors.any? %> -
-

<%= pluralize(@statistic.errors.count, "error") %> prohibited this statistic from being saved:

+
+

<%= pluralize(@statistic.errors.count, "error") %> prohibited this statistic from being saved:

-
    - <% @statistic.errors.full_messages.each do |msg| %> -
  • <%= msg %>
  • - <% end %> -
-
+ +
<% end %>
@@ -20,8 +23,8 @@
<%= f.select :main_category_id, (@main_categories.collect { |mc| [mc.name, mc.id] }), - {:no_label => true}, :onchange => 'getSubCategory(this.options[this.options.selectedIndex].value)', - :class => "w150" %> + {:no_label => true}, :onchange => 'getSubCategory(this.options[this.options.selectedIndex].value)', + :class => "w150" %>
<%= f.select :sub_category_id, (@sub_categories.present? ? @sub_categories.collect { |mc| [mc.name, mc.id] } : []), @@ -30,7 +33,9 @@
- <%= f.text_area :description, :class => "wb85 h200 mb20" %> +
+ <%= f.text_area :description, :class => "wb85 h200 mb20", :style => "display: none;" %> +
@@ -40,10 +45,64 @@ 保存 <%= link_to '取消', statistics_path ,:class=>"grey_btn_big fr c_white mr10" %>
- <% end %> + <% end %>
From 59849472ab422e5eaa58a4e03434bd25725ffdbf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 9 Feb 2018 10:07:34 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=85=B3=E5=8D=A1?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=8A=E4=BC=A0=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/statistics_controller.rb | 1 + app/views/statistics/show.html.erb | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/controllers/statistics_controller.rb b/app/controllers/statistics_controller.rb index 45e630606..31afa9a07 100644 --- a/app/controllers/statistics_controller.rb +++ b/app/controllers/statistics_controller.rb @@ -86,6 +86,7 @@ class StatisticsController < ApplicationController respond_to do |format| if @statistic.update_attributes(params[:statistic]) + @statistic.save_attachments_containers(params[:attachments], User.current, true) format.html { redirect_to @statistic, notice: 'Statistic was successfully updated.' } format.json { head :no_content } else diff --git a/app/views/statistics/show.html.erb b/app/views/statistics/show.html.erb index 33c371735..8992fe985 100644 --- a/app/views/statistics/show.html.erb +++ b/app/views/statistics/show.html.erb @@ -1,3 +1,6 @@ +<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %> +<%= javascript_include_tag '/editormd/lib/marked.min.js','/editormd/lib/prettify.min.js','/editormd/lib/raphael.min.js','/editormd/lib/underscore.min.js','/editormd/lib/sequence-diagram.min.js', + '/editormd/lib/flowchart.min.js','/editormd/lib/jquery.flowchart.min.js','/editormd/editormd.js' %>

<%= notice %>

@@ -32,5 +35,17 @@ <%= link_to '编辑', edit_statistic_path(@statistic) ,:class => "submit_btn" %> <%= link_to '返回', statistics_path ,:class=>"grey_btn" %>
- -
\ No newline at end of file +
+ \ No newline at end of file