From cec31ed345f7983c6fb9ab87e25efbb9062f2792 Mon Sep 17 00:00:00 2001 From: spen Date: Thu, 20 Mar 2014 15:52:38 +0800 Subject: [PATCH] Add show plugin profile action --- .../back_end/writing_patents_controller.rb | 16 ++++++++++++++-- .../front_end/writing_patents/show.html.erb | 8 ++++++-- .../personal_patent/plugin/_profile.html.erb | 12 ++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/controllers/panel/personal_patent/back_end/writing_patents_controller.rb b/app/controllers/panel/personal_patent/back_end/writing_patents_controller.rb index 6234531..44272ad 100644 --- a/app/controllers/panel/personal_patent/back_end/writing_patents_controller.rb +++ b/app/controllers/panel/personal_patent/back_end/writing_patents_controller.rb @@ -176,7 +176,13 @@ class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendCon respond_to do |format| if @writing_patent.update_attributes(params[:writing_patent]) - format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) } + + if params[:writing_patent][:user_id] + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_patent][:user_id],:show_plugin_profile=>"WritingPatent")) } + else + format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) } + end + # format.js { render 'toggle_enable' } format.xml { head :ok } else @@ -195,7 +201,13 @@ class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendCon @writing_patent.destroy respond_to do |format| - format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) } + + if params[:user_id] + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"WritingPatent")) } + else + format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) } + end + # format.xml { head :ok } format.js end diff --git a/app/views/panel/personal_patent/front_end/writing_patents/show.html.erb b/app/views/panel/personal_patent/front_end/writing_patents/show.html.erb index ea30e50..26c0f9e 100644 --- a/app/views/panel/personal_patent/front_end/writing_patents/show.html.erb +++ b/app/views/panel/personal_patent/front_end/writing_patents/show.html.erb @@ -1,5 +1,6 @@ <% # encoding: utf-8 %> +
@@ -28,14 +29,16 @@ <% end %> <% if !@writing_patent.publish_date.blank? %> - + <% end %> <% if !@writing_patent.url.blank? %> <% end %> - + <% if !@writing_patent.authors.blank? %> + + <% end %> <% if @writing_patent.writing_patent_files.size > 0 %> @@ -53,3 +56,4 @@ <% end %>
<%= t("module_name.personal_patent") %>
<%= t("personal_patent.publication_date")%><%= @writing_patent.publish_date %>
<%= t("personal_patent.publication_date")%><%= @writing_patent.publish_date.strftime("%Y.%m") %>
<%= t("personal_patent.url")%><%= link_to t(:url), @writing_patent.url, {:target => '_blank', :title => @writing_patent.url} if !@writing_patent.url.blank? %>
<%= t("personal_patent.authors")%><%= "#{User.from_id(@writing_patent.create_user_id).name rescue ''},#{@writing_patent.authors rescue ''}"%>
<%= t("personal_patent.authors")%><%= "#{@writing_patent.authors rescue ''}"%>
<%= t("personal_patent.file")%>
+
diff --git a/app/views/panel/personal_patent/plugin/_profile.html.erb b/app/views/panel/personal_patent/plugin/_profile.html.erb index 818ebb1..d90c730 100644 --- a/app/views/panel/personal_patent/plugin/_profile.html.erb +++ b/app/views/panel/personal_patent/plugin/_profile.html.erb @@ -41,7 +41,7 @@ <% end -%> - +
<% if is_admin? %> @@ -55,7 +55,7 @@ <% @writing_patents.each do |writing_patent| %> - "> + "> <% if is_admin? %>
<%= check_box_tag 'to_change[]', writing_patent.id.to_s, false, :class => "list-check" %> @@ -64,6 +64,14 @@ <%= writing_patent.publish_date.strftime("%Y.%m") %> <%= link_to writing_patent.patent_title, panel_personal_patent_front_end_writing_patent_path(writing_patent) %> +
+ +