external commit
This commit is contained in:
		
							parent
							
								
									d7e8663c1d
								
							
						
					
					
						commit
						c29955d9e3
					
				
							
								
								
									
										0
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/assets/images/personal_patent/.gitkeep
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										0
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/assets/images/personal_patent/.gitkeep
								
								
								
									vendored
								
								
									Normal file
								
							
							
								
								
									
										23
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/application_controller.rb
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										23
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/controllers/application_controller.rb
								
								
								
									vendored
								
								
									Normal file
								
							|  | @ -0,0 +1,23 @@ | ||||||
|  | class ApplicationController < ActionController::Base | ||||||
|  |   protect_from_forgery | ||||||
|  |   before_filter :set_locale | ||||||
|  |    | ||||||
|  |   # Set I18n.locale | ||||||
|  |   def set_locale | ||||||
|  |     # update session if passed | ||||||
|  |     session[:locale] = params[:locale] if params[:locale] | ||||||
|  | 
 | ||||||
|  |     # set locale based on session or default | ||||||
|  |     begin | ||||||
|  |       # check if locale is valid for non site pages | ||||||
|  |       if !VALID_LOCALES.include?(session[:locale]) | ||||||
|  |         I18n.locale = I18n.default_locale | ||||||
|  |       else | ||||||
|  |         I18n.locale = session[:locale] | ||||||
|  |       end | ||||||
|  |      rescue | ||||||
|  |        I18n.locale = I18n.default_locale | ||||||
|  |      end     | ||||||
|  |   end | ||||||
|  |    | ||||||
|  | end | ||||||
|  | @ -0,0 +1,8 @@ | ||||||
|  | class Panel::PersonalPatent::BackEnd::TagsController < Admin::TagsController | ||||||
|  | 
 | ||||||
|  |   def initialize | ||||||
|  |     super | ||||||
|  |     @app_title = 'personal_patent' | ||||||
|  |   end | ||||||
|  |    | ||||||
|  | end | ||||||
|  | @ -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 | ||||||
|  | @ -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 | ||||||
|  | @ -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 | ||||||
|  | @ -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 | ||||||
							
								
								
									
										9
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/models/personal_patent_tag.rb
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										9
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/models/personal_patent_tag.rb
								
								
								
									vendored
								
								
									Normal file
								
							|  | @ -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 | ||||||
							
								
								
									
										108
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent.rb
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										108
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent.rb
								
								
								
									vendored
								
								
									Normal file
								
							|  | @ -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 | ||||||
							
								
								
									
										28
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_category.rb
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										28
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_category.rb
								
								
								
									vendored
								
								
									Normal file
								
							|  | @ -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 | ||||||
							
								
								
									
										14
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_file.rb
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										14
									
								
								vendor/built_in_modules/personal_patent/app - %BDƻs/models/writing_patent_file.rb
								
								
								
									vendored
								
								
									Normal file
								
							|  | @ -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 | ||||||
|  | @ -0,0 +1,30 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  | <%= form_for(@writing_patent_category, :remote => true, :url => @url) do |f| %> | ||||||
|  | 
 | ||||||
|  | 	<h2><%= (@writing_patent_category.new_record? ? 'Add' : 'Edit') %></h2> | ||||||
|  | 
 | ||||||
|  | 	<div id="widget-title"> | ||||||
|  | 		<%= f.label :key %> | ||||||
|  | 		<%= f.text_field :key %> | ||||||
|  | 	</div> | ||||||
|  | 	 | ||||||
|  | 	<div id="widget-title"> | ||||||
|  | 		<%= f.fields_for :title_translations do |f| %> | ||||||
|  | 		  <% @site_valid_locales.each do |locale| %> | ||||||
|  | 				<div class="control-group"> | ||||||
|  | 					<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> | ||||||
|  | 					<div class="controls"> | ||||||
|  | 						<%= f.text_field locale, :class => 'input-xxlarge', :value => (@web_link_category.title_translations[locale] rescue nil) %> | ||||||
|  | 					</div> | ||||||
|  | 				</div> | ||||||
|  | 		  <% end %> | ||||||
|  | 		<% end %> | ||||||
|  | 	</div> | ||||||
|  |    | ||||||
|  |   <div class="form-actions"> | ||||||
|  |     <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> | ||||||
|  |   </div> | ||||||
|  |    | ||||||
|  | <% end %> | ||||||
|  |   | ||||||
|  | @ -0,0 +1,16 @@ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	<tr id="<%= dom_id writing_patent_category %>" class="with_action"> | ||||||
|  | 		<td> | ||||||
|  | 			<%= writing_patent_category.key %> | ||||||
|  | 			<div class="quick-edit"> | ||||||
|  | 				<ul class="nav nav-pills hide"> | ||||||
|  | 					<li><%= link_to t('writing_patent_category.edit'), edit_panel_personal_patent_back_end_writing_patent_category_path(writing_patent_category), :remote => true %></li> | ||||||
|  | 					<li><%= link_to t('writing_patent_category.delete'), panel_personal_patent_back_end_writing_patent_category_path(writing_patent_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li> | ||||||
|  | 				</ul> | ||||||
|  | 			</div> | ||||||
|  | 		</td> | ||||||
|  | 		<% @site_valid_locales.each do |locale| %> | ||||||
|  | 		<td><%= writing_patent_category.title_translations[locale] %></td> | ||||||
|  | 		<% end %> | ||||||
|  | 	</tr> | ||||||
|  | @ -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(); | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $("#<%= dom_id @writing_patent_category %>").remove(); | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $("#form > form").replaceWith("<%= j render "form" %>"); | ||||||
|  | @ -0,0 +1,23 @@ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <%= flash_messages %> | ||||||
|  | 
 | ||||||
|  | <table id="writing_patent_categorys" class="table main-list"> | ||||||
|  | 	<thead> | ||||||
|  | 		<tr> | ||||||
|  | 			<th class="span1-2"><%= t('writing_patent_category.key') %></th> | ||||||
|  | 			<% @site_valid_locales.each do |locale| %> | ||||||
|  | 			<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th> | ||||||
|  | 			<% end %> | ||||||
|  | 		</tr> | ||||||
|  | 	</thead> | ||||||
|  | 	<tbody> | ||||||
|  | 
 | ||||||
|  | 	<%= render :partial => 'writing_patent_category', :collection => @writing_patent_categorys %> | ||||||
|  | 	 | ||||||
|  | 	</tbody> | ||||||
|  | </table> | ||||||
|  | 
 | ||||||
|  | <div id="form"><%= render :partial => "form" %></div> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $("#form > form").replaceWith("<%= j render "form" %>"); | ||||||
|  | @ -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(); | ||||||
|  | @ -0,0 +1,11 @@ | ||||||
|  | <div id="filter" class="subnav"> | ||||||
|  | 	<div class="filters"> | ||||||
|  | 		<div id="sort_headers" class="table-label"> | ||||||
|  | 			<%= render 'sort_headers' %>  | ||||||
|  | 		</div> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | <% content_for :page_specific_javascript do %> | ||||||
|  | 	<%= javascript_include_tag "sort_header" %> | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1,209 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  |   <%= f.error_messages %> | ||||||
|  | 
 | ||||||
|  | 	<!--Widget start--> | ||||||
|  | 	 | ||||||
|  | 	<div id="sub-wiget"> | ||||||
|  | 
 | ||||||
|  | 		<div id="widget-tags" class="widget-box widget-size-300"> | ||||||
|  | 			<div class="widget-action clear"> | ||||||
|  | 				<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a> | ||||||
|  | 			</div> | ||||||
|  | 			<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3> | ||||||
|  | 			<div class="widget-content clear form-horizontal"> | ||||||
|  | 				<% @tags.each do |tag| %> | ||||||
|  | 					<%= content_tag :label,:class => "checkbox inline" do -%> | ||||||
|  | 						<%= check_box_tag 'writing_patent[tag_ids][]', tag.id, @writing_patent.tag_ids.include?(tag.id)%> | ||||||
|  | 						<%= tag[I18n.locale] %> | ||||||
|  |             <%= hidden_field_tag 'writing_patent[tag_ids][]', '' %> | ||||||
|  | 					<% end %> | ||||||
|  | 				<% end %> | ||||||
|  | 			</div> | ||||||
|  | 		</div>   | ||||||
|  |    | ||||||
|  | 	</div> | ||||||
|  |    | ||||||
|  |    | ||||||
|  | <!--Wiget End--> | ||||||
|  | <!--Post Start--> | ||||||
|  | 
 | ||||||
|  | 	<div id="post-body"> | ||||||
|  | 		<div id="post-body-content" class="clear"> | ||||||
|  | 		 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :year ,t("personal_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]'} ) %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= 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 ]} %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= 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'} %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= 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'} %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<ul class="nav nav-tabs"> | ||||||
|  | 				<% @site_valid_locales.each_with_index do |locale, i| %> | ||||||
|  | 			    <li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li> | ||||||
|  | 				<% end %> | ||||||
|  | 			</ul> | ||||||
|  | 			 | ||||||
|  | 			<div class="tab-content"> | ||||||
|  | 			 | ||||||
|  | 				<% @site_valid_locales.each_with_index do |locale, i| %> | ||||||
|  | 				 | ||||||
|  | 				<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> | ||||||
|  | 					 | ||||||
|  | 					<div class="title"> | ||||||
|  | 						<%= f.label :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 %> | ||||||
|  | 					</div> | ||||||
|  | 					 | ||||||
|  | 					<div class="title"> | ||||||
|  | 						<%= 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 %> | ||||||
|  | 					</div> | ||||||
|  | 					 | ||||||
|  | 					<div class="title"> | ||||||
|  | 						<%= 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 %> | ||||||
|  | 					</div> | ||||||
|  | 					 | ||||||
|  | 					<div class="title"> | ||||||
|  | 						<%= 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 %> | ||||||
|  | 					</div> | ||||||
|  | 					 | ||||||
|  | 				</div> | ||||||
|  | 
 | ||||||
|  | 				<% end %> | ||||||
|  | 				 | ||||||
|  | 			</div> | ||||||
|  | 
 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :url, t("personal_patent.url") %> | ||||||
|  | 				<%= f.text_field :url %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :keywords, t("personal_patent.keywords") %> | ||||||
|  | 				<%= f.text_field :keywords %> | ||||||
|  | 			</div> | ||||||
|  | 
 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :abstract, t("personal_patent.abstract") %> | ||||||
|  | 				<%= f.text_field :abstract %> | ||||||
|  | 			</div> | ||||||
|  | 	 | ||||||
|  | 			<div id="title"> | ||||||
|  | 				<%= 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") %>  | ||||||
|  | 			</div> | ||||||
|  | 
 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :note, t("personal_patent.note") %> | ||||||
|  | 				<%= f.text_area :note, :size => "60x3" %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 		</div> | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 			 | ||||||
|  | 		<div> | ||||||
|  | 					 | ||||||
|  | 			<div id='plugin_files' class="plugin_files_block"> | ||||||
|  | 				 | ||||||
|  | 			<table class="table table-condensed"> | ||||||
|  | 				<thead> | ||||||
|  | 					<tr> | ||||||
|  | 						<th>File</th> | ||||||
|  | 						<th>File Name</th> | ||||||
|  | 						<th class="span1"></th> | ||||||
|  | 					</tr> | ||||||
|  | 				</thead> | ||||||
|  | 				<tfoot> | ||||||
|  | 					<tr> | ||||||
|  | 						<td style="text-align:center" colspan="3"> | ||||||
|  | 							<div id='add_plugin_file' class="info_input plugin_files_block"> | ||||||
|  | 								<%= hidden_field_tag 'plugin_file_field_count', @writing_patent.writing_patent_files.count %> | ||||||
|  | 								<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a> | ||||||
|  | 							</div> | ||||||
|  | 						</td> | ||||||
|  | 					</tr> | ||||||
|  | 				 | ||||||
|  | 				</tfoot> | ||||||
|  | 				<tbody> | ||||||
|  | 					 | ||||||
|  | 					<% @writing_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 %>	 | ||||||
|  | 				</tbody> | ||||||
|  | 			</table> | ||||||
|  | 			 | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 		</div> | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 	</div> | ||||||
|  | 	 | ||||||
|  | <!--Post End--> | ||||||
|  | 
 | ||||||
|  |    | ||||||
|  | 	<div class="form-actions"> | ||||||
|  | 	<%= f.submit t('submit'), :class=>'btn btn-primary' %> | ||||||
|  | 	<%= link_to t('cancel'), get_go_back, :class=>"btn" %>  | ||||||
|  | 	</div>  | ||||||
|  | 	 | ||||||
|  | 
 | ||||||
|  | <% content_for :page_specific_javascript do %> | ||||||
|  | 	<%= javascript_include_tag "archive_plugin_form" %> | ||||||
|  | 	<script> | ||||||
|  | 		$('#add_plugin_file a.add').live('click', function(){ | ||||||
|  | 			var new_id = $(this).prev().attr('value'); | ||||||
|  | 			var old_id = new RegExp("new_add_plugin_files", "g"); | ||||||
|  | 			$(this).prev().attr('value', parseInt(new_id) + 1); | ||||||
|  | 			$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_patent_files) %>").replace(old_id, new_id)); | ||||||
|  | 		}); | ||||||
|  | 		 | ||||||
|  | 		$('.add_plugin_files_block a.delete').live('click', function(){ | ||||||
|  | 		  $(this).parents('.list_item').remove(); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 		$('.action a.remove_existing_record').live('click', function(){ | ||||||
|  | 		  $(this).next('.should_destroy').attr('value', 1); | ||||||
|  | 		  $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 	</script> | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1,50 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  | 		<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'> | ||||||
|  | 			<td> | ||||||
|  | 				<div class="control-group"> | ||||||
|  | 					<div class="controls"> | ||||||
|  | 					<%= f.file_field :file %> | ||||||
|  | 					<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> | ||||||
|  | 					</div> | ||||||
|  | 				</div> | ||||||
|  | 			</td>	 | ||||||
|  | 			<td>	 | ||||||
|  | 			 | ||||||
|  | 				<div class="tab-content"> | ||||||
|  | 				 | ||||||
|  | 					<% @site_valid_locales.each_with_index do |locale, i| %> | ||||||
|  | 					 | ||||||
|  | 					<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> | ||||||
|  | 						<%#= 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| %> | ||||||
|  | 							<div class="control-group"> | ||||||
|  | 							<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label> | ||||||
|  | 							<div class="controls"> | ||||||
|  | 							<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %> | ||||||
|  | 							</div> | ||||||
|  | 							</div> | ||||||
|  | 						<% end %>	 | ||||||
|  | 						 | ||||||
|  | 					</div> | ||||||
|  | 
 | ||||||
|  | 					<% end %> | ||||||
|  | 					 | ||||||
|  | 				</div> | ||||||
|  | 				 | ||||||
|  | 			</td> | ||||||
|  | 			 | ||||||
|  | 			<td> | ||||||
|  | 			<span class="action"> | ||||||
|  | 			<% if form_file.new_record? %> | ||||||
|  | 			  <a class="delete"><i class="icon-remove"></i></a> | ||||||
|  | 			<% else %>	 | ||||||
|  | 			  <%= f.hidden_field :id %> | ||||||
|  | 			  <a class="remove_existing_record"><i class="icon-remove"></i></a> | ||||||
|  | 			  <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> | ||||||
|  | 			<% end %> | ||||||
|  | 			</span> | ||||||
|  | 			 | ||||||
|  | 			</td> | ||||||
|  | 		</tr> | ||||||
|  | 		 | ||||||
|  | @ -0,0 +1,11 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  | 	<tr id="<%= dom_id list_writing_patent_category %>"> | ||||||
|  | 		<td><%= list_writing_patent_category.title %></td> | ||||||
|  | 		<td class="span2"> | ||||||
|  | 		 | ||||||
|  | 		<a href="<%= panel_personal_patent_back_end_writing_patent_writing_patent_category_quick_edit_path(list_writing_patent_category) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a> | ||||||
|  | 		<%= 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" %> | ||||||
|  | 		</td> | ||||||
|  | 	</tr> | ||||||
|  | @ -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 %> | ||||||
|  | @ -0,0 +1,25 @@ | ||||||
|  | <tr id="<%= dom_id writing_patent %>" class="with_action"> | ||||||
|  | 	<td> | ||||||
|  | 		<% 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 -%> | ||||||
|  | 	</td> | ||||||
|  | 	<td><%= writing_patent.publish_date.strftime("%Y.%m") %></td> | ||||||
|  | 	<td> | ||||||
|  | 	<%= link_to writing_patent.patent_title, panel_personal_patent_front_end_writing_patent_path(writing_patent) %> | ||||||
|  | 	<div class="quick-edit"> | ||||||
|  | 		<ul class="nav nav-pills hide"> | ||||||
|  | 			<%if at_least_module_manager || writing_patent.writing_patent_category.cur_user_is_sub_manager_of(:edit)%> | ||||||
|  | 			<li><%= link_to t('edit'), edit_panel_personal_patent_back_end_writing_patent_path(writing_patent) %></li> | ||||||
|  | 			<li><%= link_to t('delete'), panel_personal_patent_back_end_writing_patent_path(writing_patent), :confirm => t('sure?'), :method => :delete, :remote => true %></li> | ||||||
|  | 			<% end -%> | ||||||
|  | 		</ul> | ||||||
|  | 	</div> | ||||||
|  | 	</td> | ||||||
|  | 	<td><%= writing_patent.patent_no %></td> | ||||||
|  | 	<td><%= writing_patent.patent_country %></td> | ||||||
|  | 	<td><%= writing_patent.authors %></td> | ||||||
|  | 	<td><%= writing_patent.url %></td> | ||||||
|  | 	<td><%= User.from_id(writing_patent.create_user_id).name rescue ''%></td> | ||||||
|  | </tr> | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,34 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  | <%= form_for(@set_writing_patent_category, :remote => true, :url => @writing_patent_category_url ) do |f| %> | ||||||
|  | 
 | ||||||
|  | 			<div class="modal-header"> | ||||||
|  |                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||||||
|  |                 <h3 id="myModalLabe1"><%= (@set_writing_patent_category.new_record? ? 'Add 專利類別' : 'Edit 專利類別') %></h3> | ||||||
|  |             </div> | ||||||
|  |             <div class="modal-body"> | ||||||
|  | 			 | ||||||
|  | 			<div class="control-group"> | ||||||
|  | 				<label for="http" class="control-label">Key</label> | ||||||
|  | 				<div class="controls"> | ||||||
|  | 				<%= f.text_field :key %> | ||||||
|  | 			</div> | ||||||
|  | 
 | ||||||
|  | 			<%= f.fields_for :title_translations do |f| %> | ||||||
|  | 				<% @site_valid_locales.each do |locale| %> | ||||||
|  | 					<div class="control-group"> | ||||||
|  | 						<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> | ||||||
|  | 						<div class="controls"> | ||||||
|  | 							<%= f.text_field locale, :class => 'control-label', :value => (@set_writing_patent_category.title_translations[locale] rescue nil) %> | ||||||
|  | 						</div> | ||||||
|  | 					</div> | ||||||
|  | 				<% end %> | ||||||
|  | 			<% end %> | ||||||
|  | 			 | ||||||
|  |             <div class="modal-footer"> | ||||||
|  | 				<%= hidden_field_tag 'writing_patent_category[writing_patent_category]', @set_writing_patent_category.id %> | ||||||
|  | 				<%= f.submit t('submit'), :class=>'btn btn-primary' %> | ||||||
|  | 				<a class="btn" data-dismiss="modal"><%= t('cancel')%></a> | ||||||
|  |             </div> | ||||||
|  | <% end %> | ||||||
|  | 		 | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | 
 | ||||||
|  | <% if !@writing_patent_category.blank? %> | ||||||
|  | $("#myModal1").modal('hide'); | ||||||
|  | $('<%= j render :partial => 'list_writing_patent_category', :collection => [@writing_patent_category] %>').appendTo('#writing_patent_categorys').hide().fadeIn(); | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $("#<%= dom_id @writing_patent %>").remove(); | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | <h1><%= t('personal_patent.editing_personal_patent') %></h1> | ||||||
|  | 
 | ||||||
|  | <%= form_for @writing_patent, :url => panel_personal_patent_back_end_writing_patent_path(@writing_patent), :html => {:class => 'clear'} do |f| %> | ||||||
|  | 	<%= render :partial => 'form', :locals => {:f => f} %> | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1,22 @@ | ||||||
|  | <%= render 'filter' %> | ||||||
|  | <table class="table main-list"> | ||||||
|  | 	<thead> | ||||||
|  | 		<tr> | ||||||
|  | 			<th class="span1"></th> | ||||||
|  | 			<th class="span1"></th> | ||||||
|  | 			<th class="span2"></th> | ||||||
|  | 			<th class="span3"></th> | ||||||
|  | 			<th class="span2"></th> | ||||||
|  | 		</tr> | ||||||
|  | 	</thead> | ||||||
|  | 	<tbody id="tbody_writing_patents" class="sort-holder"> | ||||||
|  | 		<%= render :partial => 'writing_patent', :collection => @writing_patents %> | ||||||
|  | 	</tbody> | ||||||
|  | </table> | ||||||
|  | 
 | ||||||
|  | <div class="form-actions form-fixed pagination-right"> | ||||||
|  | 	<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_patent_back_end_writing_patent_path, :class => 'btn btn-primary pull-right' %> | ||||||
|  | 	<div id="writing_patent_pagination" class="paginationFixed"> | ||||||
|  | 	<%= paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | $("#sort_headers").html("<%= j render 'sort_headers' %>"); | ||||||
|  | $("#tbody_writing_patents").html("<%= j render :partial => 'writing_patent', :collection => @writing_patents %>"); | ||||||
|  | $("#writing_patent_pagination").html("<%= j paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); | ||||||
|  | @ -0,0 +1,10 @@ | ||||||
|  | 
 | ||||||
|  | <%= flash_messages %> | ||||||
|  | <div id="poststuff"> | ||||||
|  | <h1><%= t('writing_patent.new_personal_patent') %></h1> | ||||||
|  | <%= form_for @writing_patent, :url => panel_personal_patent_back_end_writing_patents_path, :html => {:class => 'clear'} do |f| %> | ||||||
|  | 	<%= render :partial => 'form', :locals => {:f => f} %> | ||||||
|  | <% end %> | ||||||
|  | </div> | ||||||
|  | <%#= link_back %> | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | $("#enable_<%= @bulletin.id %>").toggle(); | ||||||
|  | $("#disable_<%= @bulletin.id %>").toggle(); | ||||||
|  | $("#bulletin_<%= @bulletin.id %>").toggleClass('disable'); | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | 
 | ||||||
|  | <% if !@writing_patent_category.blank? %> | ||||||
|  | $("#myModal1").modal('hide'); | ||||||
|  | $("#<%= dom_id @writing_patent_category %>").replaceWith("<%= j render :partial => 'list_writing_patent_category', :collection => [@writing_patent_category] %>"); | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $("#myModal1").html("<%= j render "writing_patent_category_qe" %>"); | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $("#myModal1").html("<%= j render "writing_patent_category_qe" %>"); | ||||||
|  | @ -0,0 +1,113 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <div id="isotope"> | ||||||
|  |             <div class="item element"> | ||||||
|  |                 <div class="detail w-a h-a"> | ||||||
|  |                     <p class="totle"> | ||||||
|  | 						<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_patent_back_end_writing_patent_writing_patent_category_quick_add_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a> | ||||||
|  |                         <span>專利類別</span>                         | ||||||
|  |                     </p> | ||||||
|  |                     <div class="detal-list my_scroll"> | ||||||
|  |                         <div class="scrollbar"> | ||||||
|  |                             <div class="track"> | ||||||
|  |                                 <div class="thumb"> | ||||||
|  |                                     <div class="end"></div> | ||||||
|  |                                 </div> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="viewport"> | ||||||
|  |                             <div class="overview"> | ||||||
|  |                                 <table id="writing_patent_categorys" class="table table-striped"> | ||||||
|  |                                     <tbody> | ||||||
|  | 										<%= render :partial => 'list_writing_patent_category', :collection => @writing_patent_categorys %> | ||||||
|  |                                     </tbody> | ||||||
|  |                                 </table> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  | 			 | ||||||
|  |             <div class="item element"> | ||||||
|  |                 <div class="detail w-a h-a"> | ||||||
|  |                     <p class="totle">                         | ||||||
|  |                         <button class="btn btn-small btn-primary pull-right" type="button" data-toggle="modal" data-target="#myModal4"><i class="icon-plus"></i> 新增</button> | ||||||
|  |                         <span>領域</span> | ||||||
|  |                     </p> | ||||||
|  |                     <ul class="nav nav-tabs"> | ||||||
|  |                         <li class="active"><a href="#">中文</a></li> | ||||||
|  |                         <li><a href="#">English</a></li> | ||||||
|  |                     </ul> | ||||||
|  |                     <div class="detal-list my_scroll"> | ||||||
|  |                         <div class="scrollbar"> | ||||||
|  |                             <div class="track"> | ||||||
|  |                                 <div class="thumb"> | ||||||
|  |                                     <div class="end"></div> | ||||||
|  |                                 </div> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="viewport"> | ||||||
|  |                             <div class="overview"> | ||||||
|  |                                 <table class="table table-striped"> | ||||||
|  |                                     <tbody> | ||||||
|  |                                         <tr> | ||||||
|  |                                             <td>Corresponding Author</td> | ||||||
|  |                                             <td>編輯 刪除</td> | ||||||
|  |                                         </tr> | ||||||
|  |                                         <tr> | ||||||
|  |                                             <td>First Author, Co- Authors</td> | ||||||
|  |                                             <td>編輯 刪除</td> | ||||||
|  |                                         </tr> | ||||||
|  |                                     </tbody> | ||||||
|  |                                 </table> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |         <div class="form-actions form-fixed pagination-right"> | ||||||
|  |             <a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯出</a>  | ||||||
|  |             <a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯入</a>  | ||||||
|  |             <a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 新增</a>  | ||||||
|  |             <a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 設定</a>  | ||||||
|  |         </div> | ||||||
|  | 
 | ||||||
|  | 		<div id="writing_patent_category_qe"> | ||||||
|  | 			<div style="display:none;" class="modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||||||
|  | 				<%= render :partial => "writing_patent_category_qe" %> | ||||||
|  | 			</div> | ||||||
|  | 		</div> | ||||||
|  | 		 | ||||||
|  |         <div style="display:none;" class="modal" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||||||
|  |             <div class="modal-header"> | ||||||
|  |                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||||||
|  |                 <h3 id="myModalLabel">領域</h3> | ||||||
|  |             </div> | ||||||
|  |             <ul class="nav nav-tabs"> | ||||||
|  |                 <li class="active"><a href="#">中文</a></li> | ||||||
|  |                 <li><a href="#">English</a></li> | ||||||
|  |             </ul> | ||||||
|  |             <div class="modal-body"> | ||||||
|  |                 <form class="form-horizontal"> | ||||||
|  |                     <div class="control-group"> | ||||||
|  |                         <label class="control-label" for="inputvalue">名稱</label> | ||||||
|  |                         <div class="controls"> | ||||||
|  |                             <input type="text" id="inputvalue" placeholder="Value"> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|  |                 </form> | ||||||
|  |             </div> | ||||||
|  |             <div class="modal-footer"> | ||||||
|  |                 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> | ||||||
|  |                 <button class="btn btn-primary">Save changes</button> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 
 | ||||||
|  | <% content_for :page_specific_css do %> | ||||||
|  | 	<%= stylesheet_link_tag "item" %> | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1,11 @@ | ||||||
|  | <div id="filter" class="subnav"> | ||||||
|  | 	<div class="filters"> | ||||||
|  | 		<div id="sort_headers" class="table-label"> | ||||||
|  | 			<%= render 'sort_headers' %>  | ||||||
|  | 		</div> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | <% content_for :page_specific_javascript do %> | ||||||
|  | 	<%= javascript_include_tag "sort_header" %> | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1,209 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  |   <%= f.error_messages %> | ||||||
|  | 
 | ||||||
|  | 	<!--Widget start--> | ||||||
|  | 	 | ||||||
|  | 	<div id="sub-wiget"> | ||||||
|  | 
 | ||||||
|  | 		<div id="widget-tags" class="widget-box widget-size-300"> | ||||||
|  | 			<div class="widget-action clear"> | ||||||
|  | 				<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a> | ||||||
|  | 			</div> | ||||||
|  | 			<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3> | ||||||
|  | 			<div class="widget-content clear form-horizontal"> | ||||||
|  | 				<% @tags.each do |tag| %> | ||||||
|  | 					<%= content_tag :label,:class => "checkbox inline" do -%> | ||||||
|  | 						<%= check_box_tag 'writing_patent[tag_ids][]', tag.id, @writing_patent.tag_ids.include?(tag.id)%> | ||||||
|  | 						<%= tag[I18n.locale] %> | ||||||
|  |             <%= hidden_field_tag 'writing_patent[tag_ids][]', '' %> | ||||||
|  | 					<% end %> | ||||||
|  | 				<% end %> | ||||||
|  | 			</div> | ||||||
|  | 		</div>   | ||||||
|  |    | ||||||
|  | 	</div> | ||||||
|  |    | ||||||
|  |    | ||||||
|  | <!--Wiget End--> | ||||||
|  | <!--Post Start--> | ||||||
|  | 
 | ||||||
|  | 	<div id="post-body"> | ||||||
|  | 		<div id="post-body-content" class="clear"> | ||||||
|  | 		 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :year ,t("personal_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]'} ) %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= 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 ]} %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= 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'} %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= 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'} %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<ul class="nav nav-tabs"> | ||||||
|  | 				<% @site_valid_locales.each_with_index do |locale, i| %> | ||||||
|  | 			    <li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li> | ||||||
|  | 				<% end %> | ||||||
|  | 			</ul> | ||||||
|  | 			 | ||||||
|  | 			<div class="tab-content"> | ||||||
|  | 			 | ||||||
|  | 				<% @site_valid_locales.each_with_index do |locale, i| %> | ||||||
|  | 				 | ||||||
|  | 				<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> | ||||||
|  | 					 | ||||||
|  | 					<div class="title"> | ||||||
|  | 						<%= f.label :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 %> | ||||||
|  | 					</div> | ||||||
|  | 					 | ||||||
|  | 					<div class="title"> | ||||||
|  | 						<%= 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 %> | ||||||
|  | 					</div> | ||||||
|  | 					 | ||||||
|  | 					<div class="title"> | ||||||
|  | 						<%= 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 %> | ||||||
|  | 					</div> | ||||||
|  | 					 | ||||||
|  | 					<div class="title"> | ||||||
|  | 						<%= 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 %> | ||||||
|  | 					</div> | ||||||
|  | 					 | ||||||
|  | 				</div> | ||||||
|  | 
 | ||||||
|  | 				<% end %> | ||||||
|  | 				 | ||||||
|  | 			</div> | ||||||
|  | 
 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :url, t("personal_patent.url") %> | ||||||
|  | 				<%= f.text_field :url %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :keywords, t("personal_patent.keywords") %> | ||||||
|  | 				<%= f.text_field :keywords %> | ||||||
|  | 			</div> | ||||||
|  | 
 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :abstract, t("personal_patent.abstract") %> | ||||||
|  | 				<%= f.text_field :abstract %> | ||||||
|  | 			</div> | ||||||
|  | 	 | ||||||
|  | 			<div id="title"> | ||||||
|  | 				<%= 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") %>  | ||||||
|  | 			</div> | ||||||
|  | 
 | ||||||
|  | 			<div class="title"> | ||||||
|  | 				<%= f.label :note, t("personal_patent.note") %> | ||||||
|  | 				<%= f.text_area :note, :size => "60x3" %> | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 		</div> | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 			 | ||||||
|  | 		<div> | ||||||
|  | 					 | ||||||
|  | 			<div id='plugin_files' class="plugin_files_block"> | ||||||
|  | 				 | ||||||
|  | 			<table class="table table-condensed"> | ||||||
|  | 				<thead> | ||||||
|  | 					<tr> | ||||||
|  | 						<th>File</th> | ||||||
|  | 						<th>File Name</th> | ||||||
|  | 						<th class="span1"></th> | ||||||
|  | 					</tr> | ||||||
|  | 				</thead> | ||||||
|  | 				<tfoot> | ||||||
|  | 					<tr> | ||||||
|  | 						<td style="text-align:center" colspan="3"> | ||||||
|  | 							<div id='add_plugin_file' class="info_input plugin_files_block"> | ||||||
|  | 								<%= hidden_field_tag 'plugin_file_field_count', @writing_patent.writing_patent_files.count %> | ||||||
|  | 								<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a> | ||||||
|  | 							</div> | ||||||
|  | 						</td> | ||||||
|  | 					</tr> | ||||||
|  | 				 | ||||||
|  | 				</tfoot> | ||||||
|  | 				<tbody> | ||||||
|  | 					 | ||||||
|  | 					<% @writing_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 %>	 | ||||||
|  | 				</tbody> | ||||||
|  | 			</table> | ||||||
|  | 			 | ||||||
|  | 			</div> | ||||||
|  | 			 | ||||||
|  | 		</div> | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 	</div> | ||||||
|  | 	 | ||||||
|  | <!--Post End--> | ||||||
|  | 
 | ||||||
|  |    | ||||||
|  | 	<div class="form-actions"> | ||||||
|  | 	<%= f.submit t('submit'), :class=>'btn btn-primary' %> | ||||||
|  | 	<%= link_to t('cancel'), get_go_back, :class=>"btn" %>  | ||||||
|  | 	</div>  | ||||||
|  | 	 | ||||||
|  | 
 | ||||||
|  | <% content_for :page_specific_javascript do %> | ||||||
|  | 	<%= javascript_include_tag "archive_plugin_form" %> | ||||||
|  | 	<script> | ||||||
|  | 		$('#add_plugin_file a.add').live('click', function(){ | ||||||
|  | 			var new_id = $(this).prev().attr('value'); | ||||||
|  | 			var old_id = new RegExp("new_add_plugin_files", "g"); | ||||||
|  | 			$(this).prev().attr('value', parseInt(new_id) + 1); | ||||||
|  | 			$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_patent_files) %>").replace(old_id, new_id)); | ||||||
|  | 		}); | ||||||
|  | 		 | ||||||
|  | 		$('.add_plugin_files_block a.delete').live('click', function(){ | ||||||
|  | 		  $(this).parents('.list_item').remove(); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 		$('.action a.remove_existing_record').live('click', function(){ | ||||||
|  | 		  $(this).next('.should_destroy').attr('value', 1); | ||||||
|  | 		  $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 	</script> | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1,50 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  | 		<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'> | ||||||
|  | 			<td> | ||||||
|  | 				<div class="control-group"> | ||||||
|  | 					<div class="controls"> | ||||||
|  | 					<%= f.file_field :file %> | ||||||
|  | 					<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> | ||||||
|  | 					</div> | ||||||
|  | 				</div> | ||||||
|  | 			</td>	 | ||||||
|  | 			<td>	 | ||||||
|  | 			 | ||||||
|  | 				<div class="tab-content"> | ||||||
|  | 				 | ||||||
|  | 					<% @site_valid_locales.each_with_index do |locale, i| %> | ||||||
|  | 					 | ||||||
|  | 					<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> | ||||||
|  | 						<%#= 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| %> | ||||||
|  | 							<div class="control-group"> | ||||||
|  | 							<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label> | ||||||
|  | 							<div class="controls"> | ||||||
|  | 							<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %> | ||||||
|  | 							</div> | ||||||
|  | 							</div> | ||||||
|  | 						<% end %>	 | ||||||
|  | 						 | ||||||
|  | 					</div> | ||||||
|  | 
 | ||||||
|  | 					<% end %> | ||||||
|  | 					 | ||||||
|  | 				</div> | ||||||
|  | 				 | ||||||
|  | 			</td> | ||||||
|  | 			 | ||||||
|  | 			<td> | ||||||
|  | 			<span class="action"> | ||||||
|  | 			<% if form_file.new_record? %> | ||||||
|  | 			  <a class="delete"><i class="icon-remove"></i></a> | ||||||
|  | 			<% else %>	 | ||||||
|  | 			  <%= f.hidden_field :id %> | ||||||
|  | 			  <a class="remove_existing_record"><i class="icon-remove"></i></a> | ||||||
|  | 			  <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> | ||||||
|  | 			<% end %> | ||||||
|  | 			</span> | ||||||
|  | 			 | ||||||
|  | 			</td> | ||||||
|  | 		</tr> | ||||||
|  | 		 | ||||||
|  | @ -0,0 +1,7 @@ | ||||||
|  | <%= 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']).html_safe %> | ||||||
|  | @ -0,0 +1,24 @@ | ||||||
|  | <tr id="<%= dom_id writing_patent %>" class="with_action"> | ||||||
|  | 	<td> | ||||||
|  | 		<% 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 -%> | ||||||
|  | 	</td> | ||||||
|  | 	<td><%= writing_patent.period_start_date.strftime("%Y.%m") %> ~ <%= writing_patent.period_end_date.strftime("%Y.%m") %></td> | ||||||
|  | 	<td> | ||||||
|  | 	<%= link_to writing_patent.writing_patent_title, panel_personal_patent_front_end_writing_patent_path(writing_patent) %> | ||||||
|  | 	<div class="quick-edit"> | ||||||
|  | 		<ul class="nav nav-pills hide"> | ||||||
|  | 			<%if at_least_module_manager || writing_patent.writing_patent_category.cur_user_is_sub_manager_of(:edit)%> | ||||||
|  | 			<li><%= link_to t('edit'), edit_panel_personal_patent_plugin_writing_patent_path(writing_patent) %></li> | ||||||
|  | 			<li><%= link_to t('delete'), panel_personal_patent_plugin_writing_patent_path(writing_patent), :confirm => t('sure?'), :method => :delete, :remote => true %></li> | ||||||
|  | 			<% end -%> | ||||||
|  | 		</ul> | ||||||
|  | 	</div> | ||||||
|  | 	</td> | ||||||
|  | 	<td><%= writing_patent.participator %></td> | ||||||
|  | 	<td><%= writing_patent.job_title %></td> | ||||||
|  | 	<td><%= writing_patent.unit %></td> | ||||||
|  | 	<td><%= User.from_id(writing_patent.create_user_id).name rescue ''%></td> | ||||||
|  | </tr> | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $("#<%= dom_id @writing_patent %>").remove(); | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | <h1><%= t('personal_patent.editing_personal_patent') %></h1> | ||||||
|  | 
 | ||||||
|  | <%= form_for @writing_patent, :url => panel_personal_patent_plugin_writing_patent_path(@writing_patent), :html => {:class => 'clear'} do |f| %> | ||||||
|  | 	<%= render :partial => 'form', :locals => {:f => f} %> | ||||||
|  | <% end %> | ||||||
|  | @ -0,0 +1,22 @@ | ||||||
|  | <%= render 'filter' %> | ||||||
|  | <table class="table main-list"> | ||||||
|  | 	<thead> | ||||||
|  | 		<tr> | ||||||
|  | 			<th class="span1"></th> | ||||||
|  | 			<th class="span1"></th> | ||||||
|  | 			<th class="span2"></th> | ||||||
|  | 			<th class="span3"></th> | ||||||
|  | 			<th class="span2"></th> | ||||||
|  | 		</tr> | ||||||
|  | 	</thead> | ||||||
|  | 	<tbody id="tbody_writing_patents" class="sort-holder"> | ||||||
|  | 		<%= render :partial => 'writing_patent', :collection => @writing_patents %> | ||||||
|  | 	</tbody> | ||||||
|  | </table> | ||||||
|  | 
 | ||||||
|  | <div class="form-actions form-fixed pagination-right"> | ||||||
|  | 	<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_patent_plugin_writing_patent_path, :class => 'btn btn-primary pull-right' %> | ||||||
|  | 	<div id="writing_patent_pagination" class="paginationFixed"> | ||||||
|  | 	<%= paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | $("#sort_headers").html("<%= j render 'sort_headers' %>"); | ||||||
|  | $("#tbody_writing_patents").html("<%= j render :partial => 'writing_patent', :collection => @writing_patents %>"); | ||||||
|  | $("#writing_patent_pagination").html("<%= j paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); | ||||||
|  | @ -0,0 +1,10 @@ | ||||||
|  | 
 | ||||||
|  | <%= flash_messages %> | ||||||
|  | <div id="poststuff"> | ||||||
|  | <h1><%= t('writing_patent.new_personal_patent') %></h1> | ||||||
|  | <%= form_for @writing_patent, :url => panel_personal_patent_plugin_writing_patents_path, :html => {:class => 'clear'} do |f| %> | ||||||
|  | 	<%= render :partial => 'form', :locals => {:f => f} %> | ||||||
|  | <% end %> | ||||||
|  | </div> | ||||||
|  | <%#= link_back %> | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | $("#enable_<%= @bulletin.id %>").toggle(); | ||||||
|  | $("#disable_<%= @bulletin.id %>").toggle(); | ||||||
|  | $("#bulletin_<%= @bulletin.id %>").toggleClass('disable'); | ||||||
		Loading…
	
		Reference in New Issue