From 6c06d0f457191315dd5a69fd6983cde20b3203cc Mon Sep 17 00:00:00 2001 From: spen Date: Thu, 20 Mar 2014 15:53:26 +0800 Subject: [PATCH] Add show plugin profile action --- .../back_end/writing_books_controller.rb | 16 ++++++++++++++-- .../back_end/writing_books/_form.html.erb | 2 +- .../front_end/writing_books/show.html.erb | 6 +++++- .../panel/personal_book/plugin/_profile.html.erb | 12 ++++++++++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/controllers/panel/personal_book/back_end/writing_books_controller.rb b/app/controllers/panel/personal_book/back_end/writing_books_controller.rb index a2b1333..c663dde 100644 --- a/app/controllers/panel/personal_book/back_end/writing_books_controller.rb +++ b/app/controllers/panel/personal_book/back_end/writing_books_controller.rb @@ -231,7 +231,13 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl respond_to do |format| if @writing_book.update_attributes(params[:writing_book]) - format.html { redirect_to(panel_personal_book_back_end_writing_books_url) } + + if params[:writing_book][:user_id] + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_book][:user_id],:show_plugin_profile=>"WritingBook")) } + else + format.html { redirect_to(panel_personal_book_back_end_writing_books_url) } + end + # format.js { render 'toggle_enable' } format.xml { head :ok } else @@ -251,7 +257,13 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl @writing_book.destroy respond_to do |format| - format.html { redirect_to(panel_personal_book_back_end_writing_books_url) } + + if params[:user_id] + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"WritingBook")) } + else + format.html { redirect_to(panel_personal_book_back_end_writing_books_url) } + end + # format.xml { head :ok } format.js end diff --git a/app/views/panel/personal_book/back_end/writing_books/_form.html.erb b/app/views/panel/personal_book/back_end/writing_books/_form.html.erb index 3ead8d3..b561fa2 100644 --- a/app/views/panel/personal_book/back_end/writing_books/_form.html.erb +++ b/app/views/panel/personal_book/back_end/writing_books/_form.html.erb @@ -255,7 +255,7 @@
<%= f.fields_for :authors_translations do |f| %> - <%= f.text_area locale, rows: 2, class: "input-block-level", value: (@writing_book.authors_translations[locale] rescue nil) %> + <%= f.text_field locale, rows: 2, class: "input-block-level", value: (@writing_book.authors_translations[locale] rescue nil) %> <% end %>
diff --git a/app/views/panel/personal_book/front_end/writing_books/show.html.erb b/app/views/panel/personal_book/front_end/writing_books/show.html.erb index 8c87f07..56e9492 100644 --- a/app/views/panel/personal_book/front_end/writing_books/show.html.erb +++ b/app/views/panel/personal_book/front_end/writing_books/show.html.erb @@ -1,5 +1,6 @@ <% # encoding: utf-8 %> +
@@ -59,7 +60,9 @@ <% end %> - + <% if !@writing_book.authors.blank? %> + + <% end %> <% if @writing_book.writing_book_files.size > 0 %> @@ -77,3 +80,4 @@ <% end %>
<%= t("module_name.personal_book") %>
<%= t("personal_book.url")%><%= link_to t(:url), @writing_book.url, {:target => '_blank', :title => @writing_book.url} if !@writing_book.url.blank? %>
<%= t("personal_book.authors")%><%= "#{User.from_id(@writing_book.create_user_id).name rescue ''},#{@writing_book.authors rescue ''}"%>
<%= t("personal_book.authors")%><%= "#{@writing_book.authors rescue ''}"%>
<%= t("personal_book.files")%>
+
diff --git a/app/views/panel/personal_book/plugin/_profile.html.erb b/app/views/panel/personal_book/plugin/_profile.html.erb index ee6aa78..c70820e 100644 --- a/app/views/panel/personal_book/plugin/_profile.html.erb +++ b/app/views/panel/personal_book/plugin/_profile.html.erb @@ -41,7 +41,7 @@ <% end -%> - +
<% if is_admin? %> @@ -55,7 +55,7 @@ <% @writing_books.each do |writing_book| %> - "> + "> <% if is_admin? %>
<%= check_box_tag 'to_change[]', writing_book.id.to_s, false, :class => "list-check" %> @@ -64,6 +64,14 @@ <%= writing_book.year %> <%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %> +
+ +