From c29955d9e34a2b721c82d6f309ef78f526971148 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 16 Oct 2012 21:52:10 +0800 Subject: [PATCH] external commit --- .../assets/images/personal_patent/.gitkeep | 0 .../javascripts/personal_patent/.gitkeep | 0 .../stylesheets/personal_patent/.gitkeep | 0 .../app - %BDƻs/controllers/.gitkeep | 0 .../controllers/application_controller.rb | 23 ++ .../back_end/tags_controller.rb | 8 + .../writing_patent_categorys_controller.rb | 119 +++++++++ .../back_end/writing_patents_controller.00.rb | 244 ++++++++++++++++++ .../back_end/writing_patents_controller.rb | 244 ++++++++++++++++++ .../plugin/writing_patents_controller.rb | 181 +++++++++++++ .../app - %BDƻs/helpers/.gitkeep | 0 .../app - %BDƻs/mailers/.gitkeep | 0 .../app - %BDƻs/models/.gitkeep | 0 .../app - %BDƻs/models/personal_patent_tag.rb | 9 + .../app - %BDƻs/models/writing_patent.rb | 108 ++++++++ .../models/writing_patent_category.rb | 28 ++ .../app - %BDƻs/models/writing_patent_file.rb | 14 + .../app - %BDƻs/views/.gitkeep | 0 .../writing_patent_categorys/_form.html.erb | 30 +++ .../_writing_patent_category.html.erb | 16 ++ .../writing_patent_categorys/create.js.erb | 2 + .../writing_patent_categorys/destroy.js.erb | 1 + .../writing_patent_categorys/edit.js.erb | 1 + .../writing_patent_categorys/index.html.erb | 23 ++ .../writing_patent_categorys/new.js.erb | 1 + .../writing_patent_categorys/update.js.erb | 4 + .../back_end/writing_patents/_filter.html.erb | 11 + .../back_end/writing_patents/_form.html.erb | 209 +++++++++++++++ .../writing_patents/_form_file.html.erb | 50 ++++ .../_list_writing_patent_category.html.erb | 11 + .../writing_patents/_sort_headers.html.erb | 8 + .../writing_patents/_writing_patent.html.erb | 25 ++ .../_writing_patent_category_qe.html.erb | 34 +++ .../create_writing_patent_setting.js.erb | 5 + .../back_end/writing_patents/destroy.js.erb | 1 + .../back_end/writing_patents/edit.html.erb | 5 + .../back_end/writing_patents/index.html.erb | 22 ++ .../back_end/writing_patents/index.js.erb | 3 + .../back_end/writing_patents/new.html.erb | 10 + .../back_end/writing_patents/show.html.erb | 0 .../writing_patents/toggle_enable.js.erb | 3 + .../update_writing_patent_setting.js.erb | 5 + .../writing_patent_category_quick_add.js.erb | 1 + .../writing_patent_category_quick_edit.js.erb | 1 + .../writing_patent_setting.html.erb | 113 ++++++++ .../plugin/writing_patents/_filter.html.erb | 11 + .../plugin/writing_patents/_form.html.erb | 209 +++++++++++++++ .../plugin/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 + 57 files changed, 1918 insertions(+) create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/assets/images/personal_patent/.gitkeep create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/assets/javascripts/personal_patent/.gitkeep create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/assets/stylesheets/personal_patent/.gitkeep create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/.gitkeep create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/application_controller.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/tags_controller.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patent_categorys_controller.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patents_controller.00.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patents_controller.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/plugin/writing_patents_controller.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/helpers/.gitkeep create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/mailers/.gitkeep create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/models/.gitkeep create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/models/personal_patent_tag.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_category.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_file.rb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/.gitkeep create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/_form.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/_writing_patent_category.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/create.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/destroy.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/edit.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/index.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/new.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/update.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_filter.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form_file.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_list_writing_patent_category.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_sort_headers.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_writing_patent.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_writing_patent_category_qe.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/create_writing_patent_setting.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/destroy.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/edit.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/index.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/index.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/new.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/show.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/toggle_enable.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/update_writing_patent_setting.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/writing_patent_category_quick_add.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/writing_patent_category_quick_edit.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/writing_patent_setting.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_filter.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form_file.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_sort_headers.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_writing_patent.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/destroy.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/edit.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/index.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/index.js.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/new.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/show.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/toggle_enable.js.erb diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/assets/images/personal_patent/.gitkeep b/vendor/built_in_modules/personal_patent/app - %BDƻs/assets/images/personal_patent/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/assets/javascripts/personal_patent/.gitkeep b/vendor/built_in_modules/personal_patent/app - %BDƻs/assets/javascripts/personal_patent/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/assets/stylesheets/personal_patent/.gitkeep b/vendor/built_in_modules/personal_patent/app - %BDƻs/assets/stylesheets/personal_patent/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/.gitkeep b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/application_controller.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/application_controller.rb new file mode 100644 index 00000000..307a4acd --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/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/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/tags_controller.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/tags_controller.rb new file mode 100644 index 00000000..b7479e8c --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/tags_controller.rb @@ -0,0 +1,8 @@ +class Panel::PersonalPatent::BackEnd::TagsController < Admin::TagsController + + def initialize + super + @app_title = 'personal_patent' + end + +end diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patent_categorys_controller.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patent_categorys_controller.rb new file mode 100644 index 00000000..fe7bc853 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patent_categorys_controller.rb @@ -0,0 +1,119 @@ +class Panel::PersonalPatent::BackEnd::WritingPatentCategorysController < OrbitBackendController + include OrbitControllerLib::DivisionForDisable + + before_filter :force_order_for_visitor,:only=>[:index,:show] + before_filter :force_order_for_user,:except => [:index,:show] + before_filter :for_app_manager,:except => [:index] + + def index + + @writing_patent_categorys = WritingPatentCategory.all + @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 /projects/1 + # GET /projects/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 /projects/new + # GET /projects/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 /projects/1/edit + def edit + + @writing_patent_category = WritingPatentCategory.find(params[:id]) + + @url = panel_personal_patent_back_end_writing_patent_category_path(@writing_patent_category) + + @verb = :put + + respond_to do |format| + format.html + format.js + end + end + + # POST /projects + # POST /projects.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 /projects/1 + # PUT /projects/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) + + 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 /projects/1 + # DELETE /projects/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/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patents_controller.00.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patents_controller.00.rb new file mode 100644 index 00000000..d038e1b8 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patents_controller.00.rb @@ -0,0 +1,244 @@ +class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + before_filter :force_order_for_visitor,:only=>[:index,:show] + before_filter :force_order_for_user,:except => [:index,:show] + # before_filter :for_app_manager,:except => [:index,:show] + before_filter :only => [ :new,:create,:edit,:update,:create] do |controller| + controller.get_categorys('WritingPatentCategory') + end + + def index + + get_categorys("WritingPatentCategory",params[:writing_patent_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",:writing_patent_category_id.in => @writing_patent_category_ids) : get_viewable("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids) + + get_tags + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @writing_patents } + format.js + end + end + + def writing_patent_setting + + @writing_patent_categorys = WritingPatentCategory.all + + get_tags + + @set_writing_patent_category = WritingPatentCategory.new(:display => 'List') + @writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path + + + end + + def writing_patent_category_quick_add + @set_writing_patent_category = WritingPatentCategory.new(:display => 'List') + @writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path + @set_writing_patent_category.id = params[:id] + + respond_to do |format| + format.js + end + + end + + def writing_patent_category_quick_edit + + @set_writing_patent_category = WritingPatentCategory.find(params[:writing_patent_id]) + @writing_patent_category_url = panel_personal_patent_back_end_writing_patent_path(@set_writing_patent_category) + + 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 + + @writing_patent = WritingPatent.new + debugger + @writing_patent_categorys = WritingPatentCategory.all + + 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]) + + @writing_patent_categorys = WritingPatentCategory.all + + 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 + + + @writing_patent_categorys = WritingPatentCategory.all + 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_back_end_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 + + 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]).delete_all + end + redirect_to panel_personal_patent_back_end_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 ? WritingPatent.admin_manager_all.find(id).to_a : WritingPatent.admin_manager_all)) + # elsif is_sub_manager? + # @writing_patent_categorys = WritingPatent.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_tags + module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'}) + @tags = Tag.all(:conditions => {:module_app_id => module_app.id}) + end + +end diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patents_controller.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patents_controller.rb new file mode 100644 index 00000000..a0bec01b --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/back_end/writing_patents_controller.rb @@ -0,0 +1,244 @@ +class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + before_filter :force_order_for_visitor,:only=>[:index,:show] + before_filter :force_order_for_user,:except => [:index,:show] + # before_filter :for_app_manager,:except => [:index,:show] + before_filter :only => [ :new,:create,:edit,:update,:create] do |controller| + controller.get_categorys('WritingPatentCategory') + end + + def index + + get_categorys("WritingPatentCategory",params[:writing_patent_writing_patent_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",:writing_patent_category_id.in => @writing_patent_category_ids) : get_viewable("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids) + + get_tags + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @writing_patents } + format.js + end + end + + def writing_patent_setting + + @writing_patent_categorys = WritingPatentCategory.all + + get_tags + + @set_writing_patent_category = WritingPatentCategory.new(:display => 'List') + @writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path + + + end + + def writing_patent_category_quick_add + @set_writing_patent_category = WritingPatentCategory.new(:display => 'List') + @writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path + @set_writing_patent_category.id = params[:id] + + respond_to do |format| + format.js + end + + end + + def writing_patent_category_quick_edit + + @set_writing_patent_category = WritingPatentCategory.find(params[:writing_patent_id]) + @writing_patent_category_url = panel_personal_patent_back_end_writing_patent_path(@set_writing_patent_category) + + respond_to do |format| + format.js + end + end + + # GET /writing_patents/1 + # GET /writing_patents/1.xml + def show + @writing_patent = Project.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 = Project.new + + @writing_patent_categorys = WritingPatentCategory.all + + 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 = Project.find(params[:id]) + + @writing_patent_categorys = WritingPatentCategory.all + + 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 + + + @writing_patent_categorys = WritingPatentCategory.all + get_tags + + @writing_patent = Project.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_back_end_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 + + 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 = Project.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 = Project.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 = Project.any_in(:_id => params[:ids]).delete_all + end + redirect_to panel_personal_patent_back_end_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 ? Project.admin_manager_all.find(id).to_a : Project.admin_manager_all)) + # elsif is_sub_manager? + # @writing_patent_categorys = Project.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_tags + module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'}) + @tags = Tag.all(:conditions => {:module_app_id => module_app.id}) + end + +end diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/plugin/writing_patents_controller.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/plugin/writing_patents_controller.rb new file mode 100644 index 00000000..1acab41d --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/panel/personal_patent/plugin/writing_patents_controller.rb @@ -0,0 +1,181 @@ +class Panel::PersonalPatent::Plugin::WritingPatentsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + before_filter :force_order_for_visitor,:only=>[:index,:show] + before_filter :force_order_for_user,:except => [:index,:show] + # before_filter :for_app_manager,:except => [:index,:show] + before_filter :only => [ :new,:create,:edit,:update,:create] do |controller| + controller.get_categorys('WritingPatentCategory') + end + + def index + + get_categorys("WritingPatentCategory",params[:writing_patent_writing_patent_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_categories.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) + + 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 = Project.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 = Project.new + + @writing_patent_categorys = WritingPatentCategory.all + + 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 = Project.find(params[:id]) + + @writing_patent_categorys = WritingPatentCategory.all + + get_tags + end + + # POST /writing_patents + # POST /writing_patents.xml + def create + + @writing_patent_categorys = WritingPatentCategory.all + get_tags + + @writing_patent = Project.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_writing_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 = Project.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_writing_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 = Project.find(params[:id]) + @writing_patent.destroy + + respond_to do |format| + format.html { redirect_to(panel_personal_writing_patent_plugin_writing_patents_url) } + # format.xml { head :ok } + format.js + end + end + + def delete + if params[:ids] + writing_patents = Project.any_in(:_id => params[:ids]).delete_all + end + redirect_to panel_personal_writing_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 ? Project.admin_manager_all.find(id).to_a : Project.admin_manager_all)) + # elsif is_sub_manager? + # @writing_patent_categorys = Project.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_tags + module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'}) + @tags = Tag.all(:conditions => {:module_app_id => module_app.id}) + end + +end diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/helpers/.gitkeep b/vendor/built_in_modules/personal_patent/app - %BDƻs/helpers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/mailers/.gitkeep b/vendor/built_in_modules/personal_patent/app - %BDƻs/mailers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/models/.gitkeep b/vendor/built_in_modules/personal_patent/app - %BDƻs/models/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/models/personal_patent_tag.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/models/personal_patent_tag.rb new file mode 100644 index 00000000..752e62e6 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/models/personal_patent_tag.rb @@ -0,0 +1,9 @@ +class PersonalPatentTag < Tag + + has_and_belongs_to_many :writing_patents + + def get_visible_links(sort = :title) + self.writing_patents.where(:is_hidden => false).desc(:is_top, sort) + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent.rb new file mode 100644 index 00000000..75bc5054 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent.rb @@ -0,0 +1,108 @@ +# encoding: utf-8 + +class WritingPatent + include Mongoid::Document + include Mongoid::Timestamps + include Mongoid::MultiParameterAttributes + + # scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) } + + 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 + field :update_user_id + + # field :is_top, :type => Boolean, :default => false + # field :is_hot, :type => Boolean, :default => false + # field :is_hidden, :type => Boolean, :default => false + + has_many :writing_patent_files, :autosave => true, :dependent => :destroy + + accepts_nested_attributes_for :writing_patent_files, :allow_destroy => true + + # before_save :update_avliable_language, :clean_checkboxs + + validates :writing_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}(([0-9]{1,5})?\/.*)?$/ix, :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 is_top? + self.is_top + end + + def sorted_tags + tags.order_by(I18n.locale, :asc) + end + + def update_avliable_language + VALID_LOCALES.each do |locale| + if (title_translations[locale].blank? rescue true) + self["available_for_#{locale}".to_sym] = false + else + self["available_for_#{locale}".to_sym] = true + end + end + 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.tag_ids.delete('') + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_category.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_category.rb new file mode 100644 index 00000000..e1dfcab0 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_category.rb @@ -0,0 +1,28 @@ +# 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 = 'project' + # ObjectAuthTitlesOptions = %W{edit} + ObjectAuthTitlesOptions = %W{submit_new fact_check} + + field :key + + field :title, localize: true + + has_many :writing_patents + + def pp_object + title + end + + def self.from_id(id) + WritingPatentCategory.find(id) rescue nil + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_file.rb b/vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_file.rb new file mode 100644 index 00000000..df7c5b45 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/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/vendor/built_in_modules/personal_patent/app - %BDƻs/views/.gitkeep b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/_form.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/_form.html.erb new file mode 100644 index 00000000..c3542e8b --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/_form.html.erb @@ -0,0 +1,30 @@ +<% # encoding: utf-8 %> + +<%= form_for(@writing_patent_category, :remote => true, :url => @url) do |f| %> + +

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

+ +
+ <%= f.label :key %> + <%= f.text_field :key %> +
+ +
+ <%= f.fields_for :title_translations do |f| %> + <% @site_valid_locales.each do |locale| %> +
+ <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
+ <%= f.text_field locale, :class => 'input-xxlarge', :value => (@web_link_category.title_translations[locale] rescue nil) %> +
+
+ <% end %> + <% end %> +
+ +
+ <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> +
+ +<% end %> + \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/_writing_patent_category.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/_writing_patent_category.html.erb new file mode 100644 index 00000000..08396d9b --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/_writing_patent_category.html.erb @@ -0,0 +1,16 @@ + + + + + <%= writing_patent_category.key %> +
+ +
+ + <% @site_valid_locales.each do |locale| %> + <%= writing_patent_category.title_translations[locale] %> + <% end %> + \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/create.js.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/create.js.erb new file mode 100644 index 00000000..9a4eb545 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/create.js.erb @@ -0,0 +1,2 @@ +$('<%= j render :partial => 'writing_patent_category', :collection => [@writing_patent_category] %>').appendTo('#writing_patent_categorys').hide().fadeIn(); +$("#new_writing_patent_category")[0].reset(); \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/destroy.js.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/destroy.js.erb new file mode 100644 index 00000000..8bd6da01 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @writing_patent_category %>").remove(); \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/edit.js.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/edit.js.erb new file mode 100644 index 00000000..eaff01fa --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/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/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/index.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/index.html.erb new file mode 100644 index 00000000..41adf614 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/index.html.erb @@ -0,0 +1,23 @@ + + +<%= flash_messages %> + + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + <%= render :partial => 'writing_patent_category', :collection => @writing_patent_categorys %> + + +
<%= t('writing_patent_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
+ +
<%= render :partial => "form" %>
+ + diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/new.js.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/new.js.erb new file mode 100644 index 00000000..40061b9f --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/new.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/update.js.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/update.js.erb new file mode 100644 index 00000000..299b38a7 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patent_categorys/update.js.erb @@ -0,0 +1,4 @@ +$("#<%= dom_id @writing_patent_category %>").replaceWith("<%= j render :partial => 'link_category', :collection => [@writing_patent_category] %>"); +<% @writing_patent_category = ProjectCategory.new(:display => 'List') # reset for new form %> +$(".edit_writing_patent_category").replaceWith("<%= j render "form" %>") +$(".new_writing_patent_category")[0].reset(); \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_filter.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_filter.html.erb new file mode 100644 index 00000000..63882b8f --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_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/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form.html.erb new file mode 100644 index 00000000..22022c21 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form.html.erb @@ -0,0 +1,209 @@ +<% # encoding: utf-8 %> + + <%= f.error_messages %> + + + +
+ +
+
+ +
+

Tags

+
+ <% @tags.each do |tag| %> + <%= content_tag :label,:class => "checkbox inline" do -%> + <%= check_box_tag 'writing_patent[tag_ids][]', tag.id, @writing_patent.tag_ids.include?(tag.id)%> + <%= tag[I18n.locale] %> + <%= hidden_field_tag 'writing_patent[tag_ids][]', '' %> + <% end %> + <% end %> +
+
+ +
+ + + + + +
+
+ +
+ <%= f.label :year ,t("personal_patent.year")%> + <%= 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]'} ) %> +
+ +
+ <%= f.label :writing_patent_category ,t("personal_patent.writing_patent_category")%> + <%= f.select :writing_patent_category_id, @writing_patent_categorys.collect {|t| [ t.title, t.id ]} %> +
+ +
+ <%= f.label :period_start_date ,t("personal_patent.period_start_date")%> + <%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %> +
+ +
+ <%= f.label :period_end_date ,t("personal_patent.period_end_date")%> + <%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %> +
+ + + +
+ + <% @site_valid_locales.each_with_index do |locale, i| %> + +
"> + +
+ <%= f.label :writing_patent_title ,t("personal_patent.writing_patent_title")%> + <%= f.fields_for :writing_patent_title_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.writing_patent_title_translations[locale] rescue nil) %> + <% end %> +
+ +
+ <%= f.label :job_title ,t("personal_patent.job_title")%> + <%= f.fields_for :job_title_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.job_title_translations[locale] rescue nil) %> + <% end %> +
+ +
+ <%= f.label :participator ,t("personal_patent.participator")%> + <%= f.fields_for :participator_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.participator_translations[locale] rescue nil) %> + <% end %> +
+ +
+ <%= f.label :unit ,t("personal_patent.unit")%> + <%= f.fields_for :unit_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.unit_translations[locale] rescue nil) %> + <% end %> +
+ +
+ + <% end %> + +
+ +
+ <%= f.label :url, t("personal_patent.url") %> + <%= f.text_field :url %> +
+ +
+ <%= f.label :keywords, t("personal_patent.keywords") %> + <%= f.text_field :keywords %> +
+ +
+ <%= f.label :abstract, t("personal_patent.abstract") %> + <%= f.text_field :abstract %> +
+ +
+ <%= f.label :language, t("personal_patent.language") %> + <%= f.radio_button :language, "Chinese" %> <%= t("personal_patent.Chinese") %> + <%= f.radio_button :language, "English" %> <%= t("personal_patent.English") %> +
+ +
+ <%= f.label :note, t("personal_patent.note") %> + <%= f.text_area :note, :size => "60x3" %> +
+ +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + + <% @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 %> + +
FileFile Name
+
+ <%= hidden_field_tag 'plugin_file_field_count', @writing_patent.writing_patent_files.count %> + ADD/新增 +
+
+ +
+ +
+ + + + + + +
+ + + + +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "archive_plugin_form" %> + +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form_file.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form_file.html.erb new file mode 100644 index 00000000..a91d6a85 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form_file.html.erb @@ -0,0 +1,50 @@ +<% # encoding: utf-8 %> + + " class='list_item'> + +
+
+ <%= f.file_field :file %> + <%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> +
+
+ + + +
+ + <% @site_valid_locales.each_with_index do |locale, i| %> + +
"> + <%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %> + <%= f.fields_for :file_title_translations do |f| %> +
+ +
+ <%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %> +
+
+ <% end %> + +
+ + <% end %> + +
+ + + + + + <% if form_file.new_record? %> + + <% else %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + + + + + diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_list_writing_patent_category.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_list_writing_patent_category.html.erb new file mode 100644 index 00000000..97db4523 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_list_writing_patent_category.html.erb @@ -0,0 +1,11 @@ +<% # encoding: utf-8 %> + + + <%= list_writing_patent_category.title %> + + + <%= t('edit')%> + <%= link_to show_toggle_archive_btn(list_writing_patent_category), + polymorphic_path([:panel, :personal_patent, :back_end, list_writing_patent_category]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %> + + \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_sort_headers.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_sort_headers.html.erb new file mode 100644 index 00000000..a6dad620 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_sort_headers.html.erb @@ -0,0 +1,8 @@ +<%= render_sort_bar(true, delete_panel_personal_patent_back_end_writing_patents_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), + ['publish_date', 'publish_date', 'span1', 'writing_patent.publish_date'], + ['patent_title', 'patent_title','span3', 'writing_patent.patent_title'], + ['patent_no', 'patent_no','span3', 'writing_patent.patent_no'], + ['patent_country', 'patent_country','span3', 'writing_patent.patent_country'], + ['authors', 'authors','span3', 'writing_patent.authors'], + ['url', 'url','span3', 'writing_patent.url'], + ['create_modified', 'create_user_id','span1-3', 'writing_patent.create_modified']).html_safe %> \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_writing_patent.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_writing_patent.html.erb new file mode 100644 index 00000000..f0257dd6 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_writing_patent.html.erb @@ -0,0 +1,25 @@ + + + <% if (writing_patent.create_user_id == current_user.id) || is_manager? %> + <%= check_box_tag 'to_delete[]', writing_patent.id, false, :class => "checkbox_in_list" %> + <% end -%> + + <%= writing_patent.publish_date.strftime("%Y.%m") %> + + <%= link_to writing_patent.patent_title, panel_personal_patent_front_end_writing_patent_path(writing_patent) %> +
+ +
+ + <%= writing_patent.patent_no %> + <%= writing_patent.patent_country %> + <%= writing_patent.authors %> + <%= writing_patent.url %> + <%= User.from_id(writing_patent.create_user_id).name rescue ''%> + + diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_writing_patent_category_qe.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_writing_patent_category_qe.html.erb new file mode 100644 index 00000000..f16154c3 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_writing_patent_category_qe.html.erb @@ -0,0 +1,34 @@ +<% # encoding: utf-8 %> + +<%= form_for(@set_writing_patent_category, :remote => true, :url => @writing_patent_category_url ) do |f| %> + + +