From c46688eed0df8db7d06ddd6014ad49c3f6daf0a9 Mon Sep 17 00:00:00 2001 From: Manson Wang Date: Wed, 15 Jan 2014 18:50:34 +0800 Subject: [PATCH] Orbit PersonalDiploma Module --- .gitignore | 6 + Gemfile | 17 ++ MIT-LICENSE | 20 ++ README.rdoc | 3 + Rakefile | 39 ++++ app/assets/images/personal_diploma/.gitkeep | 0 .../javascripts/personal_diploma/.gitkeep | 0 .../desktop/personal_diploma.js | 149 +++++++++++++ .../stylesheets/personal_diploma/.gitkeep | 0 .../personal_diploma/personal_diploma.css | 115 ++++++++++ .../personal_diploma/personal_diploma.scss | 123 ++++++++++ app/controllers/.gitkeep | 0 app/controllers/application_controller.rb | 23 ++ .../back_end/diplomas_controller.rb | 198 +++++++++++++++++ .../personal_diploma_intros_controller.rb | 10 + .../desktop/personal_diplomas_controller.rb | 51 +++++ .../desktop/plugin_intros_controller.rb | 32 +++ .../front_end/diplomas_controller.rb | 17 ++ .../plugin/diplomas_controller.rb | 164 ++++++++++++++ app/helpers/.gitkeep | 0 .../desktop/personal_diplomas_helper.rb | 103 +++++++++ app/mailers/.gitkeep | 0 app/models/.gitkeep | 0 app/models/diploma.rb | 59 +++++ app/models/personal_diploma_intro.rb | 4 + app/views/.gitkeep | 0 .../back_end/diplomas/_diploma.html.erb | 16 ++ .../back_end/diplomas/_filter.html.erb | 9 + .../back_end/diplomas/_form.html.erb | 210 ++++++++++++++++++ .../back_end/diplomas/_sort_headers.html.erb | 0 .../diplomas/create_diploma_setting.js.erb | 5 + .../back_end/diplomas/destroy.js.erb | 1 + .../diplomas/diploma_setting.html.erb | 85 +++++++ .../back_end/diplomas/edit.html.erb | 15 ++ .../back_end/diplomas/index.html.erb | 34 +++ .../back_end/diplomas/index.js.erb | 3 + .../back_end/diplomas/new.html.erb | 15 ++ .../back_end/diplomas/show.html.erb | 0 .../back_end/diplomas/toggle_enable.js.erb | 3 + .../diplomas/update_diploma_setting.js.erb | 6 + .../desktop/personal_diplomas/_form.html.erb | 91 ++++++++ .../personal_diplomas/diploma_window.html.erb | 36 +++ .../desktop/personal_diplomas/edit.html.erb | 3 + .../desktop/personal_diplomas/index.html.erb | 69 ++++++ .../desktop/personal_diplomas/new.html.erb | 3 + .../desktop/plugin_intros/_form.html.erb | 54 +++++ .../desktop/plugin_intros/edit.html.erb | 3 + .../desktop/plugin_intros/new.html.erb | 3 + .../front_end/_profile.html.erb | 54 +++++ .../front_end/diplomas/index.html.erb | 0 .../front_end/diplomas/show.html.erb | 45 ++++ .../personal_diploma/plugin/_profile.html.erb | 96 ++++++++ .../plugin/diplomas/_diploma.html.erb | 20 ++ .../plugin/diplomas/_filter.html.erb | 11 + .../plugin/diplomas/_form.html.erb | 126 +++++++++++ .../plugin/diplomas/_sort_headers.html.erb | 0 .../plugin/diplomas/destroy.js.erb | 1 + .../plugin/diplomas/edit.html.erb | 5 + .../plugin/diplomas/index.html.erb | 22 ++ .../plugin/diplomas/index.js.erb | 3 + .../plugin/diplomas/new.html.erb | 10 + .../plugin/diplomas/show.html.erb | 0 .../plugin/diplomas/toggle_enable.js.erb | 3 + config/locales/en.yml | 57 +++++ config/locales/zh_tw.yml | 58 +++++ config/routes.rb | 39 ++++ lib/personal_diploma.rb | 4 + lib/personal_diploma/engine.rb | 24 ++ lib/personal_diploma/version.rb | 3 + lib/tasks/personal_diploma_tasks.rake | 4 + personal_diploma.gemspec | 23 ++ personal_diploma.json | 12 + script/rails | 6 + 73 files changed, 2423 insertions(+) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 MIT-LICENSE create mode 100644 README.rdoc create mode 100644 Rakefile create mode 100644 app/assets/images/personal_diploma/.gitkeep create mode 100644 app/assets/javascripts/personal_diploma/.gitkeep create mode 100644 app/assets/javascripts/personal_diploma/desktop/personal_diploma.js create mode 100644 app/assets/stylesheets/personal_diploma/.gitkeep create mode 100644 app/assets/stylesheets/personal_diploma/personal_diploma.css create mode 100644 app/assets/stylesheets/personal_diploma/personal_diploma.scss create mode 100644 app/controllers/.gitkeep create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/panel/personal_diploma/back_end/diplomas_controller.rb create mode 100644 app/controllers/panel/personal_diploma/back_end/personal_diploma_intros_controller.rb create mode 100644 app/controllers/panel/personal_diploma/desktop/personal_diplomas_controller.rb create mode 100644 app/controllers/panel/personal_diploma/desktop/plugin_intros_controller.rb create mode 100644 app/controllers/panel/personal_diploma/front_end/diplomas_controller.rb create mode 100644 app/controllers/panel/personal_diploma/plugin/diplomas_controller.rb create mode 100644 app/helpers/.gitkeep create mode 100644 app/helpers/panel/personal_diploma/desktop/personal_diplomas_helper.rb create mode 100644 app/mailers/.gitkeep create mode 100644 app/models/.gitkeep create mode 100644 app/models/diploma.rb create mode 100644 app/models/personal_diploma_intro.rb create mode 100644 app/views/.gitkeep create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/_diploma.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/_filter.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/_form.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/_sort_headers.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/create_diploma_setting.js.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/destroy.js.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/diploma_setting.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/edit.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/index.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/index.js.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/new.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/show.html.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/toggle_enable.js.erb create mode 100644 app/views/panel/personal_diploma/back_end/diplomas/update_diploma_setting.js.erb create mode 100644 app/views/panel/personal_diploma/desktop/personal_diplomas/_form.html.erb create mode 100644 app/views/panel/personal_diploma/desktop/personal_diplomas/diploma_window.html.erb create mode 100644 app/views/panel/personal_diploma/desktop/personal_diplomas/edit.html.erb create mode 100644 app/views/panel/personal_diploma/desktop/personal_diplomas/index.html.erb create mode 100644 app/views/panel/personal_diploma/desktop/personal_diplomas/new.html.erb create mode 100644 app/views/panel/personal_diploma/desktop/plugin_intros/_form.html.erb create mode 100644 app/views/panel/personal_diploma/desktop/plugin_intros/edit.html.erb create mode 100644 app/views/panel/personal_diploma/desktop/plugin_intros/new.html.erb create mode 100644 app/views/panel/personal_diploma/front_end/_profile.html.erb create mode 100644 app/views/panel/personal_diploma/front_end/diplomas/index.html.erb create mode 100644 app/views/panel/personal_diploma/front_end/diplomas/show.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/_profile.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/_diploma.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/_filter.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/_form.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/_sort_headers.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/destroy.js.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/edit.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/index.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/index.js.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/new.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/show.html.erb create mode 100644 app/views/panel/personal_diploma/plugin/diplomas/toggle_enable.js.erb create mode 100644 config/locales/en.yml create mode 100644 config/locales/zh_tw.yml create mode 100644 config/routes.rb create mode 100644 lib/personal_diploma.rb create mode 100644 lib/personal_diploma/engine.rb create mode 100644 lib/personal_diploma/version.rb create mode 100644 lib/tasks/personal_diploma_tasks.rake create mode 100644 personal_diploma.gemspec create mode 100644 personal_diploma.json create mode 100644 script/rails diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1463de6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.bundle/ +log/*.log +pkg/ +test/dummy/db/*.sqlite3 +test/dummy/log/*.log +test/dummy/tmp/ \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..2a09354 --- /dev/null +++ b/Gemfile @@ -0,0 +1,17 @@ +source "http://rubygems.org" + +# Declare your gem's dependencies in personal_diploma.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' diff --git a/MIT-LICENSE b/MIT-LICENSE new file mode 100644 index 0000000..406f17b --- /dev/null +++ b/MIT-LICENSE @@ -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. diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..6132a8b --- /dev/null +++ b/README.rdoc @@ -0,0 +1,3 @@ += PersonalDiploma + +This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..92af165 --- /dev/null +++ b/Rakefile @@ -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 = 'PersonalDiploma' + 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 diff --git a/app/assets/images/personal_diploma/.gitkeep b/app/assets/images/personal_diploma/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/personal_diploma/.gitkeep b/app/assets/javascripts/personal_diploma/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js b/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js new file mode 100644 index 0000000..756b437 --- /dev/null +++ b/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js @@ -0,0 +1,149 @@ +orbitDesktop.prototype.initializePersonalDiploma = function(target,url,cache){ // this init journal papers + this.initializePersonalDiploma.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.initializePersonalDiploma.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.initializePersonalDiploma.diplomaDelete = function(data,dom){ + var parent = dom.parent().parent().parent(); + if(data.success){ + parent.hide("slide",function(){parent.remove();}); + o.notify(data.msg,"success"); + } + } + + this.initializePersonalDiploma.canceldiploma = 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.initializePersonalDiploma.editdiploma = function(){ + o.highlight_sub_menu_item(1); + uploadFiles(); + languageSelect(); + } + + this.initializePersonalDiploma.adddiploma = function(){ // to open add pages in journal papers page + uploadFiles(); + languageSelect(); + } + this.initializePersonalDiploma.brief = function(){ + o.enablelanguageSelect(); + $("textarea.editor").ckeditor({ + height: 300, + width: $(".overview").width() - 20 + }); + } + + this.initializePersonalDiploma.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.initializePersonalDiploma.coauthor = function(){ // to open add pages in coauthor page + var bindHandlers = function(){ // to bind handlers for add page + + } + bindHandlers(); + } + this.initializePersonalDiploma.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.initializePersonalDiploma.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.initializePersonalDiploma.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.initializePersonalDiploma.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; + } + } +}; + + diff --git a/app/assets/stylesheets/personal_diploma/.gitkeep b/app/assets/stylesheets/personal_diploma/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/personal_diploma/personal_diploma.css b/app/assets/stylesheets/personal_diploma/personal_diploma.css new file mode 100644 index 0000000..eced2ae --- /dev/null +++ b/app/assets/stylesheets/personal_diploma/personal_diploma.css @@ -0,0 +1,115 @@ +/* Books */ +[page-name="diploma_list"] .list_t_item .inner { + padding-left: 30px; } +[page-name="diploma_list"] .list_item_action { + font-size: 12px; + float: left; + margin-left: -30px; } + [page-name="diploma_list"] .list_item_action a { + display: block; + width: 20px; + height: 20px; + line-height: 20px; + margin: 1px 1px 6px 1px; } + [page-name="diploma_list"] .list_item_action .icon-star-empty { + color: #999; + font-size: 20px; } + [page-name="diploma_list"] .list_item_action .icon-star { + color: #faa732; + font-size: 20px; } + [page-name="diploma_list"] .list_item_action .icon-check-empty { + color: #999; + font-size: 20px; } + [page-name="diploma_list"] .list_item_action .icon-check { + color: #333; + font-size: 20px; } +[page-name="diploma_list"] .file_view .list_t_des { + overflow: hidden; } +[page-name="diploma_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="diploma_list"] .file_view .file:hover { + background-color: #f7f7f7; } + [page-name="diploma_list"] .file_view .file img { + width: 38px; + height: 38px; + position: absolute; + left: 6px; + top: 6px; } + [page-name="diploma_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; } diff --git a/app/assets/stylesheets/personal_diploma/personal_diploma.scss b/app/assets/stylesheets/personal_diploma/personal_diploma.scss new file mode 100644 index 0000000..93c8187 --- /dev/null +++ b/app/assets/stylesheets/personal_diploma/personal_diploma.scss @@ -0,0 +1,123 @@ +@import "desktop-helper"; + +/* Books */ +[page-name="diploma_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; + } +} \ No newline at end of file diff --git a/app/controllers/.gitkeep b/app/controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..307a4ac --- /dev/null +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/panel/personal_diploma/back_end/diplomas_controller.rb b/app/controllers/panel/personal_diploma/back_end/diplomas_controller.rb new file mode 100644 index 0000000..09541df --- /dev/null +++ b/app/controllers/panel/personal_diploma/back_end/diplomas_controller.rb @@ -0,0 +1,198 @@ +class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + + def index + get_plugins + + # @tags = get_tags + # @categories = get_categories_for_index + # @statuses = get_statuses + # category_ids = @categories.collect{|t| t.id} + + @diplomas = get_sorted_and_filtered("diploma") + respond_to do |format| + format.html # index.html.erb + format.js { } + format.xml { render :xml => @diplomas } + end + end + + def diploma_setting + + get_plugins + + @tags = get_tags + + end + + # GET /diplomas/1 + # GET /diplomas/1.xml + def show + @diploma = Diploma.find(params[:id]) + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @diploma } + end + end + + # GET /diplomas/new + # GET /diplomas/new.xml + def new + + get_plugins + + @diploma = Diploma.new + + @tags = get_tags + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @diploma } + end + end + + # GET /diplomas/1/edit + def edit + + get_plugins + + @diploma = Diploma.find(params[:id]) + + @tags = get_tags + end + + # POST /diplomas + # POST /diplomas.xml + def create + + @tags = get_tags + + @diploma = Diploma.new(params[:diploma]) + + if params[:diploma][:user_id] + @diploma.create_user_id = params[:diploma][:user_id] + @diploma.update_user_id = params[:diploma][:user_id] + else + @diploma.create_user_id = current_user.id + @diploma.update_user_id = current_user.id + end + + respond_to do |format| + if @diploma.save + + if params[:diploma][:user_id] + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:diploma][:user_id],:show_plugin_profile=>'Diploma')) } + else + format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) } + end + + format.xml { render :xml => @diploma, :status => :created, :location => @diploma } + else + format.html { render :action => "new" } + format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity } + end + end + + end + + # PUT /diplomas/1 + # PUT /diplomas/1.xml + def update + + @diploma = Diploma.find(params[:id]) + + @diploma.update_user_id = current_user.id + + params[:diploma][:tag_ids] ||=[] + + respond_to do |format| + if @diploma.update_attributes(params[:diploma]) + format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) } + # format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity } + end + end + + end + + # DELETE /diplomas/1 + # DELETE /diplomas/1.xml + def destroy + @diploma = Diploma.find(params[:id]) + @diploma.destroy + + respond_to do |format| + format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) } + # format.xml { head :ok } + format.js + end + end + + def delete + if params[:ids] + diplomas = Diploma.any_in(:_id => params[:ids]).destroy_all + end + redirect_to panel_personal_diploma_back_end_diplomas_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end + + def data_share + + if params[:ids] + + @diplomas = Diploma.any_in(:_id => params[:ids]) + + @diplomas.each do |diploma| + + diploma.is_hidden = params[:disable] + + diploma.save + end + + end + + respond_to do |format| + + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"Diploma")) } + 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) + # @diploma_categorys = [] + # if(is_manager? || is_admin?) + # @diploma_categorys = (id ? DiplomaCategory.admin_manager_all.find(id).to_a : DiplomaCategory.admin_manager_all)) + # elsif is_sub_manager? + # @diploma_categorys = DiplomaCategory.all.authed_for_user(current_user,'edit') + # end + # if @diploma_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 diff --git a/app/controllers/panel/personal_diploma/back_end/personal_diploma_intros_controller.rb b/app/controllers/panel/personal_diploma/back_end/personal_diploma_intros_controller.rb new file mode 100644 index 0000000..22b8503 --- /dev/null +++ b/app/controllers/panel/personal_diploma/back_end/personal_diploma_intros_controller.rb @@ -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 diff --git a/app/controllers/panel/personal_diploma/desktop/personal_diplomas_controller.rb b/app/controllers/panel/personal_diploma/desktop/personal_diplomas_controller.rb new file mode 100644 index 0000000..456efc8 --- /dev/null +++ b/app/controllers/panel/personal_diploma/desktop/personal_diplomas_controller.rb @@ -0,0 +1,51 @@ +class Panel::PersonalDiploma::Desktop::PersonalDiplomasController < ApplicationController + + def index + @diplomas = Diploma.where(create_user_id: current_user.id) + respond_to do |format| + format.html { render :layout => false} + end + end + + def new + @diploma = Diploma.new + render :layout => false + end + + def create + params[:diploma][:create_user_id] = current_user.id + @diploma = Diploma.new(params[:diploma]) + if @diploma.save + render json: {success: true, msg: t('create_success')}.to_json + else + error_msg = @diploma.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def edit + @diploma = Diploma.find(params[:id]) + render :layout => false + end + + def update + params[:diploma][:create_user_id] = current_user.id + @diploma = Diploma.find(params[:id]) + if @diploma.update_attributes(params[:diploma]) + render json: {success: true, msg: t('create_success')}.to_json + else + error_msg = @diploma.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def destroy + @diploma = Diploma.find(params[:id]) + @diploma.destroy + render :json => {success: true, msg: t('delete_success')} + end + + def diploma_window + render :layout => false + end +end \ No newline at end of file diff --git a/app/controllers/panel/personal_diploma/desktop/plugin_intros_controller.rb b/app/controllers/panel/personal_diploma/desktop/plugin_intros_controller.rb new file mode 100644 index 0000000..d58b680 --- /dev/null +++ b/app/controllers/panel/personal_diploma/desktop/plugin_intros_controller.rb @@ -0,0 +1,32 @@ +class Panel::PersonalDiploma::Desktop::PluginIntrosController < ApplicationController + + def index + @intro = PersonalDiplomaIntro.where(:user_id => current_user.id.to_s).first + if @intro.blank? + @intro = PersonalDiplomaIntro.new + render "new", :layout => false + else + render "edit", :layout => false + end + end + + def create + @intro = PersonalDiplomaIntro.new(params[:personal_diploma_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 = PersonalDiplomaIntro.find(params[:id]) + if @intro.update_attributes(params[:personal_diploma_intro]) + render :json => {"success" => true}.to_json + else + render :json => {"success" => false}.to_json + end + end + +end \ No newline at end of file diff --git a/app/controllers/panel/personal_diploma/front_end/diplomas_controller.rb b/app/controllers/panel/personal_diploma/front_end/diplomas_controller.rb new file mode 100644 index 0000000..d4d6039 --- /dev/null +++ b/app/controllers/panel/personal_diploma/front_end/diplomas_controller.rb @@ -0,0 +1,17 @@ +class Panel::PersonalDiploma::FrontEnd::DiplomasController < OrbitWidgetController + + def initialize + super + @app_title = 'personal_diploma' + end + + + def index + end + + def show + @diploma = Diploma.find(params[:id]) + end + + +end diff --git a/app/controllers/panel/personal_diploma/plugin/diplomas_controller.rb b/app/controllers/panel/personal_diploma/plugin/diplomas_controller.rb new file mode 100644 index 0000000..ca022e6 --- /dev/null +++ b/app/controllers/panel/personal_diploma/plugin/diplomas_controller.rb @@ -0,0 +1,164 @@ +class Panel::PersonalDiploma::Plugin::DiplomasController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + + def index + + @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 + + @diplomas = (params[:sort] || @filter) ? get_sorted_and_filtered("diploma",:create_user_id => current_user.id) : get_viewable("diploma", :create_user_id => current_user.id) + @tags = get_tags + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @diplomas } + format.js + end + end + + def diploma_setting + + @tags = get_tags + + end + + # GET /diplomas/1 + # GET /diplomas/1.xml + def show + @diploma = Diploma.find(params[:id]) + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @diploma } + end + end + + # GET /diplomas/new + # GET /diplomas/new.xml + def new + + @diploma = Diploma.new + + @tags = get_tags + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @diploma } + end + end + + # GET /diplomas/1/edit + def edit + @diploma = Diploma.find(params[:id]) + + @tags = get_tags + end + + # POST /diplomas + # POST /diplomas.xml + def create + + @tags = get_tags + + @diploma = Diploma.new(params[:diploma]) + + @diploma.create_user_id = current_user.id + @diploma.update_user_id = current_user.id + + respond_to do |format| + if @diploma.save + format.html { redirect_to(panel_personal_diploma_plugin_diplomas_url) } + format.xml { render :xml => @diploma, :status => :created, :location => @diploma } + else + format.html { render :action => "new" } + format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity } + end + end + end + + # PUT /diplomas/1 + # PUT /diplomas/1.xml + def update + + @diploma = Diploma.find(params[:id]) + + @diploma.update_user_id = current_user.id + + params[:diploma][:tag_ids] ||=[] + + respond_to do |format| + if @diploma.update_attributes(params[:diploma]) + format.html { redirect_to(panel_personal_diploma_plugin_diplomas_url) } + # format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @diploma.errors, :status => :unprocessable_entity } + end + end + end + + # DELETE /diplomas/1 + # DELETE /diplomas/1.xml + def destroy + @diploma = Diploma.find(params[:id]) + @diploma.destroy + + respond_to do |format| + format.html { redirect_to(panel_personal_diploma_plugin_diplomas_url) } + # format.xml { head :ok } + format.js + end + end + + def delete + if params[:ids] + diplomas = Diploma.any_in(:_id => params[:ids]).destroy_all + end + redirect_to panel_personal_diploma_plugin_diplomas_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) + # @diploma_categorys = [] + # if(is_manager? || is_admin?) + # @diploma_categorys = (id ? DiplomaCategory.admin_manager_all.find(id).to_a : DiplomaCategory.admin_manager_all)) + # elsif is_sub_manager? + # @diploma_categorys = DiplomaCategory.all.authed_for_user(current_user,'edit') + # end + # if @diploma_categorys.empty? && params[:action] != "index" + # flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") + # redirect_to :action => :index + # end + # end + +end diff --git a/app/helpers/.gitkeep b/app/helpers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/helpers/panel/personal_diploma/desktop/personal_diplomas_helper.rb b/app/helpers/panel/personal_diploma/desktop/personal_diplomas_helper.rb new file mode 100644 index 0000000..181daac --- /dev/null +++ b/app/helpers/panel/personal_diploma/desktop/personal_diplomas_helper.rb @@ -0,0 +1,103 @@ +module Panel::PersonalDiploma::Desktop::PersonalDiplomasHelper + 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 "school_name" + des = content_tag(:div, publication.school_name, + :class => "list_t_des") + when "keywords" + des = content_tag(:div, publication.keywords, + :class => "list_t_des") + when "department" + des = content_tag(:div, publication.department, + :class => "list_t_des") + when "file" + des = content_tag(:div, link_publication_file(publication), + :class => "list_t_des") + else + end + + content_tag(:div, publication.school_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_diploma_desktop_personal_diploma_path(publication), + "callback-method" => "editdiploma", + "ajax-remote" => "get") + \ + content_tag(:a, t(:delete_), + "ajax-remote" => "delete", + "confirm-message" => t("sure?"), + "callback-method" => "diplomaDelete", + :class => "journal_paper_delete admbg2 admtxt", + :href => panel_personal_diploma_desktop_personal_diploma_path(publication)) + end + end + + def link_publication_file publication + publication.writing_conference_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 diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/diploma.rb b/app/models/diploma.rb new file mode 100644 index 0000000..99cd643 --- /dev/null +++ b/app/models/diploma.rb @@ -0,0 +1,59 @@ +# encoding: utf-8 + +class Diploma + include Mongoid::Document + include Mongoid::Timestamps + include Mongoid::MultiParameterAttributes + + include OrbitModel::LanguageRestrict + include OrbitModel::Status + include OrbitTag::Taggable + + LANGUAGE_TYPES = [ "English", "Chinese" ] + + + field :school_name, localize: true + field :country, localize: true + field :department, localize: true + field :degree, localize: true + + field :year + field :language + field :keywords + field :start_date , :type => Date + field :end_date , :type => Date + 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 :school_name, :at_least_one => true + + 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.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 \ No newline at end of file diff --git a/app/models/personal_diploma_intro.rb b/app/models/personal_diploma_intro.rb new file mode 100644 index 0000000..be90da9 --- /dev/null +++ b/app/models/personal_diploma_intro.rb @@ -0,0 +1,4 @@ +class PersonalDiplomaIntro < PersonalPluginIntro + + +end diff --git a/app/views/.gitkeep b/app/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_diploma/back_end/diplomas/_diploma.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/_diploma.html.erb new file mode 100644 index 0000000..a6649b7 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/_diploma.html.erb @@ -0,0 +1,16 @@ + + <%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %> + + <%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %> +
+ +
+ + <%= User.from_id(diploma.create_user_id).name rescue ''%> + + diff --git a/app/views/panel/personal_diploma/back_end/diplomas/_filter.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/_filter.html.erb new file mode 100644 index 0000000..ad02d4d --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/_filter.html.erb @@ -0,0 +1,9 @@ +
+
+ <%= render 'sort_headers' %> +
+
+ +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_diploma/back_end/diplomas/_form.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/_form.html.erb new file mode 100644 index 0000000..af76296 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/_form.html.erb @@ -0,0 +1,210 @@ +<% # encoding: utf-8 %> +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "lib/main-forms" %> + <%= stylesheet_link_tag "lib/fileupload" %> + <%= stylesheet_link_tag "lib/main-list" %> +<% end %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/bootstrap-fileupload" %> + <%= javascript_include_tag "lib/file-type" %> + <%= javascript_include_tag "lib/module-area" %> +<% end %> + + <%= f.error_messages %> + + +
+ + + + + + +
+ + +
+ + <% if !params[:user_id].blank? %> + +
+ +
+ <%= User.from_id(params[:user_id]).name rescue ''%> +
+
+ + <% end %> + + +
+ +
+ <%= 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'} %> +
+
+ + +
+ +
+ <%= 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'} %> +
+
+ + +
+ +
+ <%= f.text_field :url , :class => "span6" %> +
+
+ + +
+ +
+ <%= f.text_field :keywords %> +
+
+ + +
+ +
+ <%= f.radio_button :language, "Chinese" %> <%= t("personal_diploma.Chinese") %> + <%= f.radio_button :language, "English" %> <%= t("personal_diploma.English") %> +
+
+ + +
+ +
+ <%= f.text_area :note, rows: 2, class: "input-block-level" %> +
+
+ +
+ + + <% if show_form_status_field(@diploma) %> +
+ + +
+ +
+ +
+
+ +
+ <% end %> + + +
+ + +
+ +
+ <% @tags.each do |tag| %> + + <% end %> +
+
+ +
+ +
+ + + + + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> + + +
+ +
+ <%= 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 %> +
+
+ + +
+ +
+ <%= 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 %> +
+
+ + +
+ +
+ <%= 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 %> +
+
+ + +
+ +
+ <%= 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 %> +
+
+ +
+ + <% end %> + +
+ +
+ + +
+ <%= 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" %> +
\ No newline at end of file diff --git a/app/views/panel/personal_diploma/back_end/diplomas/_sort_headers.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/_sort_headers.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_diploma/back_end/diplomas/create_diploma_setting.js.erb b/app/views/panel/personal_diploma/back_end/diplomas/create_diploma_setting.js.erb new file mode 100644 index 0000000..9152ee4 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/create_diploma_setting.js.erb @@ -0,0 +1,5 @@ + +<% if !@diploma_category.blank? %> +$("#myModal1").modal('hide'); +$('<%= j render :partial => 'list_patent_type', :collection => [@diploma_category] %>').appendTo('#diploma_categorys').hide().fadeIn(); +<% end %> diff --git a/app/views/panel/personal_diploma/back_end/diplomas/destroy.js.erb b/app/views/panel/personal_diploma/back_end/diplomas/destroy.js.erb new file mode 100644 index 0000000..0b81fea --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @diploma %>").remove(); \ No newline at end of file diff --git a/app/views/panel/personal_diploma/back_end/diplomas/diploma_setting.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/diploma_setting.html.erb new file mode 100644 index 0000000..f2f8cc3 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/diploma_setting.html.erb @@ -0,0 +1,85 @@ +<% # 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 %> + +<%= render :partial => 'admin/plugins/plugin_list' %> + +
+ +
+
+

+ + 領域 +

+ +
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + +
Corresponding Author編輯 刪除
First Author, Co- Authors編輯 刪除
+
+
+
+
+
+
+
+ + <%= 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' %>  +
+ + + + + + +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "item" %> +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_diploma/back_end/diplomas/edit.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/edit.html.erb new file mode 100644 index 0000000..146d940 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/edit.html.erb @@ -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 %> + + + +<%= 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} %> +
+<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_diploma/back_end/diplomas/index.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/index.html.erb new file mode 100644 index 0000000..a06b6ed --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/index.html.erb @@ -0,0 +1,34 @@ +<% 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 %> + + + + + + + + + + + + + <%= render :partial => 'diploma', :collection => @diplomas %> + +
<%= t('date_') %><%= t('personal_diploma.school_name') %><%= t("personal_plugins.author") %>
+ +
+
+ <%= 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' %> +
+ +
diff --git a/app/views/panel/personal_diploma/back_end/diplomas/index.js.erb b/app/views/panel/personal_diploma/back_end/diplomas/index.js.erb new file mode 100644 index 0000000..b6c9aa5 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/index.js.erb @@ -0,0 +1,3 @@ +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_diplomas").html("<%= j render :partial => 'diploma', :collection => @diplomas %>"); +$("#diploma_pagination").html("<%= j paginate @diplomas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); \ No newline at end of file diff --git a/app/views/panel/personal_diploma/back_end/diplomas/new.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/new.html.erb new file mode 100644 index 0000000..4c31916 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/new.html.erb @@ -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 %> + + + +<%= form_for @diploma, url: panel_personal_diploma_back_end_diplomas_path, html: {class: "form-horizontal main-forms previewable"} do |f| %> +
+ <%= render partial: 'form', locals: {f: f} %> +
+<% end %> diff --git a/app/views/panel/personal_diploma/back_end/diplomas/show.html.erb b/app/views/panel/personal_diploma/back_end/diplomas/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_diploma/back_end/diplomas/toggle_enable.js.erb b/app/views/panel/personal_diploma/back_end/diplomas/toggle_enable.js.erb new file mode 100644 index 0000000..b00cfa0 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/toggle_enable.js.erb @@ -0,0 +1,3 @@ +$("#enable_<%= @bulletin.id %>").toggle(); +$("#disable_<%= @bulletin.id %>").toggle(); +$("#bulletin_<%= @bulletin.id %>").toggleClass('disable'); \ No newline at end of file diff --git a/app/views/panel/personal_diploma/back_end/diplomas/update_diploma_setting.js.erb b/app/views/panel/personal_diploma/back_end/diplomas/update_diploma_setting.js.erb new file mode 100644 index 0000000..f2a6035 --- /dev/null +++ b/app/views/panel/personal_diploma/back_end/diplomas/update_diploma_setting.js.erb @@ -0,0 +1,6 @@ + +<% if !@diploma_category.blank? %> +$("#myModal1").modal('hide'); +$("#<%= dom_id @diploma_category %>").replaceWith("<%= j render :partial => 'list_patent_type', :collection => [@diploma_category] %>"); +<% end %> + diff --git a/app/views/panel/personal_diploma/desktop/personal_diplomas/_form.html.erb b/app/views/panel/personal_diploma/desktop/personal_diplomas/_form.html.erb new file mode 100644 index 0000000..20e509c --- /dev/null +++ b/app/views/panel/personal_diploma/desktop/personal_diplomas/_form.html.erb @@ -0,0 +1,91 @@ +
+
+ + <%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %> + <% if not @diploma.new_record? %> + <%= submit_tag t("cancel"), :type => "button", "callback-method"=>"canceldiploma", "ajax-remote" => "get", :href => panel_personal_diploma_desktop_personal_diplomas_path, class: "fn_btn ini_input hp hh1 admbg2 admtxt" %> + + <% end %> +
+
+
Language
+
+ +
+
+
+
+
+
+
+ + +
\ No newline at end of file diff --git a/app/views/panel/personal_diploma/desktop/personal_diplomas/diploma_window.html.erb b/app/views/panel/personal_diploma/desktop/personal_diplomas/diploma_window.html.erb new file mode 100644 index 0000000..5698db4 --- /dev/null +++ b/app/views/panel/personal_diploma/desktop/personal_diplomas/diploma_window.html.erb @@ -0,0 +1,36 @@ +<%= stylesheet_link_tag "/assets/personal_diploma/personal_diploma" %> +<%= javascript_include_tag "personal_diploma/desktop/personal_diploma" %> +
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/app/views/panel/personal_diploma/desktop/personal_diplomas/edit.html.erb b/app/views/panel/personal_diploma/desktop/personal_diplomas/edit.html.erb new file mode 100644 index 0000000..58023af --- /dev/null +++ b/app/views/panel/personal_diploma/desktop/personal_diplomas/edit.html.erb @@ -0,0 +1,3 @@ +<%= form_for @diploma, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_diploma_desktop_personal_diploma_path(@diploma) do |f| %> + <%= render partial: 'form', locals: {:f => f} %> +<%end%> diff --git a/app/views/panel/personal_diploma/desktop/personal_diplomas/index.html.erb b/app/views/panel/personal_diploma/desktop/personal_diplomas/index.html.erb new file mode 100644 index 0000000..94778bf --- /dev/null +++ b/app/views/panel/personal_diploma/desktop/personal_diplomas/index.html.erb @@ -0,0 +1,69 @@ +
+
+
+
+ +
+
+
+
More
+
+ +
+
+
+
Tag
+
+ +
+
+
+
Status
+
+ +
+
+
+
View
+
+
    +
  • <%= link_to "School Name", panel_personal_diploma_desktop_personal_diplomas_path + "?view=school_name", :class => "hp hh1 admtxt", "ajax-remote" => "get" %>
  • +
  • <%= link_to "Keywords", panel_personal_diploma_desktop_personal_diplomas_path + "?view=keywords", :class => "hp hh1 admtxt", "ajax-remote" => "get" %>
  • +
  • <%= link_to "Department", panel_personal_diploma_desktop_personal_diplomas_path + "?view=department", :class => "hp hh1 admtxt", "ajax-remote" => "get" %>
  • +
+
+
+
+
Share
+ +
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/app/views/panel/personal_diploma/desktop/personal_diplomas/new.html.erb b/app/views/panel/personal_diploma/desktop/personal_diplomas/new.html.erb new file mode 100644 index 0000000..21d8a3f --- /dev/null +++ b/app/views/panel/personal_diploma/desktop/personal_diplomas/new.html.erb @@ -0,0 +1,3 @@ +<%= form_for @diploma, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_diploma_desktop_personal_diplomas_path do |f| %> + <%= render partial: 'form', locals: {:f => f} %> +<%end%> diff --git a/app/views/panel/personal_diploma/desktop/plugin_intros/_form.html.erb b/app/views/panel/personal_diploma/desktop/plugin_intros/_form.html.erb new file mode 100644 index 0000000..1dfa224 --- /dev/null +++ b/app/views/panel/personal_diploma/desktop/plugin_intros/_form.html.erb @@ -0,0 +1,54 @@ +
+
+ + <%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %> +
+
+
Language
+
+ +
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/app/views/panel/personal_diploma/desktop/plugin_intros/edit.html.erb b/app/views/panel/personal_diploma/desktop/plugin_intros/edit.html.erb new file mode 100644 index 0000000..a339c15 --- /dev/null +++ b/app/views/panel/personal_diploma/desktop/plugin_intros/edit.html.erb @@ -0,0 +1,3 @@ +<%= form_for @intro, html: { multipart: true, "form-type"=>"ajax_form","notification"=>"Brief Intro Updated"}, url: panel_personal_diploma_desktop_plugin_intro_path(@intro) do |f| %> + <%= render partial: 'form', locals: {:f => f} %> +<%end%> diff --git a/app/views/panel/personal_diploma/desktop/plugin_intros/new.html.erb b/app/views/panel/personal_diploma/desktop/plugin_intros/new.html.erb new file mode 100644 index 0000000..184808c --- /dev/null +++ b/app/views/panel/personal_diploma/desktop/plugin_intros/new.html.erb @@ -0,0 +1,3 @@ +<%= form_for @intro, html: { multipart: true, "form-type"=>"ajax_form", "notification"=>"Brief Intro Saved"}, url: panel_personal_diploma_desktop_plugin_intros_path do |f| %> + <%= render partial: 'form', locals: {f: f} %> +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_diploma/front_end/_profile.html.erb b/app/views/panel/personal_diploma/front_end/_profile.html.erb new file mode 100644 index 0000000..63540b9 --- /dev/null +++ b/app/views/panel/personal_diploma/front_end/_profile.html.erb @@ -0,0 +1,54 @@ +<% + if @member + + @diplomas = Diploma.where(is_hidden: false, :create_user_id => @member.id).desc(:start_date) + + @diploma_intro = !PersonalDiplomaIntro.where(:user_id => @member.id).blank? ? PersonalDiplomaIntro.where(:user_id => @member.id).first : PersonalDiplomaIntro.new +%> + + <% if @diploma_intro.brief_intro and !@diploma_intro.blank? %> + +
+ <%= @diploma_intro.text.html_safe rescue '' %> +
+ + <% end %> + + <% if ( !@diploma_intro.blank? and @diploma_intro.complete_list ) or @diploma_intro.blank? %> + + <% if !@diplomas.blank? %> + + + + + + + + + + + + + + <% @diplomas.each do |diploma| %> + + + + + + + + + + <% end %> + + +
<%= t('personal_diploma.school_name') %><%= t('personal_diploma.country') %><%= t('personal_diploma.department') %><%= t('personal_diploma.degree') %><%= t('date_') %>
+ <%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %> + <%= diploma.country %><%= diploma.department %><%= diploma.degree %><%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %>
+ + <% end %> + + <% end %> + +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_diploma/front_end/diplomas/index.html.erb b/app/views/panel/personal_diploma/front_end/diplomas/index.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_diploma/front_end/diplomas/show.html.erb b/app/views/panel/personal_diploma/front_end/diplomas/show.html.erb new file mode 100644 index 0000000..49a556c --- /dev/null +++ b/app/views/panel/personal_diploma/front_end/diplomas/show.html.erb @@ -0,0 +1,45 @@ +<% # encoding: utf-8 %> + + + + + <% if !@diploma.year.blank? %> + + <% end %> + + <% if !@diploma.language.blank? %> + + <% end %> + + <% if !@diploma.school_name.blank? %> + + <% end %> + + <% if !@diploma.country.blank? %> + + <% end %> + + <% if !@diploma.department.blank? %> + + <% end %> + + <% if !@diploma.degree.blank? %> + + <% end %> + + <% if !@diploma.start_date.blank? %> + + <% end %> + + <% if !@diploma.end_date.blank? %> + + <% end %> + + <% if !@diploma.language.blank? %> + + <% end %> + + + + +
<%= t("module_name.personal_diploma") %>
<%= t("personal_diploma.school_name")%><%= @diploma.year %>
<%= t("personal_diploma.language")%><%= @diploma.language %>
<%= t("personal_diploma.school_name")%><%= @diploma.school_name %>
<%= t("personal_diploma.country")%><%= @diploma.country %>
<%= t("personal_diploma.department")%><%= @diploma.department %>
<%= t("personal_diploma.degree")%><%= @diploma.degree %>
<%= t("personal_diploma.start_date")%><%= @diploma.start_date %>
<%= t("personal_diploma.end_date")%><%= @diploma.end_date %>
<%= t("personal_diploma.url")%><%= link_to t(:url), @diploma.url, {:target => '_blank', :title => @diploma.url} if !@diploma.url.blank? %>
<%= t("personal_diploma.authors")%><%= User.from_id(@diploma.create_user_id).name rescue '' %>
diff --git a/app/views/panel/personal_diploma/plugin/_profile.html.erb b/app/views/panel/personal_diploma/plugin/_profile.html.erb new file mode 100644 index 0000000..edae638 --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/_profile.html.erb @@ -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? + @diplomas = Diploma.where(:create_user_id => @user.id).desc(:start_date).page(params[:page]).per(10) + else + @diplomas = Diploma.where(is_hidden: false, :create_user_id => @user.id).desc(:start_date).page(params[:page]).per(10) + end + +%> + +<% if is_admin? %> +
+
+ <%= 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') ) %> +
+
+<% end -%> + + + + + <% if is_admin? %> + + <% end -%> + + + + + + + <% @diplomas.each do |diploma| %> + + "> + <% if is_admin? %> + + <% end -%> + + + + + <% end %> + + +
<%= t('date_') %><%= t('personal_diploma.school_name') %>
+ <%= check_box_tag 'to_change[]', diploma.id.to_s, false, :class => "list-check" %> + <%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %> + <%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %> +
+ +<% if is_admin? %> +
+
+ <%= 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' %> +
+ +
+<% end %> + + \ No newline at end of file diff --git a/app/views/panel/personal_diploma/plugin/diplomas/_diploma.html.erb b/app/views/panel/personal_diploma/plugin/diplomas/_diploma.html.erb new file mode 100644 index 0000000..3fa95c9 --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/_diploma.html.erb @@ -0,0 +1,20 @@ + + + <% if (diploma.create_user_id == current_user.id) || is_manager? %> + <%= check_box_tag 'to_delete[]', diploma.id, false, :class => "checkbox_in_list" %> + <% end -%> + + <%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %> + + <%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %> +
+ +
+ + + diff --git a/app/views/panel/personal_diploma/plugin/diplomas/_filter.html.erb b/app/views/panel/personal_diploma/plugin/diplomas/_filter.html.erb new file mode 100644 index 0000000..63882b8 --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/_filter.html.erb @@ -0,0 +1,11 @@ + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_diploma/plugin/diplomas/_form.html.erb b/app/views/panel/personal_diploma/plugin/diplomas/_form.html.erb new file mode 100644 index 0000000..b3bf0d9 --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/_form.html.erb @@ -0,0 +1,126 @@ +<% # encoding: utf-8 %> + + <%= f.error_messages %> + + + +
+ +
+
+ +
+

Tags

+
+ <% @tags.each do |tag| %> + <%= content_tag :label,:class => "checkbox inline" do -%> + <%= check_box_tag 'diploma[tag_ids][]', tag.id, @diploma.tag_ids.include?(tag.id)%> + <%= tag.name %> + <%= hidden_field_tag 'diploma[tag_ids][]', '' %> + <% end %> + <% end %> +
+
+ +
+ + + + + +
+
+ +
+ <%= 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'} %> +
+ +
+ <%= 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'} %> +
+ + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> + +
+ <%= 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 %> +
+ +
+ <%= 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 %> +
+ +
+ <%= 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 %> +
+ +
+ <%= 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 %> +
+ +
+ + <% end %> + +
+ +
+ <%= f.label :url, t("personal_diploma.url") %> + <%= f.text_field :url %> +
+ +
+ <%= f.label :keywords, t("personal_diploma.keywords") %> + <%= f.text_field :keywords %> +
+ +
+ <%= 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") %> +
+ +
+ <%= f.label :note, t("personal_diploma.note") %> + <%= f.text_area :note, :size => "60x3" %> +
+ +
+ + +
+ + + + +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
\ No newline at end of file diff --git a/app/views/panel/personal_diploma/plugin/diplomas/_sort_headers.html.erb b/app/views/panel/personal_diploma/plugin/diplomas/_sort_headers.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_diploma/plugin/diplomas/destroy.js.erb b/app/views/panel/personal_diploma/plugin/diplomas/destroy.js.erb new file mode 100644 index 0000000..0b81fea --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @diploma %>").remove(); \ No newline at end of file diff --git a/app/views/panel/personal_diploma/plugin/diplomas/edit.html.erb b/app/views/panel/personal_diploma/plugin/diplomas/edit.html.erb new file mode 100644 index 0000000..5d8c5ac --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/edit.html.erb @@ -0,0 +1,5 @@ +

<%= t('personal_diploma.editing_personal_diploma') %>

+ +<%= form_for @diploma, :url => panel_personal_diploma_plugin_diploma_path(@diploma), :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> diff --git a/app/views/panel/personal_diploma/plugin/diplomas/index.html.erb b/app/views/panel/personal_diploma/plugin/diplomas/index.html.erb new file mode 100644 index 0000000..d55da77 --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/index.html.erb @@ -0,0 +1,22 @@ +<%= render 'filter' %> + + + + + + + + + + + + <%= render :partial => 'diploma', :collection => @diplomas %> + +
+ +
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_diploma_plugin_diploma_path, :class => 'btn btn-primary pull-right' %> +
+ <%= paginate @diplomas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> +
+
diff --git a/app/views/panel/personal_diploma/plugin/diplomas/index.js.erb b/app/views/panel/personal_diploma/plugin/diplomas/index.js.erb new file mode 100644 index 0000000..b6c9aa5 --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/index.js.erb @@ -0,0 +1,3 @@ +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_diplomas").html("<%= j render :partial => 'diploma', :collection => @diplomas %>"); +$("#diploma_pagination").html("<%= j paginate @diplomas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); \ No newline at end of file diff --git a/app/views/panel/personal_diploma/plugin/diplomas/new.html.erb b/app/views/panel/personal_diploma/plugin/diplomas/new.html.erb new file mode 100644 index 0000000..aee478e --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/new.html.erb @@ -0,0 +1,10 @@ + +<%= flash_messages %> +
+

<%= t('diploma.new_personal_diploma') %>

+<%= form_for @diploma, :url => panel_personal_diploma_plugin_diplomas_path, :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> +
+<%#= link_back %> + diff --git a/app/views/panel/personal_diploma/plugin/diplomas/show.html.erb b/app/views/panel/personal_diploma/plugin/diplomas/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_diploma/plugin/diplomas/toggle_enable.js.erb b/app/views/panel/personal_diploma/plugin/diplomas/toggle_enable.js.erb new file mode 100644 index 0000000..b00cfa0 --- /dev/null +++ b/app/views/panel/personal_diploma/plugin/diplomas/toggle_enable.js.erb @@ -0,0 +1,3 @@ +$("#enable_<%= @bulletin.id %>").toggle(); +$("#disable_<%= @bulletin.id %>").toggle(); +$("#bulletin_<%= @bulletin.id %>").toggleClass('disable'); \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..24ff688 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,57 @@ +en: + module_name: + personal_diploma: Diploma + personal_diploma: + paper_title : "Paper Title" + book_title : "Book Title" + 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" + school_name : "School Name" + country : "Country" + department : "Department" + degree : "Degree" + frontend: + diplomas: "Diploma Front-end" + + 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…" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml new file mode 100644 index 0000000..72ccfcc --- /dev/null +++ b/config/locales/zh_tw.yml @@ -0,0 +1,58 @@ +zh_tw: + module_name: + personal_diploma: 學歷 + personal_diploma: + paper_title : "論文名稱" + book_title : "期刊名稱" + extracted_chapters : "摘要" + end_date : "結束日期" + start_date : "開始日期" + publishers : "出版社" + 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 : "描述" + pages : "Pages" + school_name : "學校名稱" + country : "國家" + department : "系所" + degree : "學位" + frontend: + diplomas: "學歷前台" + + create_success : "新增完成!!" + update_success : "更新完成!!" + delete_success : "刪除成功!!" + add: "新增" + back: "返回" + delete: "刪除" + edit: "編輯" + nothing: "無" + show: "顯示" + sure?: "您肯定嗎?" + update: "更新" + yes_: "是" + no_: "否" + cancel : "取消" + save: "儲存" + hintText: "請輸入搜尋關鍵字" + noResultsText: "沒有相關的比對結果" + searchingText: "搜尋中…" diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..ca0151e --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,39 @@ +Rails.application.routes.draw do + + namespace :panel do + namespace :personal_diploma do + namespace :desktop do + match "diploma_window" => "personal_diplomas#diploma_window" + resources :personal_diplomas + resources :plugin_intros + end + namespace :back_end do + + match 'diploma_setting' => "diplomas#diploma_setting" ,:as => :diploma_setting + + resources :diplomas do + collection do + get 'delete' + get 'data_share' + end + end + + resources :personal_diploma_intros + resources :tags + end + namespace :front_end do + resources :diplomas + end + namespace :plugin do + resources :diplomas + end + namespace :widget do + match "diplomas" => "diplomas#index" + match "home_list" => "diplomas#home_list" + match "reload_diplomas" => "diplomas#reload_diplomas" + end + end + end + match "/appfront/*path" => redirect("/panel/*path") + +end diff --git a/lib/personal_diploma.rb b/lib/personal_diploma.rb new file mode 100644 index 0000000..e8cb549 --- /dev/null +++ b/lib/personal_diploma.rb @@ -0,0 +1,4 @@ +require "personal_diploma/engine" + +module PersonalDiploma +end diff --git a/lib/personal_diploma/engine.rb b/lib/personal_diploma/engine.rb new file mode 100644 index 0000000..4c2c884 --- /dev/null +++ b/lib/personal_diploma/engine.rb @@ -0,0 +1,24 @@ +module PersonalDiploma + class Engine < Rails::Engine + initializer "personal_diploma" do + OrbitApp.registration "PersonalDiploma",:type=> 'ModuleApp' do + module_label 'module_name.personal_diploma' + base_url File.expand_path File.dirname(__FILE__) + personal_plugin :enable => true, :sort_number => '40', :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' + + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + + front_end do + app_page 'diplomas' do + frontend_i18n "personal_diploma.frontend.diplomas" + end + end + + end + end + end +end diff --git a/lib/personal_diploma/version.rb b/lib/personal_diploma/version.rb new file mode 100644 index 0000000..c8d86b8 --- /dev/null +++ b/lib/personal_diploma/version.rb @@ -0,0 +1,3 @@ +module PersonalDiploma + VERSION = "0.0.1" +end diff --git a/lib/tasks/personal_diploma_tasks.rake b/lib/tasks/personal_diploma_tasks.rake new file mode 100644 index 0000000..7909dc8 --- /dev/null +++ b/lib/tasks/personal_diploma_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :personal_diploma do +# # Task goes here +# end diff --git a/personal_diploma.gemspec b/personal_diploma.gemspec new file mode 100644 index 0000000..5ca67b4 --- /dev/null +++ b/personal_diploma.gemspec @@ -0,0 +1,23 @@ +$:.push File.expand_path("../lib", __FILE__) + +# Maintain your gem's version: +require "personal_diploma/version" + +# Describe your gem and declare its dependencies: +Gem::Specification.new do |s| + s.name = "personal_diploma" + s.version = PersonalDiploma::VERSION + s.authors = ["RulingDigital"] + s.email = ["service@rulingcom.com"] + s.homepage = "http://www.rulingcom.com" + s.summary = "" + s.description = "Orbit PersonalDiploma 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 diff --git a/personal_diploma.json b/personal_diploma.json new file mode 100644 index 0000000..b209942 --- /dev/null +++ b/personal_diploma.json @@ -0,0 +1,12 @@ +{ + "title": "personal_diploma", + "object": "diploma", + "version": "0.1", + "organization": "Rulingcom", + "author": "RD dep", + "intro": "A simple blog……", + "update_info": "Some info", + "create_date": "09-08-2012", + "enable_frontend": true, + "has_plugin": true +} diff --git a/script/rails b/script/rails new file mode 100644 index 0000000..23bd81f --- /dev/null +++ b/script/rails @@ -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__)