Merge branch 'master' into 'master'
something for better user experience * render edit button even if wiki_page has no html content * redirect to referer_url after update wiki_page * add direct link to front end wiki page * add parent page for wiki page See merge request !2
This commit is contained in:
commit
7c19c4d9a6
|
@ -57,6 +57,13 @@ class Admin::PageContentsController < OrbitAdminController
|
||||||
render :json => {"success" => true}.to_json
|
render :json => {"success" => true}.to_json
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def update_params
|
def update_params
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Admin::WikiPagesController < OrbitAdminController
|
||||||
def update
|
def update
|
||||||
wiki = WikiPage.find(params[:id])
|
wiki = WikiPage.find(params[:id])
|
||||||
wiki.update_attributes(wiki_page_params)
|
wiki.update_attributes(wiki_page_params)
|
||||||
redirect_to admin_wiki_pages_path(:page_id => wiki.page.id)
|
redirect_to params['referer_url']
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -61,4 +61,4 @@ class Admin::WikiPagesController < OrbitAdminController
|
||||||
def wiki_page_params
|
def wiki_page_params
|
||||||
params.require(:wiki_page).permit!
|
params.require(:wiki_page).permit!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<table class="table table-striped table-hover main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><%= @wiki_parent_page.page_id%></td>
|
||||||
|
<td>
|
||||||
|
<a href="/<%= I18n.locale %><%= @wiki_parent_page.url %>" target="_blank"><%= @wiki_parent_page.name %></a>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<% if can_edit_or_delete?(@wiki_parent_page) %>
|
||||||
|
<li><a href="/admin/page_contents/new?page_id=<%= @wiki_parent_page.id.to_s %>"><%= t(:edit) %></a></li>
|
||||||
|
<li><a href="/admin/wiki_pages/?page_id=<%= @wiki_parent_page.id.to_s %>"><%= t("page_content.wiki") %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><a href="/admin/page_contents/<%= @wiki_parent_page.id.to_s %>/view" ><%= @wiki_parent_page.page_contexts.last.version rescue nil %></a></td>
|
||||||
|
<td><%= format_value @wiki_parent_page.page_contexts.last.updated_at rescue nil %></td>
|
||||||
|
<td><%= User.find(@wiki_parent_page.page_contexts.last.update_user_id).user_name rescue nil %></td>
|
||||||
|
<td>
|
||||||
|
<% 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;") %>
|
||||||
|
<button <%= !@wiki_parent_page.category_id.nil? ? "data-page-category-id=#{@wiki_parent_page.category_id.to_s}" : "" %> data-page-id="<%= @wiki_parent_page.id.to_s %>" class="btn btn-primary save_category hide">Save</button>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -10,7 +10,7 @@
|
||||||
<% @wikis.each do |page| %>
|
<% @wikis.each do |page| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="" target="_blank"><%= page.title %></a>
|
<a href="/<%= I18n.locale %><%= @page.url + '/?wiki=' + page.uid.to_s %>" target="_blank"><%= page.title %></a>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<% if can_edit_or_delete?(page.page) %>
|
<% if can_edit_or_delete?(page.page) %>
|
||||||
|
@ -20,7 +20,9 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td><%= format_value page.created_at rescue nil %></td>
|
<td><%= format_value page.created_at rescue nil %></td>
|
||||||
<td><%= page.page.page_id rescue "" %></td>
|
<td>
|
||||||
|
<a href="<%= wiki_parent_admin_page_content_path(:id => page.page_id.to_s) %>" target="_blank"><%= page.page.page_id rescue "" %></a>
|
||||||
|
</td>
|
||||||
<td><%= User.find(page.update_user_id).user_name rescue nil %></td>
|
<td><%= User.find(page.update_user_id).user_name rescue nil %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -35,4 +37,4 @@
|
||||||
<a href="<%= new_admin_wiki_page_path(:page_id => @page.id) %>" class="btn btn-small btn-info order-btn-class" id="edit-order-btn">Add</a>
|
<a href="<%= new_admin_wiki_page_path(:page_id => @page.id) %>" class="btn btn-small btn-info order-btn-class" id="edit-order-btn">Add</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
</div>
|
</div>
|
||||||
<h3 class="page-module-title"><%= data["title"] %></h3>
|
<h3 class="page-module-title"><%= data["title"] %></h3>
|
||||||
|
|
||||||
<%= data["html"].html_safe %>
|
<%= data["html"].html_safe unless data["html"].nil? %>
|
||||||
|
|
||||||
<% if !data["url_to_edit"].blank? %>
|
<% if !data["url_to_edit"].blank? %>
|
||||||
<p class='admin-edit text-right'><a class='btn btn-primary' href='<%= data["url_to_edit"] %>'><i class='icon-edit'></i> <%= t(:edit) %></a></p>
|
<p class='admin-edit text-right'><a class='btn btn-primary' href='<%= data["url_to_edit"] %>'><i class='icon-edit'></i> <%= t(:edit) %></a></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -7,6 +7,7 @@ Rails.application.routes.draw do
|
||||||
resources :page_contents do
|
resources :page_contents do
|
||||||
member do
|
member do
|
||||||
get "view" => "page_contents#view"
|
get "view" => "page_contents#view"
|
||||||
|
get "wiki_parent" => "page_contents#wiki_parent"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :wiki_pages
|
resources :wiki_pages
|
||||||
|
|
Loading…
Reference in New Issue