Add Brief intro. for all personal plugins

Add Share Setting for Personal Plugins ( if have old data must be add default value "field: is_hidden => false " )
Apply New UI to Member Plugin Edit Page
Personal Plugin Summary fix
Academic Info. list fix
This commit is contained in:
Spen authored and saurabhbhatia committed 2013-09-18 18:55:40 +08:00
1 parent b487740035
commit a067bcd304
159 files changed
+5145 -3453

No files matched your search

@@ -24,27 +24,29 @@
<% show_roles.attribute_fields.where(:disabled=>false).asc(:_id).each do |rf| %>
<%
if !@member.get_attribute_value(rf).blank?
if !@member.get_attribute_value(rf)['val'].blank?
@rodata = @member.get_attribute_value(rf)['val']
elsif !@member.get_attribute_value(rf)[I18n.locale].blank?
@rodata = @member.get_attribute_value(rf)[I18n.locale]
else
@rodata = nil
end
end
<%
if !@member.get_attribute_value(rf).blank?
if !@member.get_attribute_value(rf)['val'].blank?
@rodata = @member.get_attribute_value(rf)['val']
elsif !@member.get_attribute_value(rf)[I18n.locale].blank?
@rodata = @member.get_attribute_value(rf)[I18n.locale]
else
@rodata = nil
end
if !@rodata.blank? and !@member.get_attribute_value(rf).get_value_by_locale(I18n.locale).blank?
%>
if !@rodata.blank? and !@member.get_attribute_value(rf).get_value_by_locale(I18n.locale).blank?
%>
<tr>
<td><%= rf.title %></td>
<td><%= nl2br(show_attribute_value(@member.get_attribute_value(rf).get_value_by_locale(I18n.locale))) rescue '' %></td>
</tr>
<tr>
<td><%= rf.title %></td>
<td><%= nl2br(show_attribute_value(@member.get_attribute_value(rf).get_value_by_locale(I18n.locale))) rescue '' %></td>
</tr>
<% end -%>
<% end -%>
<% end -%>
<% end -%>
<%= render :partial => 'show_sub_role',:collection=> @member.get_sub_roles_by_role(show_roles)%>
<%= render :partial => 'show_sub_role',:collection=> @member.get_sub_roles_by_role(show_roles)%>
@@ -46,38 +46,71 @@
<%= show_avatar(@member) %>
</div>
<div class="member-module">
<div class="module-nav">
<ul>
<% @plugins.each do |plugin| %>
<li><a href="#<%= plugin.name %>"><%= plugin.name %></a></li>
<%
@plugins.each do |plugin|
@data = plugin.app_name.classify.constantize.where(is_hidden: false, :create_user_id=>@member.id)
@intro_data = plugin.intro_app_name.classify.constantize.where(:user_id=>@member.id).first
%>
<% if !@intro_data.blank? %>
<% if !@intro_data.brief_intro.blank? or !@intro_data.complete_list.blank? %>
<li><a href="#<%= plugin.name %>"><%= plugin.name %></a></li>
<% end %>
<% else %>
<% if !@data.blank? %>
<li><a href="#<%= plugin.name %>"><%= plugin.name %></a></li>
<% end %>
<% end %>
<% end %>
</ul>
</div>
<div class="module-content">
<%
@plugins.each do |plugin|
@plugins.each do |plugin|
@plugin_partial = !plugin.front_partial_path.blank? ? OrbitApp::Plugin::Registration.find_by_key(plugin.name).front_partial_path : nil
@data = plugin.app_name.classify.constantize.where(:create_user_id=>@member.id)
@intro_data = plugin.intro_app_name.classify.constantize.where(:user_id=>@member.id).first
%>
<div class="module-pane" id="<%= plugin.name %>">
<%= render :partial => @plugin_partial if !@plugin_partial.blank? %>
</div>
<% if !@intro_data.blank? %>
<% if !@intro_data.brief_intro.blank? or !@intro_data.complete_list.blank? %>
<div class="module-pane" id="<%= plugin.name %>">
<%= render :partial => @plugin_partial if !@plugin_partial.blank? %>
</div>
<% end %>
<% else %>
<% if !@data.blank? %>
<div class="module-pane" id="<%= plugin.name %>">
<%= render :partial => @plugin_partial if !@plugin_partial.blank? %>
</div>
<% end %>
<% end %>
<% end %>
</div>
</div>
</div>
</div>
<%= stylesheet_link_tag "member/default_member" %>
<%= javascript_include_tag "member/moduletab" %>
<%= javascript_include_tag "member/moduletab" %>
@@ -0,0 +1,10 @@
class Panel::PersonalBook::BackEnd::PersonalBookIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_book_intro'
@app_type_name = 'personal_book'
@reback_name = 'WritingBook'
end
end
@@ -9,43 +9,19 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
end
def index
get_plugins
get_plugins
get_categorys("BookPaperType",params[:book_paper_type_id])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@paper_types = BookPaperType.all
@paper_type_ids = @paper_types.collect{|t| t.id.to_s} + [nil]
# @writing_books = WritingBook.search(params[:category_id])
#@writing_books = (params[:sort] || @filter) ? get_sorted_and_filtered_writing_books : WritingBook.all.page(params[:page]).per(10)
@writing_books = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_book",:book_paper_type_id.in => @paper_type_ids) : get_viewable("writing_book",:book_paper_type_id.in => @paper_type_ids)
@books = @writing_books.page params[:page]
@tags = get_tags
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@paper_type_ids = BookPaperType.all.collect{|t| t.id.to_s} + [nil]
@writing_books = get_sorted_and_filtered("writing_book", :book_paper_type_id.in => @paper_type_ids)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_books }
format.js
end
end
@@ -59,10 +35,10 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
@tags = get_tags
@set_author_type = BookAuthorType.new(:display => 'List')
@author_type_url = panel_personal_book_back_end_writing_books_path
@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
@paper_type_url = panel_personal_book_back_end_writing_books_path
end
@@ -183,25 +159,26 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
# @level_types = BookLevelType.all
@author_types = BookAuthorType.all
@paper_types = BookPaperType.all
@tags = get_tags
@tags = get_tags
@writing_book = WritingBook.new(params[:writing_book])
if params[:writing_book][:user_id]
if params[:writing_book][:user_id]
@writing_book.create_user_id = params[:writing_book][:user_id]
@writing_book.update_user_id = params[:writing_book][:user_id]
else
@writing_book.create_user_id = current_user.id
@writing_book.create_user_id = current_user.id
@writing_book.update_user_id = current_user.id
end
respond_to do |format|
if @writing_book.save
if params[:writing_book][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_book][:user_id],:show_plugin_profile=>'Book')) }
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) }
format.html { redirect_to(panel_personal_book_back_end_writing_books_url) }
end
format.xml { render :xml => @writing_book, :status => :created, :location => @writing_book }
@@ -209,7 +186,9 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
format.html { render :action => "new" }
format.xml { render :xml => @writing_book.errors, :status => :unprocessable_entity }
end
end
end
end
@@ -244,23 +223,24 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
else
@writing_book = WritingBook.find(params[:id])
@writing_book.update_user_id = current_user.id
params[:writing_book][:tag_ids] ||=[]
@writing_book = WritingBook.find(params[:id])
@writing_book.update_user_id = current_user.id
params[:writing_book][:tag_ids] ||=[]
respond_to do |format|
if @writing_book.update_attributes(params[:writing_book])
format.html { redirect_to(panel_personal_book_back_end_writing_books_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_book.errors, :status => :unprocessable_entity }
respond_to do |format|
if @writing_book.update_attributes(params[:writing_book])
format.html { redirect_to(panel_personal_book_back_end_writing_books_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_book.errors, :status => :unprocessable_entity }
end
end
end
end
end
@@ -283,6 +263,29 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
end
redirect_to panel_personal_book_back_end_writing_books_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@writing_books = WritingBook.any_in(:_id => params[:ids])
@writing_books.each do |writing_book|
writing_book.is_hidden = params[:disable]
writing_book.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"WritingBook")) }
end
end
protected
@@ -0,0 +1,4 @@
class PersonalBookIntro < PersonalPluginIntro
end
@@ -1,256 +1,340 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<!-- Input Area -->
<div class="input-area">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i><%= f.label :author_type ,t("personal_book.author_type")%></h3>
<div class="widget-content clear form-horizontal">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_book[book_author_type_ids][]', author_type.id, @writing_book.book_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_book[book_author_type_ids][]', '' %>
<% end %>
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<% if show_form_status_field(@writing_book) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<% end %>
<!-- Category -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_book[book_author_type_ids][]', author_type.id, @writing_book.book_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_book[book_author_type_ids][]', '' %>
<% end %>
</div>
</div>
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_book[tag_ids][]', tag.id, @writing_book.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'writing_book[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<% if !params[:user_id].blank? %>
<div class="span6">
<%= t("著作人")%>
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
<% end %>
<div class="title">
<%= f.label :year ,t("personal_book.year")%>
<%= select_year((@writing_book.year ? @writing_book.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_book[year]'} ) %>
</div>
<div class="title">
<%= f.label :book_paper_type ,t("personal_book.book_paper_type")%>
<%= f.select :book_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]} %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="title">
<%= f.label :publish_date ,t("personal_book.publish_date")%>
<%= f.date_select :publish_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :paper_title ,t("personal_book.paper_title")%>
<%= f.fields_for :paper_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_book.paper_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :book_title ,t("personal_book.book_title")%>
<%= f.fields_for :book_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_book.book_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :extracted_chapters ,t("personal_book.extracted_chapters")%>
<%= f.fields_for :extracted_chapters_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_book.extracted_chapters_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :publisher ,t("personal_book.publisher")%>
<%= f.fields_for :publisher_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_book.publisher_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :editor ,t("personal_book.editor")%>
<%= f.fields_for :editor_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_book.editor_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<div class="title">
<%= f.label :authors,t("web_resource.authors") %>
<%= f.fields_for :authors_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :size => "60x3", :value => (@writing_book.authors_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Category -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.book_paper_type") %></label>
<div class="controls">
<%= f.select :book_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<% end %>
</div>
<div class="title">
<%= f.label :publication_date ,t("personal_book.publication_date")%>
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.year") %></label>
<div class="controls">
<%= select_year((@writing_book.year ? @writing_book.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_book[year]',:class => 'span1'} ) %>
</div>
</div>
<div class="title">
<%= f.label :url, t("personal_book.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_book.keywords") %>
<%= f.text_field :keywords %>
</div>
<!-- publish_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.publish_date") %></label>
<div class="controls">
<%= f.date_select :publish_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
</div>
<div class="title">
<%= f.label :pages, t("personal_book.pages") %>
<%= f.text_field :pages %>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.publication_date") %></label>
<div class="controls">
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
</div>
<div class="title">
<%= f.label :isbn, t("personal_book.isbn") %>
<%= f.text_field :isbn %>
</div>
<div id="title">
<%= f.label :language, t("personal_book.language") %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_book.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_book.English") %>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<div class="title">
<%= f.label :note, t("personal_book.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
<div>
<div id='plugin_files' class="plugin_files_block">
<table class="table table-condensed">
<thead>
<tr>
<th>File</th>
<th>File Name</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<div id='add_plugin_file' class="info_input plugin_files_block">
<%= hidden_field_tag 'plugin_file_field_count', @writing_book.writing_book_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @writing_book.writing_book_files.each_with_index do |writing_book_file, i| %>
<%= f.fields_for :writing_book_files, writing_book_file do |f| %>
<%= render :partial => 'form_file', :object => writing_book_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<!--Post End-->
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<!-- pages -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.pages") %></label>
<div class="controls">
<%= f.text_field :pages %>
</div>
</div>
<!-- isbn -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.language") %></label>
<div class="controls">
<%= f.radio_button :language, "Chinese" %> <%= t("personal_book.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_book.English") %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<% if show_form_status_field(@writing_book) %>
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @writing_book.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @writing_book.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'writing_book[tag_ids][]', tag.id, @writing_book.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'writing_book[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- paper_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_book.paper_title") %></label>
<div class="controls">
<%= f.fields_for :paper_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.paper_title"), value: (@writing_book.paper_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- book_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_book.book_title") %></label>
<div class="controls">
<%= f.fields_for :book_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.book_title"), value: (@writing_book.book_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- extracted_chapters-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_book.extracted_chapters") %></label>
<div class="controls">
<%= f.fields_for :extracted_chapters_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.extracted_chapters"), value: (@writing_book.extracted_chapters_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- publisher-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_book.publisher") %></label>
<div class="controls">
<%= f.fields_for :publisher_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.publisher"), value: (@writing_book.publisher_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- editor-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_book.editor") %></label>
<div class="controls">
<%= f.fields_for :editor_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.editor"), value: (@writing_book.editor_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- authors-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_book.authors") %></label>
<div class="controls">
<%= 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) %>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @writing_book && !@writing_book.writing_book_files.blank? %>
<div class="exist">
<% @writing_book.writing_book_files.each_with_index do |writing_book_file, i| %>
<%= f.fields_for :writing_book_files, writing_book_file do |f| %>
<%= render :partial => 'form_file', :object => writing_book_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'plugin_file_field_count', @writing_book.writing_book_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %>
<script>
$('#add_plugin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_add_plugin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_book_files) %>").replace(old_id, new_id));
});
$('.add_plugin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
});
</script>
<script>
$(document).ready(function() {
$('.main-forms .add-on').tooltip();
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_writing_book_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_book_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});
</script>
<% end %>
@@ -1,50 +1,45 @@
<% # encoding: utf-8 %>
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
</div>
</div>
</td>
<td>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %>
<%= f.fields_for :file_title_translations do |f| %>
<div class="control-group">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
<div class="controls">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<i class="icons-paperclip"></i>
<%= f.file_field :file %>
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</span>
<% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
</div>
@@ -1,9 +1,4 @@
<tr id="<%= dom_id writing_book %>" class="with_action">
<td class="span1">
<% if (writing_book.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', writing_book.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td class="span1"><%= writing_book.year %></td>
<td class="span1">
<%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %>
@@ -9,8 +9,8 @@
</div>
<h1><%= t('personal_book.editing_personal_book') %></h1>
<%= form_for @writing_book, :url => panel_personal_book_back_end_writing_book_path(@writing_book), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= form_for @writing_book, url: panel_personal_book_back_end_writing_book_path(@writing_book), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -13,10 +13,9 @@
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"><%= t("personal_book.year") %></th>
<th class="span7"><%= t("personal_book.book_title") %></th>
<th class="span1"><%= t("personal_plugins.author") %></th>
</tr>
</thead>
<tbody id="tbody_writing_books" class="sort-holder">
@@ -24,10 +23,13 @@
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), panel_personal_book_back_end_writing_book_setting_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_book_back_end_writing_book_path, :class => 'btn btn-primary pull-right' %>
<div id="writing_book_pagination" class="paginationFixed">
<%= paginate @books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
<div class="pagination pagination-centered">
<%= paginate @writing_books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
@@ -7,16 +7,10 @@
<%= render :partial => 'admin/plugins/plugin_list' %>
</div>
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('writing_book.new_personal_book') %></h1>
<%= form_for @writing_book, :url => panel_personal_book_back_end_writing_books_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>
</div>
<%= form_for @writing_book, url: panel_personal_book_back_end_writing_books_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -15,7 +15,7 @@
<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>
<span><%= t("personal_book.book_paper_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -41,7 +41,7 @@
<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>
<span><%= t("personal_book.author_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -1,42 +1,50 @@
<%
if @member
@writing_books = WritingBook.where(:create_user_id => @member.id).desc(:year)
else
@writing_books = WritingBook.all.desc(:year)
end
@writing_books = WritingBook.where(is_hidden: false, :create_user_id => @member.id).desc(:year)
@writing_book_intro = !PersonalBookIntro.where(:user_id => @member.id).blank? ? PersonalBookIntro.where(:user_id => @member.id).first : PersonalBookIntro.new
%>
<% if !@writing_books.blank? %>
<% if @writing_book_intro.brief_intro and !@writing_book_intro.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_book.year') %></th>
<th class="grid8"><%= t('personal_book.book_title') %></th>
<th class="grid3"><%= t('personal_book.authors') %></th>
</tr>
</thead>
<tbody>
<% @writing_books.each do |writing_book| %>
<tr>
<td><%= writing_book.year %></td>
<td>
<%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %>
</td>
<td><%= writing_book.authors %></td>
</tr>
<% end %>
<div class="info">
<%= @writing_book_intro.text.html_safe rescue '' %>
</div>
</tbody>
</table>
<% end %>
<% if ( !@writing_book_intro.blank? and @writing_book_intro.complete_list ) or @writing_book_intro.blank? %>
<% else %>
<% if !@writing_books.blank? %>
<%= t('nothing')%>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_book.year') %></th>
<th class="grid8"><%= t('personal_book.book_title') %></th>
<th class="grid3"><%= t('personal_book.authors') %></th>
</tr>
</thead>
<tbody>
<% @writing_books.each do |writing_book| %>
<tr>
<td><%= writing_book.year %></td>
<td>
<%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %>
</td>
<td><%= writing_book.authors %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<% end %>
@@ -1,3 +1,10 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
@@ -17,17 +24,29 @@
end
if @user
@writing_books = WritingBook.where(:create_user_id => @user.id).page(params[:page]).per(10)
if @user && is_admin?
@writing_books = WritingBook.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else
@writing_books = WritingBook.all.page(params[:page]).per(10)
@writing_books = WritingBook.where(is_hidden: false, :create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
end
%>
<% if is_admin? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_book_back_end_writing_books_path(:user_id => params[:id], :disable => 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_book_back_end_writing_books_path(:user_id => params[:id], :disable => 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped">
<thead>
<tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_book.year') %></th>
<th><%= t('personal_book.book_title') %></th>
</tr>
@@ -36,7 +55,12 @@
<% @writing_books.each do |writing_book| %>
<tr>
<tr class="<%= writing_book.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', writing_book.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= writing_book.year %></td>
<td>
<%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %>
@@ -48,11 +72,25 @@
</tbody>
</table>
<% if is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_book_back_end_personal_book_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_book_back_end_writing_book_path(:user_id => @user.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @writing_books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
</div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>
+7 -2
View File
@@ -9,10 +9,13 @@ Rails.application.routes.draw do
namespace :back_end do
match 'writing_book_setting' => "writing_books#writing_book_setting" ,:as => :writing_book_setting
# match 'writing_book_intro' => "writing_books#writing_book_intro" ,:as => :writing_book_intro
resources :writing_books do
collection do
get 'delete'
get 'data_share'
end
match "author_type_quick_add" => "writing_books#author_type_quick_add" ,:as => :author_type_quick_add
@@ -21,8 +24,10 @@ Rails.application.routes.draw do
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
resources :book_paper_types
resources :book_author_types
resources :personal_book_intros
resources :book_paper_types
resources :book_author_types
resources :tags
end
namespace :front_end do
+1 -1
View File
@@ -2,7 +2,7 @@ module PersonalBook
OrbitApp.registration "PersonalBook",:type=> 'ModuleApp' do
module_label 'module_name.personal_book'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_book/plugin/profile",:front_path=>"panel/personal_book/front_end/profile",:admin_path=>"/panel/personal_book/back_end/writing_books",:i18n=>'module_name.personal_book'
personal_plugin :enable => true, :app_name=>"WritingBook", :intro_app_name=>"PersonalBookIntro",:path=>"panel/personal_book/plugin/profile",:front_path=>"panel/personal_book/front_end/profile",:admin_path=>"/panel/personal_book/back_end/writing_books",:i18n=>'module_name.personal_book'
@@ -0,0 +1,10 @@
class Panel::PersonalConference::BackEnd::PersonalConferenceIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_conference_intro'
@app_type_name = 'personal_conference'
@reback_name = 'WritingConference'
end
end
@@ -9,43 +9,19 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
end
def index
get_plugins
get_plugins
get_categorys("ConferencePaperType",params[:conference_paper_type_id])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@paper_types = ConferencePaperType.all
@paper_type_ids = @paper_types.collect{|t| t.id.to_s} + [nil]
# @writing_conferences = WritingConference.search(params[:category_id])
#@writing_conferences = (params[:sort] || @filter) ? get_sorted_and_filtered_writing_conferences : WritingConference.all.page(params[:page]).per(10)
@writing_conferences = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_conference",:conference_paper_type_id.in => @paper_type_ids) : get_viewable("writing_conference",:conference_paper_type_id.in => @paper_type_ids)
@conferences = @writing_conferences.page params[:page]
@tags = get_tags
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@paper_type_ids = ConferencePaperType.all.collect{|t| t.id.to_s} + [nil]
@writing_conferences = get_sorted_and_filtered("writing_conference", :conference_paper_type_id.in => @paper_type_ids)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_conferences }
format.js
end
end
@@ -59,10 +35,10 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
@tags = get_tags
@set_author_type = ConferenceAuthorType.new(:display => 'List')
@author_type_url = panel_personal_conference_back_end_writing_conferences_path
@author_type_url = panel_personal_conference_back_end_writing_conferences_path
@set_paper_type = ConferencePaperType.new(:display => 'List')
@paper_type_url = panel_personal_conference_back_end_writing_conferences_path
@paper_type_url = panel_personal_conference_back_end_writing_conferences_path
end
@@ -181,25 +157,25 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
# @paper_types = ConferenceLevelType.all
@author_types = ConferenceAuthorType.all
@paper_types = ConferencePaperType.all
@tags = get_tags
@tags = get_tags
@writing_conference = WritingConference.new(params[:writing_conference])
if params[:writing_conference][:user_id]
if params[:writing_conference][:user_id]
@writing_conference.create_user_id = params[:writing_conference][:user_id]
@writing_conference.update_user_id = params[:writing_conference][:user_id]
else
@writing_conference.create_user_id = current_user.id
@writing_conference.create_user_id = current_user.id
@writing_conference.update_user_id = current_user.id
end
respond_to do |format|
if @writing_conference.save
if params[:writing_conference][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_conference][:user_id],:show_plugin_profile=>'Conference')) }
if params[:writing_conference][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_conference][:user_id],:show_plugin_profile=>'WritingConference')) }
else
format.html { redirect_to(panel_personal_conference_back_end_writing_conferences_url) }
format.html { redirect_to(panel_personal_conference_back_end_writing_conferences_url) }
end
format.xml { render :xml => @writing_conference, :status => :created, :location => @writing_conference }
@@ -242,23 +218,24 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
else
@writing_conference = WritingConference.find(params[:id])
@writing_conference = WritingConference.find(params[:id])
@writing_conference.update_user_id = current_user.id
@writing_conference.update_user_id = current_user.id
params[:writing_conference][:tag_ids] ||=[]
params[:writing_conference][:tag_ids] ||=[]
respond_to do |format|
if @writing_conference.update_attributes(params[:writing_conference])
format.html { redirect_to(panel_personal_conference_back_end_writing_conferences_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_conference.errors, :status => :unprocessable_entity }
respond_to do |format|
if @writing_conference.update_attributes(params[:writing_conference])
format.html { redirect_to(panel_personal_conference_back_end_writing_conferences_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_conference.errors, :status => :unprocessable_entity }
end
end
end
end
end
@@ -281,6 +258,30 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
end
redirect_to panel_personal_conference_back_end_writing_conferences_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@writing_conferences = WritingConference.any_in(:_id => params[:ids])
@writing_conferences.each do |writing_conference|
writing_conference.is_hidden = params[:disable]
writing_conference.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"WritingConference")) }
end
end
protected
@@ -0,0 +1,4 @@
class PersonalConferenceIntro < PersonalPluginIntro
end
@@ -1,258 +1,333 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<!-- Input Area -->
<div class="input-area">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i><%= f.label :paper_type ,t("personal_conference.paper_type")%></h3>
<div class="widget-content clear form-horizontal">
<% @paper_types.each do |paper_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_paper_type_ids][]', paper_type.id, @writing_conference.conference_paper_type_ids.include?(paper_type.id)%>
<%= paper_type.title %>
<%= hidden_field_tag 'writing_conference[conference_paper_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<% if show_form_status_field(@writing_conference) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i><%= f.label :author_type ,t("personal_conference.author_type")%></h3>
<div class="widget-content clear form-horizontal">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_author_type_ids][]', author_type.id, @writing_conference.conference_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_conference[conference_author_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<!-- Module -->
<div class="tab-content module-area">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[tag_ids][]', tag.id, @writing_conference.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'writing_conference[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div id="post-body">
<div id="post-body-content" class="clear">
<% if !params[:user_id].blank? %>
<div class="span6">
<%= t("著作人")%>
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
<% end %>
<div class="title">
<%= f.label :year ,t("personal_conference.year")%>
<%= select_year((@writing_conference.year ? @writing_conference.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_conference[year]'} ) %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="title">
<%= f.label :period_start_date ,t("personal_conference.period_start_date")%>
<%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
<div class="title">
<%= f.label :period_end_date ,t("personal_conference.period_end_date")%>
<%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :paper_title ,t("personal_conference.paper_title")%>
<%= f.fields_for :paper_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_conference.paper_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :conference_title ,t("personal_conference.conference_title")%>
<%= f.fields_for :conference_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_conference.conference_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :location ,t("personal_conference.location")%>
<%= f.fields_for :location_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_conference.location_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :sponsor ,t("personal_conference.sponsor")%>
<%= f.fields_for :sponsor_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_conference.sponsor_translations[locale] rescue nil) %>
<% end %>
</div>
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<div class="title">
<%= f.label :authors,t("web_resource.authors") %>
<%= f.fields_for :authors_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :size => "60x3", :value => (@writing_conference.authors_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="title">
<%= f.label :publication_date ,t("personal_conference.publication_date")%>
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.paper_type") %></label>
<div class="controls">
<% @paper_types.each do |paper_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_paper_type_ids][]', paper_type.id, @writing_conference.conference_paper_type_ids.include?(paper_type.id)%>
<%= paper_type.title %>
<%= hidden_field_tag 'writing_conference[conference_paper_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<div class="title">
<%= f.label :url, t("personal_conference.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_conference.keywords") %>
<%= f.text_field :keywords %>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_conference[conference_author_type_ids][]', author_type.id, @writing_conference.conference_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_conference[conference_author_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<div class="title">
<%= f.label :abstract, t("personal_conference.abstract") %>
<%= f.text_field :abstract %>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.year") %></label>
<div class="controls">
<%= select_year((@writing_conference.year ? @writing_conference.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_conference[year]',:class => 'span1'} ) %>
</div>
</div>
<div class="title">
<%= f.label :language, t("personal_journal.language") %>
<%= f.select :language, WritingConference::LANGUAGE_TYPES, :prompt => 'Select' %>
</div>
<!-- period_start_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.period_start_date") %></label>
<div class="controls">
<%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
</div>
<!-- period_end_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.period_end_date") %></label>
<div class="controls">
<%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.publication_date") %></label>
<div class="controls">
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- abstract -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.abstract") %></label>
<div class="controls">
<%= f.text_field :abstract %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.language") %></label>
<div class="controls">
<%= f.select :language, WritingConference::LANGUAGE_TYPES, :prompt => 'Select' %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<% if show_form_status_field(@writing_conference) %>
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @writing_conference.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @writing_conference.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'writing_conference[tag_ids][]', tag.id, @writing_conference.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'writing_conference[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- paper_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_conference.paper_title") %></label>
<div class="controls">
<%= f.fields_for :paper_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_conference.paper_title"), value: (@writing_conference.paper_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- conference_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_conference.conference_title") %></label>
<div class="controls">
<%= f.fields_for :conference_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_conference.conference_title"), value: (@writing_conference.conference_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- location-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_conference.location") %></label>
<div class="controls">
<%= f.fields_for :location_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_conference.location"), value: (@writing_conference.location_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- sponsor-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_conference.sponsor") %></label>
<div class="controls">
<%= f.fields_for :sponsor_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_conference.sponsor"), value: (@writing_conference.sponsor_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- authors-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_conference.authors") %></label>
<div class="controls">
<%= f.fields_for :authors_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_conference.authors"), value: (@writing_conference.authors_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @writing_conference && !@writing_conference.writing_conference_files.blank? %>
<div class="exist">
<% @writing_conference.writing_conference_files.each_with_index do |archive_file_multiple, i| %>
<%= f.fields_for :writing_conference_files, archive_file_multiple do |f| %>
<%= render :partial => 'form_file', :object => archive_file_multiple, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'plugin_file_field_count', @writing_conference.writing_conference_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<div class="title">
<%= f.label :note, t("personal_conference.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
<div>
<div id='plugin_files' class="plugin_files_block">
<table class="table table-condensed">
<thead>
<tr>
<th>File</th>
<th>File Name</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<div id='add_plugin_file' class="info_input plugin_files_block">
<%= hidden_field_tag 'plugin_file_field_count', @writing_conference.writing_conference_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @writing_conference.writing_conference_files.each_with_index do |writing_conference_file, i| %>
<%= f.fields_for :writing_conference_files, writing_conference_file do |f| %>
<%= render :partial => 'form_file', :object => writing_conference_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %>
<script>
$('#add_plugin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_add_plugin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_conference_files) %>").replace(old_id, new_id));
});
$('.add_plugin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
});
</script>
<script>
$(document).ready(function() {
$('.main-forms .add-on').tooltip();
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_writing_conference_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_conference_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});
</script>
<% end %>
@@ -1,50 +1,45 @@
<% # encoding: utf-8 %>
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
</div>
</div>
</td>
<td>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %>
<%= f.fields_for :file_title_translations do |f| %>
<div class="control-group">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
<div class="controls">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<i class="icons-paperclip"></i>
<%= f.file_field :file %>
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</span>
<% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
</div>
@@ -1,9 +1,4 @@
<tr id="<%= dom_id writing_conference %>" class="with_action">
<td>
<% if (writing_conference.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', writing_conference.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td><%= writing_conference.year %></td>
<td>
<%= link_to writing_conference.create_link, panel_personal_conference_front_end_writing_conference_path(writing_conference) %>
@@ -8,8 +8,8 @@
</div>
<h1><%= t('personal_conference.editing_personal_conference') %></h1>
<%= form_for @writing_conference, :url => panel_personal_conference_back_end_writing_conference_path(@writing_conference), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= form_for @writing_conference, url: panel_personal_conference_back_end_writing_conference_path(@writing_conference), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -13,10 +13,9 @@
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"><%= t("personal_book.year") %></th>
<th class="span7"><%= t("module_name.personal_conference") %></th>
<th class="span1"><%= t("personal_plugins.author") %></th>
</tr>
</thead>
<tbody id="tbody_writing_conferences" class="sort-holder">
@@ -24,10 +23,12 @@
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), panel_personal_conference_back_end_writing_conference_setting_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_conference_back_end_writing_conference_path, :class => 'btn btn-primary pull-right' %>
<div id="writing_conference_pagination" class="paginationFixed">
<%= paginate @conferences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
<div class="pagination pagination-centered">
<%= paginate @writing_conferences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
@@ -8,14 +8,8 @@
</div>
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('writing_conference.new_personal_conference') %></h1>
<%= form_for @writing_conference, :url => panel_personal_conference_back_end_writing_conferences_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>
<%= form_for @writing_conference, url: panel_personal_conference_back_end_writing_conferences_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -15,7 +15,7 @@
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_conference_back_end_writing_conference_paper_type_quick_add_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>論文型態</span>
<span><%= t("personal_conference.paper_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -41,7 +41,7 @@
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_conference_back_end_writing_conference_author_type_quick_add_path('add') %>#myModal2" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>作者型態</span>
<span><%= t("personal_conference.author_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -1,42 +1,50 @@
<%
if @member
@writing_conferences = WritingConference.where(:create_user_id => @member.id).desc(:year)
else
@writing_conferences = WritingConference.all.desc(:year)
end
@writing_conferences = WritingConference.where(is_hidden: false, :create_user_id => @member.id).desc(:year)
@writing_conference_intro = !PersonalConferenceIntro.where(:user_id => @member.id).blank? ? PersonalConferenceIntro.where(:user_id => @member.id).first : PersonalConferenceIntro.new
%>
<% if !@writing_conferences.blank? %>
<% if @writing_conference_intro.brief_intro and !@writing_conference_intro.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_conference.year') %></th>
<th class="grid8"><%= t('module_name.personal_conference') %></th>
<th class="grid3"><%= t('personal_conference.authors') %></th>
</tr>
</thead>
<tbody>
<% @writing_conferences.each do |writing_conference| %>
<tr>
<td><%= writing_conference.year %></td>
<td>
<%= link_to writing_conference.create_link, panel_personal_conference_front_end_writing_conference_path(writing_conference) %>
</td>
<td><%= writing_conference.authors %></td>
</tr>
<% end %>
<div class="info">
<%= @writing_conference_intro.text.html_safe rescue '' %>
</div>
</tbody>
</table>
<% end %>
<% if ( !@writing_conference_intro.blank? and @writing_conference_intro.complete_list ) or @writing_conference_intro.blank? %>
<% else %>
<% if !@writing_conferences.blank? %>
<%= t('nothing')%>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_conference.year') %></th>
<th class="grid8"><%= t('module_name.personal_conference') %></th>
<th class="grid3"><%= t('personal_conference.authors') %></th>
</tr>
</thead>
<tbody>
<% @writing_conferences.each do |writing_conference| %>
<tr>
<td><%= writing_conference.year %></td>
<td>
<%= link_to writing_conference.create_link, panel_personal_conference_front_end_writing_conference_path(writing_conference) %>
</td>
<td><%= writing_conference.authors %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<% end %>
@@ -1,3 +1,10 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
@@ -17,18 +24,29 @@
end
if @user
@writing_conferences = WritingConference.where(:create_user_id => @user.id).page(params[:page]).per(10)
if @user && is_admin?
@writing_conferences = WritingConference.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else
@writing_conferences = WritingConference.all.page(params[:page]).per(10)
@writing_conferences = WritingConference.where(is_hidden: false, :create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
end
%>
<% if is_admin? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_conference_back_end_writing_conferences_path(:user_id => params[:id], :disable => 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_conference_back_end_writing_conferences_path(:user_id => params[:id], :disable => 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped">
<thead>
<tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_conference.year') %></th>
<th><%= t('module_name.personal_conference') %></th>
</tr>
@@ -37,7 +55,12 @@
<% @writing_conferences.each do |writing_conference| %>
<tr>
<tr class="<%= writing_conference.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', writing_conference.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= writing_conference.year %></td>
<td>
<%= link_to writing_conference.create_link, panel_personal_conference_front_end_writing_conference_path(writing_conference) %>
@@ -49,11 +72,25 @@
</tbody>
</table>
<% if is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_conference_back_end_personal_conference_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_conference_back_end_writing_conference_path(:user_id => @user.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @writing_conferences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>
@@ -1,7 +1,7 @@
en:
module_name:
personal_conference: Conference
personal_conference: Conference Paper
personal_conference:
year : "Year"
@@ -14,12 +14,14 @@ Rails.application.routes.draw do
resources :writing_conferences do
collection do
get 'delete'
get 'data_share'
end
match "author_type_quick_add" => "writing_conferences#author_type_quick_add" ,:as => :author_type_quick_add
match "author_type_quick_edit" => "writing_conferences#author_type_quick_edit" ,:as => :author_type_quick_edit
match "paper_type_quick_add" => "writing_conferences#paper_type_quick_add" ,:as => :paper_type_quick_add
match "paper_type_quick_edit" => "writing_conferences#paper_type_quick_edit" ,:as => :paper_type_quick_edit
end
resources :personal_conference_intros
resources :conference_paper_types
resources :conference_author_types
# resources :conference_level_types
+1 -1
View File
@@ -2,7 +2,7 @@ module PersonalConference
OrbitApp.registration "PersonalConference",:type=> 'ModuleApp' do
module_label 'module_name.personal_conference'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_conference/plugin/profile",:front_path=>"panel/personal_conference/front_end/profile",:admin_path=>"/panel/personal_conference/back_end/writing_conferences",:i18n=>'module_name.personal_conference'
personal_plugin :enable => true, :app_name=>"WritingConference", :intro_app_name=>"PersonalConferenceIntro",:path=>"panel/personal_conference/plugin/profile",:front_path=>"panel/personal_conference/front_end/profile",:admin_path=>"/panel/personal_conference/back_end/writing_conferences",:i18n=>'module_name.personal_conference'
@@ -3,38 +3,20 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
def index
get_plugins
@filter = params[:filter]
new_filter = params[:new_filter]
get_plugins
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@diplomas = (params[:sort] || @filter) ? get_sorted_and_filtered("diploma") : get_viewable("diploma")
@diplomas_page = @diplomas.page params[:page]
@tags = get_tags
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@diplomas = get_sorted_and_filtered("diploma")
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @diplomas }
format.js
end
end
@@ -86,25 +68,25 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
# POST /diplomas.xml
def create
@tags = get_tags
@tags = get_tags
@diploma = Diploma.new(params[:diploma])
if params[:diploma][:user_id]
if params[:diploma][:user_id]
@diploma.create_user_id = params[:diploma][:user_id]
@diploma.update_user_id = params[:diploma][:user_id]
else
@diploma.create_user_id = current_user.id
@diploma.create_user_id = current_user.id
@diploma.update_user_id = current_user.id
end
respond_to do |format|
if @diploma.save
if params[:diploma][:user_id]
if params[:diploma][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:diploma][:user_id],:show_plugin_profile=>'Diploma')) }
else
format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) }
format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) }
end
format.xml { render :xml => @diploma, :status => :created, :location => @diploma }
@@ -113,6 +95,7 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity }
end
end
end
# PUT /diplomas/1
@@ -123,18 +106,19 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
@diploma.update_user_id = current_user.id
params[:diploma][:tag_ids] ||=[]
params[:diploma][:tag_ids] ||=[]
respond_to do |format|
if @diploma.update_attributes(params[:diploma])
format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) }
# format.js { render 'toggle_enable' }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /diplomas/1
@@ -156,6 +140,29 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
end
redirect_to panel_personal_diploma_back_end_diplomas_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@diplomas = Diploma.any_in(:_id => params[:ids])
@diplomas.each do |diploma|
diploma.is_hidden = params[:disable]
diploma.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"Diploma")) }
end
end
protected
@@ -0,0 +1,10 @@
class Panel::PersonalDiploma::BackEnd::PersonalDiplomaIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_diploma_intro'
@app_type_name = 'personal_diploma'
@reback_name = 'Diploma'
end
end
@@ -0,0 +1,4 @@
class PersonalDiplomaIntro < PersonalPluginIntro
end
@@ -1,9 +1,4 @@
<tr id="<%= dom_id diploma %>" class="with_action">
<td class="span1">
<% if (diploma.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', diploma.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td class="span1"><%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %></td>
<td class="span1">
<%= diploma.school_name %>
@@ -1,136 +1,210 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<!-- Input Area -->
<div class="input-area">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'diploma[tag_ids][]', tag.id, @diploma.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'diploma[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<% if show_form_status_field(@diploma) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<div id="post-body">
<div id="post-body-content" class="clear">
<% if !params[:user_id].blank? %>
<div class="span6">
<%= t("著作人")%>
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
<% end %>
<div class="title">
<%= f.label :start_date ,t("personal_diploma.start_date")%>
<%= f.date_select :start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
<div class="title">
<%= f.label :end_date ,t("personal_diploma.end_date")%>
<%= f.date_select :end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :school_name ,t("personal_diploma.school_name")%>
<%= f.fields_for :school_name_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@diploma.school_name_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :country ,t("personal_diploma.country")%>
<%= f.fields_for :country_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@diploma.country_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :department ,t("personal_diploma.department")%>
<%= f.fields_for :department_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@diploma.department_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :degree ,t("personal_diploma.degree")%>
<%= f.fields_for :degree_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@diploma.degree_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Module -->
<div class="tab-content module-area">
<% end %>
</div>
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="title">
<%= f.label :url, t("personal_diploma.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_diploma.keywords") %>
<%= f.text_field :keywords %>
</div>
<div id="title">
<%= f.label :language, t("personal_diploma.language") %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_diploma.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_diploma.English") %>
</div>
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<div class="title">
<%= f.label :note, t("personal_diploma.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
</div>
<!--Post End-->
<% end %>
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<!-- start_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_diploma.start_date") %></label>
<div class="controls">
<%= f.date_select :start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
</div>
<!-- end_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_diploma.end_date") %></label>
<div class="controls">
<%= f.date_select :end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_diploma.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_diploma.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_diploma.language") %></label>
<div class="controls">
<%= f.radio_button :language, "Chinese" %> <%= t("personal_diploma.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_diploma.English") %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_diploma.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<% if show_form_status_field(@diploma) %>
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @diploma.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @diploma.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'diploma[tag_ids][]', tag.id, @diploma.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'diploma[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- school_name-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_diploma.school_name") %></label>
<div class="controls">
<%= f.fields_for :school_name_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_diploma.school_name"), value: (@diploma.school_name_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- country-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_diploma.country") %></label>
<div class="controls">
<%= f.fields_for :country_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_diploma.country"), value: (@diploma.country_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- department-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_diploma.department") %></label>
<div class="controls">
<%= f.fields_for :department_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_diploma.department"), value: (@diploma.department_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- degree-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_diploma.degree") %></label>
<div class="controls">
<%= f.fields_for :degree_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_diploma.degree"), value: (@diploma.degree_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
@@ -1,12 +1,15 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
<h1><%= t('personal_diploma.editing_personal_diploma') %></h1>
</div>
<%= form_for @diploma, :url => panel_personal_diploma_back_end_diploma_path(@diploma), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= form_for @diploma, url: panel_personal_diploma_back_end_diploma_path(@diploma), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -13,10 +13,9 @@
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span2"><%= t('date_') %></th>
<th class="span5"><%= t('personal_diploma.school_name') %></th>
<th class="span1"><%= t("personal_plugins.author") %></th>
</tr>
</thead>
<tbody id="tbody_diplomas" class="sort-holder">
@@ -24,10 +23,12 @@
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), panel_personal_diploma_back_end_diploma_setting_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_diploma_back_end_diploma_path, :class => 'btn btn-primary pull-right' %>
<div id="diploma_pagination" class="paginationFixed">
<%= paginate @diplomas_page, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
<div class="pagination pagination-centered">
<%= paginate @diplomas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
@@ -1,18 +1,15 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('diploma.new_personal_diploma') %></h1>
<%= form_for @diploma, :url => panel_personal_diploma_back_end_diplomas_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>
<%= form_for @diploma, url: panel_personal_diploma_back_end_diplomas_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -1,38 +1,48 @@
<%
if @member
@diplomas = Diploma.where(:create_user_id => @member.id).desc(:start_date)
else
@diplomas = Diploma.all.desc(:start_date)
end
@diplomas = Diploma.where(is_hidden: false, :create_user_id => @member.id).desc(:start_date)
@diploma_intro = !PersonalDiplomaIntro.where(:user_id => @member.id).blank? ? PersonalDiplomaIntro.where(:user_id => @member.id).first : PersonalDiplomaIntro.new
%>
<% if !@diplomas.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid3"><%= t('date_') %></th>
<th class="grid9"><%= t('personal_diploma.school_name') %></th>
</tr>
</thead>
<tbody>
<% @diplomas.each do |diploma| %>
<tr>
<td><%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %></td>
<td>
<%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %>
</td>
</tr>
<% end %>
<% if @diploma_intro.brief_intro and !@diploma_intro.blank? %>
</tbody>
</table>
<div class="info">
<%= @diploma_intro.text.html_safe rescue '' %>
</div>
<% else %>
<% end %>
<%= t('nothing')%>
<% if ( !@diploma_intro.blank? and @diploma_intro.complete_list ) or @diploma_intro.blank? %>
<% if !@diplomas.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid3"><%= t('date_') %></th>
<th class="grid9"><%= t('personal_diploma.school_name') %></th>
</tr>
</thead>
<tbody>
<% @diplomas.each do |diploma| %>
<tr>
<td><%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %></td>
<td>
<%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<% end %>
@@ -1,3 +1,10 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
@@ -17,17 +24,29 @@
end
if @user
@diplomas = Diploma.where(:create_user_id => @user.id).page(params[:page]).per(10)
if @user && is_admin?
@diplomas = Diploma.where(:create_user_id => @user.id).desc(:start_date).page(params[:page]).per(10)
else
@diplomas = Diploma.all.page(params[:page]).per(10)
@diplomas = Diploma.where(is_hidden: false, :create_user_id => @user.id).desc(:start_date).page(params[:page]).per(10)
end
%>
<% if is_admin? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_diploma_back_end_diplomas_path(:user_id => params[:id], :disable => 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_diploma_back_end_diplomas_path(:user_id => params[:id], :disable => 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped">
<thead>
<tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span2"><%= t('date_') %></th>
<th><%= t('personal_diploma.school_name') %></th>
</tr>
@@ -36,7 +55,12 @@
<% @diplomas.each do |diploma| %>
<tr>
<tr class="<%= diploma.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', diploma.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %></td>
<td>
<%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %>
@@ -48,11 +72,25 @@
</tbody>
</table>
<% if is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_diploma_back_end_personal_diploma_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_diploma_back_end_diploma_path(:user_id => @user.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @diplomas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>
@@ -13,9 +13,11 @@ Rails.application.routes.draw do
resources :diplomas do
collection do
get 'delete'
get 'data_share'
end
end
resources :personal_diploma_intros
resources :tags
end
namespace :front_end do
+1 -1
View File
@@ -2,7 +2,7 @@ module PersonalDiploma
OrbitApp.registration "PersonalDiploma",:type=> 'ModuleApp' do
module_label 'module_name.personal_diploma'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_diploma/plugin/profile",:front_path=>"panel/personal_diploma/front_end/profile",:admin_path=>"/panel/personal_diploma/back_end/diplomas",:i18n=>'module_name.personal_diploma'
personal_plugin :enable => true, :app_name=>"Diploma", :intro_app_name=>"PersonalDiplomaIntro",:path=>"panel/personal_diploma/plugin/profile",:front_path=>"panel/personal_diploma/front_end/profile",:admin_path=>"/panel/personal_diploma/back_end/diplomas",:i18n=>'module_name.personal_diploma'
@@ -10,40 +10,19 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
end
def index
get_plugins
get_plugins
get_categorys("ExperienceCategory",params[:experience_category_ids])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@experience_categorys = get_categories_for_index("ExperienceCategory")
@experience_category_ids = @experience_categorys.collect{|t| t.id.to_s} + [nil]
@experiences = (params[:sort] || @filter) ? get_sorted_and_filtered("experience",:experience_category_id.in => @experience_category_ids) : get_viewable("experience",:experience_category_id.in => @experience_category_ids)
@experience_pages = @experiences.page params[:page]
@tags = get_tags
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@experience_category_ids = ExperienceCategory.all.collect{|t| t.id.to_s} + [nil]
@experiences = get_sorted_and_filtered("experience", :experience_category_id.in => @experience_category_ids)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @experiences }
format.js
end
end
@@ -56,7 +35,7 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
@tags = get_tags
@set_experience_type = ExperienceCategory.new(:display => 'List')
@experience_type_url = panel_personal_experience_back_end_experiences_path
@experience_type_url = panel_personal_experience_back_end_experiences_path
end
@@ -138,25 +117,25 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
else
@experience_types = ExperienceCategory.all
@tags = get_tags
@tags = get_tags
@experience = Experience.new(params[:experience])
if params[:experience][:user_id]
if params[:experience][:user_id]
@experience.create_user_id = params[:experience][:user_id]
@experience.update_user_id = params[:experience][:user_id]
else
@experience.create_user_id = current_user.id
@experience.create_user_id = current_user.id
@experience.update_user_id = current_user.id
end
respond_to do |format|
if @experience.save
if params[:experience][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:experience][:user_id],:show_plugin_profile=>'Experience')) }
if params[:experience][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:experience][:user_id],:show_plugin_profile=>"Experience")) }
else
format.html { redirect_to(panel_personal_experience_back_end_experiences_url) }
format.html { redirect_to(panel_personal_experience_back_end_experiences_url) }
end
format.xml { render :xml => @experience, :status => :created, :location => @experience }
@@ -191,18 +170,19 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
@experience.update_user_id = current_user.id
params[:experience][:tag_ids] ||=[]
params[:experience][:tag_ids] ||=[]
respond_to do |format|
if @experience.update_attributes(params[:experience])
format.html { redirect_to(panel_personal_experience_back_end_experiences_url) }
# format.js { render 'toggle_enable' }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @experience.errors, :status => :unprocessable_entity }
end
end
end
end
@@ -226,6 +206,29 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
end
redirect_to panel_personal_experience_back_end_experiences_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@experiences = Experience.any_in(:_id => params[:ids])
@experiences.each do |experience|
experience.is_hidden = params[:disable]
experience.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"Experience")) }
end
end
protected
@@ -0,0 +1,10 @@
class Panel::PersonalExperience::BackEnd::PersonalExperienceIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_experience_intro'
@app_type_name = 'personal_experience'
@reback_name = 'Experience'
end
end
@@ -0,0 +1,4 @@
class PersonalExperienceIntro < PersonalPluginIntro
end
@@ -1,9 +1,4 @@
<tr id="<%= dom_id experience %>" class="with_action">
<td class="span1">
<% if (experience.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', experience.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td class="span1"><%= experience.start_date.strftime("%Y.%m") %> ~ <%= experience.end_date.strftime("%Y.%m") %></td>
<td class="span1">
<%= experience.organizationt_title %>
@@ -1,133 +1,208 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<!-- Input Area -->
<div class="input-area">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'experience[tag_ids][]', tag.id, @experience.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'experience[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<% if show_form_status_field(@experience) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<div id="post-body">
<div id="post-body-content" class="clear">
<% if !params[:user_id].blank? %>
<div class="span6">
<%= t("著作人")%>
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
<% end %>
<div class="title">
<%= f.label :experience_category ,t("personal_experience.experience_category")%>
<%= f.select :experience_category_id, @experience_categorys.collect {|t| [ t.title, t.id ]} %>
</div>
<div class="title">
<%= f.label :start_date ,t("personal_experience.start_date")%>
<%= f.date_select :start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
<div class="title">
<%= f.label :end_date ,t("personal_experience.end_date")%>
<%= f.date_select :end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :organizationt_title ,t("personal_experience.organizationt_title")%>
<%= f.fields_for :organizationt_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@experience.organizationt_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :department ,t("personal_experience.department")%>
<%= f.fields_for :department_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@experience.department_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :job_title ,t("personal_experience.job_title")%>
<%= f.fields_for :job_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@experience.job_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Module -->
<div class="tab-content module-area">
<% end %>
</div>
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="title">
<%= f.label :url, t("personal_experience.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_experience.keywords") %>
<%= f.text_field :keywords %>
</div>
<div id="title">
<%= f.label :language, t("personal_experience.language") %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_experience.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_experience.English") %>
</div>
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<div class="title">
<%= f.label :note, t("personal_experience.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
</div>
<!--Post End-->
<% end %>
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<!-- experience_category -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_experience.experience_category") %></label>
<div class="controls">
<%= f.select :experience_category_id, @experience_categorys.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<!-- start_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_experience.start_date") %></label>
<div class="controls">
<%= f.date_select :start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
</div>
<!-- end_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_experience.end_date") %></label>
<div class="controls">
<%= f.date_select :end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_experience.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_experience.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_experience.language") %></label>
<div class="controls">
<%= f.radio_button :language, "Chinese" %> <%= t("personal_experience.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_experience.English") %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_experience.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<% if show_form_status_field(@experience) %>
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @experience.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @experience.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'experience[tag_ids][]', tag.id, @experience.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'experience[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- organizationt_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_experience.organizationt_title") %></label>
<div class="controls">
<%= f.fields_for :organizationt_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_experience.organizationt_title"), value: (@experience.school_name_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- department-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_experience.department") %></label>
<div class="controls">
<%= f.fields_for :department_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_experience.department"), value: (@experience.department_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- job_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_experience.job_title") %></label>
<div class="controls">
<%= f.fields_for :job_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_experience.job_title"), value: (@experience.job_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
@@ -8,8 +8,8 @@
</div>
<h1><%= t('personal_experience.editing_personal_experience') %></h1>
<%= form_for @experience, :url => panel_personal_experience_back_end_experience_path(@experience), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= form_for @experience, url: panel_personal_experience_back_end_experience_path(@experience), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -15,7 +15,7 @@
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_experience_back_end_experience_experience_category_quick_add_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>機關類別</span>
<span><%= t("personal_experience.experience_category") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -13,12 +13,11 @@
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span2"><%= t('date_') %></th>
<th class="span2"><%= t('personal_experience.organizationt_title') %></th>
<th class="span2"><%= t('personal_experience.department') %></th>
<th class="span2"><%= t('personal_experience.job_title') %></th>
<th class="span1"><%= t("personal_plugins.author") %></th>
</tr>
</thead>
<tbody id="tbody_experiences" class="sort-holder">
@@ -26,10 +25,12 @@
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), panel_personal_experience_back_end_experience_setting_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_experience_back_end_experience_path, :class => 'btn btn-primary pull-right' %>
<div id="experience_pagination" class="paginationFixed">
<%= paginate @experience_pages, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
<div class="pagination pagination-centered">
<%= paginate @experiences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
@@ -8,14 +8,8 @@
</div>
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('experience.new_personal_experience') %></h1>
<%= form_for @experience, :url => panel_personal_experience_back_end_experiences_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= form_for @experience, url: panel_personal_experience_back_end_experiences_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
</div>
<%#= link_back %>
@@ -1,38 +1,48 @@
<%
if @member
@experiences = Experience.where(:create_user_id => @member.id).desc(:start_date)
else
@experiences = Experience.all.desc(:start_date)
end
@experiences = Experience.where(is_hidden: false, :create_user_id => @member.id).desc(:start_date)
@experience_intro = !PersonalExperienceIntro.where(:user_id => @member.id).blank? ? PersonalExperienceIntro.where(:user_id => @member.id).first : PersonalExperienceIntro.new
%>
<% if !@experiences.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid3"><%= t('date_') %></th>
<th class="grid9"><%= t('personal_experience.organizationt_title') %></th>
</tr>
</thead>
<tbody>
<% @experiences.each do |experience| %>
<tr>
<td><%= experience.start_date.strftime("%Y.%m") %> ~ <%= experience.end_date.strftime("%Y.%m") %></td>
<td>
<%= link_to experience.organizationt_title, panel_personal_experience_front_end_experience_path(experience) %>
</td>
</tr>
<% end %>
<% if @experience_intro.brief_intro and !@experience_intro.blank? %>
</tbody>
</table>
<div class="info">
<%= @experience_intro.text.html_safe rescue '' %>
</div>
<% else %>
<% end %>
<%= t('nothing')%>
<% if ( !@experience_intro.blank? and @experience_intro.complete_list ) or @experience_intro.blank? %>
<% if !@experiences.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid3"><%= t('date_') %></th>
<th class="grid9"><%= t('personal_experience.organizationt_title') %></th>
</tr>
</thead>
<tbody>
<% @experiences.each do |experience| %>
<tr>
<td><%= experience.start_date.strftime("%Y.%m") %> ~ <%= experience.end_date.strftime("%Y.%m") %></td>
<td>
<%= link_to experience.organizationt_title, panel_personal_experience_front_end_experience_path(experience) %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<% end %>
@@ -1,3 +1,10 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
@@ -17,18 +24,29 @@
end
if @user
@experiences = Experience.where(:create_user_id => @user.id).page(params[:page]).per(10)
if @user && is_admin?
@experiences = Experience.where(:create_user_id => @user.id).desc(:start_date).page(params[:page]).per(10)
else
@experiences = Experience.all.page(params[:page]).per(10)
@experiences = Experience.where(is_hidden: false, :create_user_id => @user.id).desc(:start_date).page(params[:page]).per(10)
end
%>
<% if is_admin? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_experience_back_end_experiences_path(:user_id => params[:id], :disable => 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_experience_back_end_experiences_path(:user_id => params[:id], :disable => 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped">
<thead>
<tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span2"><%= t('date_') %></th>
<th><%= t('personal_experience.organizationt_title') %></th>
</tr>
@@ -37,7 +55,12 @@
<% @experiences.each do |experience| %>
<tr>
<tr class="<%= experience.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', experience.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= experience.start_date.strftime("%Y.%m") %> ~ <%= experience.end_date.strftime("%Y.%m") %></td>
<td>
<%= link_to experience.organizationt_title, panel_personal_experience_front_end_experience_path(experience) %>
@@ -49,10 +72,24 @@
</tbody>
</table>
<% if is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_experience_back_end_personal_experience_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_experience_back_end_experience_path(:user_id => @user.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @experiences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> </div>
</div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>
@@ -13,12 +13,14 @@ Rails.application.routes.draw do
resources :experiences do
collection do
get 'delete'
get 'data_share'
end
match "experience_category_quick_add" => "experiences#experience_category_quick_add" ,:as => :experience_category_quick_add
match "experience_category_quick_edit" => "experiences#experience_category_quick_edit" ,:as => :experience_category_quick_edit
end
resources :experience_categorys
resources :personal_experience_intros
resources :experience_categorys
resources :tags
end
namespace :front_end do
+1 -1
View File
@@ -2,7 +2,7 @@ module PersonalExperience
OrbitApp.registration "PersonalExperience",:type=> 'ModuleApp' do
module_label 'module_name.personal_experience'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_experience/plugin/profile",:front_path=>"panel/personal_experience/front_end/profile",:admin_path=>"/panel/personal_experience/back_end/experiences",:i18n=>'module_name.personal_experience'
personal_plugin :enable => true, :app_name=>"Experience", :intro_app_name=>"PersonalExperienceIntro",:path=>"panel/personal_experience/plugin/profile",:front_path=>"panel/personal_experience/front_end/profile",:admin_path=>"/panel/personal_experience/back_end/experiences",:i18n=>'module_name.personal_experience'
@@ -9,40 +9,19 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
end
def index
get_plugins
get_plugins
get_categorys("HonorCategory",params[:honor_category_ids])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@honor_categorys = get_categories_for_index("HonorCategory")
@honor_category_ids = @honor_categorys.collect{|t| t.id.to_s} + [nil]
@honors = (params[:sort] || @filter) ? get_sorted_and_filtered("honor",:honor_category_id.in => @honor_category_ids) : get_viewable("honor",:honor_category_id.in => @honor_category_ids)
@honor_pages = @honors.page params[:page]
@tags = get_tags
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@honor_category_ids = HonorCategory.all.collect{|t| t.id.to_s} + [nil]
@honors = get_sorted_and_filtered("honor", :honor_category_id.in => @honor_category_ids)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @honors }
format.js
end
end
@@ -55,7 +34,7 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
@tags = get_tags
@set_honor_type = HonorCategory.new(:display => 'List')
@honor_type_url = panel_personal_honor_back_end_honors_path
@honor_type_url = panel_personal_honor_back_end_honors_path
end
@@ -137,28 +116,28 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
else
@honor_types = HonorCategory.all
@tags = get_tags
@tags = get_tags
@honor = Honor.new(params[:honor])
@honor.create_user_id = current_user.id
@honor.update_user_id = current_user.id
if params[:honor][:user_id]
if params[:honor][:user_id]
@honor.create_user_id = params[:honor][:user_id]
@honor.update_user_id = params[:honor][:user_id]
else
@honor.create_user_id = current_user.id
@honor.create_user_id = current_user.id
@honor.update_user_id = current_user.id
end
respond_to do |format|
if @honor.save
if params[:honor][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:honor][:user_id],:show_plugin_profile=>'Honor')) }
if params[:honor][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:honor][:user_id],:show_plugin_profile=>"Honor")) }
else
format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
end
format.xml { render :xml => @honor, :status => :created, :location => @honor }
@@ -193,12 +172,12 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
@honor.update_user_id = current_user.id
params[:honor][:tag_ids] ||=[]
params[:honor][:tag_ids] ||=[]
respond_to do |format|
if @honor.update_attributes(params[:honor])
format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
# format.js { render 'toggle_enable' }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
@@ -228,6 +207,29 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
end
redirect_to panel_personal_honor_back_end_honors_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@honors = Honor.any_in(:_id => params[:ids])
@honors.each do |honor|
honor.is_hidden = params[:disable]
honor.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"Honor")) }
end
end
protected
@@ -0,0 +1,10 @@
class Panel::PersonalHonor::BackEnd::PersonalHonorIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_honor_intro'
@app_type_name = 'personal_honor'
@reback_name = 'Honor'
end
end
@@ -0,0 +1,4 @@
class PersonalHonorIntro < PersonalPluginIntro
end
@@ -1,97 +1,163 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<!-- Input Area -->
<div class="input-area">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'honor[tag_ids][]', tag.id, @honor.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'honor[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<% if show_form_status_field(@honor) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<div id="post-body">
<div id="post-body-content" class="clear">
<% if !params[:user_id].blank? %>
<div class="span6">
<%= t("著作人")%>
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
<% end %>
<div class="title">
<%= f.label :year ,t("personal_honor.year")%>
<%= select_year((@honor.year ? @honor.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'honor[year]'} ) %>
</div>
<div class="title">
<%= f.label :honor_category ,t("personal_honor.honor_category")%>
<%= f.select :honor_category_id, @honor_categorys.collect {|t| [ t.title, t.id ]} %>
</div>
<!-- Module -->
<div class="tab-content module-area">
<div class="title">
<%= f.label :award_name, t("personal_honor.award_name") %>
<%= f.text_field :award_name %>
</div>
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="title">
<%= f.label :awarding_unit, t("personal_honor.awarding_unit") %>
<%= f.text_field :awarding_unit %>
</div>
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<div class="title">
<%= f.label :url, t("personal_honor.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_honor.keywords") %>
<%= f.text_field :keywords %>
</div>
<div id="title">
<%= f.label :language, t("personal_honor.language") %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_honor.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_honor.English") %>
</div>
<% end %>
<div class="title">
<%= f.label :note, t("personal_honor.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
</div>
<!--Post End-->
<!-- personal_honor -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.year") %></label>
<div class="controls">
<%= select_year((@honor.year ? @honor.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'honor[year]', :class => "span1"} ) %>
</div>
</div>
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<!-- honor_category -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.honor_category") %></label>
<div class="controls">
<%= f.select :honor_category_id, @honor_categorys.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<!-- award_name -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.award_name") %></label>
<div class="controls">
<%= f.text_field :award_name %>
</div>
</div>
<!-- awarding_unit -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.awarding_unit") %></label>
<div class="controls">
<%= f.text_field :awarding_unit %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.language") %></label>
<div class="controls">
<%= f.radio_button :language, "Chinese" %> <%= t("personal_honor.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_honor.English") %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<% if show_form_status_field(@honor) %>
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @honor.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @honor.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'honor[tag_ids][]', tag.id, @honor.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'honor[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
@@ -1,9 +1,4 @@
<tr id="<%= dom_id honor %>" class="with_action">
<td class="span1">
<% if (honor.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', honor.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td class="span1"><%= honor.year %></td>
<td class="span1">
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
@@ -8,8 +8,8 @@
</div>
<h1><%= t('personal_honor.editing_personal_honor') %></h1>
<%= form_for @honor, :url => panel_personal_honor_back_end_honor_path(@honor), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= form_for @honor, url: panel_personal_honor_back_end_honor_path(@honor), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -15,7 +15,7 @@
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_honor_back_end_honor_honor_category_quick_add_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>類別</span>
<span><%= t("personal_honor.honor_category") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -13,11 +13,10 @@
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"><%= t('personal_honor.year') %></th>
<th class="span3"><%= t('personal_honor.award_name') %></th>
<th class="span2"><%= t('personal_honor.awarding_unit') %></th>
<th class="span1"><%= t("personal_plugins.author") %></th>
</tr>
</thead>
<tbody id="tbody_honors" class="sort-holder">
@@ -25,9 +24,12 @@
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), panel_personal_honor_back_end_honor_setting_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_honor_back_end_honor_path, :class => 'btn btn-primary pull-right' %>
<div id="honor_pagination" class="paginationFixed">
<%= paginate @honor_pages, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
<div class="pagination pagination-centered">
<%= paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
@@ -8,14 +8,8 @@
</div>
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('honor.new_personal_honor') %></h1>
<%= form_for @honor, :url => panel_personal_honor_back_end_honors_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>
<%= form_for @honor, url: panel_personal_honor_back_end_honors_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -1,38 +1,49 @@
<%
if @member
@honors = Honor.where(:create_user_id => @member.id).desc(:year)
else
@honors = Honor.all.desc(:year)
end
@honors = Honor.where(is_hidden: false, :create_user_id => @member.id).desc(:year)
@honor_intro = !PersonalHonorIntro.where(:user_id => @member.id).blank? ? PersonalHonorIntro.where(:user_id => @member.id).first : PersonalHonorIntro.new
%>
<% if !@honors.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_honor.year') %></th>
<th class="grid10"><%= t('personal_honor.award_name') %></th>
</tr>
</thead>
<tbody>
<% @honors.each do |honor| %>
<tr>
<td><%= honor.year %></td>
<td>
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
</td>
</tr>
<% end %>
<% if @honor_intro.brief_intro and !@honor_intro.blank? %>
</tbody>
</table>
<div class="info">
<%= @honor_intro.text.html_safe rescue '' %>
</div>
<% else %>
<% end %>
<%= t('nothing')%>
<% if ( !@honor_intro.blank? and @honor_intro.complete_list ) or @honor_intro.blank? %>
<% if !@honors.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_honor.year') %></th>
<th class="grid10"><%= t('personal_honor.award_name') %></th>
</tr>
</thead>
<tbody>
<% @honors.each do |honor| %>
<tr>
<td><%= honor.year %></td>
<td>
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<% end %>
<% end %>
@@ -1,3 +1,10 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
@@ -17,18 +24,29 @@
end
if @user
@honors = Honor.where(:create_user_id => @user.id).page(params[:page]).per(10)
if @user && is_admin?
@honors = Honor.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else
@honors = Honor.all.page(params[:page]).per(10)
@honors = Honor.where(is_hidden: false, :create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
end
%>
<% if is_admin? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_honor_back_end_honors_path(:user_id => params[:id], :disable => 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_honor_back_end_honors_path(:user_id => params[:id], :disable => 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped">
<thead>
<tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_honor.year') %></th>
<th><%= t('personal_honor.award_name') %></th>
</tr>
@@ -37,7 +55,12 @@
<% @honors.each do |honor| %>
<tr>
<tr class="<%= honor.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', honor.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= honor.year %></td>
<td>
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
@@ -49,11 +72,25 @@
</tbody>
</table>
<% if is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_honor_back_end_personal_honor_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_honor_back_end_honor_path(:user_id => @user.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>
+3 -1
View File
@@ -14,12 +14,14 @@ Rails.application.routes.draw do
resources :honors do
collection do
get 'delete'
get 'data_share'
end
match "honor_category_quick_add" => "honors#honor_category_quick_add" ,:as => :honor_category_quick_add
match "honor_category_quick_edit" => "honors#honor_category_quick_edit" ,:as => :honor_category_quick_edit
end
resources :honor_categorys
resources :personal_honor_intros
resources :honor_categorys
resources :tags
end
namespace :front_end do
+1 -1
View File
@@ -2,7 +2,7 @@ module PersonalHonor
OrbitApp.registration "PersonalHonor",:type=> 'ModuleApp' do
module_label 'module_name.personal_honor'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_honor/plugin/profile",:front_path=>"panel/personal_honor/front_end/profile",:admin_path=>"/panel/personal_honor/back_end/honors",:i18n=>'module_name.personal_honor'
personal_plugin :enable => true, :app_name=>"Honor", :intro_app_name=>"PersonalHonorIntro",:path=>"panel/personal_honor/plugin/profile",:front_path=>"panel/personal_honor/front_end/profile",:admin_path=>"/panel/personal_honor/back_end/honors",:i18n=>'module_name.personal_honor'
@@ -0,0 +1,10 @@
class Panel::PersonalJournal::BackEnd::PersonalJournalIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_journal_intro'
@app_type_name = 'personal_journal'
@reback_name = 'WritingJournal'
end
end
@@ -9,43 +9,19 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end
def index
get_plugins
get_categorys("JournalPaperType",params[:journal_paper_type_id])
@filter = params[:filter]
new_filter = params[:new_filter]
get_plugins
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@paper_types = JournalPaperType.all
@paper_type_ids = @paper_types.collect{|t| t.id.to_s} + [nil]
@level_types = JournalLevelType.all
# @writing_journals = WritingJournal.search(params[:category_id])
#@writing_journals = (params[:sort] || @filter) ? get_sorted_and_filtered_writing_journals : WritingJournal.all.page(params[:page]).per(10)
@writing_journals = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_journal",:journal_paper_type_id.in => @paper_type_ids) : get_viewable("writing_journal",:journal_paper_type_id.in => @paper_type_ids)
@writing_journal_pages = @writing_journals.page params[:page]
@tags = get_tags
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@paper_type_ids = JournalPaperType.all.collect{|t| t.id.to_s} + [nil]
@writing_journals = get_sorted_and_filtered("writing_journal", :journal_paper_type_id.in => @paper_type_ids)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_journals }
format.js
end
end
@@ -61,13 +37,13 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
# @writing_journal_categorys = JournalLevelType.all
@set_level_type = JournalLevelType.new(:display => 'List')
@level_type_url = panel_personal_journal_back_end_writing_journals_path
@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
@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
@paper_type_url = panel_personal_journal_back_end_writing_journals_path
end
@@ -193,7 +169,7 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end
end
elsif params[:journal_author_type]
elsif params[:journal_author_type]
@journal_author_type = JournalAuthorType.new(params[:journal_author_type])
@@ -204,7 +180,7 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end
elsif params[:journal_paper_type]
elsif params[:journal_paper_type]
@journal_paper_type = JournalPaperType.new(params[:journal_paper_type])
@@ -219,28 +195,28 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all
@tags = get_tags
@tags = get_tags
@writing_journal = WritingJournal.new(params[:writing_journal])
if params[:writing_journal][:user_id]
if params[:writing_journal][:user_id]
@writing_journal.create_user_id = params[:writing_journal][:user_id]
@writing_journal.update_user_id = params[:writing_journal][:user_id]
else
@writing_journal.create_user_id = current_user.id
@writing_journal.create_user_id = current_user.id
@writing_journal.update_user_id = current_user.id
end
respond_to do |format|
if @writing_journal.save
if params[:writing_journal][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_journal][:user_id],:show_plugin_profile=>'Journal')) }
if params[:writing_journal][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_journal][:user_id],:show_plugin_profile=>"WritingJournal")) }
else
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
end
format.xml { render :xml => @writing_journal, :status => :created, :location => @writing_journal }
format.xml { render :xml => @writing_journal, :status => :created, :location => @writing_journal }
else
format.html { render :action => "new" }
@@ -255,32 +231,32 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
# PUT /writing_journals/1.xml
def update
if params[:journal_level_type]
@journal_level_type = JournalLevelType.find(params[:id])
if params[:journal_level_type]
@journal_level_type = JournalLevelType.find(params[:id])
respond_to do |format|
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])
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|
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]
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|
@@ -293,26 +269,25 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
else
@writing_journal = WritingJournal.find(params[:id])
@writing_journal.update_user_id = current_user.id
params[:writing_journal][:tag_ids] ||=[]
params[:writing_journal][:tag_ids] ||=[]
respond_to do |format|
if @writing_journal.update_attributes(params[:writing_journal])
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
# format.js { render 'toggle_enable' }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_journal.errors, :status => :unprocessable_entity }
end
end
end
end
end
# DELETE /writing_journals/1
# DELETE /writing_journals/1.xml
@@ -333,6 +308,29 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end
redirect_to panel_personal_journal_back_end_writing_journals_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@writing_journals = WritingJournal.any_in(:_id => params[:ids])
@writing_journals.each do |writing_journal|
writing_journal.is_hidden = params[:disable]
writing_journal.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"WritingJournal")) }
end
end
protected
@@ -0,0 +1,4 @@
class PersonalJournalIntro < PersonalPluginIntro
end
@@ -1,295 +1,345 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<div class="widget-box widget-size-300" id="widget-intro">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icon-book"></i><%= f.label :abstract, t("personal_journal.abstract") %></h3>
<div class="widget-content clear form-horizontal">
<%= f.text_area :abstract, :size => "60x3" %>
</div>
</div>
<div class="widget-box widget-size-300" id="widget-intro">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icon-book"></i><%= f.label :abstract, t("personal_journal.note") %></h3>
<div class="widget-content clear form-horizontal">
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
<!-- Input Area -->
<div class="input-area">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_journal[tag_ids][]', tag.id, @writing_journal.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'writing_journal[tag_ids][]', '' %>
<% end %>
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<% if show_form_status_field(@writing_journal) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<% end %>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.year") %></label>
<div class="controls">
<%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]', :class => "span1"} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.language") %></label>
<div class="controls">
<%= f.select :language, WritingJournal::LANGUAGE_TYPES, :prompt => 'Select', :class => "span3" %>
</div>
</div>
<!-- level_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.level_type") %></label>
<div class="controls">
<% @level_types.each do |level_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_journal[journal_level_type_ids][]', level_type.id, @writing_journal.journal_level_type_ids.include?(level_type.id)%>
<%= level_type.title %>
<%= hidden_field_tag 'writing_journal[journal_level_type_ids][]', '' %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<% end %>
</div>
</div>
<div id="post-body">
<div id="post-body-content" class="clear">
<% if !params[:user_id].blank? %>
<div class="span6">
<%= t("著作人")%>
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
<% end %>
<div class="span6">
<%= f.label :year ,t("personal_journal.year")%>
<%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]', :class => "span6"} ) %>
</div>
<!-- paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.paper_type") %></label>
<div class="controls">
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span3" %>
</div>
</div>
<div class="span6">
<%= f.label :language, t("personal_journal.language") %>
<%= f.select :language, WritingJournal::LANGUAGE_TYPES, :prompt => 'Select', :class => "span6" %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_journal[journal_author_type_ids][]', author_type.id, @writing_journal.journal_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_journal[journal_author_type_ids][]', '' %>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%= f.label :paper_title ,t("personal_journal.paper_title")%>
<%= f.fields_for :paper_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'span12', :value => (@writing_journal.paper_title_translations[locale] rescue nil) %>
<% end %>
<br>
<%= f.label :journal_title ,t("personal_journal.journal_title")%>
<%= f.fields_for :journal_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'span12', :value => (@writing_journal.journal_title_translations[locale] rescue nil) %>
<% end %>
<br>
</div>
<% end %>
</div>
</div>
<% end %>
<!-- vol_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.vol_no") %></label>
<div class="controls">
<%= f.text_field :vol_no %>
</div>
</div>
<%= f.label :level_type ,t("personal_journal.level_type")%>
<div class="form-inline">
<ul class="nav nav-pills">
<% @level_types.each_with_index do |level_type, i| %>
<li class="pull-left">
<%= check_box_tag 'writing_journal[journal_level_type_ids][]', level_type.id, @writing_journal.journal_level_type_ids.include?(level_type.id), :id => "field-#{i}" %>
<label for="field-<%= i %>"><%= level_type.title %></label>
<%= hidden_field_tag 'writing_journal[journal_level_type_ids][]', '' %>
</li>
<% end %>
</ul>
</div>
<!-- issue_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.issue_no") %></label>
<div class="controls">
<%= f.text_field :issue_no %>
</div>
</div>
<div class="row">
<!-- form_to -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.form_to") %></label>
<div class="controls">
<%= f.text_field :form_to_start, :class=>'span1' %> ~ <%= f.text_field :form_to_end, :class=>'span1' %>
</div>
</div>
<div class="span3">
<%= f.label :vol_no, t("personal_journal.vol_no") %>
<%= f.text_field :vol_no %>
</div>
<!-- total_pages -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.total_pages") %></label>
<div class="controls">
<%= f.text_field :total_pages %>
</div>
</div>
<div class="span3">
<%= f.label :issue_no, t("personal_journal.issue_no") %>
<%= f.text_field :issue_no %>
</div>
<!-- isbn -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<div class="span3">
<%= f.label :form_to, t("personal_journal.form_to") %>
<%= f.text_field :form_to_start, :class=>'span1' %> ~ <%= f.text_field :form_to_end, :class=>'span1' %>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<div class="span3">
<%= f.label :total_pages, t("personal_journal.total_pages") %>
<%= f.text_field :total_pages %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.publication_date") %></label>
<div class="controls">
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
</div>
<div class="row">
<div class="span5">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<div class="title">
<%= f.label :authors,t("web_resource.authors") %>
<%= f.fields_for :authors_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'span5', :value => (@writing_journal.authors_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- abstract -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.abstract") %></label>
<div class="controls">
<%= f.text_area :abstract, rows: 2, class: "input-block-level" %>
</div>
</div>
<% end %>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
<div class="span7">
<label>&nbsp;</label>
<input type="text" name="" id="" class="span7">
</div>
</div>
</div>
</div>
<div class="row">
<div class="span5">
<%= f.label :author_type ,t("personal_journal.author_type")%>
<div class="form-inline">
<ul class="nav nav-pills">
<% @author_types.each_with_index do |author_type, i | %>
<li class="pull-left">
<%= check_box_tag 'writing_journal[journal_author_type_ids][]', author_type.id, @writing_journal.journal_author_type_ids.include?(author_type.id), :id => "field-#{i}" %>
<label for="field-<%= i %>"><%= author_type.title %></label>
<%= hidden_field_tag 'writing_journal[journal_author_type_ids][]', '' %>
</li>
<% end %>
</ul>
</div>
</div>
<div class="span7">
<%= f.label :paper_type ,t("personal_journal.paper_type")%>
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span7" %>
</div>
</div>
<!-- Status Module -->
<% if show_form_status_field(@writing_journal) %>
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @writing_journal.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @writing_journal.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'writing_journal[tag_ids][]', tag.id, @writing_journal.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'writing_journal[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- paper_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_journal.paper_title") %></label>
<div class="controls">
<%= f.fields_for :paper_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_journal.paper_title"), value: (@writing_journal.paper_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- journal_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_journal.journal_title") %></label>
<div class="controls">
<%= f.fields_for :journal_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_journal.journal_title"), value: (@writing_journal.journal_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- authors-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_journal.authors") %></label>
<div class="controls">
<%= f.fields_for :authors_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_journal.authors"), value: (@writing_journal.authors_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @writing_journal && !@writing_journal.writing_journal_files.blank? %>
<div class="exist">
<% @writing_journal.writing_journal_files.each_with_index do |writing_journal_file, i| %>
<%= f.fields_for :writing_journal_files, writing_journal_file do |f| %>
<%= render :partial => 'form_file', :object => writing_journal_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'plugin_file_field_count', @writing_journal.writing_journal_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
<%= f.label :isbn, t("personal_journal.isbn") %>
<%= f.text_field :isbn , :class => "span12" %>
<br>
<%= f.label :keywords, t("personal_journal.keywords") %>
<%= f.text_field :keywords , :class => "span12" %>
<br>
<div class="title">
<%= f.label :publication_date ,t("personal_journal.publication_date")%>
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
</div>
<%= f.label :url, t("personal_journal.url") %>
<%= f.text_field :url , :class => "span12" %>
<br>
</div>
<div>
<div id='plugin_files' class="plugin_files_block">
<table class="table table-condensed">
<thead>
<tr>
<th>File</th>
<th>File Name</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<div id='add_plugin_file' class="info_input plugin_files_block">
<%= hidden_field_tag 'plugin_file_field_count', @writing_journal.writing_journal_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @writing_journal.writing_journal_files.each_with_index do |writing_journal_file, i| %>
<%= f.fields_for :writing_journal_files, writing_journal_file do |f| %>
<%= render :partial => 'form_file', :object => writing_journal_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %>
<script>
$('#add_plugin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_add_plugin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id));
});
$('.add_plugin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
});
</script>
<script>
$(document).ready(function() {
$('.main-forms .add-on').tooltip();
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_writing_journal_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});
</script>
<% end %>
@@ -1,50 +1,45 @@
<% # encoding: utf-8 %>
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
</div>
</div>
</td>
<td>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %>
<%= f.fields_for :file_title_translations do |f| %>
<div class="control-group">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
<div class="controls">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<i class="icons-paperclip"></i>
<%= f.file_field :file %>
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</span>
<% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
</div>
@@ -1,10 +1,6 @@
<tr id="<%= dom_id writing_journal %>" class="with_action">
<td class="span1">
<% if (writing_journal.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', writing_journal.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td class="span1"><%= writing_journal.publication_date %></td>
<td class="span1"><%= writing_journal.year %></td>
<td class="span1">
<%= link_to writing_journal.create_link , panel_personal_journal_front_end_writing_journal_path(writing_journal) %>
<div class="quick-edit">
@@ -8,8 +8,8 @@
</div>
<h1><%= t('personal_journal.editing_personal_journal') %></h1>
<%= form_for @writing_journal, :url => panel_personal_journal_back_end_writing_journal_path(@writing_journal), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= form_for @writing_journal, url: panel_personal_journal_back_end_writing_journal_path(@writing_journal), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -13,10 +13,9 @@
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"><%= t('personal_journal.year') %></th>
<th class="span7"><%= t('module_name.personal_journal') %></th>
<th class="span1"><%= t('personal_journal.authors') %></th>
</tr>
</thead>
<tbody id="tbody_writing_journals" class="sort-holder">
@@ -24,10 +23,12 @@
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), panel_personal_journal_back_end_writing_journal_setting_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_journal_back_end_writing_journal_path, :class => 'btn btn-primary pull-right' %>
<div id="writing_journal_pagination" class="paginationFixed">
<%= paginate @writing_journal_pages, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
<div class="pagination pagination-centered">
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
@@ -8,14 +8,8 @@
</div>
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('writing_journal.new_personal_journal') %></h1>
<%= form_for @writing_journal, :url => panel_personal_journal_back_end_writing_journals_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>
<%= form_for @writing_journal, url: panel_personal_journal_back_end_writing_journals_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -15,7 +15,7 @@
<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>
<span><%= t("personal_journal.level_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -41,7 +41,7 @@
<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>
<span><%= t("personal_journal.author_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -67,7 +67,7 @@
<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>
<span><%= t("personal_journal.paper_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
@@ -1,41 +1,50 @@
<%
if @member
@writing_journals = WritingJournal.where(:create_user_id => @member.id).desc(:year)
else
@writing_journals = WritingJournal.all.desc(:year)
end
@writing_journals = WritingJournal.where(is_hidden: false, :create_user_id => @member.id).desc(:year)
@writing_journal_intro = !PersonalJournalIntro.where(:user_id => @member.id).blank? ? PersonalJournalIntro.where(:user_id => @member.id).first : PersonalJournalIntro.new
%>
<% if !@writing_journals.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_journal.year') %></th>
<th class="grid8"><%= t('module_name.personal_journal') %></th>
<th class="grid3"><%= t('personal_journal.authors') %></th>
</tr>
</thead>
<tbody>
<% if @writing_journal_intro.brief_intro and !@writing_journal_intro.blank? %>
<div class="info">
<%= @writing_journal_intro.text.html_safe rescue '' %>
</div>
<% end %>
<% if ( !@writing_journal_intro.blank? and @writing_journal_intro.complete_list ) or @writing_journal_intro.blank? %>
<% if !@writing_journals.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_journal.year') %></th>
<th class="grid8"><%= t('module_name.personal_journal') %></th>
<th class="grid3"><%= t('personal_journal.authors') %></th>
</tr>
</thead>
<tbody>
<% @writing_journals.each do |writing_journal| %>
<tr>
<td><%= writing_journal.year %></td>
<td>
<%= link_to writing_journal.create_link, panel_personal_journal_front_end_writing_journal_path(writing_journal) %>
</td>
<td><%= writing_journal.authors %></td>
</tr>
<% end %>
</tbody>
</table>
<% @writing_journals.each do |writing_journal| %>
<tr>
<td><%= writing_journal.year %></td>
<td>
<%= link_to writing_journal.create_link, panel_personal_journal_front_end_writing_journal_path(writing_journal) %>
</td>
<td><%= writing_journal.authors %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% else %>
<%= t('nothing')%>
<% end %>
<% end %>
@@ -1,3 +1,10 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
@@ -16,17 +23,29 @@
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
if @user
@writing_journals = WritingJournal.where(:create_user_id => @user.id).page(params[:page]).per(10)
if @user && is_admin?
@writing_journals = WritingJournal.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else
@writing_journals = WritingJournal.all.page(params[:page]).per(10)
@writing_journals = WritingJournal.where(is_hidden: false, :create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
end
%>
<% if is_admin? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_journal_back_end_writing_journals_path(:user_id => params[:id], :disable => 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_journal_back_end_writing_journals_path(:user_id => params[:id], :disable => 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped">
<thead>
<tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_journal.year') %></th>
<th><%= t('module_name.personal_journal') %></th>
<% if not @user%>
@@ -38,7 +57,12 @@
<% @writing_journals.each do |writing_journal| %>
<tr>
<tr class="<%= writing_journal.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', writing_journal.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= writing_journal.year %></td>
<td>
<%= link_to writing_journal.create_link, panel_personal_journal_front_end_writing_journal_path(writing_journal) %>
@@ -53,11 +77,25 @@
</tbody>
</table>
<% if is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_journal_back_end_personal_journal_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_journal_back_end_writing_journal_path(:user_id => @user.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>
@@ -1,6 +1,6 @@
en:
module_name:
personal_journal: Journal
personal_journal: Journal Paper
personal_journal:
paper_title : "Paper Title"
journal_title : "Journal Title"
@@ -15,6 +15,7 @@ Rails.application.routes.draw do
resources :writing_journals do
collection do
get 'delete'
get 'data_share'
end
match "level_type_quick_add" => "writing_journals#level_type_quick_add" ,:as => :level_type_quick_add
@@ -27,6 +28,7 @@ Rails.application.routes.draw do
match "tag_quick_edit" => "writing_journals#tag_quick_edit" ,:as => :tag_quick_edit
end
resources :personal_journal_intros
resources :journal_paper_types
resources :journal_author_types
resources :journal_level_types
+1 -1
View File
@@ -2,7 +2,7 @@ module PersonalJournal
OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do
module_label 'module_name.personal_journal'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_journal/plugin/profile",:front_path=>"panel/personal_journal/front_end/profile",:admin_path=>"/panel/personal_journal/back_end/writing_journals",:i18n=>'module_name.personal_journal'
personal_plugin :enable => true, :app_name=>"WritingJournal", :intro_app_name=>"PersonalJournalIntro",:path=>"panel/personal_journal/plugin/profile",:front_path=>"panel/personal_journal/front_end/profile",:admin_path=>"/panel/personal_journal/back_end/writing_journals",:i18n=>'module_name.personal_journal'
@@ -9,40 +9,18 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
# end
def index
get_plugins
get_plugins
# get_categorys("LabCategory",params[:lab_category_ids])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
# @lab_categorys = get_categories_for_index("LabCategory")
# @lab_category_ids = @lab_categorys.collect{|t| t.id.to_s} + [nil]
@labs = (params[:sort] || @filter) ? get_sorted_and_filtered("lab") : get_viewable("lab")
@lab_pages = @labs.page params[:page]
@tags = get_tags
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@labs = get_sorted_and_filtered("lab")
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @labs }
format.js
end
end
@@ -94,24 +72,24 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
# POST /labs.xml
def create
@tags = get_tags
@tags = get_tags
@lab = Lab.new(params[:lab])
if params[:lab][:user_id]
if params[:lab][:user_id]
@lab.create_user_id = params[:lab][:user_id]
@lab.update_user_id = params[:lab][:user_id]
else
@lab.create_user_id = current_user.id
@lab.create_user_id = current_user.id
@lab.update_user_id = current_user.id
end
respond_to do |format|
if @lab.save
if params[:lab][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:lab][:user_id],:show_plugin_profile=>'Lab')) }
if params[:lab][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:lab][:user_id],:show_plugin_profile=>"Lab")) }
else
format.html { redirect_to(panel_personal_lab_back_end_labs_url) }
format.html { redirect_to(panel_personal_lab_back_end_labs_url) }
end
format.xml { render :xml => @lab, :status => :created, :location => @lab }
@@ -130,7 +108,7 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
@lab.update_user_id = current_user.id
params[:lab][:tag_ids] ||=[]
params[:lab][:tag_ids] ||=[]
respond_to do |format|
if @lab.update_attributes(params[:lab])
@@ -164,6 +142,29 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
end
redirect_to panel_personal_lab_back_end_labs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@labs = Lab.any_in(:_id => params[:ids])
@labs.each do |lab|
lab.is_hidden = params[:disable]
lab.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"Lab")) }
end
end
protected
@@ -0,0 +1,10 @@
class Panel::PersonalLab::BackEnd::PersonalLabIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_lab_intro'
@app_type_name = 'personal_lab'
@reback_name = 'Lab'
end
end
@@ -0,0 +1,4 @@
class PersonalLabIntro < PersonalPluginIntro
end
@@ -1,214 +1,288 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<!-- Input Area -->
<div class="input-area">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'lab[tag_ids][]', tag.id, @lab.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'lab[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<% if show_form_status_field(@lab) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<div id="post-body">
<div id="post-body-content" class="clear">
<% if !params[:user_id].blank? %>
<div class="span6">
<%= t("著作人")%>
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
<% end %>
<div class="title">
<%= f.label :year ,t("personal_lab.year")%>
<%= select_year((@lab.year ? @lab.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'lab[year]'} ) %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :lab_title ,t("personal_lab.lab_title")%>
<%= f.fields_for :lab_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@lab.lab_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :location ,t("personal_lab.location")%>
<%= f.fields_for :location_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@lab.location_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :participating_professor ,t("personal_lab.participating_professor")%>
<%= f.fields_for :participating_professor_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@lab.participating_professor_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :participating_student ,t("personal_lab.participating_student")%>
<%= f.fields_for :participating_student_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@lab.participating_student_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Module -->
<div class="tab-content module-area">
<% end %>
</div>
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="title">
<%= f.label :extension_no, t("personal_lab.extension_no") %>
<%= f.text_field :extension_no %>
</div>
<% if !params[:user_id].blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= User.from_id(params[:user_id]).name rescue ''%>
</div>
</div>
<div class="title">
<%= f.label :research_direction, t("personal_lab.research_direction") %>
<%= f.text_field :research_direction %>
</div>
<% end %>
<div class="title">
<%= f.label :facility, t("personal_lab.facility") %>
<%= f.text_field :facility %>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_lab.year") %></label>
<div class="controls">
<%= select_year((@lab.year ? @lab.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'lab[year]', :class => 'span1'} ) %>
</div>
</div>
<div class="title">
<%= f.label :url, t("personal_lab.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_lab.keywords") %>
<%= f.text_field :keywords %>
</div>
<div id="title">
<%= f.label :language, t("personal_lab.language") %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_lab.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_lab.English") %>
</div>
<!-- extension_no -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_lab.extension_no") %></label>
<div class="controls">
<%= f.text_field :extension_no %>
</div>
</div>
<div class="title">
<%= f.label :note, t("personal_lab.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
<div>
<div id='plugin_files' class="plugin_files_block">
<table class="table table-condensed">
<thead>
<tr>
<th>File</th>
<th>File Name</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<div id='add_plugin_file' class="info_input plugin_files_block">
<%= hidden_field_tag 'plugin_file_field_count', @lab.lab_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @lab.lab_files.each_with_index do |lab_file, i| %>
<%= f.fields_for :lab_files, lab_file do |f| %>
<%= render :partial => 'form_file', :object => lab_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<!--Post End-->
<!-- research_direction -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_lab.research_direction") %></label>
<div class="controls">
<%= f.text_field :research_direction %>
</div>
</div>
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<!-- facility -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_lab.facility") %></label>
<div class="controls">
<%= f.text_field :facility %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_lab.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_lab.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_lab.language") %></label>
<div class="controls">
<%= f.radio_button :language, "Chinese" %> <%= t("personal_lab.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_lab.English") %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_lab.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<% if show_form_status_field(@lab) %>
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @lab.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @lab.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'lab[tag_ids][]', tag.id, @lab.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'lab[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- lab_title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.lab_title") %></label>
<div class="controls">
<%= f.fields_for :lab_title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.lab_title"), value: (@lab.lab_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- location-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.location") %></label>
<div class="controls">
<%= f.fields_for :location_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.location"), value: (@lab.location_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- participating_professor-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.participating_professor") %></label>
<div class="controls">
<%= f.fields_for :participating_professor_chapters_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_professor"), value: (@lab.participating_professor_chapters_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- participating_student-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_lab.participating_student") %></label>
<div class="controls">
<%= f.fields_for :participating_student_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_student"), value: (@lab.participating_student_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @lab && !@lab.lab_files.blank? %>
<div class="exist">
<% @lab.lab_files.each_with_index do |lab_file, i| %>
<%= f.fields_for :lab_files, lab_file do |f| %>
<%= render :partial => 'form_file', :object => lab_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'plugin_file_field_count', @lab.lab_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %>
<script>
$('#add_plugin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_add_plugin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :lab_files) %>").replace(old_id, new_id));
});
$('.add_plugin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
});
</script>
<script>
$(document).ready(function() {
$('.main-forms .add-on').tooltip();
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_lab_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :lab_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});
</script>
<% end %>
@@ -1,50 +1,45 @@
<% # encoding: utf-8 %>
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
</div>
</div>
</td>
<td>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %>
<%= f.fields_for :file_title_translations do |f| %>
<div class="control-group">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
<div class="controls">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<i class="icons-paperclip"></i>
<%= f.file_field :file %>
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</span>
<% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
</div>
@@ -1,9 +1,4 @@
<tr id="<%= dom_id lab %>" class="with_action">
<td class="span1">
<% if (lab.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', lab.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td class="span1"><%= lab.year %></td>
<td class="span1">
<%= link_to lab.lab_title, panel_personal_lab_front_end_lab_path(lab) %>
@@ -8,8 +8,8 @@
</div>
<h1><%= t('personal_lab.editing_personal_lab') %></h1>
<%= form_for @lab, :url => panel_personal_lab_back_end_lab_path(@lab), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= form_for @lab, url: panel_personal_lab_back_end_lab_path(@lab), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -13,11 +13,10 @@
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"></th>
<th class="span1"><%= t('personal_lab.year') %></th>
<th class="span3"><%= t('personal_lab.lab_title') %></th>
<th class="span2"><%= t('personal_lab.location') %></th>
<th class="span1"><%= t("personal_plugins.author") %></th>
</tr>
</thead>
<tbody id="tbody_labs" class="sort-holder">
@@ -25,9 +24,11 @@
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_lab_back_end_lab_path, :class => 'btn btn-primary pull-right' %>
<div id="lab_pagination" class="paginationFixed">
<%= paginate @lab_pages, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
<div class="pagination pagination-centered">
<%= paginate @labs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
@@ -8,14 +8,8 @@
</div>
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('lab.new_personal_lab') %></h1>
<%= form_for @lab, :url => panel_personal_lab_back_end_labs_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>
<%= form_for @lab, url: panel_personal_lab_back_end_labs_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>
@@ -1,40 +1,50 @@
<%
if @member
@labs = Lab.where(:create_user_id => @member.id).desc(:year)
else
@labs = Lab.all.desc(:year)
end
@labs = Lab.where(is_hidden: false, :create_user_id => @member.id).desc(:year)
@lab_intro = !PersonalLabIntro.where(:user_id => @member.id).blank? ? PersonalLabIntro.where(:user_id => @member.id).first : PersonalLabIntro.new
%>
<% if !@labs.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_lab.year') %></th>
<th class="grid7"><%= t('personal_lab.lab_title') %></th>
<th class="grid4"><%= t('personal_lab.location') %></th>
</tr>
</thead>
<tbody>
<% @labs.each do |lab| %>
<tr>
<td><%= lab.year %></td>
<td>
<%= link_to lab.lab_title, panel_personal_lab_front_end_lab_path(lab) %>
</td>
<td><%= lab.location %></td>
</tr>
<% end %>
<% if @lab_intro.brief_intro and !@lab_intro.blank? %>
</tbody>
</table>
<div class="info">
<%= @lab_intro.text.html_safe rescue '' %>
</div>
<% else %>
<% end %>
<%= t('nothing')%>
<% if ( !@lab_intro.blank? and @lab_intro.complete_list ) or @lab_intro.blank? %>
<% end %>
<% if !@labs.blank? %>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_lab.year') %></th>
<th class="grid7"><%= t('personal_lab.lab_title') %></th>
<th class="grid4"><%= t('personal_lab.location') %></th>
</tr>
</thead>
<tbody>
<% @labs.each do |lab| %>
<tr>
<td><%= lab.year %></td>
<td>
<%= link_to lab.lab_title, panel_personal_lab_front_end_lab_path(lab) %>
</td>
<td><%= lab.location %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<% end %>
@@ -1,3 +1,10 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
@@ -17,18 +24,29 @@
end
if @user
@labs = Lab.where(:create_user_id => @user.id).page(params[:page]).per(10)
if @user && is_admin?
@labs = Lab.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else
@labs = Lab.all.page(params[:page]).per(10)
@labs = Lab.where(is_hidden: false, :create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
end
%>
<% if is_admin? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_lab_back_end_labs_path(:user_id => params[:id], :disable => 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_lab_back_end_labs_path(:user_id => params[:id], :disable => 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped">
<thead>
<tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_lab.year') %></th>
<th><%= t('personal_lab.lab_title') %></th>
<th><%= t('personal_lab.location') %></th>
@@ -38,7 +56,12 @@
<% @labs.each do |lab| %>
<tr>
<tr class="<%= lab.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', lab.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= lab.year %></td>
<td>
<%= link_to lab.lab_title, panel_personal_lab_front_end_lab_path(lab) %>
@@ -51,11 +74,25 @@
</tbody>
</table>
<% if is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_lab_back_end_personal_lab_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_lab_back_end_lab_path(:user_id => @user.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @labs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>
+2
View File
@@ -13,9 +13,11 @@ Rails.application.routes.draw do
resources :labs do
collection do
get 'delete'
get 'data_share'
end
end
resources :personal_lab_intros
resources :tags
end
namespace :front_end do
+1 -1
View File
@@ -2,7 +2,7 @@ module PersonalLab
OrbitApp.registration "PersonalLab",:type=> 'ModuleApp' do
module_label 'module_name.personal_lab'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_lab/plugin/profile",:front_path=>"panel/personal_lab/front_end/profile",:admin_path=>"/panel/personal_lab/back_end/labs",:i18n=>'module_name.personal_lab'
personal_plugin :enable => true, :app_name=>"Lab", :intro_app_name=>"PersonalLabIntro",:path=>"panel/personal_lab/plugin/profile",:front_path=>"panel/personal_lab/front_end/profile",:admin_path=>"/panel/personal_lab/back_end/labs",:i18n=>'module_name.personal_lab'
end
@@ -0,0 +1,10 @@
class Panel::PersonalPatent::BackEnd::PersonalPatentIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'personal_patent_intro'
@app_type_name = 'personal_patent'
@reback_name = 'WritingPatent'
end
end
@@ -9,40 +9,19 @@ class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendCon
end
def index
get_plugins
get_plugins
get_categorys("WritingPatentCategory",params[:writing_patent_category_ids])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@writing_patent_categorys = get_categories_for_index("WritingPatentCategory")
@writing_patent_category_ids = @writing_patent_categorys.collect{|t| t.id.to_s} + [nil]
@writing_patents = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids) : get_viewable("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids)
@writing_patent_pages = @writing_patents.page params[:page]
@tags = get_tags
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@writing_patent_category_ids = WritingPatentCategory.all.collect{|t| t.id.to_s} + [nil]
@writing_patents = get_sorted_and_filtered("writing_patent", :writing_patent_category_id.in => @writing_patent_category_ids)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_patents }
format.js
end
end
@@ -55,7 +34,7 @@ class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendCon
@tags = get_tags
@set_patent_type = WritingPatentCategory.new(:display => 'List')
@patent_type_url = panel_personal_patent_back_end_writing_patents_path
@patent_type_url = panel_personal_patent_back_end_writing_patents_path
end
@@ -124,47 +103,50 @@ class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendCon
# POST /writing_patents.xml
def create
if params[:writing_patent_category]
@writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category])
if params[:writing_patent_category]
@writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category])
respond_to do |format|
if @writing_patent_category.save
format.js { render 'create_writing_patent_setting' }
end
end
else
@patent_types = WritingPatentCategory.all
@tags = get_tags
@writing_patent = WritingPatent.new(params[:writing_patent])
if params[:writing_patent][:user_id]
@writing_patent.create_user_id = params[:writing_patent][:user_id]
@writing_patent.update_user_id = params[:writing_patent][:user_id]
respond_to do |format|
if @writing_patent_category.save
format.js { render 'create_writing_patent_setting' }
end
end
else
@writing_patent.create_user_id = current_user.id
@writing_patent.update_user_id = current_user.id
end
respond_to do |format|
if @writing_patent.save
@patent_types = WritingPatentCategory.all
@tags = get_tags
@writing_patent = WritingPatent.new(params[:writing_patent])
if params[:writing_patent][:user_id]
@writing_patent.create_user_id = params[:writing_patent][:user_id]
@writing_patent.update_user_id = params[:writing_patent][:user_id]
else
@writing_patent.create_user_id = current_user.id
@writing_patent.update_user_id = current_user.id
end
respond_to do |format|
if @writing_patent.save
if params[:writing_patent][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_patent][:user_id],:show_plugin_profile=>'Patent')) }
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.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent }
else
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
format.html { render :action => "new" }
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
end
format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent }
else
format.html { render :action => "new" }
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
end
end
end
end
@@ -190,12 +172,12 @@ class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendCon
@writing_patent.update_user_id = current_user.id
params[:writing_patent][:tag_ids] ||=[]
params[:writing_patent][:tag_ids] ||=[]
respond_to do |format|
if @writing_patent.update_attributes(params[:writing_patent])
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
# format.js { render 'toggle_enable' }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
@@ -225,6 +207,29 @@ class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendCon
end
redirect_to panel_personal_patent_back_end_writing_patents_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@writing_patents = WritingPatent.any_in(:_id => params[:ids])
@writing_patents.each do |writing_patent|
writing_patent.is_hidden = params[:disable]
writing_patent.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"WritingPatent")) }
end
end
protected
@@ -0,0 +1,4 @@
class PersonalPatentIntro < PersonalPluginIntro
end
Loaded 100 of 159 files, more files were not shown because too many files have changed in this diff. Show more