diff --git a/app/controllers/admin/page_contents_controller.rb b/app/controllers/admin/page_contents_controller.rb index 9c781b9..9842f5c 100644 --- a/app/controllers/admin/page_contents_controller.rb +++ b/app/controllers/admin/page_contents_controller.rb @@ -57,6 +57,13 @@ class Admin::PageContentsController < OrbitAdminController render :json => {"success" => true}.to_json end + def wiki_parent + parent_page_id = params[:id] + @wiki_parent_page = Page.where(:id => parent_page_id).first + @table_fields = ["page_content.id", :name,:version,:update_at,:last_modified, :category] + @categories = @module_app.categories.enabled.authorized(current_user).collect{|c| [c.title, c.id]} + end + private def update_params diff --git a/app/controllers/admin/wiki_pages_controller.rb b/app/controllers/admin/wiki_pages_controller.rb index 868a1f9..86f87cc 100644 --- a/app/controllers/admin/wiki_pages_controller.rb +++ b/app/controllers/admin/wiki_pages_controller.rb @@ -53,7 +53,7 @@ class Admin::WikiPagesController < OrbitAdminController def update wiki = WikiPage.find(params[:id]) wiki.update_attributes(wiki_page_params) - redirect_to admin_wiki_pages_path(:page_id => wiki.page.id) + redirect_to params['referer_url'] end private @@ -61,4 +61,4 @@ class Admin::WikiPagesController < OrbitAdminController def wiki_page_params params.require(:wiki_page).permit! end -end \ No newline at end of file +end diff --git a/app/views/admin/page_contents/wiki_parent.html.erb b/app/views/admin/page_contents/wiki_parent.html.erb new file mode 100644 index 0000000..13213e0 --- /dev/null +++ b/app/views/admin/page_contents/wiki_parent.html.erb @@ -0,0 +1,34 @@ + + + + <% @table_fields.each do |f| %> + <%= thead(f) %> + <% end %> + + + + + + + + + + + + +
<%= @wiki_parent_page.page_id%> + <%= @wiki_parent_page.name %> +
+ +
+
<%= @wiki_parent_page.page_contexts.last.version rescue nil %><%= format_value @wiki_parent_page.page_contexts.last.updated_at rescue nil %><%= User.find(@wiki_parent_page.page_contexts.last.update_user_id).user_name rescue nil %> + <% if can_edit_or_delete?(@wiki_parent_page) %> + <%= select_tag("category_id",options_for_select(@categories, (@wiki_parent_page.category_id.to_s rescue "")), prompt: t("select_category"), class: "category_select", style: "margin-bottom:0; width:150px;") %> + + <% end %> +
diff --git a/app/views/admin/wiki_pages/_index.html.erb b/app/views/admin/wiki_pages/_index.html.erb index cc221f9..ae73573 100644 --- a/app/views/admin/wiki_pages/_index.html.erb +++ b/app/views/admin/wiki_pages/_index.html.erb @@ -10,7 +10,7 @@ <% @wikis.each do |page| %> - <%= page.title %> + <%= page.title %>
<%= format_value page.created_at rescue nil %> - <%= page.page.page_id rescue "" %> + + <%= page.page.page_id rescue "" %> + <%= User.find(page.update_user_id).user_name rescue nil %> <% end %> @@ -35,4 +37,4 @@ Add <% end %> - \ No newline at end of file + diff --git a/app/views/page_contents/index.html.erb b/app/views/page_contents/index.html.erb index 3ccc552..5b5369c 100644 --- a/app/views/page_contents/index.html.erb +++ b/app/views/page_contents/index.html.erb @@ -6,8 +6,8 @@

<%= data["title"] %>

-<%= data["html"].html_safe %> +<%= data["html"].html_safe unless data["html"].nil? %> <% if !data["url_to_edit"].blank? %>

<%= t(:edit) %>

-<% end %> \ No newline at end of file +<% end %> diff --git a/config/routes.rb b/config/routes.rb index 674fa2a..6d816ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,7 @@ Rails.application.routes.draw do resources :page_contents do member do get "view" => "page_contents#view" + get "wiki_parent" => "page_contents#wiki_parent" end end resources :wiki_pages