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 2013-09-18 17:31:53 +08:00 committed by saurabhbhatia
parent dc8815d619
commit 9613a52305
159 changed files with 5145 additions and 3453 deletions

View File

@ -0,0 +1,105 @@
var ListCheck = function(element) {
this.element = $(element);
this.element.data('exists', true);
if(this.element.context.parentNode.tagName == "TD") {
this.elementWrap = $(this.element.context.parentNode);
this.elementWrap.addClass('listCheck');
} else if(this.element.context.parentNode.tagName == "TH") {
this.elementWrap = $(this.element.context.parentNode);
this.elementWrap.addClass('listCheckHead');
}
this.element.before('<i class="icon-check-empty" />');
};
$.fn.listCheck = function (callback) {
this.each(function (i) {
if(!$(this).data('exists')) {
new ListCheck(this);
};
});
this.on(clickEvent, function(e) {
if($(this).prop('checked')) {
$(this).siblings('i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
} else {
$(this).siblings('i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
};
if ($(this).closest('.listCheckHead').length) {
$('.listCheck .list-check').prop('checked', $(this).prop('checked'));
if($(this).prop('checked')) {
$('.listCheck i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
} else {
$('.listCheck i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
}
};
var _isCheck = $('tbody .list-check').filter(':checked').length,
_defaultLength = $('tbody .list-check').length;
if(_isCheck > 0 && _isCheck < _defaultLength) {
$('.listCheckHead i').removeClass('icon-check-empty icon-check').addClass('icon-minus');
} else if(!_isCheck) {
$('.listCheckHead i').removeClass('icon-minus icon-check').addClass('icon-check-empty');
} else {
$('.listCheckHead i').removeClass('icon-check-empty icon-minus').addClass('icon-check');
}
_isCheck ? $('.list-active-btn').removeClass('disabled').data('actionable', true) : $('.list-active-btn').addClass('disabled').data('actionable', false);
});
};
function clearCheck() {
$('.list-check').each(function() {
$(this).prop('checked', false);
})
}
function actionSuccess(e) {
$("tbody .list-check").each(function() {
switch(e) {
case 'list-be-hide':
$(this).filter(':checked').closest('tr').addClass('checkHide');
break;
case 'list-be-show':
$(this).filter(':checked').closest('tr').removeClass('checkHide');
break;
case 'list-be-remove':
$(this).filter(':checked').closest('tr').fadeOut(300, function() {
$(this).remove();
});
break;
};
$('.list-check').siblings('i').removeAttr('class').addClass('icon-check-empty').closest('tr').removeClass('checkHit');
});
clearCheck();
}
$(function() {
var $t = null,
_data = null;
clearCheck();
$('.list-check').listCheck();
$('.list-active-btn').data('actionable', false).on(clickEvent, function(e) {
$t = $(this)
_data = $(this).data()
_data.actionable ? $('#dialog').modal('show') : "";
e.preventDefault();
});
$("#dialog").on('show', function (e) {
$(this).find('.delete-item').on(clickEvent, function() {
var _v = [];
$("tbody .list-check").each(function() {
this.checked && _v.push("ids[]="+this.value)
});
var _t = $t.attr("rel");
if(_t.indexOf("?") > -1) {
$.ajax(_t + "&" + _v.join("&")).done(function() {
actionSuccess(_data.checkAction)
});
} else {
$.ajax(_t + "?" + _v.join("&")).done(function() {
actionSuccess(_data.checkAction)
});
}
$('#dialog').modal('hide');
$('.list-active-btn').addClass('disabled').data('actionable', false);
e.preventDefault();
})
});
});

View File

@ -0,0 +1,28 @@
.table .listCheckHead,
.table .listCheck {
width: 30px;
vertical-align: middle;
padding: 0 0 0 10px!important;
}
.listCheckHead .list-check,
.listCheck .list-check {
position: absolute;
margin: -12px 0 0 -1px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
}
.listCheckHead i,
.listCheck i {
display: block;
}
.checkHide td {
background-color: #E6E6E6 !important;
color: #B9B9B9;
}
.checkHide a {
color: #B9B9B9;
}
.checkHit td {
background-color: #FFFEDB !important;
}

View File

@ -3,9 +3,9 @@
color: #000; color: #000;
text-decoration: none; text-decoration: none;
display: block; display: block;
overflow: hidden;
width: 100%; width: 100%;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap; white-space: nowrap;
} }
@ -364,6 +364,9 @@
#profile #module-navbar { #profile #module-navbar {
margin-left: 10px; margin-left: 10px;
} }
#profile #module-navbar .navbar {
margin-bottom: 15px;
}
#profile #member-module { #profile #member-module {
margin-left: 360px; margin-left: 360px;
} }
@ -372,9 +375,13 @@
} }
#profile #member-module #module-content .content { #profile #member-module #module-content .content {
right: 10px; right: 10px;
padding-bottom: 10px;
outline: none; outline: none;
} }
#profile #member-module #module-content .list-active {
padding-bottom: 8px;
/*border-bottom: 1px solid #DDD;*/
}
/* Responsive */ /* Responsive */
@media (max-width: 979px) { @media (max-width: 979px) {

View File

@ -26,6 +26,9 @@
margin-top: 4px; margin-top: 4px;
margin-left: 10px; margin-left: 10px;
} }
.topnav .btn-group {
margin-left: 0;
}
/* Bottom Nav */ /* Bottom Nav */
.bottomnav { .bottomnav {

View File

@ -0,0 +1,83 @@
class Admin::PersonalPluginIntrosController < OrbitMemberController
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :is_admin?
def index
get_types
@plugin_intro = @types.where(:user_id => params[:user_id]).first
if @plugin_intro.blank?
@set_type = @types.new()
@url = eval("panel_#{@app_type_name}_back_end_#{@app_type}s_path(:user_id=>params[:user_id])")
@verb = :post
else
@set_type = @types.find(@plugin_intro.id)
@url = polymorphic_path(["panel_#{@app_type_name}_back_end", @plugin_intro])
@verb = :put
end
end
def show
end
def new
end
def edit
end
def create
get_types
@plugin_intro = @types.new(params[:plugin_intro])
respond_to do |format|
if @plugin_intro.save
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:plugin_intro][:user_id],:show_plugin_profile=>@reback_name)) }
end
end
end
def update
get_types
@plugin_intro = @types.find(params[:id])
respond_to do |format|
if @plugin_intro.update_attributes(params[:plugin_intro])
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:plugin_intro][:user_id],:show_plugin_profile=>@reback_name)) }
end
end
end
def destroy
end
protected
def get_types
@types = @app_type.classify.constantize
end
end

View File

@ -98,9 +98,11 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
if(!params[:show_plugin_profile].nil?) if(!params[:show_plugin_profile].nil?)
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary' @right_partial = OrbitApp::Plugin::Registration.find_by_app_name(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary'
@plugin_app_name = OrbitApp::Plugin::Registration.find_by_app_name(params[:show_plugin_profile]).name rescue nil
else else
@right_partial = "plugin_summary" @right_partial = "plugin_summary"
@plugin_app_name = ''
end end
# @user.attribute_values.each{|att_val| # @user.attribute_values.each{|att_val|

View File

@ -0,0 +1,28 @@
class PersonalPluginIntro
include Mongoid::Document
include Mongoid::Timestamps
# include OrbitCoreLib::ObjectAuthable
# include OrbitCoreLib::ObjectDisable
# has_and_belongs_to_many :users
belongs_to :user
field :text, localize: true
field :brief_intro, :type => Boolean, :default => false
field :complete_list, :type => Boolean, :default => true
def pp_object
brief_intro
end
def self.from_id(id)
PersonalPluginIntro.find(id) rescue nil
end
def self.is_localized?(field_name)
self.fields[field_name.to_s].localized?
end
end

View File

@ -40,12 +40,15 @@ class User
has_and_belongs_to_many :sub_role_tags has_and_belongs_to_many :sub_role_tags
has_many :user_actions, :dependent => :destroy has_many :user_actions, :dependent => :destroy
has_many :personal_plugin_intro
# has_and_belongs_to_many :statuses # has_and_belongs_to_many :statuses
has_and_belongs_to_many :roles has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles has_and_belongs_to_many :sub_roles
has_and_belongs_to_many :role_statuses has_and_belongs_to_many :role_statuses
has_and_belongs_to_many :role_categorys has_and_belongs_to_many :role_categorys
accepts_nested_attributes_for :attribute_values, :allow_destroy => true accepts_nested_attributes_for :attribute_values, :allow_destroy => true
before_create :initialize_desktop before_create :initialize_desktop

View File

@ -0,0 +1,117 @@
<% # encoding: utf-8 %>
<% 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 %>
<% 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" %>
<% end %>
<%= form_for(:plugin_intro, :url => @url, :method => @verb, html: {class: "form-horizontal main-forms previewable"} ) do |f| %>
<%= f.error_messages %>
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= I18n.t("module_name.#{@app_type_name}") %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></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 %>
<!-- frontend_page -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.frontend_page") %></label>
<div class="controls">
<%= f.check_box :brief_intro, :checked => @set_type.brief_intro %> <%= t("personal_plugins.brief_intro") %>
<%= f.check_box :complete_list, :checked => @set_type.complete_list %> <%= t("personal_plugins.complete_list") %>
</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" : '' %>">
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:content) %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :text_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@set_type.text_translations[locale] rescue nil) %>
<% end %>
</div>
</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>
</fieldset>
<% end %>

View File

@ -1,46 +1,46 @@
<div class="item element"> <div class="item element">
<h3><i class="icons-book-2"></i>Module Name</h3> <h3><i class="icons-book-2"></i>Module Name</h3>
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>模組</th> <th><%= t(:module) %></th>
<th class="span2">數量</th> <th class="span2"><%= t(:quantity) %></th>
</tr> </tr>
</thead> </thead>
</table> </table>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">
<div class="track"> <div class="track">
<div class="thumb"> <div class="thumb">
<div class="end"></div> <div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>University</td>
<td class="span2">2,304</td>
</tr>
<tr>
<td>Master</td>
<td class="span2">783</td>
</tr>
<tr>
<td>Doctor</td>
<td class="span2">45</td>
</tr>
<tr>
<td>Staff</td>
<td class="span2">62</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<%
@plugins.each do |plugin|
if is_admin?
@data = plugin.app_name.classify.constantize.where(:create_user_id=>@user.id).count
else
@data = plugin.app_name.classify.constantize.where(:is_hidden=>false , :create_user_id=>@user.id).count
end
%>
<tr>
<td><%= plugin.name %></td>
<td class="span2"><%= @data %></td>
</tr>
<% end -%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -5,7 +5,8 @@
<%= render :partial => "js_and_css"%> <%= render :partial => "js_and_css"%>
<div id="filter" class="topnav clearfix"> <% content_for :right_nav do %>
<div class="searchClear pull-left" style="clear: left;"> <div class="searchClear pull-left" style="clear: left;">
<form action="" method="get"> <form action="" method="get">
<%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %> <%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
@ -35,8 +36,8 @@
</div> </div>
</div> </div>
</div>
<% end %>
<div id="list-view"> <div id="list-view">

View File

@ -5,8 +5,9 @@
<%= render :partial => "js_and_css"%> <%= render :partial => "js_and_css"%>
<div id="filter" class="topnav clearfix"> <% content_for :right_nav do %>
<div class="searchClear pull-left">
<div class="searchClear pull-left" style="clear: left;">
<form action="" method="get"> <form action="" method="get">
<%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %> <%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
<input type="hidden" name="at" id="at" value="<%= params[:at] %>" /> <input type="hidden" name="at" id="at" value="<%= params[:at] %>" />
@ -35,7 +36,8 @@
</div> </div>
</div> </div>
</div>
<% end %>
<div id="list-view"> <div id="list-view">
<ul id="member-abstract" class="clearfix"> <ul id="member-abstract" class="clearfix">

View File

@ -5,8 +5,9 @@
<%= render :partial => "js_and_css"%> <%= render :partial => "js_and_css"%>
<div id="filter" class="topnav clearfix"> <% content_for :right_nav do %>
<div class="searchClear pull-left">
<div class="searchClear pull-left" style="clear: left;">
<form action="" method="get"> <form action="" method="get">
<%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %> <%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
<input type="hidden" name="at" id="at" value="<%= params[:at] %>" /> <input type="hidden" name="at" id="at" value="<%= params[:at] %>" />
@ -35,7 +36,8 @@
</div> </div>
</div> </div>
</div>
<% end %>
<div id="list-view"> <div id="list-view">
<ul id="member-card" class="clearfix"> <ul id="member-card" class="clearfix">

View File

@ -43,7 +43,7 @@
<div class="navbar"> <div class="navbar">
<div class="navbar-inner"> <div class="navbar-inner">
<span class="brand"> <span class="brand">
<%= params[:show_plugin_profile].nil? ? t(:all_plugin_summary) : params[:show_plugin_profile] %> <%= @plugin_app_name.nil? ? t(:all_plugin_summary) : @plugin_app_name %>
</span> </span>
<ul class="nav pull-right"> <ul class="nav pull-right">
<li class="divider-vertical"></li> <li class="divider-vertical"></li>
@ -52,8 +52,8 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<% @plugins.each do |plugin| %> <% @plugins.each do |plugin| %>
<%= content_tag :li, :class=>(params[:show_plugin_profile] == plugin.name ? "active" : nil) do %> <%= content_tag :li, :class=>(params[:show_plugin_profile] == plugin.app_name ? "active" : nil) do %>
<%= link_to plugin.name, :show_plugin_profile => plugin.name %> <%= link_to plugin.name, :show_plugin_profile => plugin.app_name %>
<% end -%> <% end -%>
<% end -%> <% end -%>

View File

@ -23,8 +23,8 @@
<section id="main-wrap"> <section id="main-wrap">
<div class="wrap-inner"> <div class="wrap-inner">
<div id="filter" class="topnav clearfix"> <div id="filter" class="topnav clearfix">
<ul class="breadcrumb"> <ul class="breadcrumb text-info pull-left">
<li><a href="/orbit_4.0.1/admin/dashboards/dashboards.shtml">Dashboard</a> <span class="divider">/</span></li> <li><a href="<%= admin_users_new_interface_index_path %>">Member</a> <span class="divider">/</span></li>
<li class="active">All</li> <li class="active">All</li>
</ul> </ul>
<%= yield :right_nav %> <%= yield :right_nav %>

View File

@ -331,6 +331,12 @@ en:
password_confirmation: Password confirmation password_confirmation: Password confirmation
password_current: Current password password_current: Current password
pending: Pending pending: Pending
personal_plugins:
author : "Author"
edit_brief_intro : "Edit Brief Intro."
brief_intro : "Brief Intro."
complete_list : "Complete List"
frontend_page : "Frontend Page"
picture: Picture picture: Picture
placeholder: Field Hint placeholder: Field Hint
plugins: Plugins plugins: Plugins

View File

@ -332,6 +332,12 @@ zh_tw:
password_confirmation: 確認密碼 password_confirmation: 確認密碼
password_current: 目前的密碼 password_current: 目前的密碼
pending: 待審核 pending: 待審核
personal_plugins:
author : "著作人"
edit_brief_intro : "編輯摘要"
brief_intro : "摘要"
complete_list : "完整列表"
frontend_page : "前台呈現"
picture: 圖片 picture: 圖片
placeholder: 欄位提示文字 placeholder: 欄位提示文字
plugins: 學術資訊 plugins: 學術資訊

View File

@ -24,4 +24,4 @@ production:
# password: <%= ENV['MONGOID_PASSWORD'] %> # password: <%= ENV['MONGOID_PASSWORD'] %>
# database: <%= ENV['MONGOID_DATABASE'] %> # database: <%= ENV['MONGOID_DATABASE'] %>
<<: *defaults <<: *defaults
database: test_site database: test_site_new

View File

@ -14,6 +14,13 @@ module OrbitApp
@@registrations << DataSheet.new(name,args,:base_path=>base_path) @@registrations << DataSheet.new(name,args,:base_path=>base_path)
end end
def find_by_app_name(name)
@@registrations.each{|t|
return t if t.app_name == name
}
return nil
end
def find_by_key(key) def find_by_key(key)
@@registrations.each{|t| @@registrations.each{|t|
return t if t.name == key return t if t.name == key
@ -46,6 +53,8 @@ module OrbitApp
def initialize(name,partial=nil,*args ,&block) def initialize(name,partial=nil,*args ,&block)
@base_path = args[0][:base_path] @base_path = args[0][:base_path]
@name = partial[0][:i18n].nil? ? name : lambda{ I18n.t(partial[0][:i18n]) } @name = partial[0][:i18n].nil? ? name : lambda{ I18n.t(partial[0][:i18n]) }
@app_name = partial[0][:app_name]
@intro_app_name = partial[0][:intro_app_name]
@partial_path = '' @partial_path = ''
@front_partial_path = '' @front_partial_path = ''
@admin_partial_path = '' @admin_partial_path = ''
@ -59,6 +68,14 @@ module OrbitApp
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end end
def app_name
return @app_name
end
def intro_app_name
return @intro_app_name
end
def profile_partial_path def profile_partial_path
return @partial_path return @partial_path
end end

View File

@ -24,27 +24,29 @@
<% show_roles.attribute_fields.where(:disabled=>false).asc(:_id).each do |rf| %> <% 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).blank?
if !@member.get_attribute_value(rf)['val'].blank? if !@member.get_attribute_value(rf)['val'].blank?
@rodata = @member.get_attribute_value(rf)['val'] @rodata = @member.get_attribute_value(rf)['val']
elsif !@member.get_attribute_value(rf)[I18n.locale].blank? elsif !@member.get_attribute_value(rf)[I18n.locale].blank?
@rodata = @member.get_attribute_value(rf)[I18n.locale] @rodata = @member.get_attribute_value(rf)[I18n.locale]
else else
@rodata = nil @rodata = nil
end end
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> <tr>
<td><%= rf.title %></td> <td><%= rf.title %></td>
<td><%= nl2br(show_attribute_value(@member.get_attribute_value(rf).get_value_by_locale(I18n.locale))) rescue '' %></td> <td><%= nl2br(show_attribute_value(@member.get_attribute_value(rf).get_value_by_locale(I18n.locale))) rescue '' %></td>
</tr> </tr>
<% end -%>
<% 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)%>

View File

@ -46,38 +46,71 @@
<%= show_avatar(@member) %> <%= show_avatar(@member) %>
</div> </div>
<div class="member-module"> <div class="member-module">
<div class="module-nav"> <div class="module-nav">
<ul> <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 %> <% end %>
</ul> </ul>
</div> </div>
<div class="module-content"> <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 @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 %>"> <% if !@intro_data.blank? %>
<%= render :partial => @plugin_partial if !@plugin_partial.blank? %>
</div> <% 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 %> <% end %>
</div>
</div>
</div> </div>
</div> </div>
<%= stylesheet_link_tag "member/default_member" %> <%= stylesheet_link_tag "member/default_member" %>
<%= javascript_include_tag "member/moduletab" %> <%= javascript_include_tag "member/moduletab" %>

View File

@ -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

View File

@ -9,43 +9,19 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
end end
def index def index
get_plugins
get_plugins
get_categorys("BookPaperType",params[:book_paper_type_id]) # @tags = get_tags
@filter = params[:filter] # @categories = get_categories_for_index
new_filter = params[:new_filter] # @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
if @filter && params[:clear] @paper_type_ids = BookPaperType.all.collect{|t| t.id.to_s} + [nil]
@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
@writing_books = get_sorted_and_filtered("writing_book", :book_paper_type_id.in => @paper_type_ids)
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_books } format.xml { render :xml => @writing_books }
format.js
end end
end end
@ -59,10 +35,10 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
@tags = get_tags @tags = get_tags
@set_author_type = BookAuthorType.new(:display => 'List') @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') @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 end
@ -183,25 +159,26 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
# @level_types = BookLevelType.all # @level_types = BookLevelType.all
@author_types = BookAuthorType.all @author_types = BookAuthorType.all
@paper_types = BookPaperType.all @paper_types = BookPaperType.all
@tags = get_tags @tags = get_tags
@writing_book = WritingBook.new(params[:writing_book]) @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.create_user_id = params[:writing_book][:user_id]
@writing_book.update_user_id = params[:writing_book][:user_id] @writing_book.update_user_id = params[:writing_book][:user_id]
else 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 @writing_book.update_user_id = current_user.id
end end
respond_to do |format| respond_to do |format|
if @writing_book.save if @writing_book.save
if params[:writing_book][:user_id] 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')) } format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_book][:user_id],:show_plugin_profile=>"WritingBook")) }
else 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 end
format.xml { render :xml => @writing_book, :status => :created, :location => @writing_book } 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.html { render :action => "new" }
format.xml { render :xml => @writing_book.errors, :status => :unprocessable_entity } format.xml { render :xml => @writing_book.errors, :status => :unprocessable_entity }
end end
end end
end end
end end
@ -244,23 +223,24 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
else else
@writing_book = WritingBook.find(params[:id]) @writing_book = WritingBook.find(params[:id])
@writing_book.update_user_id = current_user.id @writing_book.update_user_id = current_user.id
params[:writing_book][:tag_ids] ||=[] params[:writing_book][:tag_ids] ||=[]
respond_to do |format| respond_to do |format|
if @writing_book.update_attributes(params[:writing_book]) if @writing_book.update_attributes(params[:writing_book])
format.html { redirect_to(panel_personal_book_back_end_writing_books_url) } format.html { redirect_to(panel_personal_book_back_end_writing_books_url) }
# format.js { render 'toggle_enable' } # format.js { render 'toggle_enable' }
format.xml { head :ok } format.xml { head :ok }
else else
format.html { render :action => "edit" } format.html { render :action => "edit" }
format.xml { render :xml => @writing_book.errors, :status => :unprocessable_entity } format.xml { render :xml => @writing_book.errors, :status => :unprocessable_entity }
end
end end
end end
end
end end
@ -283,6 +263,29 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
end end
redirect_to panel_personal_book_back_end_writing_books_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) redirect_to panel_personal_book_back_end_writing_books_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end 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 protected

View File

@ -0,0 +1,4 @@
class PersonalBookIntro < PersonalPluginIntro
end

View File

@ -1,256 +1,340 @@
<% # encoding: utf-8 %> <% # 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 %> <%= f.error_messages %>
<!--Widget start--> <!-- Input Area -->
<div class="input-area">
<div id="sub-wiget">
<div id="widget-tags" class="widget-box widget-size-300"> <!-- Module Tabs -->
<div class="widget-action clear tip" title="Setting"> <div class="nav-name"><strong><%= t(:module) %></strong></div>
<a class="action"><i class="icon-cog icon-white"></i></a> <ul class="nav nav-pills module-nav">
</div> <li></li>
<h3 class="widget-title"><i class="icons-tag"></i><%= f.label :author_type ,t("personal_book.author_type")%></h3> <li class="active">
<div class="widget-content clear form-horizontal"> <a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
<% @author_types.each do |author_type| %> </li>
<%= content_tag :label,:class => "checkbox inline" do -%> <% if show_form_status_field(@writing_book) %>
<%= check_box_tag 'writing_book[book_author_type_ids][]', author_type.id, @writing_book.book_author_type_ids.include?(author_type.id)%> <li>
<%= author_type.title %> <a href="#status" data-toggle="tab"><%= t(:status) %></a>
<%= hidden_field_tag 'writing_book[book_author_type_ids][]', '' %> </li>
<% end %> <% 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 %> <% 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 %> <% end %>
</div>
<div class="title"> </div>
<%= 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 class="title"> <!-- Category -->
<%= f.label :authors,t("web_resource.authors") %> <div class="control-group">
<%= f.fields_for :authors_translations do |f| %> <label class="control-label muted"><%= t("personal_book.book_paper_type") %></label>
<%= I18nVariable.from_locale(locale) %> <div class="controls">
<%= f.text_area locale, :size => "60x3", :value => (@writing_book.authors_translations[locale] rescue nil) %> <%= f.select :book_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]} %>
<% end %> </div>
</div> </div>
</div>
<% end %> <!-- year -->
<div class="control-group">
</div> <label class="control-label muted"><%= t("personal_book.year") %></label>
<div class="controls">
<div class="title"> <%= 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'} ) %>
<%= f.label :publication_date ,t("personal_book.publication_date")%> </div>
<%= 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"> <!-- publish_date -->
<%= f.label :url, t("personal_book.url") %> <div class="control-group">
<%= f.text_field :url %> <label class="control-label muted"><%= t("personal_book.publish_date") %></label>
</div> <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 class="title"> </div>
<%= f.label :keywords, t("personal_book.keywords") %> </div>
<%= f.text_field :keywords %>
</div>
<div class="title"> <!-- publication_date -->
<%= f.label :pages, t("personal_book.pages") %> <div class="control-group">
<%= f.text_field :pages %> <label class="control-label muted"><%= t("personal_book.publication_date") %></label>
</div> <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"> <!-- url -->
<%= f.label :isbn, t("personal_book.isbn") %> <div class="control-group">
<%= f.text_field :isbn %> <label class="control-label muted"><%= t("personal_book.url") %></label>
</div> <div class="controls">
<%= f.text_field :url , :class => "span6" %>
<div id="title"> </div>
<%= f.label :language, t("personal_book.language") %> </div>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_book.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_book.English") %>
</div>
<div class="title"> <!-- keywords -->
<%= f.label :note, t("personal_book.note") %> <div class="control-group">
<%= f.text_area :note, :size => "60x3" %> <label class="control-label muted"><%= t("personal_book.keywords") %></label>
</div> <div class="controls">
<%= f.text_field :keywords %>
</div> </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-->
<!-- pages -->
<div class="form-actions"> <div class="control-group">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> <label class="control-label muted"><%= t("personal_book.pages") %></label>
<%= f.submit t('submit'), :class=>'btn btn-primary' %> <div class="controls">
<%= link_to t('cancel'), get_go_back, :class=>"btn" %> <%= f.text_field :pages %>
</div> </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 %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %> <script>
<script> $(document).ready(function() {
$('#add_plugin_file a.add').live('click', function(){ $('.main-forms .add-on').tooltip();
var new_id = $(this).prev().attr('value'); $(document).on('click', '#add_file', function(){
var old_id = new RegExp("new_add_plugin_files", "g"); var new_id = $(this).prev().attr('value');
$(this).prev().attr('value', parseInt(new_id) + 1); var old_id = new RegExp("new_writing_book_files", "g");
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_book_files) %>").replace(old_id, new_id)); 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);
$('.add_plugin_files_block a.delete').live('click', function(){ $(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_book_files) %>").replace(old_id, new_id));
$(this).parents('.list_item').remove(); $(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');
});
$('.action a.remove_existing_record').live('click', function(){ formTip();
$(this).next('.should_destroy').attr('value', 1); });
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); $(document).on('click', '.delete_file', function(){
}); $(this).parents('.input-prepend').remove();
});
</script> $(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 %> <% end %>

View File

@ -1,50 +1,45 @@
<% # encoding: utf-8 %> <% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'> <% else %>
<td> <div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<div class="control-group"> <% if form_file.file.blank? %>
<div class="controls"> <%= t(:no_file) %>
<%= f.file_field :file %> <% else %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> <%= 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} %>
</div> <% end %>
</div> <% end %>
</td> <div class="input-prepend input-append">
<td> <label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<div class="tab-content"> <i class="icons-paperclip"></i>
<%= f.file_field :file %>
<% @site_valid_locales.each_with_index do |locale, i| %> </span>
<div class="uneditable-input input-medium">
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> <i class="icon-file fileupload-exists"></i>
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %> <span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
<%= f.fields_for :file_title_translations do |f| %> </div>
<div class="control-group"> </label>
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label> <span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<div class="controls"> <span class="tab-content">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %> <% @site_valid_locales.each_with_index do |locale, i| %>
</div> <span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
</div> <%= f.fields_for :title_translations do |f| %>
<% end %> <%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</div> </span>
<% end %>
<% end %> </span>
</span>
</div> <% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
</td> <a class="icon-trash"></a>
</span>
<td> <% else %>
<span class="action"> <span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<% if form_file.new_record? %> <%= f.hidden_field :id %>
<a class="delete"><i class="icon-remove"></i></a> <a class="icon-remove"></a>
<% else %> <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
<%= f.hidden_field :id %> </span>
<a class="remove_existing_record"><i class="icon-remove"></i></a> <% end %>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> </div>
<% end %> </div>
</span>
</td>
</tr>

View File

@ -1,9 +1,4 @@
<tr id="<%= dom_id writing_book %>" class="with_action"> <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"><%= writing_book.year %></td>
<td class="span1"> <td class="span1">
<%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %> <%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %>

View File

@ -9,8 +9,8 @@
</div> </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: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= 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} %>
<%= render :partial => 'form', :locals => {:f => f} %> </fieldset>
<% end %> <% end %>

View File

@ -13,10 +13,9 @@
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1"></th> <th class="span1"><%= t("personal_book.year") %></th>
<th class="span1"></th> <th class="span7"><%= t("personal_book.book_title") %></th>
<th class="span1"></th> <th class="span1"><%= t("personal_plugins.author") %></th>
<th class="span1"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_writing_books" class="sort-holder"> <tbody id="tbody_writing_books" class="sort-holder">
@ -24,10 +23,13 @@
</tbody> </tbody>
</table> </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-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' %> <%= 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"> </div>
<%= paginate @books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <div class="pagination pagination-centered">
<%= paginate @writing_books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </div>
</div> </div>

View File

@ -7,16 +7,10 @@
<%= render :partial => 'admin/plugins/plugin_list' %> <%= render :partial => 'admin/plugins/plugin_list' %>
</div> </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 %>
<%= 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 %>

View File

@ -15,7 +15,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">
@ -41,7 +41,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">

View File

@ -1,42 +1,50 @@
<% <%
if @member 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"> <div class="info">
<thead> <%= @writing_book_intro.text.html_safe rescue '' %>
<tr> </div>
<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> <% end %>
</table>
<% 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 %> <% end %>

View File

@ -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] @filter = params[:filter]
new_filter = params[:new_filter] new_filter = params[:new_filter]
@ -17,17 +24,29 @@
end end
if @user if @user && is_admin?
@writing_books = WritingBook.where(:create_user_id => @user.id).page(params[:page]).per(10) @writing_books = WritingBook.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else 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 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"> <table class="table table-condensed table-striped">
<thead> <thead>
<tr> <tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_book.year') %></th> <th class="span1"><%= t('personal_book.year') %></th>
<th><%= t('personal_book.book_title') %></th> <th><%= t('personal_book.book_title') %></th>
</tr> </tr>
@ -36,7 +55,12 @@
<% @writing_books.each do |writing_book| %> <% @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><%= writing_book.year %></td>
<td> <td>
<%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %> <%= link_to writing_book.create_link, panel_personal_book_front_end_writing_book_path(writing_book) %>
@ -48,11 +72,25 @@
</tbody> </tbody>
</table> </table>
<% if is_admin? %>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <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' %> <%= 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>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= paginate @writing_books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <%= paginate @writing_books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </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>

View File

@ -9,10 +9,13 @@ Rails.application.routes.draw do
namespace :back_end do namespace :back_end do
match 'writing_book_setting' => "writing_books#writing_book_setting" ,:as => :writing_book_setting 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 resources :writing_books do
collection do collection do
get 'delete' get 'delete'
get 'data_share'
end end
match "author_type_quick_add" => "writing_books#author_type_quick_add" ,:as => :author_type_quick_add 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_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 match "paper_type_quick_edit" => "writing_books#paper_type_quick_edit" ,:as => :paper_type_quick_edit
end end
resources :book_paper_types
resources :book_author_types resources :personal_book_intros
resources :book_paper_types
resources :book_author_types
resources :tags resources :tags
end end
namespace :front_end do namespace :front_end do

View File

@ -2,7 +2,7 @@ module PersonalBook
OrbitApp.registration "PersonalBook",:type=> 'ModuleApp' do OrbitApp.registration "PersonalBook",:type=> 'ModuleApp' do
module_label 'module_name.personal_book' module_label 'module_name.personal_book'
base_url File.expand_path File.dirname(__FILE__) 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'

View File

@ -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

View File

@ -9,43 +9,19 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
end end
def index def index
get_plugins
get_plugins
get_categorys("ConferencePaperType",params[:conference_paper_type_id]) # @tags = get_tags
@filter = params[:filter] # @categories = get_categories_for_index
new_filter = params[:new_filter] # @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
if @filter && params[:clear] @paper_type_ids = ConferencePaperType.all.collect{|t| t.id.to_s} + [nil]
@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
@writing_conferences = get_sorted_and_filtered("writing_conference", :conference_paper_type_id.in => @paper_type_ids)
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_conferences } format.xml { render :xml => @writing_conferences }
format.js
end end
end end
@ -59,10 +35,10 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
@tags = get_tags @tags = get_tags
@set_author_type = ConferenceAuthorType.new(:display => 'List') @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') @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 end
@ -181,25 +157,25 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
# @paper_types = ConferenceLevelType.all # @paper_types = ConferenceLevelType.all
@author_types = ConferenceAuthorType.all @author_types = ConferenceAuthorType.all
@paper_types = ConferencePaperType.all @paper_types = ConferencePaperType.all
@tags = get_tags @tags = get_tags
@writing_conference = WritingConference.new(params[:writing_conference]) @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.create_user_id = params[:writing_conference][:user_id]
@writing_conference.update_user_id = params[:writing_conference][:user_id] @writing_conference.update_user_id = params[:writing_conference][:user_id]
else 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 @writing_conference.update_user_id = current_user.id
end end
respond_to do |format| respond_to do |format|
if @writing_conference.save if @writing_conference.save
if params[:writing_conference][:user_id] 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')) } format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_conference][:user_id],:show_plugin_profile=>'WritingConference')) }
else 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 end
format.xml { render :xml => @writing_conference, :status => :created, :location => @writing_conference } format.xml { render :xml => @writing_conference, :status => :created, :location => @writing_conference }
@ -242,23 +218,24 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
else 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| respond_to do |format|
if @writing_conference.update_attributes(params[:writing_conference]) if @writing_conference.update_attributes(params[:writing_conference])
format.html { redirect_to(panel_personal_conference_back_end_writing_conferences_url) } format.html { redirect_to(panel_personal_conference_back_end_writing_conferences_url) }
# format.js { render 'toggle_enable' } # format.js { render 'toggle_enable' }
format.xml { head :ok } format.xml { head :ok }
else else
format.html { render :action => "edit" } format.html { render :action => "edit" }
format.xml { render :xml => @writing_conference.errors, :status => :unprocessable_entity } format.xml { render :xml => @writing_conference.errors, :status => :unprocessable_entity }
end
end end
end end
end
end end
@ -281,6 +258,30 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
end end
redirect_to panel_personal_conference_back_end_writing_conferences_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) redirect_to panel_personal_conference_back_end_writing_conferences_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end 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 protected

View File

@ -0,0 +1,4 @@
class PersonalConferenceIntro < PersonalPluginIntro
end

View File

@ -1,258 +1,333 @@
<% # encoding: utf-8 %> <% # 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 %> <%= f.error_messages %>
<!--Widget start--> <!-- Input Area -->
<div class="input-area">
<div id="sub-wiget">
<div id="widget-tags" class="widget-box widget-size-300"> <!-- Module Tabs -->
<div class="widget-action clear tip" title="Setting"> <div class="nav-name"><strong><%= t(:module) %></strong></div>
<a class="action"><i class="icon-cog icon-white"></i></a> <ul class="nav nav-pills module-nav">
</div> <li></li>
<h3 class="widget-title"><i class="icons-tag"></i><%= f.label :paper_type ,t("personal_conference.paper_type")%></h3> <li class="active">
<div class="widget-content clear form-horizontal"> <a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
<% @paper_types.each do |paper_type| %> </li>
<%= content_tag :label,:class => "checkbox inline" do -%> <% if show_form_status_field(@writing_conference) %>
<%= check_box_tag 'writing_conference[conference_paper_type_ids][]', paper_type.id, @writing_conference.conference_paper_type_ids.include?(paper_type.id)%> <li>
<%= paper_type.title %> <a href="#status" data-toggle="tab"><%= t(:status) %></a>
<%= hidden_field_tag 'writing_conference[conference_paper_type_ids][]', '' %> </li>
<% end %> <% end %>
<% end %> <li>
</div> <a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</div> </li>
</ul>
<div id="widget-tags" class="widget-box widget-size-300"> <!-- Module -->
<div class="widget-action clear tip" title="Setting"> <div class="tab-content module-area">
<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>
<div id="widget-tags" class="widget-box widget-size-300"> <!-- Basic Module -->
<div class="widget-action clear tip" title="Setting"> <div class="tab-pane fade in active" id="basic">
<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-->
<div id="post-body"> <% if !params[:user_id].blank? %>
<div id="post-body-content" class="clear">
<div class="control-group">
<% if !params[:user_id].blank? %> <label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<div class="span6"> <%= User.from_id(params[:user_id]).name rescue ''%>
<%= t("著作人")%> </div>
<%= User.from_id(params[:user_id]).name rescue ''%> </div>
</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>
<div class="title"> <% end %>
<%= 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 %> <!-- paper_type -->
<div class="control-group">
</div> <label class="control-label muted"><%= t("personal_conference.paper_type") %></label>
<div class="controls">
<div class="title"> <% @paper_types.each do |paper_type| %>
<%= f.label :publication_date ,t("personal_conference.publication_date")%> <%= content_tag :label,:class => "checkbox inline" do -%>
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month, :day] }, {:class => 'span1'} %> <%= check_box_tag 'writing_conference[conference_paper_type_ids][]', paper_type.id, @writing_conference.conference_paper_type_ids.include?(paper_type.id)%>
</div> <%= paper_type.title %>
<%= hidden_field_tag 'writing_conference[conference_paper_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<div class="title"> <!-- author_type -->
<%= f.label :url, t("personal_conference.url") %> <div class="control-group">
<%= f.text_field :url %> <label class="control-label muted"><%= t("personal_conference.author_type") %></label>
</div> <div class="controls">
<% @author_types.each do |author_type| %>
<div class="title"> <%= content_tag :label,:class => "checkbox inline" do -%>
<%= f.label :keywords, t("personal_conference.keywords") %> <%= check_box_tag 'writing_conference[conference_author_type_ids][]', author_type.id, @writing_conference.conference_author_type_ids.include?(author_type.id)%>
<%= f.text_field :keywords %> <%= author_type.title %>
</div> <%= hidden_field_tag 'writing_conference[conference_author_type_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
<div class="title"> <!-- year -->
<%= f.label :abstract, t("personal_conference.abstract") %> <div class="control-group">
<%= f.text_field :abstract %> <label class="control-label muted"><%= t("personal_conference.year") %></label>
</div> <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"> <!-- period_start_date -->
<%= f.label :language, t("personal_journal.language") %> <div class="control-group">
<%= f.select :language, WritingConference::LANGUAGE_TYPES, :prompt => 'Select' %> <label class="control-label muted"><%= t("personal_conference.period_start_date") %></label>
</div> <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 %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %> <script>
<script> $(document).ready(function() {
$('#add_plugin_file a.add').live('click', function(){ $('.main-forms .add-on').tooltip();
var new_id = $(this).prev().attr('value'); $(document).on('click', '#add_file', function(){
var old_id = new RegExp("new_add_plugin_files", "g"); var new_id = $(this).prev().attr('value');
$(this).prev().attr('value', parseInt(new_id) + 1); var old_id = new RegExp("new_writing_conference_files", "g");
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_conference_files) %>").replace(old_id, new_id)); 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);
$('.add_plugin_files_block a.delete').live('click', function(){ $(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_conference_files) %>").replace(old_id, new_id));
$(this).parents('.list_item').remove(); $(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');
});
$('.action a.remove_existing_record').live('click', function(){ formTip();
$(this).next('.should_destroy').attr('value', 1); });
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); $(document).on('click', '.delete_file', function(){
}); $(this).parents('.input-prepend').remove();
});
</script> $(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 %> <% end %>

View File

@ -1,50 +1,45 @@
<% # encoding: utf-8 %> <% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'> <% else %>
<td> <div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<div class="control-group"> <% if form_file.file.blank? %>
<div class="controls"> <%= t(:no_file) %>
<%= f.file_field :file %> <% else %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> <%= 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} %>
</div> <% end %>
</div> <% end %>
</td> <div class="input-prepend input-append">
<td> <label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<div class="tab-content"> <i class="icons-paperclip"></i>
<%= f.file_field :file %>
<% @site_valid_locales.each_with_index do |locale, i| %> </span>
<div class="uneditable-input input-medium">
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> <i class="icon-file fileupload-exists"></i>
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %> <span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
<%= f.fields_for :file_title_translations do |f| %> </div>
<div class="control-group"> </label>
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label> <span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<div class="controls"> <span class="tab-content">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %> <% @site_valid_locales.each_with_index do |locale, i| %>
</div> <span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
</div> <%= f.fields_for :title_translations do |f| %>
<% end %> <%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</div> </span>
<% end %>
<% end %> </span>
</span>
</div> <% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
</td> <a class="icon-trash"></a>
</span>
<td> <% else %>
<span class="action"> <span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<% if form_file.new_record? %> <%= f.hidden_field :id %>
<a class="delete"><i class="icon-remove"></i></a> <a class="icon-remove"></a>
<% else %> <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
<%= f.hidden_field :id %> </span>
<a class="remove_existing_record"><i class="icon-remove"></i></a> <% end %>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> </div>
<% end %> </div>
</span>
</td>
</tr>

View File

@ -1,9 +1,4 @@
<tr id="<%= dom_id writing_conference %>" class="with_action"> <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><%= writing_conference.year %></td>
<td> <td>
<%= link_to writing_conference.create_link, panel_personal_conference_front_end_writing_conference_path(writing_conference) %> <%= link_to writing_conference.create_link, panel_personal_conference_front_end_writing_conference_path(writing_conference) %>

View File

@ -8,8 +8,8 @@
</div> </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: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= 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} %>
<%= render :partial => 'form', :locals => {:f => f} %> </fieldset>
<% end %> <% end %>

View File

@ -13,10 +13,9 @@
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1"></th> <th class="span1"><%= t("personal_book.year") %></th>
<th class="span1"></th> <th class="span7"><%= t("module_name.personal_conference") %></th>
<th class="span1"></th> <th class="span1"><%= t("personal_plugins.author") %></th>
<th class="span1"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_writing_conferences" class="sort-holder"> <tbody id="tbody_writing_conferences" class="sort-holder">
@ -24,10 +23,12 @@
</tbody> </tbody>
</table> </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-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' %> <%= 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"> </div>
<%= paginate @conferences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <div class="pagination pagination-centered">
<%= paginate @writing_conferences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </div>
</div> </div>

View File

@ -8,14 +8,8 @@
</div> </div>
<%= flash_messages %> <%= form_for @writing_conference, url: panel_personal_conference_back_end_writing_conferences_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<div id="poststuff"> <%= render partial: 'form', locals: {f: f} %>
<h1><%= t('writing_conference.new_personal_conference') %></h1> </fieldset>
<%= form_for @writing_conference, :url => panel_personal_conference_back_end_writing_conferences_path, :html => {:class => 'clear'} do |f| %> <% end %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>

View File

@ -15,7 +15,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">
@ -41,7 +41,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">

View File

@ -1,42 +1,50 @@
<% <%
if @member 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"> <div class="info">
<thead> <%= @writing_conference_intro.text.html_safe rescue '' %>
<tr> </div>
<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> <% end %>
</table>
<% 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 %> <% end %>

View File

@ -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] @filter = params[:filter]
new_filter = params[:new_filter] new_filter = params[:new_filter]
@ -17,18 +24,29 @@
end end
if @user if @user && is_admin?
@writing_conferences = WritingConference.where(:create_user_id => @user.id).page(params[:page]).per(10) @writing_conferences = WritingConference.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else 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 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"> <table class="table table-condensed table-striped">
<thead> <thead>
<tr> <tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_conference.year') %></th> <th class="span1"><%= t('personal_conference.year') %></th>
<th><%= t('module_name.personal_conference') %></th> <th><%= t('module_name.personal_conference') %></th>
</tr> </tr>
@ -37,7 +55,12 @@
<% @writing_conferences.each do |writing_conference| %> <% @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><%= writing_conference.year %></td>
<td> <td>
<%= link_to writing_conference.create_link, panel_personal_conference_front_end_writing_conference_path(writing_conference) %> <%= link_to writing_conference.create_link, panel_personal_conference_front_end_writing_conference_path(writing_conference) %>
@ -49,11 +72,25 @@
</tbody> </tbody>
</table> </table>
<% if is_admin? %>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <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' %> <%= 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>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= paginate @writing_conferences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <%= paginate @writing_conferences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </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>

View File

@ -1,7 +1,7 @@
en: en:
module_name: module_name:
personal_conference: Conference personal_conference: Conference Paper
personal_conference: personal_conference:
year : "Year" year : "Year"

View File

@ -14,12 +14,14 @@ Rails.application.routes.draw do
resources :writing_conferences do resources :writing_conferences do
collection do collection do
get 'delete' get 'delete'
get 'data_share'
end end
match "author_type_quick_add" => "writing_conferences#author_type_quick_add" ,:as => :author_type_quick_add 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 "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_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 match "paper_type_quick_edit" => "writing_conferences#paper_type_quick_edit" ,:as => :paper_type_quick_edit
end end
resources :personal_conference_intros
resources :conference_paper_types resources :conference_paper_types
resources :conference_author_types resources :conference_author_types
# resources :conference_level_types # resources :conference_level_types

View File

@ -2,7 +2,7 @@ module PersonalConference
OrbitApp.registration "PersonalConference",:type=> 'ModuleApp' do OrbitApp.registration "PersonalConference",:type=> 'ModuleApp' do
module_label 'module_name.personal_conference' module_label 'module_name.personal_conference'
base_url File.expand_path File.dirname(__FILE__) 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'

View File

@ -3,38 +3,20 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
include OrbitControllerLib::DivisionForDisable include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user! before_filter :authenticate_user!
def index def index
get_plugins
get_plugins
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear] # @tags = get_tags
@filter.delete(params[:type]) # @categories = get_categories_for_index
elsif @filter && new_filter # @statuses = get_statuses
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s) # category_ids = @categories.collect{|t| t.id}
@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
@diplomas = get_sorted_and_filtered("diploma")
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js { }
format.xml { render :xml => @diplomas } format.xml { render :xml => @diplomas }
format.js
end end
end end
@ -86,25 +68,25 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
# POST /diplomas.xml # POST /diplomas.xml
def create def create
@tags = get_tags @tags = get_tags
@diploma = Diploma.new(params[:diploma]) @diploma = Diploma.new(params[:diploma])
if params[:diploma][:user_id] if params[:diploma][:user_id]
@diploma.create_user_id = params[:diploma][:user_id] @diploma.create_user_id = params[:diploma][:user_id]
@diploma.update_user_id = params[:diploma][:user_id] @diploma.update_user_id = params[:diploma][:user_id]
else else
@diploma.create_user_id = current_user.id @diploma.create_user_id = current_user.id
@diploma.update_user_id = current_user.id @diploma.update_user_id = current_user.id
end end
respond_to do |format| respond_to do |format|
if @diploma.save 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')) } format.html { redirect_to(admin_users_new_interface_url(:id=>params[:diploma][:user_id],:show_plugin_profile=>'Diploma')) }
else else
format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) } format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) }
end end
format.xml { render :xml => @diploma, :status => :created, :location => @diploma } 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 } format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity }
end end
end end
end end
# PUT /diplomas/1 # PUT /diplomas/1
@ -123,18 +106,19 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
@diploma.update_user_id = current_user.id @diploma.update_user_id = current_user.id
params[:diploma][:tag_ids] ||=[] params[:diploma][:tag_ids] ||=[]
respond_to do |format| respond_to do |format|
if @diploma.update_attributes(params[:diploma]) if @diploma.update_attributes(params[:diploma])
format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) } 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 } format.xml { head :ok }
else else
format.html { render :action => "edit" } format.html { render :action => "edit" }
format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity } format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity }
end end
end end
end end
# DELETE /diplomas/1 # DELETE /diplomas/1
@ -156,6 +140,29 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
end end
redirect_to panel_personal_diploma_back_end_diplomas_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) redirect_to panel_personal_diploma_back_end_diplomas_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end 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 protected

View File

@ -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

View File

@ -0,0 +1,4 @@
class PersonalDiplomaIntro < PersonalPluginIntro
end

View File

@ -1,9 +1,4 @@
<tr id="<%= dom_id diploma %>" class="with_action"> <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.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %></td>
<td class="span1"> <td class="span1">
<%= diploma.school_name %> <%= diploma.school_name %>

View File

@ -1,136 +1,210 @@
<% # encoding: utf-8 %> <% # 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 %> <%= f.error_messages %>
<!--Widget start--> <!-- Input Area -->
<div class="input-area">
<div id="sub-wiget">
<div id="widget-tags" class="widget-box widget-size-300"> <!-- Module Tabs -->
<div class="widget-action clear tip" title="Setting"> <div class="nav-name"><strong><%= t(:module) %></strong></div>
<a class="action"><i class="icon-cog icon-white"></i></a> <ul class="nav nav-pills module-nav">
</div> <li></li>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3> <li class="active">
<div class="widget-content clear form-horizontal"> <a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
<% @tags.each do |tag| %> </li>
<%= content_tag :label,:class => "checkbox inline" do -%> <% if show_form_status_field(@diploma) %>
<%= check_box_tag 'diploma[tag_ids][]', tag.id, @diploma.tag_ids.include?(tag.id)%> <li>
<%= tag.name %> <a href="#status" data-toggle="tab"><%= t(:status) %></a>
<%= hidden_field_tag 'diploma[tag_ids][]', '' %> </li>
<% end %> <% end %>
<% end %> <li>
</div> <a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</div> </li>
</ul>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body"> <!-- Module -->
<div id="post-body-content" class="clear"> <div class="tab-content module-area">
<% 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>
<% end %> <!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
</div>
<div class="title"> <% if !params[:user_id].blank? %>
<%= f.label :url, t("personal_diploma.url") %>
<%= f.text_field :url %> <div class="control-group">
</div> <label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<div class="title"> <%= User.from_id(params[:user_id]).name rescue ''%>
<%= f.label :keywords, t("personal_diploma.keywords") %> </div>
<%= f.text_field :keywords %> </div>
</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>
<div class="title"> <% end %>
<%= f.label :note, t("personal_diploma.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
</div>
<!--Post End-->
<!-- start_date -->
<div class="form-actions"> <div class="control-group">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> <label class="control-label muted"><%= t("personal_diploma.start_date") %></label>
<%= f.submit t('submit'), :class=>'btn btn-primary' %> <div class="controls">
<%= link_to t('cancel'), get_go_back, :class=>"btn" %> <%= 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>
</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>

View File

@ -1,12 +1,15 @@
<% content_for :side_bar do %> <% 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'} %> <%= 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 %> <% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %> <%= 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| %> <%= form_for @diploma, url: panel_personal_diploma_back_end_diploma_path(@diploma), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %> <fieldset>
<% end %> <%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -13,10 +13,9 @@
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1"></th> <th class="span2"><%= t('date_') %></th>
<th class="span1"></th> <th class="span5"><%= t('personal_diploma.school_name') %></th>
<th class="span1"></th> <th class="span1"><%= t("personal_plugins.author") %></th>
<th class="span1"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_diplomas" class="sort-holder"> <tbody id="tbody_diplomas" class="sort-holder">
@ -24,10 +23,12 @@
</tbody> </tbody>
</table> </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-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' %> <%= 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"> </div>
<%= paginate @diplomas_page, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <div class="pagination pagination-centered">
<%= paginate @diplomas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </div>
</div> </div>

View File

@ -1,18 +1,15 @@
<% content_for :side_bar do %> <% 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'} %> <%= 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 %> <% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %> <%= 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> </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 %>

View File

@ -1,38 +1,48 @@
<% <%
if @member if @member
@diplomas = Diploma.where(:create_user_id => @member.id).desc(:start_date)
else @diplomas = Diploma.where(is_hidden: false, :create_user_id => @member.id).desc(:start_date)
@diplomas = Diploma.all.desc(:start_date)
end @diploma_intro = !PersonalDiplomaIntro.where(:user_id => @member.id).blank? ? PersonalDiplomaIntro.where(:user_id => @member.id).first : PersonalDiplomaIntro.new
%> %>
<% if !@diplomas.blank? %>
<table class="table"> <% if @diploma_intro.brief_intro and !@diploma_intro.blank? %>
<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> <div class="info">
</table> <%= @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 %> <% end %>

View File

@ -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] @filter = params[:filter]
new_filter = params[:new_filter] new_filter = params[:new_filter]
@ -17,17 +24,29 @@
end end
if @user if @user && is_admin?
@diplomas = Diploma.where(:create_user_id => @user.id).page(params[:page]).per(10) @diplomas = Diploma.where(:create_user_id => @user.id).desc(:start_date).page(params[:page]).per(10)
else 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 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"> <table class="table table-condensed table-striped">
<thead> <thead>
<tr> <tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span2"><%= t('date_') %></th> <th class="span2"><%= t('date_') %></th>
<th><%= t('personal_diploma.school_name') %></th> <th><%= t('personal_diploma.school_name') %></th>
</tr> </tr>
@ -36,7 +55,12 @@
<% @diplomas.each do |diploma| %> <% @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><%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %></td>
<td> <td>
<%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %> <%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %>
@ -48,11 +72,25 @@
</tbody> </tbody>
</table> </table>
<% if is_admin? %>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <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' %> <%= 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>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= paginate @diplomas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <%= paginate @diplomas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </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>

View File

@ -13,9 +13,11 @@ Rails.application.routes.draw do
resources :diplomas do resources :diplomas do
collection do collection do
get 'delete' get 'delete'
get 'data_share'
end end
end end
resources :personal_diploma_intros
resources :tags resources :tags
end end
namespace :front_end do namespace :front_end do

View File

@ -2,7 +2,7 @@ module PersonalDiploma
OrbitApp.registration "PersonalDiploma",:type=> 'ModuleApp' do OrbitApp.registration "PersonalDiploma",:type=> 'ModuleApp' do
module_label 'module_name.personal_diploma' module_label 'module_name.personal_diploma'
base_url File.expand_path File.dirname(__FILE__) 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'

View File

@ -10,40 +10,19 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
end end
def index def index
get_plugins
get_plugins
get_categorys("ExperienceCategory",params[:experience_category_ids]) # @tags = get_tags
@filter = params[:filter] # @categories = get_categories_for_index
new_filter = params[:new_filter] # @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
if @filter && params[:clear] @experience_category_ids = ExperienceCategory.all.collect{|t| t.id.to_s} + [nil]
@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
@experiences = get_sorted_and_filtered("experience", :experience_category_id.in => @experience_category_ids)
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js { }
format.xml { render :xml => @experiences } format.xml { render :xml => @experiences }
format.js
end end
end end
@ -56,7 +35,7 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
@tags = get_tags @tags = get_tags
@set_experience_type = ExperienceCategory.new(:display => 'List') @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 end
@ -138,25 +117,25 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
else else
@experience_types = ExperienceCategory.all @experience_types = ExperienceCategory.all
@tags = get_tags @tags = get_tags
@experience = Experience.new(params[:experience]) @experience = Experience.new(params[:experience])
if params[:experience][:user_id] if params[:experience][:user_id]
@experience.create_user_id = params[:experience][:user_id] @experience.create_user_id = params[:experience][:user_id]
@experience.update_user_id = params[:experience][:user_id] @experience.update_user_id = params[:experience][:user_id]
else else
@experience.create_user_id = current_user.id @experience.create_user_id = current_user.id
@experience.update_user_id = current_user.id @experience.update_user_id = current_user.id
end end
respond_to do |format| respond_to do |format|
if @experience.save if @experience.save
if params[:experience][:user_id] if params[:experience][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:experience][:user_id],:show_plugin_profile=>'Experience')) } format.html { redirect_to(admin_users_new_interface_url(:id=>params[:experience][:user_id],:show_plugin_profile=>"Experience")) }
else else
format.html { redirect_to(panel_personal_experience_back_end_experiences_url) } format.html { redirect_to(panel_personal_experience_back_end_experiences_url) }
end end
format.xml { render :xml => @experience, :status => :created, :location => @experience } 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 @experience.update_user_id = current_user.id
params[:experience][:tag_ids] ||=[] params[:experience][:tag_ids] ||=[]
respond_to do |format| respond_to do |format|
if @experience.update_attributes(params[:experience]) if @experience.update_attributes(params[:experience])
format.html { redirect_to(panel_personal_experience_back_end_experiences_url) } 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 } format.xml { head :ok }
else else
format.html { render :action => "edit" } format.html { render :action => "edit" }
format.xml { render :xml => @experience.errors, :status => :unprocessable_entity } format.xml { render :xml => @experience.errors, :status => :unprocessable_entity }
end end
end end
end end
end end
@ -226,6 +206,29 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
end end
redirect_to panel_personal_experience_back_end_experiences_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) redirect_to panel_personal_experience_back_end_experiences_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end 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 protected

View File

@ -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

View File

@ -0,0 +1,4 @@
class PersonalExperienceIntro < PersonalPluginIntro
end

View File

@ -1,9 +1,4 @@
<tr id="<%= dom_id experience %>" class="with_action"> <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.start_date.strftime("%Y.%m") %> ~ <%= experience.end_date.strftime("%Y.%m") %></td>
<td class="span1"> <td class="span1">
<%= experience.organizationt_title %> <%= experience.organizationt_title %>

View File

@ -1,133 +1,208 @@
<% # encoding: utf-8 %> <% # 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 %> <%= f.error_messages %>
<!--Widget start--> <!-- Input Area -->
<div class="input-area">
<div id="sub-wiget">
<div id="widget-tags" class="widget-box widget-size-300"> <!-- Module Tabs -->
<div class="widget-action clear tip" title="Setting"> <div class="nav-name"><strong><%= t(:module) %></strong></div>
<a class="action"><i class="icon-cog icon-white"></i></a> <ul class="nav nav-pills module-nav">
</div> <li></li>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3> <li class="active">
<div class="widget-content clear form-horizontal"> <a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
<% @tags.each do |tag| %> </li>
<%= content_tag :label,:class => "checkbox inline" do -%> <% if show_form_status_field(@experience) %>
<%= check_box_tag 'experience[tag_ids][]', tag.id, @experience.tag_ids.include?(tag.id)%> <li>
<%= tag.name %> <a href="#status" data-toggle="tab"><%= t(:status) %></a>
<%= hidden_field_tag 'experience[tag_ids][]', '' %> </li>
<% end %> <% end %>
<% end %> <li>
</div> <a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</div> </li>
</ul>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body"> <!-- Module -->
<div id="post-body-content" class="clear"> <div class="tab-content module-area">
<% 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>
<% end %> <!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
</div>
<div class="title"> <% if !params[:user_id].blank? %>
<%= f.label :url, t("personal_experience.url") %>
<%= f.text_field :url %> <div class="control-group">
</div> <label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<div class="title"> <%= User.from_id(params[:user_id]).name rescue ''%>
<%= f.label :keywords, t("personal_experience.keywords") %> </div>
<%= f.text_field :keywords %> </div>
</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>
<div class="title"> <% end %>
<%= f.label :note, t("personal_experience.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
</div>
<!--Post End-->
<!-- experience_category -->
<div class="form-actions"> <div class="control-group">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> <label class="control-label muted"><%= t("personal_experience.experience_category") %></label>
<%= f.submit t('submit'), :class=>'btn btn-primary' %> <div class="controls">
<%= link_to t('cancel'), get_go_back, :class=>"btn" %> <%= f.select :experience_category_id, @experience_categorys.collect {|t| [ t.title, t.id ]} %>
</div> </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>

View File

@ -8,8 +8,8 @@
</div> </div>
<h1><%= t('personal_experience.editing_personal_experience') %></h1> <%= form_for @experience, url: panel_personal_experience_back_end_experience_path(@experience), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= form_for @experience, :url => panel_personal_experience_back_end_experience_path(@experience), :html => {:class => 'clear'} do |f| %> <%= render partial: 'form', locals: {f: f} %>
<%= render :partial => 'form', :locals => {:f => f} %> </fieldset>
<% end %> <% end %>

View File

@ -15,7 +15,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">

View File

@ -13,12 +13,11 @@
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1"></th> <th class="span2"><%= t('date_') %></th>
<th class="span1"></th> <th class="span2"><%= t('personal_experience.organizationt_title') %></th>
<th class="span1"></th> <th class="span2"><%= t('personal_experience.department') %></th>
<th class="span1"></th> <th class="span2"><%= t('personal_experience.job_title') %></th>
<th class="span1"></th> <th class="span1"><%= t("personal_plugins.author") %></th>
<th class="span1"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_experiences" class="sort-holder"> <tbody id="tbody_experiences" class="sort-holder">
@ -26,10 +25,12 @@
</tbody> </tbody>
</table> </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-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' %> <%= 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"> </div>
<%= paginate @experience_pages, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <div class="pagination pagination-centered">
<%= paginate @experiences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </div>
</div> </div>

View File

@ -8,14 +8,8 @@
</div> </div>
<%= flash_messages %> <%= form_for @experience, url: panel_personal_experience_back_end_experiences_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<div id="poststuff"> <%= render partial: 'form', locals: {f: f} %>
<h1><%= t('experience.new_personal_experience') %></h1> </fieldset>
<%= form_for @experience, :url => panel_personal_experience_back_end_experiences_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %> <% end %>
</div>
<%#= link_back %>

View File

@ -1,38 +1,48 @@
<% <%
if @member if @member
@experiences = Experience.where(:create_user_id => @member.id).desc(:start_date)
else @experiences = Experience.where(is_hidden: false, :create_user_id => @member.id).desc(:start_date)
@experiences = Experience.all.desc(:start_date)
end @experience_intro = !PersonalExperienceIntro.where(:user_id => @member.id).blank? ? PersonalExperienceIntro.where(:user_id => @member.id).first : PersonalExperienceIntro.new
%> %>
<% if !@experiences.blank? %>
<table class="table"> <% if @experience_intro.brief_intro and !@experience_intro.blank? %>
<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> <div class="info">
</table> <%= @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 %> <% end %>

View File

@ -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] @filter = params[:filter]
new_filter = params[:new_filter] new_filter = params[:new_filter]
@ -17,18 +24,29 @@
end end
if @user if @user && is_admin?
@experiences = Experience.where(:create_user_id => @user.id).page(params[:page]).per(10) @experiences = Experience.where(:create_user_id => @user.id).desc(:start_date).page(params[:page]).per(10)
else 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 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"> <table class="table table-condensed table-striped">
<thead> <thead>
<tr> <tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span2"><%= t('date_') %></th> <th class="span2"><%= t('date_') %></th>
<th><%= t('personal_experience.organizationt_title') %></th> <th><%= t('personal_experience.organizationt_title') %></th>
</tr> </tr>
@ -37,7 +55,12 @@
<% @experiences.each do |experience| %> <% @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><%= experience.start_date.strftime("%Y.%m") %> ~ <%= experience.end_date.strftime("%Y.%m") %></td>
<td> <td>
<%= link_to experience.organizationt_title, panel_personal_experience_front_end_experience_path(experience) %> <%= link_to experience.organizationt_title, panel_personal_experience_front_end_experience_path(experience) %>
@ -49,10 +72,24 @@
</tbody> </tbody>
</table> </table>
<% if is_admin? %>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <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' %> <%= 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>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= paginate @experiences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> </div> <%= paginate @experiences, :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>

View File

@ -13,12 +13,14 @@ Rails.application.routes.draw do
resources :experiences do resources :experiences do
collection do collection do
get 'delete' get 'delete'
get 'data_share'
end end
match "experience_category_quick_add" => "experiences#experience_category_quick_add" ,:as => :experience_category_quick_add 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 match "experience_category_quick_edit" => "experiences#experience_category_quick_edit" ,:as => :experience_category_quick_edit
end end
resources :experience_categorys resources :personal_experience_intros
resources :experience_categorys
resources :tags resources :tags
end end
namespace :front_end do namespace :front_end do

View File

@ -2,7 +2,7 @@ module PersonalExperience
OrbitApp.registration "PersonalExperience",:type=> 'ModuleApp' do OrbitApp.registration "PersonalExperience",:type=> 'ModuleApp' do
module_label 'module_name.personal_experience' module_label 'module_name.personal_experience'
base_url File.expand_path File.dirname(__FILE__) 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'

View File

@ -9,40 +9,19 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
end end
def index def index
get_plugins
get_plugins
get_categorys("HonorCategory",params[:honor_category_ids]) # @tags = get_tags
@filter = params[:filter] # @categories = get_categories_for_index
new_filter = params[:new_filter] # @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
if @filter && params[:clear] @honor_category_ids = HonorCategory.all.collect{|t| t.id.to_s} + [nil]
@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
@honors = get_sorted_and_filtered("honor", :honor_category_id.in => @honor_category_ids)
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js { }
format.xml { render :xml => @honors } format.xml { render :xml => @honors }
format.js
end end
end end
@ -55,7 +34,7 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
@tags = get_tags @tags = get_tags
@set_honor_type = HonorCategory.new(:display => 'List') @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 end
@ -137,28 +116,28 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
else else
@honor_types = HonorCategory.all @honor_types = HonorCategory.all
@tags = get_tags @tags = get_tags
@honor = Honor.new(params[:honor]) @honor = Honor.new(params[:honor])
@honor.create_user_id = current_user.id @honor.create_user_id = current_user.id
@honor.update_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.create_user_id = params[:honor][:user_id]
@honor.update_user_id = params[:honor][:user_id] @honor.update_user_id = params[:honor][:user_id]
else else
@honor.create_user_id = current_user.id @honor.create_user_id = current_user.id
@honor.update_user_id = current_user.id @honor.update_user_id = current_user.id
end end
respond_to do |format| respond_to do |format|
if @honor.save if @honor.save
if params[:honor][:user_id] if params[:honor][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:honor][:user_id],:show_plugin_profile=>'Honor')) } format.html { redirect_to(admin_users_new_interface_url(:id=>params[:honor][:user_id],:show_plugin_profile=>"Honor")) }
else else
format.html { redirect_to(panel_personal_honor_back_end_honors_url) } format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
end end
format.xml { render :xml => @honor, :status => :created, :location => @honor } 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 @honor.update_user_id = current_user.id
params[:honor][:tag_ids] ||=[] params[:honor][:tag_ids] ||=[]
respond_to do |format| respond_to do |format|
if @honor.update_attributes(params[:honor]) if @honor.update_attributes(params[:honor])
format.html { redirect_to(panel_personal_honor_back_end_honors_url) } 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 } format.xml { head :ok }
else else
format.html { render :action => "edit" } format.html { render :action => "edit" }
@ -228,6 +207,29 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
end end
redirect_to panel_personal_honor_back_end_honors_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) redirect_to panel_personal_honor_back_end_honors_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end 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 protected

View File

@ -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

View File

@ -0,0 +1,4 @@
class PersonalHonorIntro < PersonalPluginIntro
end

View File

@ -1,97 +1,163 @@
<% # encoding: utf-8 %> <% # 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 %> <%= f.error_messages %>
<!--Widget start--> <!-- Input Area -->
<div class="input-area">
<div id="sub-wiget">
<div id="widget-tags" class="widget-box widget-size-300"> <!-- Module Tabs -->
<div class="widget-action clear tip" title="Setting"> <div class="nav-name"><strong><%= t(:module) %></strong></div>
<a class="action"><i class="icon-cog icon-white"></i></a> <ul class="nav nav-pills module-nav">
</div> <li></li>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3> <li class="active">
<div class="widget-content clear form-horizontal"> <a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
<% @tags.each do |tag| %> </li>
<%= content_tag :label,:class => "checkbox inline" do -%> <% if show_form_status_field(@honor) %>
<%= check_box_tag 'honor[tag_ids][]', tag.id, @honor.tag_ids.include?(tag.id)%> <li>
<%= tag.name %> <a href="#status" data-toggle="tab"><%= t(:status) %></a>
<%= hidden_field_tag 'honor[tag_ids][]', '' %> </li>
<% end %> <% end %>
<% end %> <li>
</div> <a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</div> </li>
</ul>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body"> <!-- Module -->
<div id="post-body-content" class="clear"> <div class="tab-content module-area">
<% 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>
<div class="title"> <!-- Basic Module -->
<%= f.label :award_name, t("personal_honor.award_name") %> <div class="tab-pane fade in active" id="basic">
<%= f.text_field :award_name %>
</div>
<div class="title"> <% if !params[:user_id].blank? %>
<%= f.label :awarding_unit, t("personal_honor.awarding_unit") %>
<%= f.text_field :awarding_unit %> <div class="control-group">
</div> <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"> <% end %>
<%= 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>
<div class="title"> <!-- personal_honor -->
<%= f.label :note, t("personal_honor.note") %> <div class="control-group">
<%= f.text_area :note, :size => "60x3" %> <label class="control-label muted"><%= t("personal_honor.year") %></label>
</div> <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>
</div>
<!--Post End-->
<!-- honor_category -->
<div class="form-actions"> <div class="control-group">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> <label class="control-label muted"><%= t("personal_honor.honor_category") %></label>
<%= f.submit t('submit'), :class=>'btn btn-primary' %> <div class="controls">
<%= link_to t('cancel'), get_go_back, :class=>"btn" %> <%= f.select :honor_category_id, @honor_categorys.collect {|t| [ t.title, t.id ]} %>
</div> </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>

View File

@ -1,9 +1,4 @@
<tr id="<%= dom_id honor %>" class="with_action"> <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"><%= honor.year %></td>
<td class="span1"> <td class="span1">
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %> <%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>

View File

@ -8,8 +8,8 @@
</div> </div>
<h1><%= t('personal_honor.editing_personal_honor') %></h1> <%= form_for @honor, url: panel_personal_honor_back_end_honor_path(@honor), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= form_for @honor, :url => panel_personal_honor_back_end_honor_path(@honor), :html => {:class => 'clear'} do |f| %> <%= render partial: 'form', locals: {f: f} %>
<%= render :partial => 'form', :locals => {:f => f} %> </fieldset>
<% end %> <% end %>

View File

@ -15,7 +15,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">

View File

@ -13,11 +13,10 @@
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1"></th> <th class="span1"><%= t('personal_honor.year') %></th>
<th class="span1"></th> <th class="span3"><%= t('personal_honor.award_name') %></th>
<th class="span1"></th> <th class="span2"><%= t('personal_honor.awarding_unit') %></th>
<th class="span1"></th> <th class="span1"><%= t("personal_plugins.author") %></th>
<th class="span1"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_honors" class="sort-holder"> <tbody id="tbody_honors" class="sort-holder">
@ -25,9 +24,12 @@
</tbody> </tbody>
</table> </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' %> <%= 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"> </div>
<%= paginate @honor_pages, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <div class="pagination pagination-centered">
<%= paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </div>
</div> </div>

View File

@ -8,14 +8,8 @@
</div> </div>
<%= flash_messages %> <%= form_for @honor, url: panel_personal_honor_back_end_honors_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<div id="poststuff"> <%= render partial: 'form', locals: {f: f} %>
<h1><%= t('honor.new_personal_honor') %></h1> </fieldset>
<%= form_for @honor, :url => panel_personal_honor_back_end_honors_path, :html => {:class => 'clear'} do |f| %> <% end %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>

View File

@ -1,38 +1,49 @@
<% <%
if @member if @member
@honors = Honor.where(:create_user_id => @member.id).desc(:year)
else @honors = Honor.where(is_hidden: false, :create_user_id => @member.id).desc(:year)
@honors = Honor.all.desc(:year)
end @honor_intro = !PersonalHonorIntro.where(:user_id => @member.id).blank? ? PersonalHonorIntro.where(:user_id => @member.id).first : PersonalHonorIntro.new
%> %>
<% if !@honors.blank? %>
<table class="table"> <% if @honor_intro.brief_intro and !@honor_intro.blank? %>
<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> <div class="info">
</table> <%= @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 %>

View File

@ -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] @filter = params[:filter]
new_filter = params[:new_filter] new_filter = params[:new_filter]
@ -17,18 +24,29 @@
end end
if @user if @user && is_admin?
@honors = Honor.where(:create_user_id => @user.id).page(params[:page]).per(10) @honors = Honor.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else 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 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"> <table class="table table-condensed table-striped">
<thead> <thead>
<tr> <tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_honor.year') %></th> <th class="span1"><%= t('personal_honor.year') %></th>
<th><%= t('personal_honor.award_name') %></th> <th><%= t('personal_honor.award_name') %></th>
</tr> </tr>
@ -37,7 +55,12 @@
<% @honors.each do |honor| %> <% @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><%= honor.year %></td>
<td> <td>
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %> <%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
@ -49,11 +72,25 @@
</tbody> </tbody>
</table> </table>
<% if is_admin? %>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <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' %> <%= 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>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <%= paginate @honors, :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> </div>

View File

@ -14,12 +14,14 @@ Rails.application.routes.draw do
resources :honors do resources :honors do
collection do collection do
get 'delete' get 'delete'
get 'data_share'
end end
match "honor_category_quick_add" => "honors#honor_category_quick_add" ,:as => :honor_category_quick_add 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 match "honor_category_quick_edit" => "honors#honor_category_quick_edit" ,:as => :honor_category_quick_edit
end end
resources :honor_categorys resources :personal_honor_intros
resources :honor_categorys
resources :tags resources :tags
end end
namespace :front_end do namespace :front_end do

View File

@ -2,7 +2,7 @@ module PersonalHonor
OrbitApp.registration "PersonalHonor",:type=> 'ModuleApp' do OrbitApp.registration "PersonalHonor",:type=> 'ModuleApp' do
module_label 'module_name.personal_honor' module_label 'module_name.personal_honor'
base_url File.expand_path File.dirname(__FILE__) 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'

View File

@ -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

View File

@ -9,43 +9,19 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end end
def index def index
get_plugins
get_plugins
get_categorys("JournalPaperType",params[:journal_paper_type_id])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear] # @tags = get_tags
@filter.delete(params[:type]) # @categories = get_categories_for_index
elsif @filter && new_filter # @statuses = get_statuses
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s) # category_ids = @categories.collect{|t| t.id}
@filter[new_filter[:type]].delete(new_filter[:id].to_s) @paper_type_ids = JournalPaperType.all.collect{|t| t.id.to_s} + [nil]
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
@writing_journals = get_sorted_and_filtered("writing_journal", :journal_paper_type_id.in => @paper_type_ids)
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js { }
format.xml { render :xml => @writing_journals } format.xml { render :xml => @writing_journals }
format.js
end end
end end
@ -61,13 +37,13 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
# @writing_journal_categorys = JournalLevelType.all # @writing_journal_categorys = JournalLevelType.all
@set_level_type = JournalLevelType.new(:display => 'List') @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') @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') @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 end
@ -193,7 +169,7 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end end
end end
elsif params[:journal_author_type] elsif params[:journal_author_type]
@journal_author_type = JournalAuthorType.new(params[:journal_author_type]) @journal_author_type = JournalAuthorType.new(params[:journal_author_type])
@ -204,7 +180,7 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end end
elsif params[:journal_paper_type] elsif params[:journal_paper_type]
@journal_paper_type = JournalPaperType.new(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 @level_types = JournalLevelType.all
@author_types = JournalAuthorType.all @author_types = JournalAuthorType.all
@paper_types = JournalPaperType.all @paper_types = JournalPaperType.all
@tags = get_tags @tags = get_tags
@writing_journal = WritingJournal.new(params[:writing_journal]) @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.create_user_id = params[:writing_journal][:user_id]
@writing_journal.update_user_id = params[:writing_journal][:user_id] @writing_journal.update_user_id = params[:writing_journal][:user_id]
else 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 @writing_journal.update_user_id = current_user.id
end end
respond_to do |format| respond_to do |format|
if @writing_journal.save if @writing_journal.save
if params[:writing_journal][:user_id] 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')) } format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_journal][:user_id],:show_plugin_profile=>"WritingJournal")) }
else 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 end
format.xml { render :xml => @writing_journal, :status => :created, :location => @writing_journal } format.xml { render :xml => @writing_journal, :status => :created, :location => @writing_journal }
else else
format.html { render :action => "new" } format.html { render :action => "new" }
@ -255,32 +231,32 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
# PUT /writing_journals/1.xml # PUT /writing_journals/1.xml
def update def update
if params[:journal_level_type] if params[:journal_level_type]
@journal_level_type = JournalLevelType.find(params[:id]) @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]) if @journal_level_type.update_attributes(params[:journal_level_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) } # format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_journal_setting' } format.js { render 'update_writing_journal_setting' }
end end
end end
elsif params[:journal_author_type] elsif params[:journal_author_type]
@journal_author_type = JournalAuthorType.find(params[:id]) @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]) if @journal_author_type.update_attributes(params[:journal_author_type])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) } # format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_journal_setting' } format.js { render 'update_writing_journal_setting' }
end end
end end
elsif params[:journal_paper_type] elsif params[:journal_paper_type]
@journal_paper_type = JournalPaperType.find(params[:id]) @journal_paper_type = JournalPaperType.find(params[:id])
respond_to do |format| respond_to do |format|
@ -293,26 +269,25 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
else else
@writing_journal = WritingJournal.find(params[:id]) @writing_journal = WritingJournal.find(params[:id])
@writing_journal.update_user_id = current_user.id @writing_journal.update_user_id = current_user.id
params[:writing_journal][:tag_ids] ||=[] params[:writing_journal][:tag_ids] ||=[]
respond_to do |format| respond_to do |format|
if @writing_journal.update_attributes(params[:writing_journal]) if @writing_journal.update_attributes(params[:writing_journal])
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) } 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 } format.xml { head :ok }
else else
format.html { render :action => "edit" } format.html { render :action => "edit" }
format.xml { render :xml => @writing_journal.errors, :status => :unprocessable_entity } format.xml { render :xml => @writing_journal.errors, :status => :unprocessable_entity }
end end
end end
end
end end
end
# DELETE /writing_journals/1 # DELETE /writing_journals/1
# DELETE /writing_journals/1.xml # DELETE /writing_journals/1.xml
@ -333,6 +308,29 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
end end
redirect_to panel_personal_journal_back_end_writing_journals_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) redirect_to panel_personal_journal_back_end_writing_journals_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end 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 protected

View File

@ -0,0 +1,4 @@
class PersonalJournalIntro < PersonalPluginIntro
end

View File

@ -1,295 +1,345 @@
<% # encoding: utf-8 %> <% # 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 %> <%= f.error_messages %>
<!--Widget start--> <!-- Input Area -->
<div class="input-area">
<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>
<div id="widget-tags" class="widget-box widget-size-300"> <!-- Module Tabs -->
<div class="widget-action clear tip" title="Setting"> <div class="nav-name"><strong><%= t(:module) %></strong></div>
<a class="action"><i class="icon-cog icon-white"></i></a> <ul class="nav nav-pills module-nav">
</div> <li></li>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3> <li class="active">
<div class="widget-content clear form-horizontal"> <a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
<% @tags.each do |tag| %> </li>
<%= content_tag :label,:class => "checkbox inline" do -%> <% if show_form_status_field(@writing_journal) %>
<%= check_box_tag 'writing_journal[tag_ids][]', tag.id, @writing_journal.tag_ids.include?(tag.id)%> <li>
<%= tag.name %> <a href="#status" data-toggle="tab"><%= t(:status) %></a>
<%= hidden_field_tag 'writing_journal[tag_ids][]', '' %> </li>
<% end %> <% 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 %> <% end %>
</div> <% end %>
</div> </div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body"> <!-- paper_type -->
<div id="post-body-content" class="clear"> <div class="control-group">
<label class="control-label muted"><%= t("personal_journal.paper_type") %></label>
<% if !params[:user_id].blank? %> <div class="controls">
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span3" %>
<div class="span6"> </div>
<%= t("著作人")%> </div>
<%= 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>
<div class="span6"> <!-- author_type -->
<%= f.label :language, t("personal_journal.language") %> <div class="control-group">
<%= f.select :language, WritingJournal::LANGUAGE_TYPES, :prompt => 'Select', :class => "span6" %> <label class="control-label muted"><%= t("personal_journal.author_type") %></label>
</div> <div class="controls">
<% @author_types.each do |author_type| %>
<ul class="nav nav-tabs"> <%= content_tag :label,:class => "checkbox inline" do -%>
<% @site_valid_locales.each_with_index do |locale, i| %> <%= check_box_tag 'writing_journal[journal_author_type_ids][]', author_type.id, @writing_journal.journal_author_type_ids.include?(author_type.id)%>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li> <%= author_type.title %>
<%= hidden_field_tag 'writing_journal[journal_author_type_ids][]', '' %>
<% end %> <% end %>
</ul> <% end %>
</div>
<div class="tab-content"> </div>
<% @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 %> <!-- 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")%> <!-- issue_no -->
<div class="form-inline"> <div class="control-group">
<ul class="nav nav-pills"> <label class="control-label muted"><%= t("personal_journal.issue_no") %></label>
<% @level_types.each_with_index do |level_type, i| %> <div class="controls">
<li class="pull-left"> <%= f.text_field :issue_no %>
<%= 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}" %> </div>
<label for="field-<%= i %>"><%= level_type.title %></label> </div>
<%= hidden_field_tag 'writing_journal[journal_level_type_ids][]', '' %>
</li>
<% end %>
</ul>
</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"> <!-- total_pages -->
<%= f.label :vol_no, t("personal_journal.vol_no") %> <div class="control-group">
<%= f.text_field :vol_no %> <label class="control-label muted"><%= t("personal_journal.total_pages") %></label>
</div> <div class="controls">
<%= f.text_field :total_pages %>
</div>
</div>
<div class="span3"> <!-- isbn -->
<%= f.label :issue_no, t("personal_journal.issue_no") %> <div class="control-group">
<%= f.text_field :issue_no %> <label class="control-label muted"><%= t("personal_journal.isbn") %></label>
</div> <div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<div class="span3"> <!-- keywords -->
<%= f.label :form_to, t("personal_journal.form_to") %> <div class="control-group">
<%= f.text_field :form_to_start, :class=>'span1' %> ~ <%= f.text_field :form_to_end, :class=>'span1' %> <label class="control-label muted"><%= t("personal_journal.keywords") %></label>
</div> <div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<div class="span3"> <!-- publication_date -->
<%= f.label :total_pages, t("personal_journal.total_pages") %> <div class="control-group">
<%= f.text_field :total_pages %> <label class="control-label muted"><%= t("personal_journal.publication_date") %></label>
</div> <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>
<div class="row"> <!-- url -->
<div class="control-group">
<div class="span5"> <label class="control-label muted"><%= t("personal_journal.url") %></label>
<div class="controls">
<% @site_valid_locales.each_with_index do |locale, i| %> <%= f.text_field :url , :class => "span6" %>
</div>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> </div>
<div class="title"> <!-- abstract -->
<%= f.label :authors,t("web_resource.authors") %> <div class="control-group">
<%= f.fields_for :authors_translations do |f| %> <label class="control-label muted"><%= t("personal_journal.abstract") %></label>
<%= I18nVariable.from_locale(locale) %> <div class="controls">
<%= f.text_field locale, :class=>'span5', :value => (@writing_journal.authors_translations[locale] rescue nil) %> <%= f.text_area :abstract, rows: 2, class: "input-block-level" %>
<% end %> </div>
</div> </div>
</div>
<% end %> <!-- note -->
<div class="control-group">
</div> <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"> </div>
<label>&nbsp;</label>
<input type="text" name="" id="" class="span7">
</div>
</div>
</div>
<div class="row"> <!-- Status Module -->
<div class="span5"> <% if show_form_status_field(@writing_journal) %>
<%= f.label :author_type ,t("personal_journal.author_type")%> <div class="tab-pane fade" id="status">
<div class="form-inline"> <!-- Status -->
<ul class="nav nav-pills"> <div class="control-group">
<% @author_types.each_with_index do |author_type, i | %> <label class="control-label muted"><%= t(:status) %></label>
<li class="pull-left"> <div class="controls" data-toggle="buttons-checkbox">
<%= 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 class="checkbox inline btn <%= 'active' if @writing_journal.is_hidden? %>">
<label for="field-<%= i %>"><%= author_type.title %></label> <%= f.check_box :is_hidden %> <%= t(:hide) %>
<%= hidden_field_tag 'writing_journal[journal_author_type_ids][]', '' %> </label>
</li> </div>
<% end %> </div>
</ul>
</div> </div>
</div> <% end %>
<div class="span7"> <!-- Tag Module -->
<%= f.label :paper_type ,t("personal_journal.paper_type")%> <div class="tab-pane fade" id="tag">
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span7" %>
</div> <!-- Tag -->
<div class="control-group">
</div> <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"> </div>
<%= 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>
<!-- 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 %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %> <script>
<script> $(document).ready(function() {
$('#add_plugin_file a.add').live('click', function(){ $('.main-forms .add-on').tooltip();
var new_id = $(this).prev().attr('value'); $(document).on('click', '#add_file', function(){
var old_id = new RegExp("new_add_plugin_files", "g"); var new_id = $(this).prev().attr('value');
$(this).prev().attr('value', parseInt(new_id) + 1); var old_id = new RegExp("new_writing_journal_files", "g");
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id)); 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);
$('.add_plugin_files_block a.delete').live('click', function(){ $(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id));
$(this).parents('.list_item').remove(); $(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');
});
$('.action a.remove_existing_record').live('click', function(){ formTip();
$(this).next('.should_destroy').attr('value', 1); });
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); $(document).on('click', '.delete_file', function(){
}); $(this).parents('.input-prepend').remove();
});
</script> $(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 %> <% end %>

View File

@ -1,50 +1,45 @@
<% # encoding: utf-8 %> <% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'> <% else %>
<td> <div class="fileupload fileupload-exist start-line" data-provides="fileupload">
<div class="control-group"> <% if form_file.file.blank? %>
<div class="controls"> <%= t(:no_file) %>
<%= f.file_field :file %> <% else %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> <%= 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} %>
</div> <% end %>
</div> <% end %>
</td> <div class="input-prepend input-append">
<td> <label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<div class="tab-content"> <i class="icons-paperclip"></i>
<%= f.file_field :file %>
<% @site_valid_locales.each_with_index do |locale, i| %> </span>
<div class="uneditable-input input-medium">
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> <i class="icon-file fileupload-exists"></i>
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %> <span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
<%= f.fields_for :file_title_translations do |f| %> </div>
<div class="control-group"> </label>
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label> <span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<div class="controls"> <span class="tab-content">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %> <% @site_valid_locales.each_with_index do |locale, i| %>
</div> <span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
</div> <%= f.fields_for :title_translations do |f| %>
<% end %> <%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</div> </span>
<% end %>
<% end %> </span>
</span>
</div> <% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
</td> <a class="icon-trash"></a>
</span>
<td> <% else %>
<span class="action"> <span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<% if form_file.new_record? %> <%= f.hidden_field :id %>
<a class="delete"><i class="icon-remove"></i></a> <a class="icon-remove"></a>
<% else %> <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
<%= f.hidden_field :id %> </span>
<a class="remove_existing_record"><i class="icon-remove"></i></a> <% end %>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> </div>
<% end %> </div>
</span>
</td>
</tr>

View File

@ -1,10 +1,6 @@
<tr id="<%= dom_id writing_journal %>" class="with_action"> <tr id="<%= dom_id writing_journal %>" class="with_action">
<td class="span1">
<% if (writing_journal.create_user_id == current_user.id) || is_manager? %> <td class="span1"><%= writing_journal.year %></td>
<%= 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"> <td class="span1">
<%= link_to writing_journal.create_link , panel_personal_journal_front_end_writing_journal_path(writing_journal) %> <%= link_to writing_journal.create_link , panel_personal_journal_front_end_writing_journal_path(writing_journal) %>
<div class="quick-edit"> <div class="quick-edit">

View File

@ -8,8 +8,8 @@
</div> </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: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= 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} %>
<%= render :partial => 'form', :locals => {:f => f} %> </fieldset>
<% end %> <% end %>

View File

@ -13,10 +13,9 @@
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1"></th> <th class="span1"><%= t('personal_journal.year') %></th>
<th class="span1"></th> <th class="span7"><%= t('module_name.personal_journal') %></th>
<th class="span1"></th> <th class="span1"><%= t('personal_journal.authors') %></th>
<th class="span1"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_writing_journals" class="sort-holder"> <tbody id="tbody_writing_journals" class="sort-holder">
@ -24,10 +23,12 @@
</tbody> </tbody>
</table> </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-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' %> <%= 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"> </div>
<%= paginate @writing_journal_pages, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <div class="pagination pagination-centered">
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div> </div>
</div> </div>

View File

@ -8,14 +8,8 @@
</div> </div>
<%= flash_messages %> <%= form_for @writing_journal, url: panel_personal_journal_back_end_writing_journals_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<div id="poststuff"> <%= render partial: 'form', locals: {f: f} %>
<h1><%= t('writing_journal.new_personal_journal') %></h1> </fieldset>
<%= form_for @writing_journal, :url => panel_personal_journal_back_end_writing_journals_path, :html => {:class => 'clear'} do |f| %> <% end %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>

View File

@ -15,7 +15,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">
@ -41,7 +41,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">
@ -67,7 +67,7 @@
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"> <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> <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> </p>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">

View File

@ -1,41 +1,50 @@
<% <%
if @member 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"> <% if @writing_journal_intro.brief_intro and !@writing_journal_intro.blank? %>
<thead>
<tr> <div class="info">
<th class="grid1"><%= t('personal_journal.year') %></th> <%= @writing_journal_intro.text.html_safe rescue '' %>
<th class="grid8"><%= t('module_name.personal_journal') %></th> </div>
<th class="grid3"><%= t('personal_journal.authors') %></th>
</tr> <% end %>
</thead>
<tbody> <% 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 %> <% end %>
</tbody> <% end %>
</table>
<% else %> <% end %>
<%= t('nothing')%>
<% end %>

View File

@ -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] @filter = params[:filter]
new_filter = params[:new_filter] new_filter = params[:new_filter]
@ -16,17 +23,29 @@
@filter = {new_filter[:type] => [new_filter[:id].to_s]} @filter = {new_filter[:type] => [new_filter[:id].to_s]}
end end
if @user if @user && is_admin?
@writing_journals = WritingJournal.where(:create_user_id => @user.id).page(params[:page]).per(10) @writing_journals = WritingJournal.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else 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 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"> <table class="table table-condensed table-striped">
<thead> <thead>
<tr> <tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_journal.year') %></th> <th class="span1"><%= t('personal_journal.year') %></th>
<th><%= t('module_name.personal_journal') %></th> <th><%= t('module_name.personal_journal') %></th>
<% if not @user%> <% if not @user%>
@ -38,7 +57,12 @@
<% @writing_journals.each do |writing_journal| %> <% @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><%= writing_journal.year %></td>
<td> <td>
<%= link_to writing_journal.create_link, panel_personal_journal_front_end_writing_journal_path(writing_journal) %> <%= link_to writing_journal.create_link, panel_personal_journal_front_end_writing_journal_path(writing_journal) %>
@ -53,11 +77,25 @@
</tbody> </tbody>
</table> </table>
<% if is_admin? %>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <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' %> <%= 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>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <%= paginate @writing_journals, :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> </div>

Some files were not shown because too many files have changed in this diff Show More