demo site plugin

This commit is contained in:
unknown 2012-09-17 11:02:11 +08:00 committed by Christophe Vilayphiou
parent 6b6d8ac967
commit 9eed9ec7b6
50 changed files with 1347 additions and 29 deletions

View File

@ -122,6 +122,7 @@
<%= link_to content_tag(:i, nil, :class => 'icons-personal_journal') + t('admin.personal_journal'), panel_personal_journal_back_end_writing_journals_path %> <%= link_to content_tag(:i, nil, :class => 'icons-personal_journal') + t('admin.personal_journal'), panel_personal_journal_back_end_writing_journals_path %>
<%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('writing_journals', '/panel/personal_journal/back_end/tags', 'writing_journal_categorys', 'approvals'))) do -%> <%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('writing_journals', '/panel/personal_journal/back_end/tags', 'writing_journal_categorys', 'approvals'))) do -%>
<%= content_tag :li, link_to(t('personal_journal.all_articles'), panel_personal_journal_back_end_writing_journals_path), :class => active_for_action('writing_journals', 'index') %> <%= content_tag :li, link_to(t('personal_journal.all_articles'), panel_personal_journal_back_end_writing_journals_path), :class => active_for_action('writing_journals', 'index') %>
<%= content_tag :li, link_to(t('personal_journal.setting'), panel_personal_journal_back_end_writing_journal_setting_path), :class => active_for_action('writing_journal_setting', 'index') %>
<%= content_tag :li, link_to(t('personal_journal.paper_type'), panel_personal_journal_back_end_journal_paper_types_path), :class => active_for_action('paper_types', 'index') %> <%= content_tag :li, link_to(t('personal_journal.paper_type'), panel_personal_journal_back_end_journal_paper_types_path), :class => active_for_action('paper_types', 'index') %>
<%= content_tag :li, link_to(t('personal_journal.author_type'), panel_personal_journal_back_end_journal_author_types_path), :class => active_for_action('author_types', 'index') %> <%= content_tag :li, link_to(t('personal_journal.author_type'), panel_personal_journal_back_end_journal_author_types_path), :class => active_for_action('author_types', 'index') %>
<%= content_tag :li, link_to(t('personal_journal.level_type'), panel_personal_journal_back_end_journal_level_types_path), :class => active_for_action('level_types', 'index') %> <%= content_tag :li, link_to(t('personal_journal.level_type'), panel_personal_journal_back_end_journal_level_types_path), :class => active_for_action('level_types', 'index') %>
@ -135,6 +136,7 @@
<%= link_to content_tag(:i, nil, :class => 'icons-personal_seminar') + t('admin.personal_seminar'), panel_personal_seminar_back_end_writing_seminars_path %> <%= link_to content_tag(:i, nil, :class => 'icons-personal_seminar') + t('admin.personal_seminar'), panel_personal_seminar_back_end_writing_seminars_path %>
<%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('writing_seminars', '/panel/personal_seminar/back_end/tags', 'writing_seminar_categorys', 'approvals'))) do -%> <%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('writing_seminars', '/panel/personal_seminar/back_end/tags', 'writing_seminar_categorys', 'approvals'))) do -%>
<%= content_tag :li, link_to(t('personal_seminar.all_articles'), panel_personal_seminar_back_end_writing_seminars_path), :class => active_for_action('writing_seminars', 'index') %> <%= content_tag :li, link_to(t('personal_seminar.all_articles'), panel_personal_seminar_back_end_writing_seminars_path), :class => active_for_action('writing_seminars', 'index') %>
<%= content_tag :li, link_to(t('personal_seminar.setting'), panel_personal_seminar_back_end_writing_seminar_setting_path), :class => active_for_action('writing_seminar_setting', 'index') %>
<%= content_tag :li, link_to(t('personal_seminar.paper_type'), panel_personal_seminar_back_end_seminar_paper_types_path), :class => active_for_action('paper_types', 'index') %> <%= content_tag :li, link_to(t('personal_seminar.paper_type'), panel_personal_seminar_back_end_seminar_paper_types_path), :class => active_for_action('paper_types', 'index') %>
<%= content_tag :li, link_to(t('personal_seminar.author_type'), panel_personal_seminar_back_end_seminar_author_types_path), :class => active_for_action('author_types', 'index') %> <%= content_tag :li, link_to(t('personal_seminar.author_type'), panel_personal_seminar_back_end_seminar_author_types_path), :class => active_for_action('author_types', 'index') %>
<%= content_tag :li, link_to(t('personal_seminar.tags'), panel_personal_seminar_back_end_tags_path), :class => active_for_action('/panel/personal_seminar/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('personal_seminar.tags'), panel_personal_seminar_back_end_tags_path), :class => active_for_action('/panel/personal_seminar/back_end/tags', 'index') %>
@ -147,6 +149,7 @@
<%= link_to content_tag(:i, nil, :class => 'icons-personal_book') + t('admin.personal_book'), panel_personal_book_back_end_writing_books_path %> <%= link_to content_tag(:i, nil, :class => 'icons-personal_book') + t('admin.personal_book'), panel_personal_book_back_end_writing_books_path %>
<%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('writing_books', '/panel/personal_book/back_end/tags', 'writing_book_categorys', 'approvals'))) do -%> <%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('writing_books', '/panel/personal_book/back_end/tags', 'writing_book_categorys', 'approvals'))) do -%>
<%= content_tag :li, link_to(t('personal_book.all_articles'), panel_personal_book_back_end_writing_books_path), :class => active_for_action('writing_books', 'index') %> <%= content_tag :li, link_to(t('personal_book.all_articles'), panel_personal_book_back_end_writing_books_path), :class => active_for_action('writing_books', 'index') %>
<%= content_tag :li, link_to(t('personal_book.setting'), panel_personal_book_back_end_writing_book_setting_path), :class => active_for_action('writing_book_setting', 'index') %>
<%= content_tag :li, link_to(t('personal_book.paper_type'), panel_personal_book_back_end_book_paper_types_path), :class => active_for_action('paper_types', 'index') %> <%= content_tag :li, link_to(t('personal_book.paper_type'), panel_personal_book_back_end_book_paper_types_path), :class => active_for_action('paper_types', 'index') %>
<%= content_tag :li, link_to(t('personal_book.author_type'), panel_personal_book_back_end_book_author_types_path), :class => active_for_action('author_types', 'index') %> <%= content_tag :li, link_to(t('personal_book.author_type'), panel_personal_book_back_end_book_author_types_path), :class => active_for_action('author_types', 'index') %>
<%= content_tag :li, link_to(t('personal_book.tags'), panel_personal_book_back_end_tags_path), :class => active_for_action('/panel/personal_book/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('personal_book.tags'), panel_personal_book_back_end_tags_path), :class => active_for_action('/panel/personal_book/back_end/tags', 'index') %>

View File

@ -43,7 +43,7 @@
<li><%= link_to t(:basic), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'basic'), :remote => true %></li> <li><%= link_to t(:basic), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'basic'), :remote => true %></li>
<li><%#= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li> <li><%#= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li>
<li><%= link_to t(:tags), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'tags'), :remote => true %></li> <li><%= link_to t(:tags), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'tags'), :remote => true %></li>
<li><%#= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li> <li><%= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li>
<li><%#= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li> <li><%#= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
</ul> </ul>
</li> </li>

View File

@ -1,7 +1,10 @@
class Panel::PersonalBook::BackEnd::WritingBookCategorysController < OrbitBackendController class Panel::PersonalBook::BackEnd::WritingBookCategorysController < OrbitBackendController
before_filter :for_app_manager,:except => [:index]
include OrbitControllerLib::DivisionForDisable include OrbitControllerLib::DivisionForDisable
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
before_filter :for_app_manager,:except => [:index]
def index def index
get_types get_types

View File

@ -1,8 +1,11 @@
class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendController class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
# before_filter :for_app_manager,:except => [:index,:show] # before_filter :for_app_manager,:except => [:index,:show]
before_filter :for_app_sub_manager,:except => [:index]
before_filter :only => [ :new,:edit,:update] do |controller| before_filter :only => [ :new,:edit,:update] do |controller|
controller.get_categorys('WritingBookCategory') controller.get_categorys('WritingBookCategory')
end end
@ -45,6 +48,64 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
end end
end end
def writing_book_setting
@author_types = BookAuthorType.all
@paper_types = BookPaperType.all
get_tags
@set_author_type = BookAuthorType.new(:display => 'List')
@author_type_url = panel_personal_book_back_end_writing_books_path
@set_paper_type = BookPaperType.new(:display => 'List')
@paper_type_url = panel_personal_book_back_end_writing_books_path
end
def author_type_quick_add
@set_author_type = BookAuthorType.new(:display => 'List')
@author_type_url = panel_personal_book_back_end_writing_books_path
@set_author_type.id = params[:id]
respond_to do |format|
format.js
end
end
def author_type_quick_edit
@set_author_type = BookAuthorType.find(params[:writing_book_id])
@author_type_url = panel_personal_book_back_end_writing_book_path(@set_author_type)
respond_to do |format|
format.js
end
end
def paper_type_quick_add
@set_paper_type = BookPaperType.new(:display => 'List')
@paper_type_url = panel_personal_book_back_end_writing_books_path
@set_paper_type.id = params[:id]
respond_to do |format|
format.js
end
end
def paper_type_quick_edit
@set_paper_type = BookPaperType.find(params[:writing_book_id])
@paper_type_url = panel_personal_book_back_end_writing_book_path(@set_paper_type)
respond_to do |format|
format.js
end
end
# GET /writing_books/1 # GET /writing_books/1
# GET /writing_books/1.xml # GET /writing_books/1.xml
def show def show
@ -88,6 +149,29 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
# POST /writing_books.xml # POST /writing_books.xml
def create def create
if params[:book_author_type]
@book_author_type = BookAuthorType.new(params[:book_author_type])
respond_to do |format|
if @book_author_type.save
format.js { render 'create_writing_book_setting' }
end
end
elsif params[:book_paper_type]
@book_paper_type = BookPaperType.new(params[:book_paper_type])
respond_to do |format|
if @book_paper_type.save
format.js { render 'create_writing_book_setting' }
end
end
else
# @level_types = BookLevelType.all # @level_types = BookLevelType.all
@author_types = BookAuthorType.all @author_types = BookAuthorType.all
@paper_types = BookPaperType.all @paper_types = BookPaperType.all
@ -109,9 +193,38 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
end end
end end
end
# PUT /writing_books/1 # PUT /writing_books/1
# PUT /writing_books/1.xml # PUT /writing_books/1.xml
def update def update
if params[:book_author_type]
@book_author_type = BookAuthorType.find(params[:id])
respond_to do |format|
if @book_author_type.update_attributes(params[:book_author_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_book_setting' }
end
end
elsif params[:book_paper_type]
@book_paper_type = BookPaperType.find(params[:id])
respond_to do |format|
if @book_paper_type.update_attributes(params[:book_paper_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_book_setting' }
end
end
else
@writing_book = WritingBook.find(params[:id]) @writing_book = WritingBook.find(params[:id])
@writing_book.update_user_id = current_user.id @writing_book.update_user_id = current_user.id
@ -130,6 +243,8 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
end end
end end
end
# DELETE /writing_books/1 # DELETE /writing_books/1
# DELETE /writing_books/1.xml # DELETE /writing_books/1.xml
def destroy def destroy

View File

@ -0,0 +1,34 @@
<% # encoding: utf-8 %>
<%= form_for(@set_author_type, :remote => true, :url => @author_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe2"><%= (@set_author_type.new_record? ? 'Add 作者型態' : 'Edit 作者型態') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_author_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'writing_book_category[author_type]', @set_author_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_author_type %>">
<td><%= list_author_type.title %></td>
<td>
<a href="<%= panel_personal_book_back_end_writing_book_author_type_quick_edit_path(list_author_type) %>#myModal2" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to show_toggle_archive_btn(list_author_type),
polymorphic_path([:panel, :personal_book, :back_end, list_author_type]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</td>
</tr>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_paper_type %>">
<td><%= list_paper_type.title %></td>
<td>
<a href="<%= panel_personal_book_back_end_writing_book_paper_type_quick_edit_path(list_paper_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to show_toggle_archive_btn(list_paper_type),
polymorphic_path([:panel, :personal_book, :back_end, list_paper_type]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</td>
</tr>

View File

@ -0,0 +1,29 @@
<% # encoding: utf-8 %>
<%= form_for(@set_paper_type, :remote => true, :url => @paper_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe1"><%= (@set_paper_type.new_record? ? 'Add 論文型態' : 'Edit 論文型態') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<div class="control-group">
<label for="http" class="control-label">Title</label>
<div class="controls">
<%= f.text_field :title %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'writing_book_category[paper_type]', @set_paper_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -0,0 +1 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -0,0 +1,10 @@
<% if !@book_paper_type.blank? %>
$("#myModal1").modal('hide');
$('<%= j render :partial => 'list_paper_type', :collection => [@book_paper_type] %>').appendTo('#paper_types').hide().fadeIn();
<% end %>
<% if !@book_author_type.blank? %>
$("#myModal2").modal('hide');
$('<%= j render :partial => 'list_author_type', :collection => [@book_author_type] %>').appendTo('#author_types').hide().fadeIn();
<% end %>

View File

@ -0,0 +1 @@
$("#myModal1").html("<%= j render "paper_type_qe" %>");

View File

@ -0,0 +1 @@
$("#myModal1").html("<%= j render "paper_type_qe" %>");

View File

@ -0,0 +1,10 @@
<% if !@book_paper_type.blank? %>
$("#myModal1").modal('hide');
$("#<%= dom_id @book_paper_type %>").replaceWith("<%= j render :partial => 'list_paper_type', :collection => [@book_paper_type] %>");
<% end %>
<% if !@book_author_type.blank? %>
$("#myModal2").modal('hide');
$("#<%= dom_id @book_author_type %>").replaceWith("<%= j render :partial => 'list_author_type', :collection => [@book_author_type] %>");
<% end %>

View File

@ -0,0 +1,145 @@
<% # encoding: utf-8 %>
<div id="isotope">
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_book_back_end_writing_book_paper_type_quick_add_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>論文型態</span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="paper_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_paper_type', :collection => @paper_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_book_back_end_writing_book_author_type_quick_add_path('add') %>#myModal2" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>作者型態</span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="author_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_author_type', :collection => @author_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<button class="btn btn-small btn-primary pull-right" type="button" data-toggle="modal" data-target="#myModal4"><i class="icon-plus"></i> 新增</button>
<span>領域</span>
</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Corresponding Author</td>
<td>編輯 刪除</td>
</tr>
<tr>
<td>First Author, Co- Authors</td>
<td>編輯 刪除</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions form-fixed pagination-right">
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯出</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯入</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 新增</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 設定</a> 
</div>
<div id="author_type_qe">
<div style="display:none;" class="modal" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "author_type_qe" %>
</div>
</div>
<div id="paper_type_qe">
<div style="display:none;" class="modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "paper_type_qe" %>
</div>
</div>
<div style="display:none;" class="modal" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">領域</h3>
</div>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputvalue">名稱</label>
<div class="controls">
<input type="text" id="inputvalue" placeholder="Value">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "item" %>
<% end %>

View File

@ -3,10 +3,19 @@ Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :personal_book do namespace :personal_book do
namespace :back_end do namespace :back_end do
match 'writing_book_setting' => "writing_books#writing_book_setting" ,:as => :writing_book_setting
resources :writing_books do resources :writing_books do
collection do collection do
get 'delete' get 'delete'
end end
match "author_type_quick_add" => "writing_books#author_type_quick_add" ,:as => :author_type_quick_add
match "author_type_quick_edit" => "writing_books#author_type_quick_edit" ,:as => :author_type_quick_edit
match "paper_type_quick_add" => "writing_books#paper_type_quick_add" ,:as => :paper_type_quick_add
match "paper_type_quick_edit" => "writing_books#paper_type_quick_edit" ,:as => :paper_type_quick_edit
end end
resources :book_paper_types resources :book_paper_types
resources :book_author_types resources :book_author_types

View File

@ -1,5 +1,7 @@
class Panel::PersonalJournal::BackEnd::TagsController < Admin::TagsController class Panel::PersonalJournal::BackEnd::TagsController < Admin::TagsController
include OrbitControllerLib::DivisionForDisable
def initialize def initialize
super super
@app_title = 'personal_journal' @app_title = 'personal_journal'

View File

@ -1,7 +1,11 @@
class Panel::PersonalJournal::BackEnd::WritingJournalCategorysController < OrbitBackendController class Panel::PersonalJournal::BackEnd::WritingJournalCategorysController < OrbitBackendController
before_filter :for_app_manager,:except => [:index]
include OrbitControllerLib::DivisionForDisable include OrbitControllerLib::DivisionForDisable
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
before_filter :for_app_manager,:except => [:index]
def index def index
get_types get_types

View File

@ -1,8 +1,11 @@
class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendController class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
# before_filter :for_app_manager,:except => [:index,:show] # before_filter :for_app_manager,:except => [:index,:show]
before_filter :for_app_sub_manager,:except => [:index]
before_filter :only => [ :new,:edit,:update] do |controller| before_filter :only => [ :new,:edit,:update] do |controller|
controller.get_categorys('WritingJournalCategory') controller.get_categorys('WritingJournalCategory')
end end
@ -45,6 +48,92 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end end
end end
def writing_journal_setting
@module_apps = ModuleApp.where(has_plugin: true).order_by(:title, :asc)
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
get_tags
# @writing_journal_categorys = JournalLevelType.all
@set_level_type = JournalLevelType.new(:display => 'List')
@level_type_url = panel_personal_journal_back_end_writing_journals_path
@set_author_type = JournalAuthorType.new(:display => 'List')
@author_type_url = panel_personal_journal_back_end_writing_journals_path
@set_paper_type = JournalPaperType.new(:display => 'List')
@paper_type_url = panel_personal_journal_back_end_writing_journals_path
end
def level_type_quick_add
@set_level_type = JournalLevelType.new(:display => 'List')
@level_type_url = panel_personal_journal_back_end_writing_journals_path
@set_level_type.id = params[:id]
respond_to do |format|
format.js
end
end
def level_type_quick_edit
@set_level_type = JournalLevelType.find(params[:writing_journal_id])
@level_type_url = panel_personal_journal_back_end_writing_journal_path(@set_level_type)
respond_to do |format|
format.js
end
end
def author_type_quick_add
@set_author_type = JournalAuthorType.new(:display => 'List')
@author_type_url = panel_personal_journal_back_end_writing_journals_path
@set_author_type.id = params[:id]
respond_to do |format|
format.js
end
end
def author_type_quick_edit
@set_author_type = JournalAuthorType.find(params[:writing_journal_id])
@author_type_url = panel_personal_journal_back_end_writing_journal_path(@set_author_type)
respond_to do |format|
format.js
end
end
def paper_type_quick_add
@set_paper_type = JournalPaperType.new(:display => 'List')
@paper_type_url = panel_personal_journal_back_end_writing_journals_path
@set_paper_type.id = params[:id]
respond_to do |format|
format.js
end
end
def paper_type_quick_edit
@set_paper_type = JournalPaperType.find(params[:writing_journal_id])
@paper_type_url = panel_personal_journal_back_end_writing_journal_path(@set_paper_type)
respond_to do |format|
format.js
end
end
# GET /writing_journals/1 # GET /writing_journals/1
# GET /writing_journals/1.xml # GET /writing_journals/1.xml
def show def show
@ -88,6 +177,39 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
# POST /writing_journals.xml # POST /writing_journals.xml
def create def create
if params[:journal_level_type]
@journal_level_type = JournalLevelType.new(params[:journal_level_type])
respond_to do |format|
if @journal_level_type.save
format.js { render 'create_writing_journal_setting' }
end
end
elsif params[:journal_author_type]
@journal_author_type = JournalAuthorType.new(params[:journal_author_type])
respond_to do |format|
if @journal_author_type.save
format.js { render 'create_writing_journal_setting' }
end
end
elsif params[:journal_paper_type]
@journal_paper_type = JournalPaperType.new(params[:journal_paper_type])
respond_to do |format|
if @journal_paper_type.save
format.js { render 'create_writing_journal_setting' }
end
end
else
@level_types = JournalLevelType.all @level_types = JournalLevelType.all
@author_types = JournalAuthorType.all @author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all @paper_types = JournalPaperType.all
@ -109,9 +231,51 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end end
end end
end
# PUT /writing_journals/1 # PUT /writing_journals/1
# PUT /writing_journals/1.xml # PUT /writing_journals/1.xml
def update def update
if params[:journal_level_type]
@journal_level_type = JournalLevelType.find(params[:id])
respond_to do |format|
if @journal_level_type.update_attributes(params[:journal_level_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_journal_setting' }
end
end
elsif params[:journal_author_type]
@journal_author_type = JournalAuthorType.find(params[:id])
respond_to do |format|
if @journal_author_type.update_attributes(params[:journal_author_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_journal_setting' }
end
end
elsif params[:journal_paper_type]
@journal_paper_type = JournalPaperType.find(params[:id])
respond_to do |format|
if @journal_paper_type.update_attributes(params[:journal_paper_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_journal_setting' }
end
end
else
@writing_journal = WritingJournal.find(params[:id]) @writing_journal = WritingJournal.find(params[:id])
@writing_journal.update_user_id = current_user.id @writing_journal.update_user_id = current_user.id
@ -130,6 +294,8 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end end
end end
end
# DELETE /writing_journals/1 # DELETE /writing_journals/1
# DELETE /writing_journals/1.xml # DELETE /writing_journals/1.xml
def destroy def destroy

View File

@ -0,0 +1,24 @@
<% # encoding: utf-8 %>
<%= form_for(@set_author_type, :remote => true, :url => @author_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">作者型態</h3>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputvalue">名稱</label>
<div class="controls">
<input type="text" id="inputvalue" placeholder="Value">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
<% end %>

View File

@ -0,0 +1,34 @@
<% # encoding: utf-8 %>
<%= form_for(@set_level_type, :remote => true, :url => @level_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= (@set_level_type.new_record? ? 'Add 等級' : 'Edit 等級') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_level_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'writing_journal_category[level_type]', @set_level_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_author_type %>">
<td><%= list_author_type.title %></td>
<td>
<a href="<%= panel_personal_journal_back_end_writing_journal_author_type_quick_edit_path(list_author_type) %>#myModal2" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to show_toggle_archive_btn(list_author_type),
polymorphic_path([:panel, :personal_journal, :back_end, list_author_type]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</td>
</tr>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_level_type %>">
<td><%= list_level_type.title %></td>
<td>
<a href="<%= panel_personal_journal_back_end_writing_journal_level_type_quick_edit_path(list_level_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to show_toggle_archive_btn(list_level_type),
polymorphic_path([:panel, :personal_journal, :back_end, list_level_type]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</td>
</tr>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_paper_type %>">
<td><%= list_paper_type.title %></td>
<td>
<a href="<%= panel_personal_journal_back_end_writing_journal_paper_type_quick_edit_path(list_paper_type) %>#myModal3" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to show_toggle_archive_btn(list_paper_type),
polymorphic_path([:panel, :personal_journal, :back_end, list_paper_type]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</td>
</tr>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_tag_type %>">
<td><%= list_tag_type[I18n.locale] %></td>
<td>
<a href="<%= panel_personal_journal_back_end_writing_journal_level_type_quick_edit_path(list_level_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to show_toggle_archive_btn(list_level_type),
polymorphic_path([:panel, :personal_journal, :back_end, list_level_type]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</td>
</tr>

View File

@ -0,0 +1,29 @@
<% # encoding: utf-8 %>
<%= form_for(@set_paper_type, :remote => true, :url => @paper_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe3"><%= (@set_paper_type.new_record? ? 'Add 論文型態' : 'Edit 論文型態') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<div class="control-group">
<label for="http" class="control-label">Title</label>
<div class="controls">
<%= f.text_field :title %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'writing_journal_category[paper_type]', @set_paper_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -0,0 +1 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -0,0 +1,15 @@
<% if !@journal_level_type.blank? %>
$("#myModal1").modal('hide');
$('<%= j render :partial => 'list_level_type', :collection => [@journal_level_type] %>').appendTo('#level_types').hide().fadeIn();
<% end %>
<% if !@journal_author_type.blank? %>
$("#myModal2").modal('hide');
$('<%= j render :partial => 'list_author_type', :collection => [@journal_author_type] %>').appendTo('#author_types').hide().fadeIn();
<% end %>
<% if !@journal_paper_type.blank? %>
$("#myModal3").modal('hide');
$('<%= j render :partial => 'list_paper_type', :collection => [@journal_paper_type] %>').appendTo('#paper_types').hide().fadeIn();
<% end %>

View File

@ -0,0 +1 @@
$("#myModal1").html("<%= j render "level_type_qe" %>");

View File

@ -0,0 +1 @@
$("#myModal1").html("<%= j render "level_type_qe" %>");

View File

@ -0,0 +1 @@
$("#myModal3").html("<%= j render "paper_type_qe" %>");

View File

@ -0,0 +1 @@
$("#myModal3").html("<%= j render "paper_type_qe" %>");

View File

@ -0,0 +1,14 @@
<% if !@journal_level_type.blank? %>
$("#myModal1").modal('hide');
$("#<%= dom_id @journal_level_type %>").replaceWith("<%= j render :partial => 'list_level_type', :collection => [@journal_level_type] %>");
<% end %>
<% if !@journal_author_type.blank? %>
$("#myModal2").modal('hide');
$("#<%= dom_id @journal_author_type %>").replaceWith("<%= j render :partial => 'list_author_type', :collection => [@journal_author_type] %>");
<% end %>
<% if !@journal_paper_type.blank? %>
$("#myModal3").modal('hide');
$("#<%= dom_id @journal_paper_type %>").replaceWith("<%= j render :partial => 'list_paper_type', :collection => [@journal_paper_type] %>");
<% end %>

View File

@ -0,0 +1,193 @@
<% # encoding: utf-8 %>
<div class="subnav">
<div id="module-nav">
<div class="arrow_next pull-right"><i class="icon-chevron-right"></i></div>
<div class="arrow_prev pull-left"><i class="icon-chevron-left"></i></div>
<div class="module-nav-view">
<ul class="nav nav-pills">
<% @module_apps.each do |ma| %>
<li><%= link_to eval("#{ma.object.classify.constantize}") , eval("panel_#{ma.title}_back_end_#{ma.object}s_path") %></li>
<% end %>
</ul>
</div>
</div>
</div>
<div id="isotope">
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_journal_back_end_writing_journal_level_type_quick_add_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>等級</span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="level_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_level_type', :collection => @level_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_journal_back_end_writing_journal_author_type_quick_add_path('add') %>#myModal2" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>作者型態</span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="author_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_author_type', :collection => @author_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_journal_back_end_writing_journal_author_type_quick_add_path('add') %>#myModal3" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>論文型態</span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="paper_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_paper_type', :collection => @paper_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<button class="btn btn-small btn-primary pull-right" type="button" data-toggle="modal" data-target="#myModal4"><i class="icon-plus"></i> 新增</button>
<span>領域</span>
</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Corresponding Author</td>
<td>編輯 刪除</td>
</tr>
<tr>
<td>First Author, Co- Authors</td>
<td>編輯 刪除</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions form-fixed pagination-right">
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯出</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯入</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 新增</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 設定</a> 
</div>
<div id="level_type_qe">
<div style="display:none;" class="modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "level_type_qe" %>
</div>
</div>
<div id="author_type_qe">
<div style="display:none;" class="modal" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "author_type_qe" %>
</div>
</div>
<div id="paper_type_qe">
<div style="display:none;" class="modal" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "paper_type_qe" %>
</div>
</div>
<div style="display:none;" class="modal" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">領域</h3>
</div>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputvalue">名稱</label>
<div class="controls">
<input type="text" id="inputvalue" placeholder="Value">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "item" %>
<% end %>

View File

@ -3,11 +3,27 @@ Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :personal_journal do namespace :personal_journal do
namespace :back_end do namespace :back_end do
match 'writing_journal_setting' => "writing_journals#writing_journal_setting" ,:as => :writing_journal_setting
resources :writing_journals do resources :writing_journals do
collection do collection do
get 'delete' get 'delete'
end end
match "level_type_quick_add" => "writing_journals#level_type_quick_add" ,:as => :level_type_quick_add
match "level_type_quick_edit" => "writing_journals#level_type_quick_edit" ,:as => :level_type_quick_edit
match "author_type_quick_add" => "writing_journals#author_type_quick_add" ,:as => :author_type_quick_add
match "author_type_quick_edit" => "writing_journals#author_type_quick_edit" ,:as => :author_type_quick_edit
match "paper_type_quick_add" => "writing_journals#paper_type_quick_add" ,:as => :paper_type_quick_add
match "paper_type_quick_edit" => "writing_journals#paper_type_quick_edit" ,:as => :paper_type_quick_edit
match "tag_quick_add" => "writing_journals#tag_quick_add" ,:as => :tag_quick_add
match "tag_quick_edit" => "writing_journals#tag_quick_edit" ,:as => :tag_quick_edit
end end
resources :journal_paper_types resources :journal_paper_types
resources :journal_author_types resources :journal_author_types
resources :journal_level_types resources :journal_level_types

View File

@ -1,7 +1,11 @@
class Panel::PersonalSeminar::BackEnd::WritingSeminarCategorysController < OrbitBackendController class Panel::PersonalSeminar::BackEnd::WritingSeminarCategorysController < OrbitBackendController
before_filter :for_app_manager,:except => [:index]
include OrbitControllerLib::DivisionForDisable include OrbitControllerLib::DivisionForDisable
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
before_filter :for_app_manager,:except => [:index]
def index def index
get_types get_types

View File

@ -1,8 +1,11 @@
class Panel::PersonalSeminar::BackEnd::WritingSeminarsController < OrbitBackendController class Panel::PersonalSeminar::BackEnd::WritingSeminarsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user! before_filter :authenticate_user!
# before_filter :for_app_manager,:except => [:index,:show] before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :for_app_sub_manager,:except => [:index] before_filter :force_order_for_user,:except => [:index,:show]
before_filter :only => [ :new,:edit,:update] do |controller| before_filter :only => [ :new,:edit,:update] do |controller|
controller.get_categorys('WritingSeminarCategory') controller.get_categorys('WritingSeminarCategory')
end end
@ -46,6 +49,64 @@ class Panel::PersonalSeminar::BackEnd::WritingSeminarsController < OrbitBackendC
end end
end end
def writing_seminar_setting
@author_types = SeminarAuthorType.all
@paper_types = SeminarPaperType.all
get_tags
@set_author_type = SeminarAuthorType.new(:display => 'List')
@author_type_url = panel_personal_seminar_back_end_writing_seminars_path
@set_paper_type = SeminarPaperType.new(:display => 'List')
@paper_type_url = panel_personal_seminar_back_end_writing_seminars_path
end
def paper_type_quick_add
@set_paper_type = SeminarPaperType.new(:display => 'List')
@paper_type_url = panel_personal_seminar_back_end_writing_seminars_path
@set_paper_type.id = params[:id]
respond_to do |format|
format.js
end
end
def paper_type_quick_edit
@set_paper_type = SeminarPaperType.find(params[:writing_seminar_id])
@paper_type_url = panel_personal_seminar_back_end_writing_seminar_path(@set_paper_type)
respond_to do |format|
format.js
end
end
def author_type_quick_add
@set_author_type = SeminarAuthorType.new(:display => 'List')
@author_type_url = panel_personal_seminar_back_end_writing_seminars_path
@set_author_type.id = params[:id]
respond_to do |format|
format.js
end
end
def author_type_quick_edit
@set_author_type = SeminarAuthorType.find(params[:writing_seminar_id])
@author_type_url = panel_personal_seminar_back_end_writing_seminar_path(@set_author_type)
respond_to do |format|
format.js
end
end
# GET /writing_seminars/1 # GET /writing_seminars/1
# GET /writing_seminars/1.xml # GET /writing_seminars/1.xml
def show def show
@ -62,7 +123,7 @@ class Panel::PersonalSeminar::BackEnd::WritingSeminarsController < OrbitBackendC
@writing_seminar = WritingSeminar.new @writing_seminar = WritingSeminar.new
# @writing_seminar_files = WritingSeminarFile.all # @writing_seminar_files = WritingSeminarFile.all
# @level_types = SeminarLevelType.all # @paper_types = SeminarLevelType.all
@author_types = SeminarAuthorType.all @author_types = SeminarAuthorType.all
@paper_types = SeminarPaperType.all @paper_types = SeminarPaperType.all
@ -78,7 +139,7 @@ class Panel::PersonalSeminar::BackEnd::WritingSeminarsController < OrbitBackendC
def edit def edit
@writing_seminar = WritingSeminar.find(params[:id]) @writing_seminar = WritingSeminar.find(params[:id])
# @level_types = SeminarLevelType.all # @paper_types = SeminarLevelType.all
@author_types = SeminarAuthorType.all @author_types = SeminarAuthorType.all
@paper_types = SeminarPaperType.all @paper_types = SeminarPaperType.all
@ -89,7 +150,29 @@ class Panel::PersonalSeminar::BackEnd::WritingSeminarsController < OrbitBackendC
# POST /writing_seminars.xml # POST /writing_seminars.xml
def create def create
# @level_types = SeminarLevelType.all if params[:seminar_paper_type]
@seminar_paper_type = SeminarPaperType.new(params[:seminar_paper_type])
respond_to do |format|
if @seminar_paper_type.save
format.js { render 'create_writing_seminar_setting' }
end
end
elsif params[:seminar_author_type]
@seminar_author_type = SeminarAuthorType.new(params[:seminar_author_type])
respond_to do |format|
if @seminar_author_type.save
format.js { render 'create_writing_seminar_setting' }
end
end
else
# @paper_types = SeminarLevelType.all
@author_types = SeminarAuthorType.all @author_types = SeminarAuthorType.all
@paper_types = SeminarPaperType.all @paper_types = SeminarPaperType.all
get_tags get_tags
@ -110,9 +193,38 @@ class Panel::PersonalSeminar::BackEnd::WritingSeminarsController < OrbitBackendC
end end
end end
end
# PUT /writing_seminars/1 # PUT /writing_seminars/1
# PUT /writing_seminars/1.xml # PUT /writing_seminars/1.xml
def update def update
if params[:seminar_paper_type]
@seminar_paper_type = SeminarPaperType.find(params[:id])
respond_to do |format|
if @seminar_paper_type.update_attributes(params[:seminar_paper_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_seminar_setting' }
end
end
elsif params[:seminar_author_type]
@seminar_author_type = SeminarAuthorType.find(params[:id])
respond_to do |format|
if @seminar_author_type.update_attributes(params[:seminar_author_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_seminar_setting' }
end
end
else
@writing_seminar = WritingSeminar.find(params[:id]) @writing_seminar = WritingSeminar.find(params[:id])
@writing_seminar.update_user_id = current_user.id @writing_seminar.update_user_id = current_user.id
@ -131,6 +243,8 @@ class Panel::PersonalSeminar::BackEnd::WritingSeminarsController < OrbitBackendC
end end
end end
end
# DELETE /writing_seminars/1 # DELETE /writing_seminars/1
# DELETE /writing_seminars/1.xml # DELETE /writing_seminars/1.xml
def destroy def destroy

View File

@ -0,0 +1,34 @@
<% # encoding: utf-8 %>
<%= form_for(@set_author_type, :remote => true, :url => @author_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe2"><%= (@set_author_type.new_record? ? 'Add 作者型態' : 'Edit 作者型態') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_author_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'writing_seminar_category[author_type]', @set_author_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_author_type %>">
<td><%= list_author_type.title %></td>
<td>
<a href="<%= panel_personal_seminar_back_end_writing_seminar_author_type_quick_edit_path(list_author_type) %>#myModal2" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to show_toggle_archive_btn(list_author_type),
polymorphic_path([:panel, :personal_seminar, :back_end, list_author_type]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</td>
</tr>

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_paper_type %>">
<td><%= list_paper_type.title %></td>
<td>
<a href="<%= panel_personal_seminar_back_end_writing_seminar_paper_type_quick_edit_path(list_paper_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action">編輯</a>
<%= link_to show_toggle_archive_btn(list_paper_type),
polymorphic_path([:panel, :personal_seminar, :back_end, list_paper_type]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %>
</td>
</tr>

View File

@ -0,0 +1,34 @@
<% # encoding: utf-8 %>
<%= form_for(@set_paper_type, :remote => true, :url => @paper_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= (@set_paper_type.new_record? ? 'Add 論文型態' : 'Edit 論文型態') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_paper_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'writing_seminar_category[paper_type]', @set_paper_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -0,0 +1 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -0,0 +1,10 @@
<% if !@seminar_paper_type.blank? %>
$("#myModal1").modal('hide');
$('<%= j render :partial => 'list_paper_type', :collection => [@seminar_paper_type] %>').appendTo('#paper_types').hide().fadeIn();
<% end %>
<% if !@seminar_author_type.blank? %>
$("#myModal2").modal('hide');
$('<%= j render :partial => 'list_author_type', :collection => [@seminar_author_type] %>').appendTo('#author_types').hide().fadeIn();
<% end %>

View File

@ -0,0 +1 @@
$("#myModal1").html("<%= j render "paper_type_qe" %>");

View File

@ -0,0 +1 @@
$("#myModal1").html("<%= j render "paper_type_qe" %>");

View File

@ -0,0 +1,10 @@
<% if !@seminar_paper_type.blank? %>
$("#myModal1").modal('hide');
$("#<%= dom_id @seminar_paper_type %>").replaceWith("<%= j render :partial => 'list_paper_type', :collection => [@seminar_paper_type] %>");
<% end %>
<% if !@seminar_author_type.blank? %>
$("#myModal2").modal('hide');
$("#<%= dom_id @seminar_author_type %>").replaceWith("<%= j render :partial => 'list_author_type', :collection => [@seminar_author_type] %>");
<% end %>

View File

@ -0,0 +1,146 @@
<% # encoding: utf-8 %>
<div id="isotope">
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_seminar_back_end_writing_seminar_paper_type_quick_add_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>論文型態</span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="paper_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_paper_type', :collection => @paper_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_seminar_back_end_writing_seminar_author_type_quick_add_path('add') %>#myModal2" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>作者型態</span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="author_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_author_type', :collection => @author_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<button class="btn btn-small btn-primary pull-right" type="button" data-toggle="modal" data-target="#myModal4"><i class="icon-plus"></i> 新增</button>
<span>領域</span>
</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Corresponding Author</td>
<td>編輯 刪除</td>
</tr>
<tr>
<td>First Author, Co- Authors</td>
<td>編輯 刪除</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions form-fixed pagination-right">
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯出</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯入</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 新增</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 設定</a> 
</div>
<div id="paper_type_qe">
<div style="display:none;" class="modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "paper_type_qe" %>
</div>
</div>
<div id="author_type_qe">
<div style="display:none;" class="modal" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "author_type_qe" %>
</div>
</div>
<div style="display:none;" class="modal" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">領域</h3>
</div>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputvalue">名稱</label>
<div class="controls">
<input type="text" id="inputvalue" placeholder="Value">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "item" %>
<% end %>

View File

@ -3,10 +3,19 @@ Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :personal_seminar do namespace :personal_seminar do
namespace :back_end do namespace :back_end do
match 'writing_seminar_setting' => "writing_seminars#writing_seminar_setting" ,:as => :writing_seminar_setting
resources :writing_seminars do resources :writing_seminars do
collection do collection do
get 'delete' get 'delete'
end end
match "author_type_quick_add" => "writing_seminars#author_type_quick_add" ,:as => :author_type_quick_add
match "author_type_quick_edit" => "writing_seminars#author_type_quick_edit" ,:as => :author_type_quick_edit
match "paper_type_quick_add" => "writing_seminars#paper_type_quick_add" ,:as => :paper_type_quick_add
match "paper_type_quick_edit" => "writing_seminars#paper_type_quick_edit" ,:as => :paper_type_quick_edit
end end
resources :seminar_paper_types resources :seminar_paper_types
resources :seminar_author_types resources :seminar_author_types