From a9145d5b1aa8c7c887bc9faae7173ba163c4d557 Mon Sep 17 00:00:00 2001 From: Manson Wang Date: Wed, 15 Jan 2014 19:20:52 +0800 Subject: [PATCH] Orbit PersonalPatent Module --- .gitignore | 6 + Gemfile | 17 ++ MIT-LICENSE | 20 ++ README | 0 README.rdoc | 3 + Rakefile | 39 +++ app/assets/images/personal_patent/.gitkeep | 0 .../javascripts/personal_patent/.gitkeep | 0 .../desktop/personal_patent.js | 150 ++++++++++ .../stylesheets/personal_patent/.gitkeep | 0 .../desktop/personal_patent.css | 115 ++++++++ .../desktop/personal_patent.scss | 123 ++++++++ app/controllers/.gitkeep | 0 app/controllers/application_controller.rb | 23 ++ .../personal_patent_intros_controller.rb | 10 + .../writing_patent_categorys_controller.rb | 121 ++++++++ .../back_end/writing_patents_controller.rb | 265 +++++++++++++++++ .../desktop/personal_patents_controller.rb | 71 +++++ .../desktop/plugin_intros_controller.rb | 32 ++ .../front_end/writing_patents_controller.rb | 24 ++ .../plugin/writing_patents_controller.rb | 174 +++++++++++ app/helpers/.gitkeep | 0 .../desktop/personal_patents_helper.rb | 103 +++++++ app/mailers/.gitkeep | 0 app/models/.gitkeep | 0 app/models/personal_patent_intro.rb | 4 + app/models/writing_patent.rb | 90 ++++++ app/models/writing_patent_category.rb | 24 ++ app/models/writing_patent_file.rb | 14 + app/views/.gitkeep | 0 .../writing_patent_categorys/_form.html.erb | 44 +++ .../_quick_edit_qe.html.erb | 28 ++ .../_writing_book_category.html.erb | 22 ++ .../writing_patent_categorys/create.js.erb | 2 + .../writing_patent_categorys/destroy.js.erb | 1 + .../writing_patent_categorys/edit.html.erb | 7 + .../writing_patent_categorys/edit.js.erb | 1 + .../writing_patent_categorys/index.html.erb | 29 ++ .../writing_patent_categorys/new.html.erb | 19 ++ .../writing_patent_categorys/new.js.erb | 1 + .../writing_patent_categorys/update.js.erb | 4 + .../back_end/writing_patents/_filter.html.erb | 9 + .../back_end/writing_patents/_form.html.erb | 276 ++++++++++++++++++ .../writing_patents/_form_file.html.erb | 45 +++ .../_list_patent_type.html.erb | 11 + .../writing_patents/_patent_type_qe.html.erb | 34 +++ .../writing_patents/_sort_headers.html.erb | 0 .../writing_patents/_writing_patent.html.erb | 19 ++ .../create_writing_patent_setting.js.erb | 5 + .../back_end/writing_patents/destroy.js.erb | 1 + .../back_end/writing_patents/edit.html.erb | 15 + .../back_end/writing_patents/index.html.erb | 37 +++ .../back_end/writing_patents/index.js.erb | 3 + .../back_end/writing_patents/new.html.erb | 15 + .../back_end/writing_patents/show.html.erb | 0 .../writing_patents/toggle_enable.js.erb | 3 + .../update_writing_patent_setting.js.erb | 6 + .../writing_patent_category_quick_add.js.erb | 1 + .../writing_patent_category_quick_edit.js.erb | 1 + .../writing_patent_setting.html.erb | 121 ++++++++ .../desktop/personal_patents/_form.html.erb | 110 +++++++ .../personal_patents/_form_file.html.erb | 50 ++++ .../desktop/personal_patents/edit.html.erb | 3 + .../desktop/personal_patents/index.html.erb | 69 +++++ .../desktop/personal_patents/new.html.erb | 3 + .../personal_patents/patent_window.html.erb | 36 +++ .../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 | 48 +++ .../front_end/writing_patents/index.html.erb | 37 +++ .../front_end/writing_patents/show.html.erb | 55 ++++ .../personal_patent/plugin/_profile.html.erb | 96 ++++++ .../plugin/writing_patents/_filter.html.erb | 11 + .../plugin/writing_patents/_form.html.erb | 193 ++++++++++++ .../writing_patents/_form_file.html.erb | 50 ++++ .../writing_patents/_sort_headers.html.erb | 7 + .../writing_patents/_writing_patent.html.erb | 24 ++ .../plugin/writing_patents/destroy.js.erb | 1 + .../plugin/writing_patents/edit.html.erb | 5 + .../plugin/writing_patents/index.html.erb | 22 ++ .../plugin/writing_patents/index.js.erb | 3 + .../plugin/writing_patents/new.html.erb | 10 + .../plugin/writing_patents/show.html.erb | 0 .../writing_patents/toggle_enable.js.erb | 3 + config/locales/en.yml | 56 ++++ config/locales/zh_tw.yml | 54 ++++ config/routes.rb | 43 +++ lib/personal_patent.rb | 4 + lib/personal_patent/engine.rb | 23 ++ lib/personal_patent/version.rb | 3 + lib/tasks/personal_patent_tasks.rake | 4 + personal_patent.gemspec | 23 ++ personal_patent.json | 13 + script/rails | 6 + test/dummy/Rakefile | 7 + .../app/assets/javascripts/application.js | 9 + .../app/assets/stylesheets/application.css | 7 + .../app/controllers/application_controller.rb | 3 + test/dummy/app/helpers/application_helper.rb | 2 + test/dummy/app/mailers/.gitkeep | 0 test/dummy/app/models/.gitkeep | 0 .../app/views/layouts/application.html.erb | 14 + test/dummy/config.ru | 4 + test/dummy/config/application.rb | 45 +++ test/dummy/config/boot.rb | 10 + test/dummy/config/database.yml | 25 ++ test/dummy/config/environment.rb | 5 + test/dummy/config/environments/development.rb | 30 ++ test/dummy/config/environments/production.rb | 60 ++++ test/dummy/config/environments/test.rb | 39 +++ .../initializers/backtrace_silencers.rb | 7 + test/dummy/config/initializers/inflections.rb | 10 + test/dummy/config/initializers/mime_types.rb | 5 + .../dummy/config/initializers/secret_token.rb | 7 + .../config/initializers/session_store.rb | 8 + .../config/initializers/wrap_parameters.rb | 14 + test/dummy/config/locales/en.yml | 5 + test/dummy/config/routes.rb | 58 ++++ test/dummy/lib/assets/.gitkeep | 0 test/dummy/log/.gitkeep | 0 test/dummy/public/404.html | 26 ++ test/dummy/public/422.html | 26 ++ test/dummy/public/500.html | 26 ++ test/dummy/public/favicon.ico | 0 test/dummy/script/rails | 6 + test/integration/navigation_test.rb | 10 + test/personal_patent_test.rb | 7 + test/test_helper.rb | 10 + 129 files changed, 3798 insertions(+) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 MIT-LICENSE create mode 100644 README create mode 100644 README.rdoc create mode 100644 Rakefile create mode 100644 app/assets/images/personal_patent/.gitkeep create mode 100644 app/assets/javascripts/personal_patent/.gitkeep create mode 100644 app/assets/javascripts/personal_patent/desktop/personal_patent.js create mode 100644 app/assets/stylesheets/personal_patent/.gitkeep create mode 100644 app/assets/stylesheets/personal_patent/desktop/personal_patent.css create mode 100644 app/assets/stylesheets/personal_patent/desktop/personal_patent.scss create mode 100644 app/controllers/.gitkeep create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/panel/personal_patent/back_end/personal_patent_intros_controller.rb create mode 100644 app/controllers/panel/personal_patent/back_end/writing_patent_categorys_controller.rb create mode 100644 app/controllers/panel/personal_patent/back_end/writing_patents_controller.rb create mode 100644 app/controllers/panel/personal_patent/desktop/personal_patents_controller.rb create mode 100644 app/controllers/panel/personal_patent/desktop/plugin_intros_controller.rb create mode 100644 app/controllers/panel/personal_patent/front_end/writing_patents_controller.rb create mode 100644 app/controllers/panel/personal_patent/plugin/writing_patents_controller.rb create mode 100644 app/helpers/.gitkeep create mode 100644 app/helpers/panel/personal_patent/desktop/personal_patents_helper.rb create mode 100644 app/mailers/.gitkeep create mode 100644 app/models/.gitkeep create mode 100644 app/models/personal_patent_intro.rb create mode 100644 app/models/writing_patent.rb create mode 100644 app/models/writing_patent_category.rb create mode 100644 app/models/writing_patent_file.rb create mode 100644 app/views/.gitkeep create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/_form.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/_quick_edit_qe.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/_writing_book_category.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/create.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/destroy.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/edit.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/edit.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/index.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/new.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/new.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patent_categorys/update.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/_filter.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/_form.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/_form_file.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/_list_patent_type.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/_patent_type_qe.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/_sort_headers.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/_writing_patent.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/create_writing_patent_setting.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/destroy.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/edit.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/index.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/index.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/new.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/show.html.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/toggle_enable.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/update_writing_patent_setting.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/writing_patent_category_quick_add.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/writing_patent_category_quick_edit.js.erb create mode 100644 app/views/panel/personal_patent/back_end/writing_patents/writing_patent_setting.html.erb create mode 100644 app/views/panel/personal_patent/desktop/personal_patents/_form.html.erb create mode 100644 app/views/panel/personal_patent/desktop/personal_patents/_form_file.html.erb create mode 100644 app/views/panel/personal_patent/desktop/personal_patents/edit.html.erb create mode 100644 app/views/panel/personal_patent/desktop/personal_patents/index.html.erb create mode 100644 app/views/panel/personal_patent/desktop/personal_patents/new.html.erb create mode 100644 app/views/panel/personal_patent/desktop/personal_patents/patent_window.html.erb create mode 100644 app/views/panel/personal_patent/desktop/plugin_intros/_form.html.erb create mode 100644 app/views/panel/personal_patent/desktop/plugin_intros/edit.html.erb create mode 100644 app/views/panel/personal_patent/desktop/plugin_intros/new.html.erb create mode 100644 app/views/panel/personal_patent/front_end/_profile.html.erb create mode 100644 app/views/panel/personal_patent/front_end/writing_patents/index.html.erb create mode 100644 app/views/panel/personal_patent/front_end/writing_patents/show.html.erb create mode 100644 app/views/panel/personal_patent/plugin/_profile.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/_filter.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/_form.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/_form_file.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/_sort_headers.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/_writing_patent.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/destroy.js.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/edit.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/index.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/index.js.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/new.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/show.html.erb create mode 100644 app/views/panel/personal_patent/plugin/writing_patents/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_patent.rb create mode 100644 lib/personal_patent/engine.rb create mode 100644 lib/personal_patent/version.rb create mode 100644 lib/tasks/personal_patent_tasks.rake create mode 100644 personal_patent.gemspec create mode 100644 personal_patent.json create mode 100644 script/rails create mode 100644 test/dummy/Rakefile create mode 100644 test/dummy/app/assets/javascripts/application.js create mode 100644 test/dummy/app/assets/stylesheets/application.css create mode 100644 test/dummy/app/controllers/application_controller.rb create mode 100644 test/dummy/app/helpers/application_helper.rb create mode 100644 test/dummy/app/mailers/.gitkeep create mode 100644 test/dummy/app/models/.gitkeep create mode 100644 test/dummy/app/views/layouts/application.html.erb create mode 100644 test/dummy/config.ru create mode 100644 test/dummy/config/application.rb create mode 100644 test/dummy/config/boot.rb create mode 100644 test/dummy/config/database.yml create mode 100644 test/dummy/config/environment.rb create mode 100644 test/dummy/config/environments/development.rb create mode 100644 test/dummy/config/environments/production.rb create mode 100644 test/dummy/config/environments/test.rb create mode 100644 test/dummy/config/initializers/backtrace_silencers.rb create mode 100644 test/dummy/config/initializers/inflections.rb create mode 100644 test/dummy/config/initializers/mime_types.rb create mode 100644 test/dummy/config/initializers/secret_token.rb create mode 100644 test/dummy/config/initializers/session_store.rb create mode 100644 test/dummy/config/initializers/wrap_parameters.rb create mode 100644 test/dummy/config/locales/en.yml create mode 100644 test/dummy/config/routes.rb create mode 100644 test/dummy/lib/assets/.gitkeep create mode 100644 test/dummy/log/.gitkeep create mode 100644 test/dummy/public/404.html create mode 100644 test/dummy/public/422.html create mode 100644 test/dummy/public/500.html create mode 100644 test/dummy/public/favicon.ico create mode 100644 test/dummy/script/rails create mode 100644 test/integration/navigation_test.rb create mode 100644 test/personal_patent_test.rb create mode 100644 test/test_helper.rb 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..b82373f --- /dev/null +++ b/Gemfile @@ -0,0 +1,17 @@ +source "http://rubygems.org" + +# Declare your gem's dependencies in personal_patent.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 b/README new file mode 100644 index 0000000..e69de29 diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..38a9403 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,3 @@ += PersonalPatent + +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..42b90b5 --- /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 = 'PersonalPatent' + 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_patent/.gitkeep b/app/assets/images/personal_patent/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/personal_patent/.gitkeep b/app/assets/javascripts/personal_patent/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/personal_patent/desktop/personal_patent.js b/app/assets/javascripts/personal_patent/desktop/personal_patent.js new file mode 100644 index 0000000..4313da1 --- /dev/null +++ b/app/assets/javascripts/personal_patent/desktop/personal_patent.js @@ -0,0 +1,150 @@ +orbitDesktop.prototype.initializePersonalPatent = function(target,url,cache){ // this init journal papers + this.initializePersonalPatent.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.initializePersonalPatent.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.initializePersonalPatent.patentDelete = function(data,dom){ + var parent = dom.parent().parent().parent(); + if(data.success){ + parent.hide("slide",function(){parent.remove();}); + o.notify(data.msg,"success"); + } + } + + this.initializePersonalPatent.cancelpatent = 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.initializePersonalPatent.editpatent = function(){ + o.highlight_sub_menu_item(1); + uploadFiles(); + languageSelect(); + } + + this.initializePersonalPatent.addpatent = function(){ // to open add pages in journal papers page + uploadFiles(); + languageSelect(); + } + + this.initializePersonalPatent.brief = function(){ + o.enablelanguageSelect(); + $("textarea.editor").ckeditor({ + height: 300, + width: $(".overview").width() - 20 + }); + } + + this.initializePersonalPatent.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.initializePersonalPatent.coauthor = function(){ // to open add pages in coauthor page + var bindHandlers = function(){ // to bind handlers for add page + + } + bindHandlers(); + } + this.initializePersonalPatent.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.initializePersonalPatent.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.initializePersonalPatent.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.initializePersonalPatent.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_patent/.gitkeep b/app/assets/stylesheets/personal_patent/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/personal_patent/desktop/personal_patent.css b/app/assets/stylesheets/personal_patent/desktop/personal_patent.css new file mode 100644 index 0000000..ac05d80 --- /dev/null +++ b/app/assets/stylesheets/personal_patent/desktop/personal_patent.css @@ -0,0 +1,115 @@ +/* Books */ +[page-name="patent_list"] .list_t_item .inner { + padding-left: 30px; } +[page-name="patent_list"] .list_item_action { + font-size: 12px; + float: left; + margin-left: -30px; } + [page-name="patent_list"] .list_item_action a { + display: block; + width: 20px; + height: 20px; + line-height: 20px; + margin: 1px 1px 6px 1px; } + [page-name="patent_list"] .list_item_action .icon-star-empty { + color: #999; + font-size: 20px; } + [page-name="patent_list"] .list_item_action .icon-star { + color: #faa732; + font-size: 20px; } + [page-name="patent_list"] .list_item_action .icon-check-empty { + color: #999; + font-size: 20px; } + [page-name="patent_list"] .list_item_action .icon-check { + color: #333; + font-size: 20px; } +[page-name="patent_list"] .file_view .list_t_des { + overflow: hidden; } +[page-name="patent_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="patent_list"] .file_view .file:hover { + background-color: #f7f7f7; } + [page-name="patent_list"] .file_view .file img { + width: 38px; + height: 38px; + position: absolute; + left: 6px; + top: 6px; } + [page-name="patent_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_patent/desktop/personal_patent.scss b/app/assets/stylesheets/personal_patent/desktop/personal_patent.scss new file mode 100644 index 0000000..0a58f44 --- /dev/null +++ b/app/assets/stylesheets/personal_patent/desktop/personal_patent.scss @@ -0,0 +1,123 @@ +@import "desktop-helper"; + +/* Books */ +[page-name="patent_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_patent/back_end/personal_patent_intros_controller.rb b/app/controllers/panel/personal_patent/back_end/personal_patent_intros_controller.rb new file mode 100644 index 0000000..4a25dbf --- /dev/null +++ b/app/controllers/panel/personal_patent/back_end/personal_patent_intros_controller.rb @@ -0,0 +1,10 @@ +class Panel::PersonalPatent::BackEnd::PersonalPatentIntrosController < Admin::PersonalPluginIntrosController + + def initialize + super + @app_type = 'personal_patent_intro' + @app_type_name = 'personal_patent' + @reback_name = 'WritingPatent' + end + +end diff --git a/app/controllers/panel/personal_patent/back_end/writing_patent_categorys_controller.rb b/app/controllers/panel/personal_patent/back_end/writing_patent_categorys_controller.rb new file mode 100644 index 0000000..35c4969 --- /dev/null +++ b/app/controllers/panel/personal_patent/back_end/writing_patent_categorys_controller.rb @@ -0,0 +1,121 @@ +class Panel::PersonalPatent::BackEnd::WritingPatentCategorysController < OrbitBackendController + include OrbitControllerLib::DivisionForDisable + + open_for_manager :except => [:index] + + def index + + @writing_patent_categorys = get_categories_for_index("WritingPatentCategory") + @writing_patent_category = WritingPatentCategory.new(:display => 'List') + + @url = panel_personal_patent_back_end_writing_patent_categorys_path + + respond_to do |format| + format.html # index.html.erb + format.js + end + end + + # GET /writing_patents/1 + # GET /writing_patents/1.xml + def show + + @writing_patent_category = WritingPatentCategory.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.js + end + end + + # GET /writing_patents/new + # GET /writing_patents/new.xml + def new + + @writing_patent_category = WritingPatentCategory.new(:display => 'List') + + @verb = :post + + respond_to do |format| + format.html # new.html.erb + format.js + end + end + + # GET /writing_patents/1/edit + def edit + + @writing_patent_category = WritingPatentCategory.find(params[:id]) + + # @url = panel_personal_patent_back_end_writing_patent_category_path(@writing_patent_category) + # @url = eval("panel_personal_patent_back_end_#{@app_type}_path(@writing_patent_category)") + @url = polymorphic_path([:panel, :personal_patent, :back_end, @writing_patent_category]) + + @verb = :put + + respond_to do |format| + format.html + format.js + end + end + + # POST /writing_patents + # POST /writing_patents.xml + def create + + @writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category]) + + respond_to do |format| + if @writing_patent_category.save + format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url, :notice => t('writing_patent_category.create_writing_patent_category_success')) } + format.js + else + format.html { render :action => "new" } + format.js { render action: "new" } + end + end + end + + # PUT /writing_patents/1 + # PUT /writing_patents/1.xml + def update + + @writing_patent_category = WritingPatentCategory.find(params[:id]) + # debugger + # @url = panel_personal_patent_back_end_writing_patent_category_path(@writing_patent_category) + # @url = eval("panel_personal_patent_back_end_#{@app_type}_path(#{@writing_patent_category})") + @url = polymorphic_path([:panel, :personal_patent, :back_end, @writing_patent_category]) + + respond_to do |format| + if @writing_patent_category.update_attributes(params[:writing_patent_category]) + format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url, :notice => t('writing_patent_category.update_writing_patent_category_success')) } + # format.xml { head :ok } + format.js + else + format.html { render :action => "edit" } + format.js { render :action => "edit" } + end + end + end + + # DELETE /writing_patents/1 + # DELETE /writing_patents/1.xml + def destroy + + @writing_patent_category = WritingPatentCategory.find(params[:id]) + @writing_patent_category.disable = @writing_patent_category.disable ? false : true + + if @writing_patent_category.save! + respond_to do |format| + format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url) } + # format.xml { head :ok } + format.js + end + else + flash[:error] = t("writing_patent_category.update_failed") + format.html { render :action => "index" } + end + + end + +end diff --git a/app/controllers/panel/personal_patent/back_end/writing_patents_controller.rb b/app/controllers/panel/personal_patent/back_end/writing_patents_controller.rb new file mode 100644 index 0000000..6234531 --- /dev/null +++ b/app/controllers/panel/personal_patent/back_end/writing_patents_controller.rb @@ -0,0 +1,265 @@ +class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + # before_filter :for_app_manager,:except => [:index,:show] + before_filter :only => [ :new,:edit,:update] do |controller| + controller.get_categorys('WritingPatentCategory') + end + + def index + get_plugins + + # @tags = get_tags + # @categories = get_categories_for_index + # @statuses = get_statuses + # category_ids = @categories.collect{|t| t.id} + @writing_patent_category_ids = WritingPatentCategory.all.collect{|t| t.id.to_s} + [nil] + + @writing_patents = get_sorted_and_filtered("writing_patent", :writing_patent_category_id.in => @writing_patent_category_ids) + respond_to do |format| + format.html # index.html.erb + format.js { } + format.xml { render :xml => @writing_patents } + end + end + + def writing_patent_setting + + get_plugins + + @patent_types = WritingPatentCategory.all + + @tags = get_tags + + @set_patent_type = WritingPatentCategory.new(:display => 'List') + @patent_type_url = panel_personal_patent_back_end_writing_patents_path + + + end + + def writing_patent_category_quick_add + @set_patent_type = WritingPatentCategory.new(:display => 'List') + @patent_type_url = panel_personal_patent_back_end_writing_patents_path + @set_patent_type.id = params[:id] + + respond_to do |format| + format.js + end + + end + + def writing_patent_category_quick_edit + + @set_patent_type = WritingPatentCategory.find(params[:writing_patent_id]) + @patent_type_url = panel_personal_patent_back_end_writing_patent_path(@set_patent_type) + + respond_to do |format| + format.js + end + end + + # GET /writing_patents/1 + # GET /writing_patents/1.xml + def show + @writing_patent = WritingPatent.find(params[:id]) + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @writing_patent } + end + end + + # GET /writing_patents/new + # GET /writing_patents/new.xml + def new + + get_plugins + + @writing_patent = WritingPatent.new + @writing_patent_categorys = WritingPatentCategory.all + + @tags = get_tags + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @writing_patent } + end + end + + # GET /writing_patents/1/edit + def edit + + get_plugins + + @writing_patent = WritingPatent.find(params[:id]) + + @patent_types = WritingPatentCategory.all + + @tags = get_tags + end + + # POST /writing_patents + # POST /writing_patents.xml + def create + + if params[:writing_patent_category] + + @writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category]) + + respond_to do |format| + if @writing_patent_category.save + format.js { render 'create_writing_patent_setting' } + end + end + + else + + @patent_types = WritingPatentCategory.all + @tags = get_tags + + @writing_patent = WritingPatent.new(params[:writing_patent]) + + if params[:writing_patent][:user_id] + @writing_patent.create_user_id = params[:writing_patent][:user_id] + @writing_patent.update_user_id = params[:writing_patent][:user_id] + else + @writing_patent.create_user_id = current_user.id + @writing_patent.update_user_id = current_user.id + end + + respond_to do |format| + + if @writing_patent.save + + if params[:writing_patent][:user_id] + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_patent][:user_id],:show_plugin_profile=>"WritingPatent")) } + else + format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) } + end + + format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent } + else + format.html { render :action => "new" } + format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity } + end + + end + + end + + end + + # PUT /writing_patents/1 + # PUT /writing_patents/1.xml + def update + + if params[:writing_patent_category] + + @writing_patent_category = WritingPatentCategory.find(params[:id]) + + respond_to do |format| + + if @writing_patent_category.update_attributes(params[:writing_patent_category]) + # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js { render 'update_writing_patent_setting' } + end + end + + else + + @writing_patent = WritingPatent.find(params[:id]) + + @writing_patent.update_user_id = current_user.id + + params[:writing_patent][:tag_ids] ||=[] + + respond_to do |format| + if @writing_patent.update_attributes(params[:writing_patent]) + format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) } + # format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity } + end + end + end + + end + + # DELETE /writing_patents/1 + # DELETE /writing_patents/1.xml + def destroy + @writing_patent = WritingPatent.find(params[:id]) + @writing_patent.destroy + + respond_to do |format| + format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) } + # format.xml { head :ok } + format.js + end + end + + def delete + if params[:ids] + writing_patents = WritingPatent.any_in(:_id => params[:ids]).destroy_all + end + redirect_to panel_personal_patent_back_end_writing_patents_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end + + def data_share + + if params[:ids] + + @writing_patents = WritingPatent.any_in(:_id => params[:ids]) + + @writing_patents.each do |writing_patent| + + writing_patent.is_hidden = params[:disable] + + writing_patent.save + end + + end + + respond_to do |format| + + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"WritingPatent")) } + 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) + # @writing_patent_categorys = [] + # if(is_manager? || is_admin?) + # @writing_patent_categorys = (id ? WritingPatentCategory.admin_manager_all.find(id).to_a : WritingPatentCategory.admin_manager_all)) + # elsif is_sub_manager? + # @writing_patent_categorys = WritingPatentCategory.all.authed_for_user(current_user,'edit') + # end + # if @writing_patent_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_patent/desktop/personal_patents_controller.rb b/app/controllers/panel/personal_patent/desktop/personal_patents_controller.rb new file mode 100644 index 0000000..ba54b84 --- /dev/null +++ b/app/controllers/panel/personal_patent/desktop/personal_patents_controller.rb @@ -0,0 +1,71 @@ +class Panel::PersonalPatent::Desktop::PersonalPatentsController < ApplicationController + + def index + @patents = WritingPatent.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 = " " + @patents = @patents.asc(:paper_title) + else + @patents = @patents.asc(@view_by).asc(:paper_title) + end + @patents = @patents.page(page).per(50) + respond_to do |format| + format.html { render :layout => false} + end + end + + def new + @patent = WritingPatent.new + render :layout => false + end + + def create + params[:writing_patent][:create_user_id] = current_user.id + @patent = WritingPatent.new(params[:writing_patent]) + if @patent.save + render json: {success: true, msg: t('create_success')}.to_json + else + error_msg = @patent.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def edit + @patent = WritingPatent.find(params[:id]) + render :layout => false + end + + def update + params[:writing_patent][:create_user_id] = current_user.id + @patent = WritingPatent.find(params[:id]) + if @patent.update_attributes(params[:writing_patent]) + render json: {success: true, msg: t('create_success')}.to_json + else + error_msg = @patent.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def destroy + @patent = WritingPatent.find(params[:id]) + @patent.destroy + render :json => {success: true, msg: t('delete_success')} + end + + def patent_window + render :layout => false + end +end \ No newline at end of file diff --git a/app/controllers/panel/personal_patent/desktop/plugin_intros_controller.rb b/app/controllers/panel/personal_patent/desktop/plugin_intros_controller.rb new file mode 100644 index 0000000..66020fb --- /dev/null +++ b/app/controllers/panel/personal_patent/desktop/plugin_intros_controller.rb @@ -0,0 +1,32 @@ +class Panel::PersonalPatent::Desktop::PluginIntrosController < ApplicationController + + def index + @intro = PersonalPatentIntro.where(:user_id => current_user.id.to_s).first + if @intro.blank? + @intro = PersonalPatentIntro.new + render "new", :layout => false + else + render "edit", :layout => false + end + end + + def create + @intro = PersonalPatentIntro.new(params[:personal_patent_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 = PersonalPatentIntro.find(params[:id]) + if @intro.update_attributes(params[:personal_patent_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_patent/front_end/writing_patents_controller.rb b/app/controllers/panel/personal_patent/front_end/writing_patents_controller.rb new file mode 100644 index 0000000..baa7c22 --- /dev/null +++ b/app/controllers/panel/personal_patent/front_end/writing_patents_controller.rb @@ -0,0 +1,24 @@ +class Panel::PersonalPatent::FrontEnd::WritingPatentsController < OrbitWidgetController + + def initialize + super + @app_title = 'personal_patent' + end + + + def index + + @writing_patents = WritingPatent.where(:is_hidden=>false).desc(:publish_date).page(params[:page]).per(10) + + end + + # GET /writing_patents/1 + # GET /writing_patents/1.xml + def show + + @writing_patent = WritingPatent.find(params[:id]) + + end + + +end diff --git a/app/controllers/panel/personal_patent/plugin/writing_patents_controller.rb b/app/controllers/panel/personal_patent/plugin/writing_patents_controller.rb new file mode 100644 index 0000000..79250bf --- /dev/null +++ b/app/controllers/panel/personal_patent/plugin/writing_patents_controller.rb @@ -0,0 +1,174 @@ +class Panel::PersonalPatent::Plugin::WritingPatentsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + # before_filter :for_app_manager,:except => [:index,:show] + before_filter :only => [ :new,:edit,:update] do |controller| + controller.get_categorys('WritingPatentCategory') + end + + def index + + get_categorys("WritingPatentCategory",params[:web_link_category_id]) + @filter = params[:filter] + new_filter = params[:new_filter] + + if @filter && params[:clear] + @filter.delete(params[:type]) + elsif @filter && new_filter + if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s) + @filter[new_filter[:type]].delete(new_filter[:id].to_s) + elsif @filter.has_key?(new_filter[:type]) + @filter[new_filter[:type]] << new_filter[:id].to_s + else + @filter.merge!({new_filter[:type] => [new_filter[:id].to_s]}) + end + elsif new_filter + @filter = {new_filter[:type] => [new_filter[:id].to_s]} + end + + @writing_patent_categorys = get_categories_for_index("WritingPatentCategory") + @writing_patent_category_ids = @writing_patent_categorys.collect{|t| t.id.to_s} + [nil] + + @writing_patents = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_patent",:create_user_id => current_user.id) : get_viewable("writing_patent", :create_user_id => current_user.id) + + @tags = get_tags + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @writing_patents } + format.js + end + end + + + # GET /writing_patents/1 + # GET /writing_patents/1.xml + def show + @writing_patent = WritingPatent.find(params[:id]) + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @writing_patent } + end + end + + # GET /writing_patents/new + # GET /writing_patents/new.xml + def new + + @writing_patent = WritingPatent.new + @writing_patent_categorys = WritingPatentCategory.all + + @tags = get_tags + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @writing_patent } + end + end + + # GET /writing_patents/1/edit + def edit + @writing_patent = WritingPatent.find(params[:id]) + + @patent_types = WritingPatentCategory.all + + @tags = get_tags + end + + # POST /writing_patents + # POST /writing_patents.xml + def create + + @patent_types = WritingPatentCategory.all + @tags = get_tags + + @writing_patent = WritingPatent.new(params[:writing_patent]) + + @writing_patent.create_user_id = current_user.id + @writing_patent.update_user_id = current_user.id + + respond_to do |format| + if @writing_patent.save + format.html { redirect_to(panel_personal_patent_plugin_writing_patents_url) } + format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent } + else + format.html { render :action => "new" } + format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity } + end + end + end + + + # PUT /writing_patents/1 + # PUT /writing_patents/1.xml + def update + + + @writing_patent = WritingPatent.find(params[:id]) + + @writing_patent.update_user_id = current_user.id + + params[:writing_patent][:tag_ids] ||=[] + + respond_to do |format| + if @writing_patent.update_attributes(params[:writing_patent]) + format.html { redirect_to(panel_personal_patent_plugin_writing_patents_url) } + # format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity } + end + end + end + + # DELETE /writing_patents/1 + # DELETE /writing_patents/1.xml + def destroy + @writing_patent = WritingPatent.find(params[:id]) + @writing_patent.destroy + + respond_to do |format| + format.html { redirect_to(panel_personal_patent_plugin_writing_patents_url) } + # format.xml { head :ok } + format.js + end + end + + def delete + if params[:ids] + writing_patents = WritingPatent.any_in(:_id => params[:ids]).destroy_all + end + redirect_to panel_personal_patent_plugin_writing_patents_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) + # @writing_patent_categorys = [] + # if(is_manager? || is_admin?) + # @writing_patent_categorys = (id ? WritingPatentCategory.admin_manager_all.find(id).to_a : WritingPatentCategory.admin_manager_all)) + # elsif is_sub_manager? + # @writing_patent_categorys = WritingPatentCategory.all.authed_for_user(current_user,'edit') + # end + # if @writing_patent_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_patent/desktop/personal_patents_helper.rb b/app/helpers/panel/personal_patent/desktop/personal_patents_helper.rb new file mode 100644 index 0000000..e1e7af4 --- /dev/null +++ b/app/helpers/panel/personal_patent/desktop/personal_patents_helper.rb @@ -0,0 +1,103 @@ +module Panel::PersonalPatent::Desktop::PersonalPatentsHelper + 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 "patent_title" + des = content_tag(:div, publication.patent_title, + :class => "list_t_des") + when "keywords" + des = content_tag(:div, publication.keywords, + :class => "list_t_des") + when "abstract" + des = content_tag(:div, publication.abstract, + :class => "list_t_des") + when "file" + des = content_tag(:div, link_publication_file(publication), + :class => "list_t_des") + else + end + + content_tag(:div, publication.patent_title, + :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_patent_desktop_personal_patent_path(publication), + "callback-method" => "editpatent", + "ajax-remote" => "get") + \ + content_tag(:a, t(:delete_), + "ajax-remote" => "delete", + "confirm-message" => t("sure?"), + "callback-method" => "patentDelete", + :class => "journal_paper_delete admbg2 admtxt", + :href => panel_personal_patent_desktop_personal_patent_path(publication)) + end + end + + def link_publication_file publication + publication.writing_patent_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/personal_patent_intro.rb b/app/models/personal_patent_intro.rb new file mode 100644 index 0000000..853cedd --- /dev/null +++ b/app/models/personal_patent_intro.rb @@ -0,0 +1,4 @@ +class PersonalPatentIntro < PersonalPluginIntro + + +end diff --git a/app/models/writing_patent.rb b/app/models/writing_patent.rb new file mode 100644 index 0000000..533d1b9 --- /dev/null +++ b/app/models/writing_patent.rb @@ -0,0 +1,90 @@ +# encoding: utf-8 + +class WritingPatent + include Mongoid::Document + include Mongoid::Timestamps + include Mongoid::MultiParameterAttributes + + include OrbitModel::LanguageRestrict + include OrbitModel::Status + include OrbitTag::Taggable + + LANGUAGE_TYPES = [ "English", "Chinese" ] + + + field :patent_title, localize: true + field :authors, localize: true + + # has_and_belongs_to_many :tags, :class_name => "PersonalPatentTag" + + belongs_to :writing_patent_category + + field :year + field :language + field :keywords + field :patent_no + field :patent_country + field :publish_date , :type => Date + field :url + field :note + field :create_user_id, :type => BSON::ObjectId + field :update_user_id, :type => BSON::ObjectId + + paginates_per 10 + + has_many :writing_patent_files, :autosave => true, :dependent => :destroy + + accepts_nested_attributes_for :writing_patent_files, :allow_destroy => true + + # before_save :clean_checkboxs + + validates :patent_title, :at_least_one => true + + before_validation :add_http + + after_save :save_writing_patent_files + + 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 => {writing_patent_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 + + def save_writing_patent_files + self.writing_patent_files.each do |t| + if t.should_destroy + t.destroy + end + end + 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/writing_patent_category.rb b/app/models/writing_patent_category.rb new file mode 100644 index 0000000..3b12746 --- /dev/null +++ b/app/models/writing_patent_category.rb @@ -0,0 +1,24 @@ +# encoding: utf-8 + +class WritingPatentCategory + include Mongoid::Document + include Mongoid::Timestamps + include OrbitCoreLib::ObjectAuthable + include OrbitCoreLib::ObjectDisable + # include Mongoid::MultiParameterAttributes + AfterObjectAuthUrl = '/panel/personal_patent/back_end/writing_patent_categorys' + APP_NAME = 'writing_patent' + # ObjectAuthTitlesOptions = %W{edit} + ObjectAuthTitlesOptions = %W{submit_new fact_check} + + field :key + + field :title, localize: true + + has_many :writing_patents + + def pp_object + title + end + +end \ No newline at end of file diff --git a/app/models/writing_patent_file.rb b/app/models/writing_patent_file.rb new file mode 100644 index 0000000..1a19f8e --- /dev/null +++ b/app/models/writing_patent_file.rb @@ -0,0 +1,14 @@ +class WritingPatentFile + + include Mongoid::Document + include Mongoid::Timestamps + + mount_uploader :file, AssetUploader + + field :description, localize: true + field :should_destroy, :type => Boolean + field :title, localize: true + + belongs_to :writing_patent + +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_patent/back_end/writing_patent_categorys/_form.html.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/_form.html.erb new file mode 100644 index 0000000..b7ea06d --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/_form.html.erb @@ -0,0 +1,44 @@ +<% # encoding: utf-8 %> + +<%= form_for(:writing_book_category, :remote => true, :url => @url, :method => @verb, :html => { :id => 'form_writing_book_category' } ) do |f| %> + +

<%= (@writing_book_category.new_record? ? 'Add' : 'Edit') %>

+ +
+ <%= f.label :key %> + <%= f.text_field :key %> +
+ +
+ <% if @types.is_localized?(:title) %> + <%= f.fields_for :title_translations do |f| %> + <% @site_in_use_locales.each do |locale| %> +
+ <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
+ <%= f.text_field locale, :class => 'input-xxlarge', :value => (@writing_book_category.title_translations[locale] rescue nil) %> +
+
+ <% end %> + <% end %> + <% else %> +
+ <%= f.label :title %> + <%= f.text_field :title %> +
+ <% end %> +
+ +
+ <%#= f.label :display %> + <%#= f.radio_button :display, "List" List%> + <%#= f.radio_button :display, "Picture" Picture%> + <%#
顯示方式是設定在前台頁面時,資訊所呈現的樣式 %> +
+ +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> +
+ +<% end %> + \ No newline at end of file diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/_quick_edit_qe.html.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/_quick_edit_qe.html.erb new file mode 100644 index 0000000..cc537cb --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/_quick_edit_qe.html.erb @@ -0,0 +1,28 @@ +<% # encoding: utf-8 %> + +
+ +
+ <%= f.label :key %> + <%= f.text_field :key %> +
+
+ <%= f.fields_for :title_translations do |f| %> + <% @site_in_use_locales.each do |locale| %> +
+ <%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
+ <%= f.text_field locale, :class => 'input-xxlarge', :value => (news_bulletin_category.title_translations[locale] rescue nil) %> +
+
+ <% end %> + <% end %> +
+ +
+ <%= f.label :display %> + <%= f.radio_button :display, "List" %>List + <%= f.radio_button :display, "Picture" %>Picture +
顯示方式是設定在前台頁面時,資訊所呈現的樣式 +
+
diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/_writing_book_category.html.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/_writing_book_category.html.erb new file mode 100644 index 0000000..c95102c --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/_writing_book_category.html.erb @@ -0,0 +1,22 @@ + + + + <%= writing_book_category.key %> +
+ +
+ + <% if @types.is_localized?(:title) %> + <% @site_in_use_locales.each do |locale| %> + <%= writing_book_category.title_translations[locale] rescue nil %> + <% end %> + <% else %> + <%= writing_book_category.title %> + <% end %> + diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/create.js.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/create.js.erb new file mode 100644 index 0000000..f4d09b4 --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/create.js.erb @@ -0,0 +1,2 @@ +$('<%= j render :partial => 'writing_book_category', :collection => [@writing_book_category] %>').appendTo('#writing_book_categorys').hide().fadeIn(); +$("#form_writing_book_category")[0].reset(); \ No newline at end of file diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/destroy.js.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/destroy.js.erb new file mode 100644 index 0000000..f68fdd4 --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @writing_book_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@writing_book_category) %> "); \ No newline at end of file diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/edit.html.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/edit.html.erb new file mode 100644 index 0000000..3d28ced --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/edit.html.erb @@ -0,0 +1,7 @@ +

<%= t('personal_book.editing_personal_book_class') %>

+ +<%= form_for @writing_book_category, :url => panel_personal_book_back_end_writing_book_category_path(@writing_book_category) do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> + +<%= link_back %> diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/edit.js.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/edit.js.erb new file mode 100644 index 0000000..eaff01f --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/edit.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); \ No newline at end of file diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/index.html.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/index.html.erb new file mode 100644 index 0000000..6cf7898 --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/index.html.erb @@ -0,0 +1,29 @@ + +<%= flash_messages %> + +<%= @types %> + + + + + + <% if @types.is_localized?(:title) %> + <% @site_in_use_locales.each do |locale| %> + + <% end %> + <% else %> + + <% end %> + + + + + <%= render :partial => 'writing_book_category', :collection => @writing_book_categorys %> + + +
<%= t('writing_book_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('writing_book_category.title') %>
+ +
<%= render :partial => "form" if is_manager? %>
+ + + diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/new.html.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/new.html.erb new file mode 100644 index 0000000..46d036b --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/new.html.erb @@ -0,0 +1,19 @@ +<% content_for :secondary do %> +<%= render :partial => '/panel/personal_book/back_end/personal_book_secondary' %> +<% end -%> + +<%= flash_messages %> + +
+
+
+
+
+ +

<%= t('writing_book_category.new_personal_book_class') %>

+<%= form_for @writing_book_category, :url => panel_personal_book_back_end_writing_book_categorys_path do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> + +<%= link_back %> + diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/new.js.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/new.js.erb new file mode 100644 index 0000000..40061b9 --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/new.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); diff --git a/app/views/panel/personal_patent/back_end/writing_patent_categorys/update.js.erb b/app/views/panel/personal_patent/back_end/writing_patent_categorys/update.js.erb new file mode 100644 index 0000000..eeb3107 --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patent_categorys/update.js.erb @@ -0,0 +1,4 @@ +$("#<%= dom_id @writing_book_category %>").replaceWith("<%= j render :partial => 'writing_book_category', :collection => [@writing_book_category] %>"); +<% @writing_book_category = @types.new(:display => 'List') # reset for new form %> +$("#form_writing_book_category").replaceWith("<%= j render "form" %>") +$("#form_writing_book_category")[0].reset(); \ No newline at end of file diff --git a/app/views/panel/personal_patent/back_end/writing_patents/_filter.html.erb b/app/views/panel/personal_patent/back_end/writing_patents/_filter.html.erb new file mode 100644 index 0000000..ad02d4d --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patents/_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_patent/back_end/writing_patents/_form.html.erb b/app/views/panel/personal_patent/back_end/writing_patents/_form.html.erb new file mode 100644 index 0000000..ba776d4 --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patents/_form.html.erb @@ -0,0 +1,276 @@ +<% # 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 %> + + +
+ +
+ <%= select_year((@writing_patent.year ? @writing_patent.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_patent[year]', :class => "span1"} ) %> +
+
+ + +
+ +
+ <%= f.select :writing_patent_category_id, @writing_patent_categorys.collect {|t| [ t.title, t.id ]} %> +
+
+ + +
+ +
+ <%= f.date_select :publish_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %> +
+
+ + +
+ +
+ <%= f.text_field :patent_no %> +
+
+ + +
+ +
+ <%= f.text_field :patent_country %> +
+
+ + +
+ +
+ <%= f.text_field :url , :class => "span6" %> +
+
+ + +
+ +
+ <%= f.text_field :keywords %> +
+
+ + +
+ +
+ <%= f.radio_button :language, "Chinese" %> <%= t("personal_patent.Chinese") %> + <%= f.radio_button :language, "English" %> <%= t("personal_patent.English") %> +
+
+ + +
+ +
+ <%= f.text_area :note, rows: 2, class: "input-block-level" %> +
+
+ +
+ + + <% if show_form_status_field(@writing_patent) %> +
+ + +
+ +
+ +
+
+ +
+ <% end %> + + +
+ + +
+ +
+ <% @tags.each do |tag| %> + + <% end %> +
+
+ +
+ +
+ + + + + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> + + +
+ +
+ <%= f.fields_for :patent_title_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_patent.patent_title"), value: (@writing_patent.patent_title_translations[locale] rescue nil) %> + <% end %> +
+
+ + +
+ +
+ <%= f.fields_for :authors_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_patent.authors"), value: (@writing_patent.authors_translations[locale] rescue nil) %> + <% end %> +
+
+ +
+ + <% end %> + + +
+ +
+ + + <% if @writing_patent && !@writing_patent.writing_patent_files.blank? %> +
+ <% @writing_patent.writing_patent_files.each_with_index do |writing_patent_file, i| %> + <%= f.fields_for :writing_patent_files, writing_patent_file do |f| %> + <%= render :partial => 'form_file', :object => writing_patent_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> +
+
+ <% end %> + + +
+
+

+ <%= hidden_field_tag 'plugin_file_field_count', @writing_patent.writing_patent_files.count %> + <%= t(:add) %> +

+ +
+
+ + + + +
+ + + +
+ + +
+ <%= 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" %> +
+ +<% content_for :page_specific_javascript do %> + +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_patent/back_end/writing_patents/_form_file.html.erb b/app/views/panel/personal_patent/back_end/writing_patents/_form_file.html.erb new file mode 100644 index 0000000..07088ba --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patents/_form_file.html.erb @@ -0,0 +1,45 @@ +<% if form_file.new_record? %> +
+<% else %> +
+ <% if form_file.file.blank? %> + <%= t(:no_file) %> + <% else %> + <%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %> + <% end %> +<% end %> +
+ + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= locale %>"> + <%= f.fields_for :title_translations do |f| %> + <%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + <% if form_file.new_record? %> + + + + <% else %> + + <%= f.hidden_field :id %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + + <% end %> +
+
\ No newline at end of file diff --git a/app/views/panel/personal_patent/back_end/writing_patents/_list_patent_type.html.erb b/app/views/panel/personal_patent/back_end/writing_patents/_list_patent_type.html.erb new file mode 100644 index 0000000..3b49373 --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patents/_list_patent_type.html.erb @@ -0,0 +1,11 @@ +<% # encoding: utf-8 %> + + + <%= list_patent_type.title %> + + + <%= t('edit')%> + <%= link_to 'Delete', + polymorphic_path([:panel, :personal_patent, :back_end, list_patent_type]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %> + + \ No newline at end of file diff --git a/app/views/panel/personal_patent/back_end/writing_patents/_patent_type_qe.html.erb b/app/views/panel/personal_patent/back_end/writing_patents/_patent_type_qe.html.erb new file mode 100644 index 0000000..da97ddc --- /dev/null +++ b/app/views/panel/personal_patent/back_end/writing_patents/_patent_type_qe.html.erb @@ -0,0 +1,34 @@ +<% # encoding: utf-8 %> + +<%= form_for(@set_patent_type, :remote => true, :url => @patent_type_url ) do |f| %> + + +