Orbit PersonalHonor Module

This commit is contained in:
Manson Wang 2014-01-15 18:52:06 +08:00
parent e74f2b2ea1
commit e27d822222
113 changed files with 3211 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/

17
Gemfile Normal file
View File

@ -0,0 +1,17 @@
source "http://rubygems.org"
# Declare your gem's dependencies in personal_honor.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# jquery-rails is used by the dummy application
gem "jquery-rails"
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

20
MIT-LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright 2012 YOURNAME
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

3
README.rdoc Normal file
View File

@ -0,0 +1,3 @@
= PersonalHonor
This project rocks and uses MIT-LICENSE.

39
Rakefile Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'PersonalHonor'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
task :default => :test

View File

@ -0,0 +1,150 @@
orbitDesktop.prototype.initializePersonalHonor = function(target,url,cache){ // this init journal papers
this.initializePersonalHonor.formCallback = function(data){
if(data.success){
o.notify(data.msg,"success");
o.sub_menu_item($("div[content-type=menu] a").eq(0));
}else{
o.notify(data.msg,"alert");
}
}
this.initializePersonalHonor.list = function(){ // to open list part in journal papers page
var journalData;
var bindHandlers = function(){ // to bind handlers for list page
}
bindHandlers();
var bindSecondaryHandlers = function(){
$("#journal_p div#paper_list a.icon-check-empty").click(function(){
if($(this).hasClass("icon-check-empty")){
$(this).switchClass("icon-check-empty","icon-check",0);
} else if($(this) .hasClass("icon-check")) {
$(this).switchClass("icon-check","icon-check-empty",0);
} else if($(this).hasClass("icon-star")){
$(this).removeClass("icon-star").addClass("icon-star-empty");
} else if($(this).hasClass("icon-star-empty")){
$(this).removeClass("icon-star-empty").addClass("icon-star");
}
return false;
})
}
o.enableSharing("div.share_mode");
}
this.initializePersonalHonor.honorDelete = function(data,dom){
var parent = dom.parent().parent().parent();
if(data.success){
parent.hide("slide",function(){parent.remove();});
o.notify(data.msg,"success");
}
}
this.initializePersonalHonor.cancelhonor = function(){
o.highlight_sub_menu_item(0);
}
var uploadFiles = function(){
$('#add_plugin_file a.add').click(function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_writing_journal_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
var x = get_html(old_id,new_id);
var newfield = $(x);
$(this).parents('table').append(newfield);
newfield.find('.action a.delete').click(function(){
newfield.remove();
});
return false;
});
$('.action a.remove_existing_record').click(function(){
$(this).toggleClass("color-red",function(){
if($(this).hasClass('color-red')){
$(this).next('.should_destroy').attr('value', 1);
}else{
$(this).next('.should_destroy').removeAttr('value');
}
})
});
}
var languageSelect = function(){
$(".language_select a").click(function(event) {
$("*[data-language]").hide();
$("*[data-language="+$(this).data("lang")+"]").show();
return false;
});
}
this.initializePersonalHonor.edithonor = function(){
o.highlight_sub_menu_item(1);
uploadFiles();
languageSelect();
}
this.initializePersonalHonor.addhonor = function(){ // to open add pages in journal papers page
uploadFiles();
languageSelect();
}
this.initializePersonalHonor.brief = function(){
o.enablelanguageSelect();
$("textarea.editor").ckeditor({
height: 300,
width: $(".overview").width() - 20
});
}
this.initializePersonalHonor.coAuthorformCallback = function(data){
if(data.success){
o.notify(data.msg,"success");
o.sub_menu_item($("div[content-type=menu] a").eq(3));
}else{
o.notify(data.msg,"alert");
}
}
this.initializePersonalHonor.coauthor = function(){ // to open add pages in coauthor page
var bindHandlers = function(){ // to bind handlers for add page
}
bindHandlers();
}
this.initializePersonalHonor.coauthorRelationForm = function(data){
if(data.success){
o.notify(data.msg,"success");
$("#co_author_relation_table").html(data.newvalue);
}else{
o.notify(data.msg,"alert");
}
}
this.initializePersonalHonor.coauthorRelationEditForm = function(data){
if(data.success){
o.notify(data.msg,"success");
var x = o.layout_data.generate_layout_html(data.newvalue);
$("div[container=true] div.overview").html(x.markup);
}else{
o.notify(data.msg,"alert");
}
}
this.initializePersonalHonor.allnone = function(d,o){
switch(o.attr("href")){
case "all":
$("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check");
break;
case "none":
$("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty");
break;
}
}
this.initializePersonalHonor.allnone = function(d,o){
switch(o.attr("href")){
case "all":
$("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check");
break;
case "none":
$("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty");
break;
}
}
};

View File

@ -0,0 +1,115 @@
/* Books */
[page-name="honor_list"] .list_t_item .inner {
padding-left: 30px; }
[page-name="honor_list"] .list_item_action {
font-size: 12px;
float: left;
margin-left: -30px; }
[page-name="honor_list"] .list_item_action a {
display: block;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px 1px 6px 1px; }
[page-name="honor_list"] .list_item_action .icon-star-empty {
color: #999;
font-size: 20px; }
[page-name="honor_list"] .list_item_action .icon-star {
color: #faa732;
font-size: 20px; }
[page-name="honor_list"] .list_item_action .icon-check-empty {
color: #999;
font-size: 20px; }
[page-name="honor_list"] .list_item_action .icon-check {
color: #333;
font-size: 20px; }
[page-name="honor_list"] .file_view .list_t_des {
overflow: hidden; }
[page-name="honor_list"] .file_view .file {
float: left;
width: 120px;
height: 50px;
padding: 6px;
margin: 1px;
position: relative;
-webkit-box-sizing: border-box;
/* webkit */
-khtml-box-sizing: border-box;
/* konqueror */
-moz-box-sizing: border-box;
/* firefox */
-ms-box-sizing: border-box;
/* ie */
box-sizing: border-box;
/* css3 */ }
[page-name="honor_list"] .file_view .file:hover {
background-color: #f7f7f7; }
[page-name="honor_list"] .file_view .file img {
width: 38px;
height: 38px;
position: absolute;
left: 6px;
top: 6px; }
[page-name="honor_list"] .file_view .file .filetitle {
display: block;
width: 100%;
height: 38px;
padding-left: 40px;
overflow: hidden;
-webkit-box-sizing: border-box;
/* webkit */
-khtml-box-sizing: border-box;
/* konqueror */
-moz-box-sizing: border-box;
/* firefox */
-ms-box-sizing: border-box;
/* ie */
box-sizing: border-box;
/* css3 */ }
/* Books Books list */
[page-name="books_books"] .datalist_item .inner {
padding-left: 30px; }
[page-name="books_books"] .list_item_action {
font-size: 12px;
float: left;
margin-left: -30px; }
[page-name="books_books"] .list_item_action i {
color: #999;
font-size: 20px;
display: block;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px 1px 6px 1px; }
[page-name="books_books"] .list_t_desc {
font-family: Arial, sans-serif;
font-size: 12px;
color: #999; }
/* Books Co-Author */
[page-name="books_coauthor"] .list_t_item {
height: 110px; }
[page-name="books_coauthor"] .list_item_function a {
display: inline-block;
padding: 4px;
font-family: Arial, sans-serif;
font-size: 11px;
-webkit-text-size-adjust: none; }
[page-name="books_coauthor"] .info {
font-family: Arial, sans-serif; }
[page-name="books_coauthor"] .info li {
margin-bottom: 8px;
color: #999; }
[page-name="books_coauthor"] .info .name {
font-size: 18px;
line-height: 24px;
color: #333; }
/* Books Co-Author Relationship*/
[page-name="books_coauthor_relation"] .edit_co_author_relation {
/*margin-left: -10px;*/ }
[page-name="books_coauthor_relation"] .form_space {
margin-bottom: 10px;
font-size: 18px;
font-family: Arial, sans-serif; }

View File

@ -0,0 +1,123 @@
@import "desktop-helper";
/* Books */
[page-name="honor_list"] {
.list_t_item .inner { padding-left: 30px; }
.list_item_action {
font-size: 12px;
float: left;
margin-left: -30px;
a {
display: block;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px 1px 6px 1px;
}
.icon-star-empty { color: #999; font-size: 20px; }
.icon-star { color: #faa732; font-size: 20px; }
.icon-check-empty { color: #999; font-size: 20px; }
.icon-check { color: #333; font-size: 20px; }
}
.file_view {
.list_t_des {
overflow: hidden;
}
.file {
float: left;
width: 120px;
height: 50px;
padding: 6px;
margin: 1px;
position: relative;
@include box-sizing;
&:hover {
background-color: lighten($gray, 10%);
}
img {
width: 38px;
height: 38px;
position: absolute;
left: 6px;
top: 6px;
}
.filetitle {
display: block;
width: 100%;
height: 38px;
padding-left: 40px;
overflow: hidden;
@include box-sizing;
}
}
}
}
/* Books Books list */
[page-name="books_books"] {
.datalist_item .inner {
padding-left: 30px;
}
.list_item_action {
font-size: 12px;
float: left;
margin-left: -30px;
}
.list_item_action i {
color: #999;
font-size: 20px;
display: block;
width: 20px;
height: 20px;
line-height: 20px;
margin: 1px 1px 6px 1px;
}
.list_t_desc {
font-family: Arial, sans-serif;
font-size: 12px;
color: #999;
}
}
/* Books Co-Author */
[page-name="books_coauthor"] {
.list_t_item {
height: 110px;
}
.list_item_function {}
.list_item_function a {
display: inline-block;
padding: 4px;
font-family: Arial, sans-serif;
font-size: 11px;
-webkit-text-size-adjust: none;
}
.info {
font-family: Arial, sans-serif;
}
.info li {
margin-bottom: 8px;
color: #999;
}
.info .name {
font-size: 18px;
line-height: 24px;
color: #333;
}
}
/* Books Co-Author Relationship*/
[page-name="books_coauthor_relation"]{
.edit_co_author_relation {
/*margin-left: -10px;*/
}
.form_space {
margin-bottom: 10px;
font-size: 18px;
font-family: Arial, sans-serif;
}
}

0
app/controllers/.gitkeep Normal file
View File

View File

@ -0,0 +1,23 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
# Set I18n.locale
def set_locale
# update session if passed
session[:locale] = params[:locale] if params[:locale]
# set locale based on session or default
begin
# check if locale is valid for non site pages
if !VALID_LOCALES.include?(session[:locale])
I18n.locale = I18n.default_locale
else
I18n.locale = session[:locale]
end
rescue
I18n.locale = I18n.default_locale
end
end
end

View File

@ -0,0 +1,121 @@
class Panel::PersonalHonor::BackEnd::HonorCategorysController < OrbitBackendController
include OrbitControllerLib::DivisionForDisable
open_for_manager :except => [:index]
def index
@honor_categorys = get_categories_for_index("HonorCategory")
@honor_category = HonorCategory.new(:display => 'List')
@url = panel_personal_honor_back_end_honor_categorys_path
respond_to do |format|
format.html # index.html.erb
format.js
end
end
# GET /honors/1
# GET /honors/1.xml
def show
@honor_category = HonorCategory.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js
end
end
# GET /honors/new
# GET /honors/new.xml
def new
@honor_category = HonorCategory.new(:display => 'List')
@verb = :post
respond_to do |format|
format.html # new.html.erb
format.js
end
end
# GET /honors/1/edit
def edit
@honor_category = HonorCategory.find(params[:id])
# @url = panel_personal_honor_back_end_honor_category_path(@honor_category)
# @url = eval("panel_personal_honor_back_end_#{@app_type}_path(@honor_category)")
@url = polymorphic_path([:panel, :personal_honor, :back_end, @honor_category])
@verb = :put
respond_to do |format|
format.html
format.js
end
end
# POST /honors
# POST /honors.xml
def create
@honor_category = HonorCategory.new(params[:honor_category])
respond_to do |format|
if @honor_category.save
format.html { redirect_to(panel_personal_honor_back_end_honor_categorys_url, :notice => t('honor_category.create_honor_category_success')) }
format.js
else
format.html { render :action => "new" }
format.js { render action: "new" }
end
end
end
# PUT /honors/1
# PUT /honors/1.xml
def update
@honor_category = HonorCategory.find(params[:id])
# debugger
# @url = panel_personal_honor_back_end_honor_category_path(@honor_category)
# @url = eval("panel_personal_honor_back_end_#{@app_type}_path(#{@honor_category})")
@url = polymorphic_path([:panel, :personal_honor, :back_end, @honor_category])
respond_to do |format|
if @honor_category.update_attributes(params[:honor_category])
format.html { redirect_to(panel_personal_honor_back_end_honor_categorys_url, :notice => t('honor_category.update_honor_category_success')) }
# format.xml { head :ok }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
# DELETE /honors/1
# DELETE /honors/1.xml
def destroy
@honor_category = HonorCategory.find(params[:id])
@honor_category.disable = @honor_category.disable ? false : true
if @honor_category.save!
respond_to do |format|
format.html { redirect_to(panel_personal_honor_back_end_honor_categorys_url) }
# format.xml { head :ok }
format.js
end
else
flash[:error] = t("honor_category.update_failed")
format.html { render :action => "index" }
end
end
end

View File

@ -0,0 +1,265 @@
class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :only => [ :new,:edit,:update] do |controller|
controller.get_categorys('HonorCategory')
end
def index
get_plugins
# @tags = get_tags
# @categories = get_categories_for_index
# @statuses = get_statuses
# category_ids = @categories.collect{|t| t.id}
@honor_category_ids = HonorCategory.all.collect{|t| t.id.to_s} + [nil]
@honors = get_sorted_and_filtered("honor", :honor_category_id.in => @honor_category_ids)
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @honors }
end
end
def honor_setting
get_plugins
@honor_types = HonorCategory.all
@tags = get_tags
@set_honor_type = HonorCategory.new(:display => 'List')
@honor_type_url = panel_personal_honor_back_end_honors_path
end
def honor_category_quick_add
@set_honor_type = HonorCategory.new(:display => 'List')
@honor_type_url = panel_personal_honor_back_end_honors_path
@set_honor_type.id = params[:id]
respond_to do |format|
format.js
end
end
def honor_category_quick_edit
@set_honor_type = HonorCategory.find(params[:honor_id])
@honor_type_url = panel_personal_honor_back_end_honor_path(@set_honor_type)
respond_to do |format|
format.js
end
end
# GET /honors/1
# GET /honors/1.xml
def show
@honor = Honor.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @honor }
end
end
# GET /honors/new
# GET /honors/new.xml
def new
get_plugins
@honor = Honor.new
@honor_categorys = HonorCategory.all
@tags = get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @honor }
end
end
# GET /honors/1/edit
def edit
get_plugins
@honor = Honor.find(params[:id])
@honor_types = HonorCategory.all
@tags = get_tags
end
# POST /honors
# POST /honors.xml
def create
if params[:honor_category]
@honor_category = HonorCategory.new(params[:honor_category])
respond_to do |format|
if @honor_category.save
format.js { render 'create_honor_setting' }
end
end
else
@honor_types = HonorCategory.all
@tags = get_tags
@honor = Honor.new(params[:honor])
@honor.create_user_id = current_user.id
@honor.update_user_id = current_user.id
if params[:honor][:user_id]
@honor.create_user_id = params[:honor][:user_id]
@honor.update_user_id = params[:honor][:user_id]
else
@honor.create_user_id = current_user.id
@honor.update_user_id = current_user.id
end
respond_to do |format|
if @honor.save
if params[:honor][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:honor][:user_id],:show_plugin_profile=>"Honor")) }
else
format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
end
format.xml { render :xml => @honor, :status => :created, :location => @honor }
else
format.html { render :action => "new" }
format.xml { render :xml => @honor.errors, :status => :unprocessable_entity }
end
end
end
end
# PUT /honors/1
# PUT /honors/1.xml
def update
if params[:honor_category]
@honor_category = HonorCategory.find(params[:id])
respond_to do |format|
if @honor_category.update_attributes(params[:honor_category])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_honor_setting' }
end
end
else
@honor = Honor.find(params[:id])
@honor.update_user_id = current_user.id
params[:honor][:tag_ids] ||=[]
respond_to do |format|
if @honor.update_attributes(params[:honor])
format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @honor.errors, :status => :unprocessable_entity }
end
end
end
end
# DELETE /honors/1
# DELETE /honors/1.xml
def destroy
@honor = Honor.find(params[:id])
@honor.destroy
respond_to do |format|
format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
honors = Honor.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_personal_honor_back_end_honors_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def data_share
if params[:ids]
@honors = Honor.any_in(:_id => params[:ids])
@honors.each do |honor|
honor.is_hidden = params[:disable]
honor.save
end
end
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"Honor")) }
format.json { render json: {"success"=>true}.to_json}
end
end
protected
# def get_index_categories(id = nil)
# @bulletin_categorys = []
# if(is_manager? || is_admin?)
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
# elsif is_sub_manager?
# @bulletin_categorys = BulletinCategory.all
# end
# @bulletin_categorys
# end
# def get_categorys(id = nil)
# @honor_categorys = []
# if(is_manager? || is_admin?)
# @honor_categorys = (id ? HonorCategory.admin_manager_all.find(id).to_a : HonorCategory.admin_manager_all))
# elsif is_sub_manager?
# @honor_categorys = HonorCategory.all.authed_for_user(current_user,'edit')
# end
# if @honor_categorys.empty? && params[:action] != "index"
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
# redirect_to :action => :index
# end
# end
def get_plugins
@plugins = OrbitApp::Plugin::Registration.all
end
end

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,71 @@
class Panel::PersonalHonor::Desktop::PersonalHonorsController < ApplicationController
def index
@honors = Honor.where(create_user_id: current_user.id)
@view_by = params[:view]
page = params[:page]
page ||= 1
@per_column = 5
case @view_by
when "abstract"
@per_column = 1
when "file"
@per_column = 2
end
if @view_by.nil?
@view_by = " "
@honors = @honors.asc(:paper_title)
else
@honors = @honors.asc(@view_by).asc(:paper_title)
end
@honors = @honors.page(page).per(50)
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@honor = Honor.new
render :layout => false
end
def create
params[:honor][:create_user_id] = current_user.id
@honor = Honor.new(params[:honor])
if @honor.save
render json: {success: true, msg: t('create_success')}.to_json
else
error_msg = @honor.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def edit
@honor = Honor.find(params[:id])
render :layout => false
end
def update
params[:honor][:create_user_id] = current_user.id
@honor = Honor.find(params[:id])
if @honor.update_attributes(params[:honor])
render json: {success: true, msg: t('create_success')}.to_json
else
error_msg = @honor.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@honor = Honor.find(params[:id])
@honor.destroy
render :json => {success: true, msg: t('delete_success')}
end
def honors_window
render :layout => false
end
end

View File

@ -0,0 +1,32 @@
class Panel::PersonalHonor::Desktop::PluginIntrosController < ApplicationController
def index
@intro = PersonalHonorIntro.where(:user_id => current_user.id.to_s).first
if @intro.blank?
@intro = PersonalHonorIntro.new
render "new", :layout => false
else
render "edit", :layout => false
end
end
def create
@intro = PersonalHonorIntro.new(params[:personal_honor_intro])
@intro.user_id = current_user.id
if @intro.save
render :json => {"success" => true}.to_json
else
render :json => {"success" => false}.to_json
end
end
def update
@intro = PersonalHonorIntro.find(params[:id])
if @intro.update_attributes(params[:personal_honor_intro])
render :json => {"success" => true}.to_json
else
render :json => {"success" => false}.to_json
end
end
end

View File

@ -0,0 +1,23 @@
class Panel::PersonalHonor::FrontEnd::HonorsController < OrbitWidgetController
def initialize
super
@app_title = 'personal_honor'
end
def index
@honors = Honor.where(:is_hidden => false).desc(:year).page(params[:page]).per(10)
end
# GET /honors/1
# GET /honors/1.xml
def show
@honor = Honor.find(params[:id])
end
end

View File

@ -0,0 +1,233 @@
class Panel::PersonalHonor::Plugin::HonorsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :only => [ :new,:edit,:update] do |controller|
controller.get_categorys('HonorCategory')
end
def index
get_categorys("HonorCategory",params[:honor_category_ids])
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
@honor_categorys = get_categories_for_index("HonorCategory")
@honor_category_ids = @honor_categorys.collect{|t| t.id.to_s} + [nil]
@honors = (params[:sort] || @filter) ? get_sorted_and_filtered("honor",:create_user_id => current_user.id) : get_viewable("honor", :create_user_id => current_user.id)
@tags = get_tags
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @honors }
format.js
end
end
def honor_setting
@honor_types = HonorCategory.all
@tags = get_tags
@set_honor_type = HonorCategory.new(:display => 'List')
@honor_type_url = panel_personal_honor_plugin_honors_path
end
def honor_category_quick_add
@set_honor_type = HonorCategory.new(:display => 'List')
@honor_type_url = panel_personal_honor_plugin_honors_path
@set_honor_type.id = params[:id]
respond_to do |format|
format.js
end
end
def honor_category_quick_edit
@set_honor_type = HonorCategory.find(params[:honor_id])
@honor_type_url = panel_personal_honor_plugin_honor_path(@set_honor_type)
respond_to do |format|
format.js
end
end
# GET /honors/1
# GET /honors/1.xml
def show
@honor = Honor.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @honor }
end
end
# GET /honors/new
# GET /honors/new.xml
def new
@honor = Honor.new
@honor_categorys = HonorCategory.all
@tags = get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @honor }
end
end
# GET /honors/1/edit
def edit
@honor = Honor.find(params[:id])
@honor_types = HonorCategory.all
@tags = get_tags
end
# POST /honors
# POST /honors.xml
def create
if params[:honor_category]
@honor_category = HonorCategory.new(params[:honor_category])
respond_to do |format|
if @honor_category.save
format.js { render 'create_honor_setting' }
end
end
else
@honor_types = HonorCategory.all
@tags = get_tags
@honor = Honor.new(params[:honor])
@honor.create_user_id = current_user.id
@honor.update_user_id = current_user.id
respond_to do |format|
if @honor.save
format.html { redirect_to(panel_personal_honor_plugin_honors_url) }
format.xml { render :xml => @honor, :status => :created, :location => @honor }
else
format.html { render :action => "new" }
format.xml { render :xml => @honor.errors, :status => :unprocessable_entity }
end
end
end
end
# PUT /honors/1
# PUT /honors/1.xml
def update
if params[:honor_category]
@honor_category = HonorCategory.find(params[:id])
respond_to do |format|
if @honor_category.update_attributes(params[:honor_category])
# format.html { redirect_to(panel_announcement_plugin_bulletins_url) }
format.js { render 'update_honor_setting' }
end
end
else
@honor = Honor.find(params[:id])
@honor.update_user_id = current_user.id
params[:honor][:tag_ids] ||=[]
respond_to do |format|
if @honor.update_attributes(params[:honor])
format.html { redirect_to(panel_personal_honor_plugin_honors_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @honor.errors, :status => :unprocessable_entity }
end
end
end
end
# DELETE /honors/1
# DELETE /honors/1.xml
def destroy
@honor = Honor.find(params[:id])
@honor.destroy
respond_to do |format|
format.html { redirect_to(panel_personal_honor_plugin_honors_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
honors = Honor.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_personal_honor_plugin_honors_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
# def get_index_categories(id = nil)
# @bulletin_categorys = []
# if(is_manager? || is_admin?)
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
# elsif is_sub_manager?
# @bulletin_categorys = BulletinCategory.all
# end
# @bulletin_categorys
# end
# def get_categorys(id = nil)
# @honor_categorys = []
# if(is_manager? || is_admin?)
# @honor_categorys = (id ? HonorCategory.admin_manager_all.find(id).to_a : HonorCategory.admin_manager_all))
# elsif is_sub_manager?
# @honor_categorys = HonorCategory.all.authed_for_user(current_user,'edit')
# end
# if @honor_categorys.empty? && params[:action] != "index"
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
# redirect_to :action => :index
# end
# end
end

0
app/helpers/.gitkeep Normal file
View File

View File

@ -0,0 +1,96 @@
module Panel::PersonalHonor::Desktop::PersonalHonorsHelper
def publication_record publication, view
content_tag :li,
"item" => "true",
"data-id" => publication.id.to_s,
:class => "list_t_item #{view.blank? ? '' : "#{view}_view" } #{publication.is_hidden? ? "private" : "public" }" do
content_tag :div,
:class => "inner" do
marker(publication.id) + \
content(publication, view) + \
edit_or_delete(publication)
end
end
end
def marker id
content_tag :div,
:class => "list_item_action" do
content_tag(:a, "",:href=>"",
:class => "icon-check-empty",
"toggle-onclick"=>"icon-check-empty icon-check",
"data-id" => id.to_s,
"ajax-remote"=>"false") + \
content_tag(:a, "",:href=>"",
:class => "icon-star-empty",
"toggle-onclick"=>"icon-star-empty icon-star",
"data-id" => id.to_s,
"ajax-remote"=>"false")
end
end
def content publication, view
case view
when "award_name"
des = content_tag(:div, publication.award_name,
:class => "list_t_des")
when "keywords"
des = content_tag(:div, publication.keywords,
:class => "list_t_des")
end
content_tag(:div, publication.award_name,
:class => "list_t_title") + des
end
def edit_or_delete publication
content_tag :div,
:class => "list_item_function" do
content_tag(:a, t("edit"),
:class => "journal_paper_edit admbg2 admtxt",
:href => edit_panel_personal_honor_desktop_personal_honor_path(publication),
"callback-method" => "edithonor",
"ajax-remote" => "get") + \
content_tag(:a, t(:delete_),
"ajax-remote" => "delete",
"confirm-message" => t("sure?"),
"callback-method" => "honorDelete",
:class => "journal_paper_delete admbg2 admtxt",
:href => panel_personal_honor_desktop_personal_honor_path(publication))
end
end
def link_publication_file publication
publication.writing_book_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url,
:class => "file",
"target" => "_blank",
"title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+)
end
def check_file_type file
if not file.nil?
file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png"
else
file_type = ""
end
end
def generate_authors_name ids
author_name = ids.map{|m|
if m == "0"
#{:id => 0, :text => current_user.name, :email => current_user.email }
{:id => 0, :text => current_user.name }
else
#{:id => m, :text => ConferenceCoAuthor.find(m).co_author, :email => ConferenceCoAuthor.find(m).email}
{:id => m, :text => ConferenceCoAuthor.find(m).co_author}
end
}
author_name.to_json
end
end

0
app/mailers/.gitkeep Normal file
View File

0
app/models/.gitkeep Normal file
View File

73
app/models/honor.rb Normal file
View File

@ -0,0 +1,73 @@
# encoding: utf-8
class Honor
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include OrbitModel::LanguageRestrict
include OrbitModel::Status
include OrbitTag::Taggable
LANGUAGE_TYPES = [ "English", "Chinese" ]
# has_and_belongs_to_many :tags, :class_name => "PersonalHonorTag"
belongs_to :honor_category
field :year
field :award_name
field :awarding_unit
field :language
field :keywords
field :url
field :note
field :create_user_id, :type => BSON::ObjectId
field :update_user_id, :type => BSON::ObjectId
paginates_per 10
# before_save :clean_checkboxs
validates_presence_of :award_name
before_validation :add_http
validates :url, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :unless => Proc.new{self.url.blank?}
def self.search( category_id = nil )
if category_id.to_s.size > 0
find(:all, :conditions => {honor_category_id: category_id}).desc( :is_top, :title )
else
find(:all).desc( :is_top, :title)
end
end
def self.widget_datas
where( :is_hidden => false ).desc(:is_top, :created_at)
end
protected
def add_http
unless self.url.blank? || self.url[/^http:\/\//] || self.url[/^https:\/\//]
self.url = 'http://' + self.url
end
end
def clean_checkboxs
self.tagged_ids.delete('')
end
end

View File

@ -0,0 +1,24 @@
# encoding: utf-8
class HonorCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
include OrbitCoreLib::ObjectDisable
# include Mongoid::MultiParameterAttributes
AfterObjectAuthUrl = '/panel/personal_honor/back_end/honor_categorys'
APP_NAME = 'honor'
# ObjectAuthTitlesOptions = %W{edit}
ObjectAuthTitlesOptions = %W{submit_new fact_check}
field :key
field :title, localize: true
has_many :honors
def pp_object
title
end
end

View File

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

0
app/views/.gitkeep Normal file
View File

View File

@ -0,0 +1,9 @@
<div class="table-label">
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

@ -0,0 +1,163 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<% if show_form_status_field(@honor) %>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<% end %>
<li>
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
</ul>
<!-- 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 %>
<!-- personal_honor -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.year") %></label>
<div class="controls">
<%= select_year((@honor.year ? @honor.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'honor[year]', :class => "span1"} ) %>
</div>
</div>
<!-- honor_category -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.honor_category") %></label>
<div class="controls">
<%= f.select :honor_category_id, @honor_categorys.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<!-- award_name -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.award_name") %></label>
<div class="controls">
<%= f.text_field :award_name %>
</div>
</div>
<!-- awarding_unit -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.awarding_unit") %></label>
<div class="controls">
<%= f.text_field :awarding_unit %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.language") %></label>
<div class="controls">
<%= f.radio_button :language, "Chinese" %> <%= t("personal_honor.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_honor.English") %>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_honor.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<% if show_form_status_field(@honor) %>
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @honor.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<% end %>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<!-- Tag -->
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @honor.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'honor[tag_ids][]', tag.id, @honor.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'honor[tag_ids][]', '' %>
</label>
<% end %>
</div>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>

View File

@ -0,0 +1,17 @@
<tr id="<%= dom_id honor %>" class="with_action">
<td class="span1"><%= honor.year %></td>
<td class="span1">
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if at_least_module_manager || honor.honor_category.cur_user_is_sub_manager_of(:edit)%>
<li><%= link_to t('edit'), edit_panel_personal_honor_back_end_honor_path(honor) %></li>
<li><%= link_to t(:delete_), panel_personal_honor_back_end_honor_path(honor), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<% end -%>
</ul>
</div>
</td>
<td class="span1"><%= honor.awarding_unit %></td>
<td class="span1"><%= User.from_id(honor.create_user_id).name rescue ''%></td>
</tr>

View File

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

View File

@ -0,0 +1,11 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_honor_type %>">
<td><%= list_honor_type.title %></td>
<td class="span2">
<a href="<%= panel_personal_honor_back_end_honor_honor_category_quick_edit_path(list_honor_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
<%= link_to 'Delete',
polymorphic_path([:panel, :personal_honor, :back_end, list_honor_type]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -0,0 +1,5 @@
<% if !@honor_category.blank? %>
$("#myModal1").modal('hide');
$('<%= j render :partial => 'list_honor_type', :collection => [@honor_category] %>').appendTo('#honor_categorys').hide().fadeIn();
<% end %>

View File

@ -0,0 +1 @@
$("#<%= dom_id @honor %>").remove();

View File

@ -0,0 +1,15 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
</div>
<%= form_for @honor, url: panel_personal_honor_back_end_honor_path(@honor), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

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

View File

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

View File

@ -0,0 +1,121 @@
<% # 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 %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
</div>
<div id="isotope">
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_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><%= t("personal_honor.honor_category") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="honor_categorys" class="table table-striped">
<tbody>
<%= render :partial => 'list_honor_type', :collection => @honor_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<button class="btn btn-small btn-primary pull-right" type="button" data-toggle="modal" data-target="#myModal4"><i class="icon-plus"></i> 新增</button>
<span>領域</span>
</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Corresponding Author</td>
<td>編輯 刪除</td>
</tr>
<tr>
<td>First Author, Co- Authors</td>
<td>編輯 刪除</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions form-fixed pagination-right">
<!-- <a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯出</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯入</a>&nbsp; -->
<%= 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>
<div id="paper_type_qe">
<div style="display:none;" class="modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "honor_type_qe" %>
</div>
</div>
<div style="display:none;" class="modal" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">領域</h3>
</div>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputvalue">名稱</label>
<div class="controls">
<input type="text" id="inputvalue" placeholder="Value">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "item" %>
<% end %>

View File

@ -0,0 +1,35 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
<%= render 'filter' %>
</div>
<table class="table main-list">
<thead>
<tr>
<th class="span1"><%= t('personal_honor.year') %></th>
<th class="span3"><%= t('personal_honor.award_name') %></th>
<th class="span2"><%= t('personal_honor.awarding_unit') %></th>
<th class="span1"><%= t("personal_plugins.author") %></th>
</tr>
</thead>
<tbody id="tbody_honors" class="sort-holder">
<%= render :partial => 'honor', :collection => @honors %>
</tbody>
</table>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), panel_personal_honor_back_end_honor_setting_path, :class => 'btn btn-primary pull-right' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_honor_back_end_honor_path, :class => 'btn btn-primary pull-right' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>

View File

@ -0,0 +1,3 @@
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_honors").html("<%= j render :partial => 'honor', :collection => @honors %>");
$("#honor_pagination").html("<%= j paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");

View File

@ -0,0 +1,15 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<%= render :partial => 'admin/plugins/plugin_list' %>
</div>
<%= form_for @honor, url: panel_personal_honor_back_end_honors_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -0,0 +1,3 @@
$("#enable_<%= @bulletin.id %>").toggle();
$("#disable_<%= @bulletin.id %>").toggle();
$("#bulletin_<%= @bulletin.id %>").toggleClass('disable');

View File

@ -0,0 +1,6 @@
<% if !@honor_category.blank? %>
$("#myModal1").modal('hide');
$("#<%= dom_id @honor_category %>").replaceWith("<%= j render :partial => 'list_honor_type', :collection => [@honor_category] %>");
<% end %>

View File

@ -0,0 +1,56 @@
<div class="toolbar hh1">
<div class="fn_g hp">
<%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %>
<% if not @honor.new_record? %>
<%= submit_tag t("cancel"), :type => "button", "callback-method"=>"cancelhonor", "ajax-remote" => "get", :href => panel_personal_honor_desktop_personal_honors_path, class: "fn_btn ini_input hp hh1 admbg2 admtxt" %>
<% end %>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1 ">Language</div>
<div class="admbg sdm_o language_select">
<ul>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li><a class="hp hh1 admtxt" href="" data-lang="<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>
</div>
<div class="overview" content-layout="simple" base-width="420">
<ul class="s_form" isotope="true">
<li class="s_grid_row" >
<%= label_tag("", t("personal_honor.award_name"), class: "s_grid_4 s_grid") %><%= f.text_field :award_name, size: "20", class: "s_grid_8 s_grid"%>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_honor.awarding_unit"), class: "s_grid_4 s_grid") %><%= f.text_field :awarding_unit, size: "20", class: "s_grid_8 s_grid"%>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_honor.year"), class: "s_grid_4 s_grid") %>
<%= select_year((@honor.year ? @honor.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'honor[year]',:class => 's_grid_4 s_grid'} ) %>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_honor.honor_category"), class: "s_grid_4 s_grid") %>
<%= f.select :honor_category_id, HonorCategory.all.collect {|t| [ t.title, t.id ]}, {:class => "s_grid s_grid_4"} %>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_honor.url"), class: "s_grid_4 s_grid") %><%= f.text_field :url, size: "20", class: "s_grid_8 s_grid"%>
</li>
<li class="s_grid_row">
<%= f.text_area :keywords, size: "20x3", placeholder: t("personal_honor.keywords"), class: "s_grid_12 s_grid_h_2 s_grid"%>
</li>
<li class="s_grid_row">
<%= f.label :language, t("personal_honor.language"), :class => "s_grid s_grid_4" %>
<%= f.select :language, Honor::LANGUAGE_TYPES,{} ,{:class => "s_grid s_grid_8"} %>
</li>
<li class="s_grid_row">
<%= f.text_area :note, size: "20x3", placeholder: t("personal_honor.note"), class: "s_grid_12 s_grid s_grid_h_5 s_grid_h_full"%>
</li>
</ul>
</div>

View File

@ -0,0 +1,3 @@
<%= form_for @honor, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_honor_desktop_personal_honor_path(@honor) do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<%end%>

View File

@ -0,0 +1,36 @@
<%= stylesheet_link_tag "/assets/personal_honor/desktop/personal_honor" %>
<%= javascript_include_tag "personal_honor/desktop/personal_honors" %>
<div id="honors">
<div id="content">
<div id="header" class="hh2">
<div class="dtitle w2 hh2 hp">
<span class="thmtxth">Honors</span>
</div>
<div id="search_app" class="hfn w2 hh1 hp thmc3">
<input type="text" class="ini_input form" value="Search" id="searchbox" />
<input type="submit" class="ini_input submit thmc1" value="Submit"/>
</div>
</div>
<div id="holder">
<div id="panel_l" class="ph">
<div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'>
<li><a href="<%= panel_personal_honor_desktop_personal_honors_path %>" callback-method="list" class="hh1 w2 hp active thmc1 thmtxt" load="true" onclick='return false;'>List</a></li>
<li><a href="<%= new_panel_personal_honor_desktop_personal_honor_path %>" callback-method="addhonor" class="admtxt hh1 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="<%= panel_personal_honor_desktop_plugin_intros_path %>" class="admtxt hh1 w2 hp" callback-method="brief" onclick='return false;'>Brief Info</a></li>
<!-- <li><a href="" class="admtxt hh1 w2 hp" onclick='return false;'>Books</a></li>
<li><a href="" class="admtxt hh1 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh1 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
<li><a href="" class="admtxt hh1 w2 hp" onclick='return false;'>Analysis</a></li>
<li><a href="" class="admtxt hh1 w2 hp" onclick='return false;'>Import</a></li>
<li><a href="" class="admtxt hh1 w2 hp" onclick='return false;'>Export</a></li> -->
</ul>
</div>
</div>
<div id="panel_r" container="true" class="ph pw admbg hp">
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,68 @@
<div class="toolbar hh1">
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-check"></span></div>
<div class="admbg sdm_o">
<ul id="journal_selection_options">
<li><a class="hp hh1 admtxt" href="all" ajax-remote="false" callback-method="allnone">All</a></li>
<li><a class="hp hh1 admtxt" href="none" ajax-remote="false" callback-method="allnone">None</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">More</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh1 admtxt" href="">Delete</a></li>
<li><a class="hp hh1 admtxt" href="">Tag</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">Tag</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh1 admtxt" href="">All</a></li>
<li><a class="hp hh1 admtxt" href="">Starred</a></li>
<li><a class="hp hh1 admtxt" href="">MIT</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">Status</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh1 admtxt" href="">All</a></li>
<li><a class="hp hh1 admtxt" href="">Published</a></li>
<li><a class="hp hh1 admtxt" href="">Pending</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">View</div>
<div class="admbg sdm_o">
<ul id="journal_view_selection">
<li><%= link_to "Award", panel_personal_honor_desktop_personal_honors_path + "?view=award_name", :class => "hp hh1 admtxt", "ajax-remote" => "get" %></li>
<li><%= link_to "Keywords", panel_personal_honor_desktop_personal_honors_path + "?view=keywords", :class => "hp hh1 admtxt", "ajax-remote" => "get" %></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1">Share</div>
<div class="admbg sdm_o share_mode" data-link="<%= data_share_panel_personal_honor_back_end_honors_path %>" data-var="disable" >
<ul>
<li><a class="hp hh1 admtxt" href="" item-class="private" data-mode="true" >Private</a></li>
<li><a class="hp hh1 admtxt" href="" item-class="public" data-mode="false" >Public</a></li>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>
</div>
<div class="overview" page-name="honor_list" content-layout="simple" base-width="300" per-column="<%= @per_column.to_s %>" pagination-var="view=<%= @view_by %>&page" >
<ul isotope="true">
<% @honors.each do |w| %>
<%= publication_record w, @view_by%>
<% end %>
</ul>
</div>

View File

@ -0,0 +1,3 @@
<%= form_for @honor, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_honor_desktop_personal_honors_path do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<%end%>

View File

@ -0,0 +1,54 @@
<div class="toolbar hh1">
<div class="fn_g hp">
<%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1 ">Language</div>
<div class="admbg sdm_o language_select">
<ul>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li><a class="hp hh1 admtxt" href="" data-lang="<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>
</div>
<div class="overview" content-layout="simple">
<ul class="s_form">
<li class="s_grid_row">
<%= label_tag("", "Frontend Page", :class => 's_grid s_grid_4') %>
<div class="s_select_g s_grid s_grid_8 s_grid_h_2">
<ul>
<li>
<%= f.check_box :brief_intro,
id: "field-0" %>
<label for="field-0"> Brief Intro </label>
</li>
<li>
<%= f.check_box :complete_list,
id: "field-1" %>
<label for="field-1"> Complete List </label>
</li>
</ul>
</div>
</li>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
<% data = "data-language=" + locale %>
<li class="s_grid_row" <%= style %> <%= data %>>
<%= label_tag("", I18nVariable.from_locale(locale), :class => 's_grid s_grid_4') %>
</li>
<li class="s_grid_row" <%= style %> <%= data %>>
<%= f.fields_for :text_translations do |f| %>
<%= f.text_area locale, :class=>"editor", rows: 5, :value => (@intro.text_translations[locale] rescue nil) %>
<% end %>
</li>
<% end %>
</ul>
</div>

View File

@ -0,0 +1,3 @@
<%= form_for @intro, html: { multipart: true, "form-type"=>"ajax_form","notification"=>"Brief Intro Updated"}, url: panel_personal_honor_desktop_plugin_intro_path(@intro) do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<%end%>

View File

@ -0,0 +1,3 @@
<%= form_for @intro, html: { multipart: true, "form-type"=>"ajax_form", "notification"=>"Brief Intro Saved"}, url: panel_personal_honor_desktop_plugin_intros_path do |f| %>
<%= render partial: 'form', locals: {f: f} %>
<% end %>

View File

@ -0,0 +1,51 @@
<%
if @member
@honors = Honor.where(is_hidden: false, :create_user_id => @member.id).desc(:year)
@honor_intro = !PersonalHonorIntro.where(:user_id => @member.id).blank? ? PersonalHonorIntro.where(:user_id => @member.id).first : PersonalHonorIntro.new
%>
<% if @honor_intro.brief_intro and !@honor_intro.blank? %>
<div class="info">
<%= @honor_intro.text.html_safe rescue '' %>
</div>
<% end %>
<% 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="grid5"><%= t('personal_honor.award_name') %></th>
<th class="grid3"><%= t('personal_honor.awarding_unit') %></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>
<td><%= honor.awarding_unit %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<% end %>

View File

@ -0,0 +1,37 @@
<% # encoding: utf-8 %>
<%= flash_messages %>
<h1><%= t('module_name.personal_honor') %></h1>
<table class="table">
<thead>
<tr>
<th class="grid1"><%= t('personal_honor.honor_category') %></th>
<th class="grid1"><%= t('personal_honor.year') %></th>
<th class="grid5"><%= t('personal_honor.award_name') %></th>
<th class="grid5"><%= t('personal_honor.award_winner') %></th>
<th class="grid3"><%= t('personal_honor.awarding_unit') %></th>
</tr>
</thead>
<tbody>
<% @honors.each do |honor| %>
<tr>
<td><%= honor.honor_category.title %></td>
<td><%= honor.year %></td>
<td>
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
</td>
<td><%= User.from_id(honor.create_user_id).name rescue '' %></td>
<td><%= honor.awarding_unit %></td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @honors, :params => {:inner => false}%>

View File

@ -0,0 +1,32 @@
<% # encoding: utf-8 %>
<table>
<caption> <%= t("module_name.personal_honor") %> </caption>
<tbody>
<% if !@honor.honor_category.blank? %>
<tr><th><%= t("personal_honor.honor_category")%></th><td><%= @honor.honor_category.title if @honor.honor_category %></td></tr>
<% end %>
<% if !@honor.year.blank? %>
<tr><th><%= t("personal_honor.year")%></th><td><%= @honor.year %></td></tr>
<% end %>
<% if !@honor.language.blank? %>
<tr><th><%= t("personal_honor.language")%></th><td><%= @honor.language %></td></tr>
<% end %>
<% if !@honor.award_name.blank? %>
<tr><th><%= t("personal_honor.award_name")%></th><td><%= @honor.award_name %></td></tr>
<% end %>
<% if !@honor.awarding_unit.blank? %>
<tr><th><%= t("personal_honor.awarding_unit")%></th><td><%= @honor.awarding_unit %></td></tr>
<% end %>
<% if !@honor.url.blank? %>
<tr><th><%= t("personal_honor.url")%></th><td><%= link_to t(:url), @honor.url, {:target => '_blank', :title => @honor.url} if !@honor.url.blank? %></td></tr>
<% end %>
<tr><th><%= t("personal_honor.award_winner")%></th><td><%= User.from_id(@honor.create_user_id).name rescue '' %></td></tr>
</tbody>
</table>

View File

@ -0,0 +1,96 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
if @user && is_admin?
@honors = Honor.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
else
@honors = Honor.where(is_hidden: false, :create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
end
%>
<% if is_admin? %>
<div class="list-active">
<div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_honor_back_end_honors_path(:user_id => params[:id], :disable => 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_honor_back_end_honors_path(:user_id => params[:id], :disable => 'false') ) %>
</div>
</div>
<% end -%>
<table class="table table-condensed table-striped">
<thead>
<tr>
<% if is_admin? %>
<th><input type="checkbox" class="list-check" /></th>
<% end -%>
<th class="span1"><%= t('personal_honor.year') %></th>
<th><%= t('personal_honor.award_name') %></th>
</tr>
</thead>
<tbody>
<% @honors.each do |honor| %>
<tr class="<%= honor.is_hidden ? "checkHide" : "" %>">
<% if is_admin? %>
<td>
<%= check_box_tag 'to_change[]', honor.id.to_s, false, :class => "list-check" %>
</td>
<% end -%>
<td><%= honor.year %></td>
<td>
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if is_admin? %>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_honor_back_end_personal_honor_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_honor_back_end_honor_path(:user_id => @user.id), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>

View File

@ -0,0 +1,11 @@
<div id="filter" class="subnav">
<div class="filters">
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

@ -0,0 +1,87 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'honor[tag_ids][]', tag.id, @honor.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'honor[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<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">
<%= f.label :award_name, t("personal_honor.award_name") %>
<%= f.text_field :award_name %>
</div>
<div class="title">
<%= f.label :awarding_unit, t("personal_honor.awarding_unit") %>
<%= f.text_field :awarding_unit %>
</div>
<div class="title">
<%= f.label :url, t("personal_honor.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_honor.keywords") %>
<%= f.text_field :keywords %>
</div>
<div id="title">
<%= f.label :language, t("personal_honor.language") %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_honor.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_honor.English") %>
</div>
<div class="title">
<%= f.label :note, t("personal_honor.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>

View File

@ -0,0 +1,21 @@
<tr id="<%= dom_id honor %>" class="with_action">
<td>
<% 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><%= honor.year %></td>
<td>
<%= link_to honor.award_name, panel_personal_honor_front_end_honor_path(honor) %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if at_least_module_manager || honor.honor_category.cur_user_is_sub_manager_of(:edit)%>
<li><%= link_to t('edit'), edit_panel_personal_honor_plugin_honor_path(honor) %></li>
<li><%= link_to t(:delete_), panel_personal_honor_plugin_honor_path(honor), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<% end -%>
</ul>
</div>
</td>
<td><%= honor.awarding_unit %></td>
</tr>

View File

@ -0,0 +1,4 @@
<%= render_sort_bar(true, delete_panel_personal_honor_back_end_honors_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['year', 'year', 'span1', 'honor.year'],
['award_name', 'award_name','span3', 'honor.award_name'],
['awarding_unit', 'awarding_unit','span3', 'honor.awarding_unit']).html_safe %>

View File

@ -0,0 +1 @@
$("#<%= dom_id @honor %>").remove();

View File

@ -0,0 +1,5 @@
<h1><%= t('personal_honor.editing_personal_honor') %></h1>
<%= form_for @honor, :url => panel_personal_honor_plugin_honor_path(@honor), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@ -0,0 +1,22 @@
<%= render 'filter' %>
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span2"></th>
<th class="span3"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="tbody_honors" class="sort-holder">
<%= render :partial => 'honor', :collection => @honors %>
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_honor_plugin_honor_path, :class => 'btn btn-primary pull-right' %>
<div id="honor_pagination" class="paginationFixed">
<%= paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>

View File

@ -0,0 +1,3 @@
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_honors").html("<%= j render :partial => 'honor', :collection => @honors %>");
$("#honor_pagination").html("<%= j paginate @honors, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");

View File

@ -0,0 +1,10 @@
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('honor.new_personal_honor') %></h1>
<%= form_for @honor, :url => panel_personal_honor_plugin_honors_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>

View File

@ -0,0 +1,3 @@
$("#enable_<%= @bulletin.id %>").toggle();
$("#disable_<%= @bulletin.id %>").toggle();
$("#bulletin_<%= @bulletin.id %>").toggleClass('disable');

57
config/locales/en.yml Normal file
View File

@ -0,0 +1,57 @@
en:
module_name:
personal_honor: Honor
personal_honor:
award_winner : "Award winner"
paper_title : "Paper Title"
book_title : "Book Title"
award_name : "Award Name"
awarding_unit : "Awarding Unit"
honor_category : "Honor Category"
extracted_chapters : "Extracted Chapters"
publishers : "Publishers"
authors : "Authors"
tags : "Tags"
year : "Year"
language : "Language"
isbn : "ISSN(ISBN)"
vol_no : "Vol.No"
issue_no : "Issue.No"
form_to_start : "From"
form_to_end : "To"
total_pages : "Total Pages"
keywords : "Keywords"
abstract : "Abstract"
publication_date : "Date of Publication"
url : "Reference URL"
note : "Note"
level_type : "Level Type"
author_type : "Author Type"
from : "From"
to : "To"
file : "File"
file_name : "File name"
description : "File Description"
pages : "Pages"
book_paper_type : "Book Paper Type"
frontend:
honors: "Honor Frontend"
create_success : "Successfully Create"
update_success : "Successfully Update"
delete_success : "Successfully Delete"
add: "Add"
back: "Back"
delete: "Delete"
edit: "Edit"
nothing: "Nothing"
show: "Show"
sure?: "Are you sure?"
update: "Update"
yes_: "Yes"
no_: "No"
cancel : "Cancel"
save: "save"
hintText: "Type in a search term"
noResultsText: "No results"
searchingText: "Searching…"

53
config/locales/zh_tw.yml Normal file
View File

@ -0,0 +1,53 @@
zh_tw:
module_name:
personal_honor: 榮譽
personal_honor:
award_winner : "得獎人"
paper_title : "論文名稱"
book_title : "期刊名稱"
award_name : "獎項名稱"
awarding_unit : "頒獎單位"
honor_category : "類別"
authors : "作者"
tags : "領域"
year : "年度"
language : "語言"
isbn : "ISSN(ISBN)"
vol_no : "卷數"
issue_no : "期數"
form_to_start : "起"
form_to_end : "訖"
total_pages : "總頁數"
keywords : "關鍵字"
abstract : "摘要"
publication_date : "發表日期"
url : "參考連結"
note : "記事"
level_type : "期刊類別"
author_type : "作者類別"
from : "起"
to : "訖"
file : "檔案"
file_name : "檔案名稱"
description : "描述"
frontend:
honors: "榮譽前台"
create_success : "新增完成!!"
update_success : "更新完成!!"
delete_success : "刪除成功!!"
add: "新增"
back: "返回"
delete: "刪除"
edit: "編輯"
nothing: "無"
show: "顯示"
sure?: "您肯定嗎?"
update: "更新"
yes_: "是"
no_: "否"
cancel : "取消"
save: "儲存"
hintText: "請輸入搜尋關鍵字"
noResultsText: "沒有相關的比對結果"
searchingText: "搜尋中…"

43
config/routes.rb Normal file
View File

@ -0,0 +1,43 @@
Rails.application.routes.draw do
namespace :panel do
namespace :personal_honor do
namespace :desktop do
match "honor_window" => "personal_honors#honors_window"
resources :personal_honors
resources :plugin_intros
end
namespace :back_end do
match 'honor_setting' => "honors#honor_setting" ,:as => :honor_setting
resources :honors do
collection do
get 'delete'
get 'data_share'
end
match "honor_category_quick_add" => "honors#honor_category_quick_add" ,:as => :honor_category_quick_add
match "honor_category_quick_edit" => "honors#honor_category_quick_edit" ,:as => :honor_category_quick_edit
end
resources :personal_honor_intros
resources :honor_categorys
resources :tags
end
namespace :front_end do
resources :honors
end
namespace :plugin do
resources :honors
end
namespace :widget do
match "honors" => "honors#index"
match "home_list" => "honors#home_list"
match "reload_honors" => "honors#reload_honors"
end
end
end
match "/appfront/*path" => redirect("/panel/*path")
end

4
lib/personal_honor.rb Normal file
View File

@ -0,0 +1,4 @@
require "personal_honor/engine"
module PersonalHonor
end

View File

@ -0,0 +1,23 @@
module PersonalHonor
class Engine < Rails::Engine
initializer "personal_honor" do
OrbitApp.registration "PersonalHonor",:type=> 'ModuleApp' do
module_label 'module_name.personal_honor'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :sort_number => '50', :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'
version "0.1"
organization "Rulingcom"
author "RD dep"
intro "I am intro"
update_info 'some update_info'
front_end do
app_page 'honors' do
frontend_i18n "personal_honor.frontend.honors"
end
end
end
end
end
end

View File

@ -0,0 +1,3 @@
module PersonalHonor
VERSION = "0.0.1"
end

View File

@ -0,0 +1,4 @@
# desc "Explaining what the task does"
# task :personal_honor do
# # Task goes here
# end

23
personal_honor.gemspec Normal file
View File

@ -0,0 +1,23 @@
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "personal_honor/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "personal_honor"
s.version = PersonalHonor::VERSION
s.authors = ["RulingDigital"]
s.email = ["service@rulingcom.com"]
s.homepage = "http://www.rulingcom.com"
s.summary = ""
s.description = "Orbit PersonalHonor module"
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
# s.add_dependency "rails", "~> 3.1.8"
# s.add_dependency "jquery-rails"
s.add_development_dependency "sqlite3"
end

13
personal_honor.json Normal file
View File

@ -0,0 +1,13 @@
{
"title": "personal_honor",
"object": "honor",
"version": "0.1",
"organization": "Rulingcom",
"author": "RD dep",
"intro": "A simple blog……",
"update_info": "Some info",
"create_date": "09-05-2012",
"category": ["HonorCategory"],
"enable_frontend": true,
"has_plugin": true
}

6
script/rails Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env ruby.exe
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_PATH = File.expand_path('../..', __FILE__)
load File.expand_path('../../test/dummy/script/rails', __FILE__)

7
test/dummy/Rakefile Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Dummy::Application.load_tasks

View File

@ -0,0 +1,9 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .

View File

@ -0,0 +1,7 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/

View File

@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end

View File

@ -0,0 +1,2 @@
module ApplicationHelper
end

View File

View File

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Dummy</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>

4
test/dummy/config.ru Normal file
View File

@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Dummy::Application

View File

@ -0,0 +1,45 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require
require "personal_honor"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end
end

10
test/dummy/config/boot.rb Normal file
View File

@ -0,0 +1,10 @@
require 'rubygems'
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
end
$:.unshift File.expand_path('../../../../lib', __FILE__)

View File

@ -0,0 +1,25 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000

View File

@ -0,0 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dummy::Application.initialize!

View File

@ -0,0 +1,30 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end

View File

@ -0,0 +1,60 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end

View File

@ -0,0 +1,39 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end

View File

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View File

@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

View File

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View File

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Dummy::Application.config.secret_token = '5880dbdc6dd9583cc02529b47d7e796b5502466b0390b829aeb1d3c63fd352cbc7fdcea5f65bd0a139d0b5f8a6d243c475c29bbed39693b81537d704d4257ccd'

View File

@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Dummy::Application.config.session_store :active_record_store

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