commit 4f98fa07b90fec3dc445a932c8d9acbd52f1d037 Author: Manson Wang Date: Wed Jan 15 19:23:10 2014 +0800 Orbit PersonalResearch Module diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1463de6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.bundle/ +log/*.log +pkg/ +test/dummy/db/*.sqlite3 +test/dummy/log/*.log +test/dummy/tmp/ \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ca30c1f --- /dev/null +++ b/Gemfile @@ -0,0 +1,17 @@ +source "http://rubygems.org" + +# Declare your gem's dependencies in personal_research.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec + +# jquery-rails is used by the dummy application +gem "jquery-rails" + +# Declare any dependencies that are still in development here instead of in +# your gemspec. These might include edge Rails or gems from your path or +# Git. Remember to move these dependencies to your gemspec before releasing +# your gem to rubygems.org. + +# To use debugger +# gem 'ruby-debug19', :require => 'ruby-debug' diff --git a/MIT-LICENSE b/MIT-LICENSE new file mode 100644 index 0000000..406f17b --- /dev/null +++ b/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright 2012 YOURNAME + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..b514c7a --- /dev/null +++ b/README.rdoc @@ -0,0 +1,3 @@ += PersonalResearch + +This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..55eba58 --- /dev/null +++ b/Rakefile @@ -0,0 +1,39 @@ +#!/usr/bin/env rake +begin + require 'bundler/setup' +rescue LoadError + puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +end +begin + require 'rdoc/task' +rescue LoadError + require 'rdoc/rdoc' + require 'rake/rdoctask' + RDoc::Task = Rake::RDocTask +end + +RDoc::Task.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'PersonalResearch' + rdoc.options << '--line-numbers' + rdoc.rdoc_files.include('README.rdoc') + rdoc.rdoc_files.include('lib/**/*.rb') +end + +APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) +load 'rails/tasks/engine.rake' + + +Bundler::GemHelper.install_tasks + +require 'rake/testtask' + +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.libs << 'test' + t.pattern = 'test/**/*_test.rb' + t.verbose = false +end + + +task :default => :test diff --git a/app/assets/images/personal_research/.gitkeep b/app/assets/images/personal_research/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/personal_research/.gitkeep b/app/assets/javascripts/personal_research/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/personal_research/desktop/personal_research.js b/app/assets/javascripts/personal_research/desktop/personal_research.js new file mode 100644 index 0000000..aba31ba --- /dev/null +++ b/app/assets/javascripts/personal_research/desktop/personal_research.js @@ -0,0 +1,151 @@ +orbitDesktop.prototype.initializePersonalResearch = function(target,url,cache){ // this init journal papers + this.initializePersonalResearch.formCallback = function(data){ + if(data.success){ + o.notify(data.msg,"success"); + o.sub_menu_item($("div[content-type=menu] a").eq(0)); + }else{ + o.notify(data.msg,"alert"); + } + } + + this.initializePersonalResearch.list = function(){ // to open list part in journal papers page + var journalData; + var bindHandlers = function(){ // to bind handlers for list page + + } + bindHandlers(); + + var bindSecondaryHandlers = function(){ + $("#journal_p div#paper_list a.icon-check-empty").click(function(){ + if($(this).hasClass("icon-check-empty")){ + $(this).switchClass("icon-check-empty","icon-check",0); + } else if($(this) .hasClass("icon-check")) { + $(this).switchClass("icon-check","icon-check-empty",0); + } else if($(this).hasClass("icon-star")){ + $(this).removeClass("icon-star").addClass("icon-star-empty"); + } else if($(this).hasClass("icon-star-empty")){ + $(this).removeClass("icon-star-empty").addClass("icon-star"); + } + return false; + }) + } + o.enableSharing("div.share_mode"); + } + this.initializePersonalResearch.researchDelete = function(data,dom){ + var parent = dom.parent().parent().parent(); + if(data.success){ + parent.hide("slide",function(){parent.remove();}); + o.notify(data.msg,"success"); + } + } + + this.initializePersonalResearch.cancelresearch = function(){ + o.highlight_sub_menu_item(0); + } + + var uploadFiles = function(){ + $('#add_plugin_file a.add').click(function(){ + var new_id = $(this).prev().attr('value'); + var old_id = new RegExp("new_writing_journal_files", "g"); + $(this).prev().attr('value', parseInt(new_id) + 1); + var x = get_html(old_id,new_id); + var newfield = $(x); + $(this).parents('table').append(newfield); + newfield.find('.action a.delete').click(function(){ + newfield.remove(); + }); + return false; + }); + $('.action a.remove_existing_record').click(function(){ + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) + }); + } + + var languageSelect = function(){ + $(".language_select a").click(function(event) { + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); + return false; + }); + } + + this.initializePersonalResearch.editresearch = function(){ + o.highlight_sub_menu_item(1); + uploadFiles(); + languageSelect(); + } + + this.initializePersonalResearch.addresearch = function(){ // to open add pages in journal papers page + uploadFiles(); + languageSelect(); + } + + this.initializePersonalResearch.brief = function(){ + o.enablelanguageSelect(); + $("textarea.editor").ckeditor({ + height: 300, + width: $(".overview").width() - 20 + }); + } + + + this.initializePersonalResearch.coAuthorformCallback = function(data){ + if(data.success){ + o.notify(data.msg,"success"); + o.sub_menu_item($("div[content-type=menu] a").eq(3)); + }else{ + o.notify(data.msg,"alert"); + } + } + this.initializePersonalResearch.coauthor = function(){ // to open add pages in coauthor page + var bindHandlers = function(){ // to bind handlers for add page + + } + bindHandlers(); + } + this.initializePersonalResearch.coauthorRelationForm = function(data){ + if(data.success){ + o.notify(data.msg,"success"); + $("#co_author_relation_table").html(data.newvalue); + }else{ + o.notify(data.msg,"alert"); + } + } + this.initializePersonalResearch.coauthorRelationEditForm = function(data){ + if(data.success){ + o.notify(data.msg,"success"); + var x = o.layout_data.generate_layout_html(data.newvalue); + $("div[container=true] div.overview").html(x.markup); + }else{ + o.notify(data.msg,"alert"); + } + } + this.initializePersonalResearch.allnone = function(d,o){ + switch(o.attr("href")){ + case "all": + $("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check"); + break; + case "none": + $("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty"); + break; + } + } + this.initializePersonalResearch.allnone = function(d,o){ + switch(o.attr("href")){ + case "all": + $("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check"); + break; + case "none": + $("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty"); + break; + } + } +}; + + diff --git a/app/assets/stylesheets/personal_research/.gitkeep b/app/assets/stylesheets/personal_research/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/personal_research/desktop/personal_research.css b/app/assets/stylesheets/personal_research/desktop/personal_research.css new file mode 100644 index 0000000..89cf679 --- /dev/null +++ b/app/assets/stylesheets/personal_research/desktop/personal_research.css @@ -0,0 +1,115 @@ +/* Books */ +[page-name="research_list"] .list_t_item .inner { + padding-left: 30px; } +[page-name="research_list"] .list_item_action { + font-size: 12px; + float: left; + margin-left: -30px; } + [page-name="research_list"] .list_item_action a { + display: block; + width: 20px; + height: 20px; + line-height: 20px; + margin: 1px 1px 6px 1px; } + [page-name="research_list"] .list_item_action .icon-star-empty { + color: #999; + font-size: 20px; } + [page-name="research_list"] .list_item_action .icon-star { + color: #faa732; + font-size: 20px; } + [page-name="research_list"] .list_item_action .icon-check-empty { + color: #999; + font-size: 20px; } + [page-name="research_list"] .list_item_action .icon-check { + color: #333; + font-size: 20px; } +[page-name="research_list"] .file_view .list_t_des { + overflow: hidden; } +[page-name="research_list"] .file_view .file { + float: left; + width: 120px; + height: 50px; + padding: 6px; + margin: 1px; + position: relative; + -webkit-box-sizing: border-box; + /* webkit */ + -khtml-box-sizing: border-box; + /* konqueror */ + -moz-box-sizing: border-box; + /* firefox */ + -ms-box-sizing: border-box; + /* ie */ + box-sizing: border-box; + /* css3 */ } + [page-name="research_list"] .file_view .file:hover { + background-color: #f7f7f7; } + [page-name="research_list"] .file_view .file img { + width: 38px; + height: 38px; + position: absolute; + left: 6px; + top: 6px; } + [page-name="research_list"] .file_view .file .filetitle { + display: block; + width: 100%; + height: 38px; + padding-left: 40px; + overflow: hidden; + -webkit-box-sizing: border-box; + /* webkit */ + -khtml-box-sizing: border-box; + /* konqueror */ + -moz-box-sizing: border-box; + /* firefox */ + -ms-box-sizing: border-box; + /* ie */ + box-sizing: border-box; + /* css3 */ } + +/* Books Books list */ +[page-name="books_books"] .datalist_item .inner { + padding-left: 30px; } +[page-name="books_books"] .list_item_action { + font-size: 12px; + float: left; + margin-left: -30px; } +[page-name="books_books"] .list_item_action i { + color: #999; + font-size: 20px; + display: block; + width: 20px; + height: 20px; + line-height: 20px; + margin: 1px 1px 6px 1px; } +[page-name="books_books"] .list_t_desc { + font-family: Arial, sans-serif; + font-size: 12px; + color: #999; } + +/* Books Co-Author */ +[page-name="books_coauthor"] .list_t_item { + height: 110px; } +[page-name="books_coauthor"] .list_item_function a { + display: inline-block; + padding: 4px; + font-family: Arial, sans-serif; + font-size: 11px; + -webkit-text-size-adjust: none; } +[page-name="books_coauthor"] .info { + font-family: Arial, sans-serif; } +[page-name="books_coauthor"] .info li { + margin-bottom: 8px; + color: #999; } +[page-name="books_coauthor"] .info .name { + font-size: 18px; + line-height: 24px; + color: #333; } + +/* Books Co-Author Relationship*/ +[page-name="books_coauthor_relation"] .edit_co_author_relation { + /*margin-left: -10px;*/ } +[page-name="books_coauthor_relation"] .form_space { + margin-bottom: 10px; + font-size: 18px; + font-family: Arial, sans-serif; } diff --git a/app/assets/stylesheets/personal_research/desktop/personal_research.scss b/app/assets/stylesheets/personal_research/desktop/personal_research.scss new file mode 100644 index 0000000..b631ff2 --- /dev/null +++ b/app/assets/stylesheets/personal_research/desktop/personal_research.scss @@ -0,0 +1,123 @@ +@import "desktop-helper"; + +/* Books */ +[page-name="research_list"] { + .list_t_item .inner { padding-left: 30px; } + .list_item_action { + font-size: 12px; + float: left; + margin-left: -30px; + + a { + display: block; + width: 20px; + height: 20px; + line-height: 20px; + margin: 1px 1px 6px 1px; + } + .icon-star-empty { color: #999; font-size: 20px; } + .icon-star { color: #faa732; font-size: 20px; } + .icon-check-empty { color: #999; font-size: 20px; } + .icon-check { color: #333; font-size: 20px; } + } + + .file_view { + .list_t_des { + overflow: hidden; + } + .file { + float: left; + width: 120px; + height: 50px; + padding: 6px; + margin: 1px; + position: relative; + @include box-sizing; + + &:hover { + background-color: lighten($gray, 10%); + } + img { + width: 38px; + height: 38px; + position: absolute; + left: 6px; + top: 6px; + } + .filetitle { + display: block; + width: 100%; + height: 38px; + padding-left: 40px; + overflow: hidden; + @include box-sizing; + } + } + } +} + +/* Books Books list */ +[page-name="books_books"] { + + .datalist_item .inner { + padding-left: 30px; + } + .list_item_action { + font-size: 12px; + float: left; + margin-left: -30px; + } + .list_item_action i { + color: #999; + font-size: 20px; + display: block; + width: 20px; + height: 20px; + line-height: 20px; + margin: 1px 1px 6px 1px; + } + .list_t_desc { + font-family: Arial, sans-serif; + font-size: 12px; + color: #999; + } +} + +/* Books Co-Author */ +[page-name="books_coauthor"] { + .list_t_item { + height: 110px; + } + .list_item_function {} + .list_item_function a { + display: inline-block; + padding: 4px; + font-family: Arial, sans-serif; + font-size: 11px; + -webkit-text-size-adjust: none; + } + .info { + font-family: Arial, sans-serif; + } + .info li { + margin-bottom: 8px; + color: #999; + } + .info .name { + font-size: 18px; + line-height: 24px; + color: #333; + } +} + +/* Books Co-Author Relationship*/ +[page-name="books_coauthor_relation"]{ + .edit_co_author_relation { + /*margin-left: -10px;*/ + } + .form_space { + margin-bottom: 10px; + font-size: 18px; + font-family: Arial, sans-serif; + } +} \ No newline at end of file diff --git a/app/controllers/.gitkeep b/app/controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..307a4ac --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,23 @@ +class ApplicationController < ActionController::Base + protect_from_forgery + before_filter :set_locale + + # Set I18n.locale + def set_locale + # update session if passed + session[:locale] = params[:locale] if params[:locale] + + # set locale based on session or default + begin + # check if locale is valid for non site pages + if !VALID_LOCALES.include?(session[:locale]) + I18n.locale = I18n.default_locale + else + I18n.locale = session[:locale] + end + rescue + I18n.locale = I18n.default_locale + end + end + +end diff --git a/app/controllers/panel/personal_research/back_end/personal_research_intros_controller.rb b/app/controllers/panel/personal_research/back_end/personal_research_intros_controller.rb new file mode 100644 index 0000000..2ae84df --- /dev/null +++ b/app/controllers/panel/personal_research/back_end/personal_research_intros_controller.rb @@ -0,0 +1,10 @@ +class Panel::PersonalResearch::BackEnd::PersonalResearchIntrosController < Admin::PersonalPluginIntrosController + + def initialize + super + @app_type = 'personal_research_intro' + @app_type_name = 'personal_research' + @reback_name = 'Research' + end + +end diff --git a/app/controllers/panel/personal_research/back_end/researchs_controller.rb b/app/controllers/panel/personal_research/back_end/researchs_controller.rb new file mode 100644 index 0000000..0460a07 --- /dev/null +++ b/app/controllers/panel/personal_research/back_end/researchs_controller.rb @@ -0,0 +1,189 @@ +class Panel::PersonalResearch::BackEnd::ResearchsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + + def index + get_plugins + + # @tags = get_tags + # @categories = get_categories_for_index + # @statuses = get_statuses + # category_ids = @categories.collect{|t| t.id} + + @researchs = get_sorted_and_filtered("research") + respond_to do |format| + format.html # index.html.erb + format.js { } + format.xml { render :xml => @researchs } + end + end + + # GET /researchs/1 + # GET /researchs/1.xml + def show + @research = Research.find(params[:id]) + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @research } + end + end + + # GET /researchs/new + # GET /researchs/new.xml + def new + + get_plugins + + @research = Research.new + + @tags = get_tags + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @research } + end + end + + # GET /researchs/1/edit + def edit + + get_plugins + + @research = Research.find(params[:id]) + + @tags = get_tags + end + + # POST /researchs + # POST /researchs.xml + def create + + @tags = get_tags + + @research = Research.new(params[:research]) + + if params[:research][:user_id] + @research.create_user_id = params[:research][:user_id] + @research.update_user_id = params[:research][:user_id] + else + @research.create_user_id = current_user.id + @research.update_user_id = current_user.id + end + + respond_to do |format| + if @research.save + + if params[:research][:user_id] + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:research][:user_id],:show_plugin_profile=>"Research")) } + else + format.html { redirect_to(panel_personal_research_back_end_researchs_url) } + end + + format.xml { render :xml => @research, :status => :created, :location => @research } + else + format.html { render :action => "new" } + format.xml { render :xml => @research.errors, :status => :unprocessable_entity } + end + end + end + + # PUT /researchs/1 + # PUT /researchs/1.xml + def update + + @research = Research.find(params[:id]) + + @research.update_user_id = current_user.id + + params[:research][:tag_ids] ||=[] + + respond_to do |format| + if @research.update_attributes(params[:research]) + format.html { redirect_to(panel_personal_research_back_end_researchs_url) } + # format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @research.errors, :status => :unprocessable_entity } + end + end + + end + + # DELETE /researchs/1 + # DELETE /researchs/1.xml + def destroy + @research = Research.find(params[:id]) + @research.destroy + + respond_to do |format| + format.html { redirect_to(panel_personal_research_back_end_researchs_url) } + # format.xml { head :ok } + format.js + end + end + + def delete + if params[:ids] + researchs = Research.any_in(:_id => params[:ids]).destroy_all + end + redirect_to panel_personal_research_back_end_researchs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end + + def data_share + + if params[:ids] + + @researchs = Research.any_in(:_id => params[:ids]) + + @researchs.each do |research| + + research.is_hidden = params[:disable] + + research.save + end + + end + + respond_to do |format| + + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"Research")) } + format.json { render json: {"success"=>true}.to_json} + end + + end + + protected + + + # def get_index_categories(id = nil) + # @bulletin_categorys = [] + # if(is_manager? || is_admin?) + # @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all) + # elsif is_sub_manager? + # @bulletin_categorys = BulletinCategory.all + # end + # @bulletin_categorys + # end + + + # def get_categorys(id = nil) + # @research_categorys = [] + # if(is_manager? || is_admin?) + # @research_categorys = (id ? ResearchCategory.admin_manager_all.find(id).to_a : ResearchCategory.admin_manager_all)) + # elsif is_sub_manager? + # @research_categorys = ResearchCategory.all.authed_for_user(current_user,'edit') + # end + # if @research_categorys.empty? && params[:action] != "index" + # flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") + # redirect_to :action => :index + # end + # end + + def get_plugins + @plugins = OrbitApp::Plugin::Registration.all + end + +end diff --git a/app/controllers/panel/personal_research/desktop/personal_researchs_controller.rb b/app/controllers/panel/personal_research/desktop/personal_researchs_controller.rb new file mode 100644 index 0000000..f333fa6 --- /dev/null +++ b/app/controllers/panel/personal_research/desktop/personal_researchs_controller.rb @@ -0,0 +1,71 @@ +class Panel::PersonalResearch::Desktop::PersonalResearchsController < ApplicationController + + def index + @researches = Research.where(create_user_id: current_user.id) + @view_by = params[:view] + page = params[:page] + page ||= 1 + + @per_column = 5 + + case @view_by + when "abstract" + @per_column = 1 + when "file" + @per_column = 2 + end + + if @view_by.nil? + @view_by = " " + @researches = @researches.asc(:paper_title) + else + @researches = @researches.asc(@view_by).asc(:paper_title) + end + @researches = @researches.page(page).per(50) + respond_to do |format| + format.html { render :layout => false} + end + end + + def new + @research = Research.new + render :layout => false + end + + def create + params[:research][:create_user_id] = current_user.id + @research = Research.new(params[:research]) + if @research.save + render json: {success: true, msg: t('create_success')}.to_json + else + error_msg = @research.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def edit + @research = Research.find(params[:id]) + render :layout => false + end + + def update + params[:research][:create_user_id] = current_user.id + @research = Research.find(params[:id]) + if @research.update_attributes(params[:research]) + render json: {success: true, msg: t('create_success')}.to_json + else + error_msg = @research.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def destroy + @research = Research.find(params[:id]) + @research.destroy + render :json => {success: true, msg: t('delete_success')} + end + + def research_window + render :layout => false + end +end \ No newline at end of file diff --git a/app/controllers/panel/personal_research/desktop/plugin_intros_controller.rb b/app/controllers/panel/personal_research/desktop/plugin_intros_controller.rb new file mode 100644 index 0000000..09e5d10 --- /dev/null +++ b/app/controllers/panel/personal_research/desktop/plugin_intros_controller.rb @@ -0,0 +1,32 @@ +class Panel::PersonalResearch::Desktop::PluginIntrosController < ApplicationController + + def index + @intro = PersonalResearchIntro.where(:user_id => current_user.id.to_s).first + if @intro.blank? + @intro = PersonalResearchIntro.new + render "new", :layout => false + else + render "edit", :layout => false + end + end + + def create + @intro = PersonalResearchIntro.new(params[:personal_research_intro]) + @intro.user_id = current_user.id + if @intro.save + render :json => {"success" => true}.to_json + else + render :json => {"success" => false}.to_json + end + end + + def update + @intro = PersonalResearchIntro.find(params[:id]) + if @intro.update_attributes(params[:personal_research_intro]) + render :json => {"success" => true}.to_json + else + render :json => {"success" => false}.to_json + end + end + +end \ No newline at end of file diff --git a/app/controllers/panel/personal_research/front_end/researchs_controller.rb b/app/controllers/panel/personal_research/front_end/researchs_controller.rb new file mode 100644 index 0000000..59ef075 --- /dev/null +++ b/app/controllers/panel/personal_research/front_end/researchs_controller.rb @@ -0,0 +1,22 @@ +class Panel::PersonalResearch::FrontEnd::ResearchsController < OrbitWidgetController + + def initialize + super + @app_title = 'personal_research' + end + + + def index + + @researchs = Research.where(:is_hidden=>false).desc(:publish_date).page(params[:page]).per(10) + + end + + # GET /researchs/1 + # GET /researchs/1.xml + def show + @research = Research.find(params[:id]) + end + + +end diff --git a/app/controllers/panel/personal_research/plugin/researchs_controller.rb b/app/controllers/panel/personal_research/plugin/researchs_controller.rb new file mode 100644 index 0000000..4703d5b --- /dev/null +++ b/app/controllers/panel/personal_research/plugin/researchs_controller.rb @@ -0,0 +1,160 @@ +class Panel::PersonalResearch::Plugin::ResearchsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + before_filter :authenticate_user! + + def index + + + @filter = params[:filter] + new_filter = params[:new_filter] + + if @filter && params[:clear] + @filter.delete(params[:type]) + elsif @filter && new_filter + if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s) + @filter[new_filter[:type]].delete(new_filter[:id].to_s) + elsif @filter.has_key?(new_filter[:type]) + @filter[new_filter[:type]] << new_filter[:id].to_s + else + @filter.merge!({new_filter[:type] => [new_filter[:id].to_s]}) + end + elsif new_filter + @filter = {new_filter[:type] => [new_filter[:id].to_s]} + end + + # @researchs = (params[:sort] || @filter) ? get_sorted_and_filtered("research",:create_user_id => current_user.id) : get_viewable("research",:create_user_id => current_user.id) + @researchs = @researchs = Research.all.where(:create_user_id => current_user.id).page(params[:page]).per(10) + + @tags = get_tags + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @researchs } + format.js + end + end + + # GET /researchs/1 + # GET /researchs/1.xml + def show + @research = Research.find(params[:id]) + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @research } + end + end + + # GET /researchs/new + # GET /researchs/new.xml + def new + + @research = Research.new + + @tags = get_tags + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @research } + end + end + + # GET /researchs/1/edit + def edit + @research = Research.find(params[:id]) + + @tags = get_tags + end + + # POST /researchs + # POST /researchs.xml + def create + + @tags = get_tags + + @research = Research.new(params[:research]) + + @research.create_user_id = current_user.id + @research.update_user_id = current_user.id + + respond_to do |format| + if @research.save + format.html { redirect_to(panel_personal_research_plugin_researchs_url) } + format.xml { render :xml => @research, :status => :created, :location => @research } + else + format.html { render :action => "new" } + format.xml { render :xml => @research.errors, :status => :unprocessable_entity } + end + end + end + + # PUT /researchs/1 + # PUT /researchs/1.xml + def update + @research = Research.find(params[:id]) + + @research.update_user_id = current_user.id + + params[:research][:tag_ids] ||=[] + + respond_to do |format| + if @research.update_attributes(params[:research]) + format.html { redirect_to(panel_personal_research_plugin_researchs_url) } + # format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @research.errors, :status => :unprocessable_entity } + end + end + end + + # DELETE /researchs/1 + # DELETE /researchs/1.xml + def destroy + @research = Research.find(params[:id]) + @research.destroy + + respond_to do |format| + format.html { redirect_to(panel_personal_research_plugin_researchs_url) } + # format.xml { head :ok } + format.js + end + end + + def delete + if params[:ids] + researchs = Research.any_in(:_id => params[:ids]).destroy_all + end + redirect_to panel_personal_research_plugin_researchs_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) + # @research_categorys = [] + # if(is_manager? || is_admin?) + # @research_categorys = (id ? ResearchCategory.admin_manager_all.find(id).to_a : ResearchCategory.admin_manager_all)) + # elsif is_sub_manager? + # @research_categorys = ResearchCategory.all.authed_for_user(current_user,'edit') + # end + # if @research_categorys.empty? && params[:action] != "index" + # flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") + # redirect_to :action => :index + # end + # end + +end diff --git a/app/helpers/.gitkeep b/app/helpers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/helpers/panel/personal_research/desktop/personal_researchs_helper.rb b/app/helpers/panel/personal_research/desktop/personal_researchs_helper.rb new file mode 100644 index 0000000..d625779 --- /dev/null +++ b/app/helpers/panel/personal_research/desktop/personal_researchs_helper.rb @@ -0,0 +1,104 @@ +module Panel::PersonalResearch::Desktop::PersonalResearchsHelper + def publication_record publication, view + content_tag :li, + "item" => "true", + "item" => "true", + "data-id" => publication.id.to_s, + :class => "list_t_item #{view.blank? ? '' : "#{view}_view" } #{publication.is_hidden? ? "private" : "public" }" do + content_tag :div, + :class => "inner" do + marker(publication.id) + \ + content(publication, view) + \ + edit_or_delete(publication) + end + end + end + + def marker id + content_tag :div, + :class => "list_item_action" do + content_tag(:a, "",:href=>"", + :class => "icon-check-empty", + "toggle-onclick"=>"icon-check-empty icon-check", + "data-id" => id.to_s, + "ajax-remote"=>"false") + \ + content_tag(:a, "",:href=>"", + :class => "icon-star-empty", + "toggle-onclick"=>"icon-star-empty icon-star", + "data-id" => id.to_s, + "ajax-remote"=>"false") + end + end + + def content publication, view + case view + when "research_title" + des = content_tag(:div, publication.research_title, + :class => "list_t_des") + when "keywords" + des = content_tag(:div, publication.keywords, + :class => "list_t_des") + when "extracted_chapters" + des = content_tag(:div, publication.extracted_chapters, + :class => "list_t_des") + when "file" + des = content_tag(:div, link_publication_file(publication), + :class => "list_t_des") + else + end + + content_tag(:div, publication.research_title, + :class => "list_t_title") + des + + end + + def edit_or_delete publication + content_tag :div, + :class => "list_item_function" do + content_tag(:a, t("edit"), + :class => "journal_paper_edit admbg2 admtxt", + :href => edit_panel_personal_research_desktop_personal_research_path(publication), + "callback-method" => "editresearch", + "ajax-remote" => "get") + \ + content_tag(:a, t(:delete_), + "ajax-remote" => "delete", + "confirm-message" => t("sure?"), + "callback-method" => "researchDelete", + :class => "journal_paper_delete admbg2 admtxt", + :href => panel_personal_research_desktop_personal_research_path(publication)) + end + end + + def link_publication_file publication + publication.research_files.map{|file| + link_to(image_tag(check_file_type(file.file.url)) + \ + content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"), + file.file.url, + :class => "file", + "target" => "_blank", + "title" => (file.title_translations[I18n.locale.to_s] rescue nil)) + }.inject(:+) + end + + def check_file_type file + if not file.nil? + file_type = MIME::Types.type_for(file).first.to_s.split("/")[1] + file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png" + else + file_type = "" + end + end + + def generate_authors_name ids + author_name = ids.map{|m| + if m == "0" + #{:id => 0, :text => current_user.name, :email => current_user.email } + {:id => 0, :text => current_user.name } + else + #{:id => m, :text => ConferenceCoAuthor.find(m).co_author, :email => ConferenceCoAuthor.find(m).email} + {:id => m, :text => ConferenceCoAuthor.find(m).co_author} + end + } + author_name.to_json + end +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/personal_research_intro.rb b/app/models/personal_research_intro.rb new file mode 100644 index 0000000..79cb931 --- /dev/null +++ b/app/models/personal_research_intro.rb @@ -0,0 +1,4 @@ +class PersonalResearchIntro < PersonalPluginIntro + + +end diff --git a/app/models/research.rb b/app/models/research.rb new file mode 100644 index 0000000..ff37216 --- /dev/null +++ b/app/models/research.rb @@ -0,0 +1,87 @@ +# encoding: utf-8 + +class Research + include Mongoid::Document + include Mongoid::Timestamps + include Mongoid::MultiParameterAttributes + + include OrbitModel::LanguageRestrict + include OrbitModel::Status + include OrbitTag::Taggable + + LANGUAGE_TYPES = [ "English", "Chinese" ] + + + field :research_title, localize: true + field :authors, localize: true + field :extracted_chapters, localize: true + + # has_and_belongs_to_many :tags, :class_name => "PersonalResearchTag" + + field :year + field :language + field :publish_date , :type => Date + field :keywords + field :url + field :note + field :create_user_id, :type => BSON::ObjectId + field :update_user_id, :type => BSON::ObjectId + + paginates_per 10 + + has_many :research_files, :autosave => true, :dependent => :destroy + + accepts_nested_attributes_for :research_files, :allow_destroy => true + + # before_save :clean_checkboxs + + validates :research_title, :at_least_one => true + + before_validation :add_http + + after_save :save_research_files + + validates :url, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :unless => Proc.new{self.url.blank?} + + def self.search( category_id = nil ) + + if category_id.to_s.size > 0 + + find(:all, :conditions => {research_category_id: category_id}).desc( :is_top, :title ) + + else + + find(:all).desc( :is_top, :title) + + end + + end + + + def self.widget_datas + + where( :is_hidden => false ).desc(:is_top, :created_at) + + end + + def save_research_files + self.research_files.each do |t| + if t.should_destroy + t.destroy + end + end + end + + protected + + def add_http + unless self.url.blank? || self.url[/^http:\/\//] || self.url[/^https:\/\//] + self.url = 'http://' + self.url + end + end + + def clean_checkboxs + self.tagged_ids.delete('') + end + +end \ No newline at end of file diff --git a/app/models/research_file.rb b/app/models/research_file.rb new file mode 100644 index 0000000..408f09d --- /dev/null +++ b/app/models/research_file.rb @@ -0,0 +1,14 @@ +class ResearchFile + + 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 :research + +end diff --git a/app/views/.gitkeep b/app/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_research/back_end/researchs/_clear_filters.html.erb b/app/views/panel/personal_research/back_end/researchs/_clear_filters.html.erb new file mode 100644 index 0000000..1b39bc3 --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/_clear_filters.html.erb @@ -0,0 +1,3 @@ +
+ <%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), panel_personal_research_back_end_researchs_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn js_history" %> +
\ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/_filter.html.erb b/app/views/panel/personal_research/back_end/researchs/_filter.html.erb new file mode 100644 index 0000000..ad02d4d --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/_filter.html.erb @@ -0,0 +1,9 @@ +
+
+ <%= render 'sort_headers' %> +
+
+ +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/_filter_tags.html.erb b/app/views/panel/personal_research/back_end/researchs/_filter_tags.html.erb new file mode 100644 index 0000000..918793b --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/_filter_tags.html.erb @@ -0,0 +1,6 @@ +
+ <% @tags.each do |tag| -%> + <%= link_to tag.name, panel_personal_research_back_end_researchs_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('tags', tag.id)}" %> + <% end -%> +
+<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %> \ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/_form.html.erb b/app/views/panel/personal_research/back_end/researchs/_form.html.erb new file mode 100644 index 0000000..312c804 --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/_form.html.erb @@ -0,0 +1,262 @@ +<% # encoding: utf-8 %> +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "lib/main-forms" %> + <%= stylesheet_link_tag "lib/fileupload" %> + <%= stylesheet_link_tag "lib/main-list" %> +<% end %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/bootstrap-fileupload" %> + <%= javascript_include_tag "lib/file-type" %> + <%= javascript_include_tag "lib/module-area" %> +<% end %> + + <%= f.error_messages %> + + +
+ + + + + + +
+ + +
+ + <% if !params[:user_id].blank? %> + +
+ +
+ <%= User.from_id(params[:user_id]).name rescue ''%> +
+
+ + <% end %> + + +
+ +
+ <%= select_year((@research.year ? @research.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'research[year]',:class => 'span1'} ) %> +
+
+ + +
+ +
+ <%= f.date_select :publish_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %> +
+
+ + +
+ +
+ <%= f.text_field :url , :class => "span6" %> +
+
+ + +
+ +
+ <%= f.text_field :keywords %> +
+
+ + +
+ +
+ <%= f.radio_button :language, "Chinese" %> <%= t("personal_research.Chinese") %> + <%= f.radio_button :language, "English" %> <%= t("personal_research.English") %> +
+
+ + +
+ +
+ <%= f.text_area :note, rows: 2, class: "input-block-level" %> +
+
+ +
+ + + <% if show_form_status_field(@research) %> +
+ + +
+ +
+ +
+
+ +
+ <% end %> + + +
+ + +
+ +
+ <% @tags.each do |tag| %> + + <% end %> +
+
+ +
+ +
+ + + + + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> + + +
+ +
+ <%= f.fields_for :research_title_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_research.research_title"), value: (@research.research_title_translations[locale] rescue nil) %> + <% end %> +
+
+ + +
+ +
+ <%= f.fields_for :extracted_chapters_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_research.extracted_chapters"), value: (@research.extracted_chapters_translations[locale] rescue nil) %> + <% end %> +
+
+ + +
+ +
+ <%= f.fields_for :authors_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_research.authors"), value: (@research.authors_translations[locale] rescue nil) %> + <% end %> +
+
+ +
+ + <% end %> + + +
+ +
+ + + <% if @research && !@research.research_files.blank? %> +
+ <% @research.research_files.each_with_index do |research_file, i| %> + <%= f.fields_for :research_files, research_file do |f| %> + <%= render :partial => 'form_file', :object => research_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> +
+
+ <% end %> + + +
+
+

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

+ +
+
+ + + + +
+ + + +
+ + +
+ <%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> + <%= f.submit t('submit'), class: 'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ +<% content_for :page_specific_javascript do %> + +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/_form_file.html.erb b/app/views/panel/personal_research/back_end/researchs/_form_file.html.erb new file mode 100644 index 0000000..07088ba --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/_form_file.html.erb @@ -0,0 +1,45 @@ +<% if form_file.new_record? %> +
+<% else %> +
+ <% if form_file.file.blank? %> + <%= t(:no_file) %> + <% else %> + <%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %> + <% end %> +<% end %> +
+ + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= locale %>"> + <%= f.fields_for :title_translations do |f| %> + <%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + <% if form_file.new_record? %> + + + + <% else %> + + <%= f.hidden_field :id %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + + <% end %> +
+
\ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/_research.html.erb b/app/views/panel/personal_research/back_end/researchs/_research.html.erb new file mode 100644 index 0000000..a9a3f6b --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/_research.html.erb @@ -0,0 +1,17 @@ + + <%= research.publish_date.strftime("%Y.%m") %> + + <%= link_to research.research_title , panel_personal_research_front_end_research_path(research) %> +
+ +
+ + <%= research.url %> + <%= User.from_id(research.create_user_id).name rescue ''%> + + diff --git a/app/views/panel/personal_research/back_end/researchs/_sort_headers.html.erb b/app/views/panel/personal_research/back_end/researchs/_sort_headers.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_research/back_end/researchs/destroy.js.erb b/app/views/panel/personal_research/back_end/researchs/destroy.js.erb new file mode 100644 index 0000000..5fcb94b --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @research %>").remove(); \ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/edit.html.erb b/app/views/panel/personal_research/back_end/researchs/edit.html.erb new file mode 100644 index 0000000..2da6f05 --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/edit.html.erb @@ -0,0 +1,15 @@ +<% content_for :side_bar do %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %> +<% end %> + + + +<%= form_for @research, url: panel_personal_research_back_end_research_path(@research), html: {class: "form-horizontal main-forms previewable"} do |f| %> +
+ <%= render partial: 'form', locals: {f: f} %> +
+<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/index.html.erb b/app/views/panel/personal_research/back_end/researchs/index.html.erb new file mode 100644 index 0000000..707a854 --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/index.html.erb @@ -0,0 +1,34 @@ +<% content_for :side_bar do %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %> +<% end %> + + + + + + + + + + + + + + <%= render :partial => 'research', :collection => @researchs %> + +
<%= t('personal_research.publication_date') %><%= t('personal_research.research_title') %><%= t('personal_research.url') %><%= t("personal_plugins.author") %>
+ +
+
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_research_back_end_research_path, :class => 'btn btn-primary pull-right' %> +
+ +
\ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/index.js.erb b/app/views/panel/personal_research/back_end/researchs/index.js.erb new file mode 100644 index 0000000..5b49fd6 --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/index.js.erb @@ -0,0 +1,3 @@ +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_researchs").html("<%= j render :partial => 'research', :collection => @researchs %>"); +$("#research_pagination").html("<%= j paginate @researchs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); \ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/new.html.erb b/app/views/panel/personal_research/back_end/researchs/new.html.erb new file mode 100644 index 0000000..df6dcc4 --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/new.html.erb @@ -0,0 +1,15 @@ +<% content_for :side_bar do %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %> +<% end %> + + + +<%= form_for @research, url: panel_personal_research_back_end_researchs_path, html: {class: "form-horizontal main-forms previewable"} do |f| %> +
+ <%= render partial: 'form', locals: {f: f} %> +
+<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_research/back_end/researchs/show.html.erb b/app/views/panel/personal_research/back_end/researchs/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_research/back_end/researchs/toggle_enable.js.erb b/app/views/panel/personal_research/back_end/researchs/toggle_enable.js.erb new file mode 100644 index 0000000..b00cfa0 --- /dev/null +++ b/app/views/panel/personal_research/back_end/researchs/toggle_enable.js.erb @@ -0,0 +1,3 @@ +$("#enable_<%= @bulletin.id %>").toggle(); +$("#disable_<%= @bulletin.id %>").toggle(); +$("#bulletin_<%= @bulletin.id %>").toggleClass('disable'); \ No newline at end of file diff --git a/app/views/panel/personal_research/desktop/personal_researchs/_form.html.erb b/app/views/panel/personal_research/desktop/personal_researchs/_form.html.erb new file mode 100644 index 0000000..5ad000d --- /dev/null +++ b/app/views/panel/personal_research/desktop/personal_researchs/_form.html.erb @@ -0,0 +1,103 @@ +
+
+ + <%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %> + <% if not @research.new_record? %> + <%= submit_tag t("cancel"), :type => "button", "callback-method"=>"cancelresearch", "ajax-remote" => "get", :href => panel_personal_research_desktop_personal_researchs_path, class: "fn_btn ini_input hp hh1 admbg2 admtxt" %> + + <% end %> +
+
+
Language
+
+ +
+
+
+
+
+
+
+
    +
  • + <% @site_in_use_locales.each_with_index do |locale, i| %> + <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %> + <% data = "data-language=" + locale %> +
    <%= data %>> + <%= f.fields_for :research_title_translations do |f| %> + <%= f.text_field locale, + size: "20", + placeholder: t("personal_research.research_title")+ "("+I18nVariable.from_locale(locale)+")", + class: "s_grid_12 s_grid", + value: (@research.research_title_translations[locale.to_s] rescue nil) %> + <% end %> + + <%= f.fields_for :extracted_chapters_translations do |f| %> + <%= f.text_field locale, + size: "20", + placeholder: t("personal_research.extracted_chapters")+ "("+I18nVariable.from_locale(locale)+")", + class: "s_grid_12 s_grid", + value: (@research.extracted_chapters_translations[locale.to_s] rescue nil) %> + <% end %> +
    + <% end %> +
  • +
  • + <%= label_tag("", t("personal_research.publication_date"), class: "s_grid_4 s_grid") %> + <%= f.date_select :publish_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year] }, {:class => 's_grid_4 s_grid'} %> + <%= f.date_select :publish_date, {:use_month_numbers => true, :order => [:month, :day] }, {:class => 's_grid_2 s_grid'} %> +
  • +
  • + <%= label_tag("", t("personal_research.url"), class: "s_grid_4 s_grid") %><%= f.text_field :url, size: "20", class: "s_grid_8 s_grid"%> +
  • +
  • + <%= f.text_area :keywords, size: "20x3", placeholder: t("personal_research.keywords"), class: "s_grid_12 s_grid_h_2 s_grid"%> +
  • +
  • + <%= f.label :language, t("personal_research.language"), :class => "s_grid s_grid_4" %> + <%= f.select :language, Research::LANGUAGE_TYPES,{} ,{:class => "s_grid s_grid_8"} %> +
  • +
  • + <%= f.text_area :note, size: "20x3", placeholder: t("personal_research.note"), class: "s_grid_12 s_grid s_grid_h_3 s_grid_h_full"%> +
  • + +
  • + + + + + + + + + + + + + + + + <% @research.research_files.each_with_index do |research_file, i| %> + <%= f.fields_for :research_files, research_file do |f| %> + <%= render :partial => 'form_file', :object => research_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> + +
    <%= t("personal_research.file")%><%= t("personal_research.file_name")%><%= t("personal_research.description") %>
    +
    + <%= hidden_field_tag 'plugin_file_field_count', @research.research_files.count %> + add +
    +
    +
  • +
+
+ \ No newline at end of file diff --git a/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb b/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb new file mode 100644 index 0000000..1db9af6 --- /dev/null +++ b/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb @@ -0,0 +1,50 @@ +" class="list_item"> + +
+ <% if form_file.new_record? %> + <%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %> + + <% else %> + <%= link_to(image_tag(check_file_type(form_file.file.url)), + form_file.file.url, + :class => "file", + "target" => "_blank", + "title" => form_file.title) %> + <% end %> +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %> + <% data = "data-language=" + locale %> + <%= data %>> + <%= f.fields_for :file_title_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4 title_field', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_title_translations[locale] rescue nil) %> + <% end %> + + + <%= data %>> + <%= f.fields_for :file_description_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_description_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + <% if form_file.new_record? %> + + <% else %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + <%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %> + + + + diff --git a/app/views/panel/personal_research/desktop/personal_researchs/edit.html.erb b/app/views/panel/personal_research/desktop/personal_researchs/edit.html.erb new file mode 100644 index 0000000..256ebf2 --- /dev/null +++ b/app/views/panel/personal_research/desktop/personal_researchs/edit.html.erb @@ -0,0 +1,3 @@ +<%= form_for @research, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_research_desktop_personal_research_path(@research) do |f| %> + <%= render partial: 'form', locals: {:f => f} %> +<%end%> diff --git a/app/views/panel/personal_research/desktop/personal_researchs/index.html.erb b/app/views/panel/personal_research/desktop/personal_researchs/index.html.erb new file mode 100644 index 0000000..a3a7033 --- /dev/null +++ b/app/views/panel/personal_research/desktop/personal_researchs/index.html.erb @@ -0,0 +1,70 @@ +
+
+
+
+ +
+
+
+
More
+
+ +
+
+
+
Tag
+
+ +
+
+
+
Status
+
+ +
+
+
+
View
+
+
    +
  • <%= link_to "Title", panel_personal_research_desktop_personal_researchs_path + "?view=research_title", :class => "hp hh1 admtxt", "ajax-remote" => "get" %>
  • +
  • <%= link_to "Extracted Chapters", panel_personal_research_desktop_personal_researchs_path + "?view=extracted_chapters", :class => "hp hh1 admtxt", "ajax-remote" => "get" %>
  • +
  • <%= link_to "File", panel_personal_research_desktop_personal_researchs_path + "?view=file", :class => "hp hh1 admtxt", "ajax-remote" => "get" %>
  • +
  • <%= link_to "Keywords", panel_personal_research_desktop_personal_researchs_path + "?view=keywords", :class => "hp hh1 admtxt", "ajax-remote" => "get" %>
  • +
+
+
+
+
Share
+ +
+
+
+
+
+
+
    + <% @researches.each do |w| %> + <%= publication_record w, @view_by%> + <% end %> +
+
\ No newline at end of file diff --git a/app/views/panel/personal_research/desktop/personal_researchs/new.html.erb b/app/views/panel/personal_research/desktop/personal_researchs/new.html.erb new file mode 100644 index 0000000..4c68094 --- /dev/null +++ b/app/views/panel/personal_research/desktop/personal_researchs/new.html.erb @@ -0,0 +1,3 @@ +<%= form_for @research, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_research_desktop_personal_researchs_path do |f| %> + <%= render partial: 'form', locals: {:f => f} %> +<%end%> diff --git a/app/views/panel/personal_research/desktop/personal_researchs/research_window.html.erb b/app/views/panel/personal_research/desktop/personal_researchs/research_window.html.erb new file mode 100644 index 0000000..28d6519 --- /dev/null +++ b/app/views/panel/personal_research/desktop/personal_researchs/research_window.html.erb @@ -0,0 +1,36 @@ +<%= stylesheet_link_tag "/assets/personal_research/desktop/personal_research" %> +<%= javascript_include_tag "personal_research/desktop/personal_research" %> +
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/app/views/panel/personal_research/desktop/plugin_intros/_form.html.erb b/app/views/panel/personal_research/desktop/plugin_intros/_form.html.erb new file mode 100644 index 0000000..1dfa224 --- /dev/null +++ b/app/views/panel/personal_research/desktop/plugin_intros/_form.html.erb @@ -0,0 +1,54 @@ +
+
+ + <%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %> +
+
+
Language
+
+ +
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/app/views/panel/personal_research/desktop/plugin_intros/edit.html.erb b/app/views/panel/personal_research/desktop/plugin_intros/edit.html.erb new file mode 100644 index 0000000..532bb9b --- /dev/null +++ b/app/views/panel/personal_research/desktop/plugin_intros/edit.html.erb @@ -0,0 +1,3 @@ +<%= form_for @intro, html: { multipart: true, "form-type"=>"ajax_form","notification"=>"Brief Intro Updated"}, url: panel_personal_research_desktop_plugin_intro_path(@intro) do |f| %> + <%= render partial: 'form', locals: {:f => f} %> +<%end%> diff --git a/app/views/panel/personal_research/desktop/plugin_intros/new.html.erb b/app/views/panel/personal_research/desktop/plugin_intros/new.html.erb new file mode 100644 index 0000000..02e3569 --- /dev/null +++ b/app/views/panel/personal_research/desktop/plugin_intros/new.html.erb @@ -0,0 +1,3 @@ +<%= form_for @intro, html: { multipart: true, "form-type"=>"ajax_form", "notification"=>"Brief Intro Saved"}, url: panel_personal_research_desktop_plugin_intros_path do |f| %> + <%= render partial: 'form', locals: {f: f} %> +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_research/front_end/_profile.html.erb b/app/views/panel/personal_research/front_end/_profile.html.erb new file mode 100644 index 0000000..b17bda8 --- /dev/null +++ b/app/views/panel/personal_research/front_end/_profile.html.erb @@ -0,0 +1,48 @@ +<% + if @member + + @researchs = Research.where(is_hidden: false, :create_user_id => @member.id).desc(:publish_date) + + @research_intro = !PersonalResearchIntro.where(:user_id => @member.id).blank? ? PersonalResearchIntro.where(:user_id => @member.id).first : PersonalResearchIntro.new +%> + + <% if @research_intro.brief_intro and !@research_intro.blank? %> + +
+ <%= @research_intro.text.html_safe rescue '' %> +
+ + <% end %> + + <% if ( !@research_intro.blank? and @research_intro.complete_list ) or @research_intro.blank? %> + + <% if !@researchs.blank? %> + + + + + + + + + + + <% @researchs.each do |research| %> + + + + + + + <% end %> + + +
<%= t('personal_research.publication_date') %><%= t('personal_research.research_title') %>
<%= research.publish_date.strftime("%Y.%m") %> + <%= link_to research.research_title, panel_personal_research_front_end_research_path(research) %> +
+ + <% end %> + + <% end %> + +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_research/front_end/researchs/index.html.erb b/app/views/panel/personal_research/front_end/researchs/index.html.erb new file mode 100644 index 0000000..36347d2 --- /dev/null +++ b/app/views/panel/personal_research/front_end/researchs/index.html.erb @@ -0,0 +1,34 @@ +<% # encoding: utf-8 %> + +<%= flash_messages %> + +

<%= t('module_name.personal_research') %>

+ + + + + + + + + + + + + <% @researchs.each do |research| %> + + + + + + + + <% end %> + + +
<%= t('personal_research.publication_date') %><%= t('personal_research.research_title') %><%= t('personal_research.authors') %>
<%= research.publish_date.strftime("%Y.%m") %> + <%= link_to research.research_title, panel_personal_research_front_end_research_path(research) %> + <%= "#{User.from_id(research.create_user_id).name rescue ''},#{research.authors rescue ''}"%>
+ + +<%= paginate @researchs, :params => {:inner => false}%> \ No newline at end of file diff --git a/app/views/panel/personal_research/front_end/researchs/show.html.erb b/app/views/panel/personal_research/front_end/researchs/show.html.erb new file mode 100644 index 0000000..971f9df --- /dev/null +++ b/app/views/panel/personal_research/front_end/researchs/show.html.erb @@ -0,0 +1,47 @@ +<% # encoding: utf-8 %> + + + + + <% if !@research.year.blank? %> + + <% end %> + + <% if !@research.language.blank? %> + + <% end %> + + <% if !@research.research_title.blank? %> + + <% end %> + + <% if !@research.extracted_chapters.blank? %> + + <% end %> + + <% if !@research.publish_date.blank? %> + + <% end %> + + <% if !@research.url.blank? %> + + <% end %> + + + + <% if @research.research_files.size > 0 %> + + + + <% end %> + +
<%= t("module_name.personal_research") %>
<%= t("personal_research.year")%><%= @research.year %>
<%= t("personal_research.language")%><%= @research.language %>
<%= t("personal_research.research_title")%><%= @research.research_title %>
<%= t("personal_research.extracted_chapters")%><%= @research.extracted_chapters %>
<%= t("personal_research.publication_date")%><%= @research.publish_date %>
<%= t("personal_research.url")%><%= link_to t(:url), @research.url, {:target => '_blank', :title => @research.url} if !@research.url.blank? %>
<%= t("personal_research.authors")%><%= "#{User.from_id(@research.create_user_id).name rescue ''},#{@research.authors rescue ''}"%>
<%= t("personal_research.file")%> +
+
+ + <% @research.research_files.each do | wjfile | %> + <%= link_to wjfile.title, wjfile.file.url, {:target => '_blank', :title => wjfile.title} if wjfile.file.file %> + <% end %> +
+
+
diff --git a/app/views/panel/personal_research/plugin/_profile.html.erb b/app/views/panel/personal_research/plugin/_profile.html.erb new file mode 100644 index 0000000..f445848 --- /dev/null +++ b/app/views/panel/personal_research/plugin/_profile.html.erb @@ -0,0 +1,96 @@ +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "lib/list-check" %> +<% end %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/list-check" %> +<% end %> + +<% + @filter = params[:filter] + new_filter = params[:new_filter] + + if @filter && params[:clear] + @filter.delete(params[:type]) + elsif @filter && new_filter + if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s) + @filter[new_filter[:type]].delete(new_filter[:id].to_s) + elsif @filter.has_key?(new_filter[:type]) + @filter[new_filter[:type]] << new_filter[:id].to_s + else + @filter.merge!({new_filter[:type] => [new_filter[:id].to_s]}) + end + elsif new_filter + @filter = {new_filter[:type] => [new_filter[:id].to_s]} + end + + + if @user && is_admin? + @researchs = Research.where(:create_user_id => @user.id).desc(:publish_date).page(params[:page]).per(10) + else + @researchs = Research.where(is_hidden: false, :create_user_id => @user.id).desc(:publish_date).page(params[:page]).per(10) + end + +%> + +<% if is_admin? %> +
+
+ <%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_panel_personal_research_back_end_researchs_path(:user_id => params[:id], :disable => 'true') ) %> + <%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_research_back_end_researchs_path(:user_id => params[:id], :disable => 'false') ) %> +
+
+<% end -%> + + + + + <% if is_admin? %> + + <% end -%> + + + + + + + <% @researchs.each do |research| %> + + "> + <% if is_admin? %> + + <% end -%> + + + + + <% end %> + + +
<%= t('personal_research.publication_date') %><%= t('personal_research.research_title') %>
+ <%= check_box_tag 'to_change[]', research.id.to_s, false, :class => "list-check" %> + <%= research.publish_date.strftime("%Y.%m") %> + <%= link_to research.research_title, panel_personal_research_front_end_research_path(research) %> +
+ +<% if is_admin? %> +
+
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_research_back_end_personal_research_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %> + <%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_research_back_end_research_path(:user_id => @user.id), :class => 'btn btn-primary' %> +
+ +
+<% end %> + + \ No newline at end of file diff --git a/app/views/panel/personal_research/plugin/researchs/_filter.html.erb b/app/views/panel/personal_research/plugin/researchs/_filter.html.erb new file mode 100644 index 0000000..63882b8 --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/_filter.html.erb @@ -0,0 +1,11 @@ + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_research/plugin/researchs/_form.html.erb b/app/views/panel/personal_research/plugin/researchs/_form.html.erb new file mode 100644 index 0000000..9a2c2d0 --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/_form.html.erb @@ -0,0 +1,183 @@ +<% # encoding: utf-8 %> + + <%= f.error_messages %> + + + +
+ +
+
+ +
+

Tags

+
+ <% @tags.each do |tag| %> + <%= content_tag :label,:class => "checkbox inline" do -%> + <%= check_box_tag 'research[tag_ids][]', tag.id, @research.tag_ids.include?(tag.id)%> + <%= tag.name %> + <%= hidden_field_tag 'research[tag_ids][]', '' %> + <% end %> + <% end %> +
+
+ +
+ + + + + +
+
+ +
+ <%= f.label :year ,t("personal_research.year")%> + <%= select_year((@research.year ? @research.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'research[year]'} ) %> +
+ + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> +
+ <%= f.label :research_title ,t("personal_research.research_title")%> + <%= f.fields_for :research_title_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@research.research_title_translations[locale] rescue nil) %> + <% end %> +
+ +
+ <%= f.label :extracted_chapters ,t("personal_research.extracted_chapters")%> + <%= f.fields_for :extracted_chapters_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@research.extracted_chapters_translations[locale] rescue nil) %> + <% end %> +
+ +
+ <%= f.label :authors,t("web_resource.authors") %> + <%= f.fields_for :authors_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_area locale, :size => "60x3", :value => (@research.authors_translations[locale] rescue nil) %> + <% end %> +
+ +
+ + <% end %> + +
+ +
+ <%= f.label :publish_date ,t("personal_research.publish_date")%> + <%= f.date_select :publish_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %> +
+ +
+ <%= f.label :url, t("personal_research.url") %> + <%= f.text_field :url %> +
+ +
+ <%= f.label :keywords, t("personal_research.keywords") %> + <%= f.text_field :keywords %> +
+ +
+ <%= f.label :language, t("personal_research.language") %> + <%= f.radio_button :language, "Chinese" %> <%= t("personal_research.Chinese") %> + <%= f.radio_button :language, "English" %> <%= t("personal_research.English") %> +
+ +
+ <%= f.label :note, t("personal_research.note") %> + <%= f.text_area :note, :size => "60x3" %> +
+ +
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + <% @research.research_files.each_with_index do |research_file, i| %> + <%= f.fields_for :research_files, research_file do |f| %> + <%= render :partial => 'form_file', :object => research_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> + +
FileFile Name
+
+ <%= hidden_field_tag 'plugin_file_field_count', @research.research_files.count %> + ADD/新增 +
+
+ +
+ +
+ + + + + + +
+ + + + +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "archive_plugin_form" %> + +<% end %> \ No newline at end of file diff --git a/app/views/panel/personal_research/plugin/researchs/_form_file.html.erb b/app/views/panel/personal_research/plugin/researchs/_form_file.html.erb new file mode 100644 index 0000000..3325847 --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/_form_file.html.erb @@ -0,0 +1,50 @@ +<% # encoding: utf-8 %> + + " class='list_item'> + +
+
+ <%= f.file_field :file %> + <%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> +
+
+ + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> + <%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %> + <%= f.fields_for :file_title_translations do |f| %> +
+ +
+ <%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %> +
+
+ <% end %> + +
+ + <% end %> + +
+ + + + + + <% if form_file.new_record? %> + + <% else %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + + + + + diff --git a/app/views/panel/personal_research/plugin/researchs/_research.html.erb b/app/views/panel/personal_research/plugin/researchs/_research.html.erb new file mode 100644 index 0000000..8949f48 --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/_research.html.erb @@ -0,0 +1,21 @@ + + + <% if (research.create_user_id == current_user.id) || is_manager? %> + <%= check_box_tag 'to_delete[]', research.id, false, :class => "checkbox_in_list" %> + <% end -%> + + <%= research.publish_date.strftime("%Y.%m") %> + + <%= link_to research.research_title , panel_personal_research_front_end_research_path(research) %> +
+ +
+ + <%= research.url %> + + diff --git a/app/views/panel/personal_research/plugin/researchs/_sort_headers.html.erb b/app/views/panel/personal_research/plugin/researchs/_sort_headers.html.erb new file mode 100644 index 0000000..be12c4e --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/_sort_headers.html.erb @@ -0,0 +1,5 @@ +<%= render_sort_bar(true, delete_panel_personal_research_back_end_researchs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), + ['publish_date', 'publish_date', 'span1', 'research.publish_date'], + ['research_title', 'research_title','span3', 'research.research_title'], + ['url', 'url','span3', 'research.url']).html_safe %> + \ No newline at end of file diff --git a/app/views/panel/personal_research/plugin/researchs/destroy.js.erb b/app/views/panel/personal_research/plugin/researchs/destroy.js.erb new file mode 100644 index 0000000..5fcb94b --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @research %>").remove(); \ No newline at end of file diff --git a/app/views/panel/personal_research/plugin/researchs/edit.html.erb b/app/views/panel/personal_research/plugin/researchs/edit.html.erb new file mode 100644 index 0000000..9f51861 --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/edit.html.erb @@ -0,0 +1,5 @@ +

<%= t('personal_research.editing_personal_research') %>

+ +<%= form_for @research, :url => panel_personal_research_plugin_research_path(@research), :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> diff --git a/app/views/panel/personal_research/plugin/researchs/index.html.erb b/app/views/panel/personal_research/plugin/researchs/index.html.erb new file mode 100644 index 0000000..84c9250 --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/index.html.erb @@ -0,0 +1,22 @@ +<%= render 'filter' %> + + + + + + + + + + + + <%= render :partial => 'research', :collection => @researchs %> + +
+ +
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_research_plugin_research_path, :class => 'btn btn-primary pull-right' %> +
+ <%= paginate @researchs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> +
+
diff --git a/app/views/panel/personal_research/plugin/researchs/index.js.erb b/app/views/panel/personal_research/plugin/researchs/index.js.erb new file mode 100644 index 0000000..5b49fd6 --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/index.js.erb @@ -0,0 +1,3 @@ +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_researchs").html("<%= j render :partial => 'research', :collection => @researchs %>"); +$("#research_pagination").html("<%= j paginate @researchs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); \ No newline at end of file diff --git a/app/views/panel/personal_research/plugin/researchs/new.html.erb b/app/views/panel/personal_research/plugin/researchs/new.html.erb new file mode 100644 index 0000000..6de925e --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/new.html.erb @@ -0,0 +1,10 @@ + +<%= flash_messages %> +
+

<%= t('research.new_personal_research') %>

+<%= form_for @research, :url => panel_personal_research_plugin_researchs_path, :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> +
+<%#= link_back %> + diff --git a/app/views/panel/personal_research/plugin/researchs/show.html.erb b/app/views/panel/personal_research/plugin/researchs/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/panel/personal_research/plugin/researchs/toggle_enable.js.erb b/app/views/panel/personal_research/plugin/researchs/toggle_enable.js.erb new file mode 100644 index 0000000..b00cfa0 --- /dev/null +++ b/app/views/panel/personal_research/plugin/researchs/toggle_enable.js.erb @@ -0,0 +1,3 @@ +$("#enable_<%= @bulletin.id %>").toggle(); +$("#disable_<%= @bulletin.id %>").toggle(); +$("#bulletin_<%= @bulletin.id %>").toggleClass('disable'); \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..a2ca463 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,53 @@ +en: + module_name: + personal_research: Research Project + personal_research: + paper_title : "Paper Title" + research_title : "Research Title" + extracted_chapters : "Extracted Chapters" + publishers : "Publishers" + authors : "Authors" + tags : "Tags" + year : "Year" + language : "Language" + isbn : "ISSN(ISBN)" + vol_no : "Vol.No" + issue_no : "Issue.No" + form_to_start : "From" + form_to_end : "To" + total_pages : "Total Pages" + keywords : "Keywords" + abstract : "Abstract" + publication_date : "Date of Publication" + url : "Reference URL" + note : "Note" + level_type : "Level Type" + author_type : "Author Type" + from : "From" + to : "To" + file : "File" + file_name : "File name" + description : "File Description" + pages : "Pages" + book_paper_type : "Book Paper Type" + frontend: + researchs: "Research Front-end" + + create_success : "Successfully Create" + update_success : "Successfully Update" + delete_success : "Successfully Delete" + add: "Add" + back: "Back" + delete: "Delete" + edit: "Edit" + nothing: "Nothing" + show: "Show" + sure?: "Are you sure?" + update: "Update" + yes_: "Yes" + no_: "No" + cancel : "Cancel" + save: "save" + hintText: "Type in a search term" + noResultsText: "No results" + searchingText: "Searching…" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml new file mode 100644 index 0000000..4161199 --- /dev/null +++ b/config/locales/zh_tw.yml @@ -0,0 +1,53 @@ +zh_tw: + module_name: + personal_research: 研究 + personal_research: + paper_title : "論文名稱" + research_title : "名稱" + extracted_chapters : "摘要" + publishers : "Publishers" + authors : "作者" + tags : "領域" + year : "年度" + language : "語言" + isbn : "ISSN(ISBN)" + vol_no : "卷數" + issue_no : "期數" + form_to_start : "起" + form_to_end : "訖" + total_pages : "總頁數" + keywords : "關鍵字" + abstract : "摘要" + publication_date : "發表日期" + url : "參考連結" + note : "記事" + level_type : "期刊類別" + author_type : "作者類別" + from : "起" + to : "訖" + file : "檔案" + file_name : "檔案名稱" + description : "描述" + pages : "Pages" + book_paper_type : "Book Paper Type" + frontend: + researchs: "研究前台" + + create_success : "新增完成!!" + update_success : "更新完成!!" + delete_success : "刪除成功!!" + add: "新增" + back: "返回" + delete: "刪除" + edit: "編輯" + nothing: "無" + show: "顯示" + sure?: "您肯定嗎?" + update: "更新" + yes_: "是" + no_: "否" + cancel : "取消" + save: "儲存" + hintText: "請輸入搜尋關鍵字" + noResultsText: "沒有相關的比對結果" + searchingText: "搜尋中…" diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..bd244cf --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,42 @@ +Rails.application.routes.draw do + + namespace :panel do + namespace :personal_research do + namespace :desktop do + match "research_window" => "personal_researchs#research_window" + resources :personal_researchs + resources :plugin_intros + end + namespace :back_end do + + match 'research_setting' => "researchs#research_setting" ,:as => :research_setting + + resources :researchs do + collection do + get 'delete' + get 'data_share' + end + + match "tag_quick_add" => "researchs#tag_quick_add" ,:as => :tag_quick_add + match "tag_quick_edit" => "researchs#tag_quick_edit" ,:as => :tag_quick_edit + end + + resources :personal_research_intros + resources :tags + end + namespace :front_end do + resources :researchs + end + namespace :plugin do + resources :researchs + end + namespace :widget do + match "researchs" => "researchs#index" + match "home_list" => "researchs#home_list" + match "reload_researchs" => "researchs#reload_researchs" + end + end + end + match "/appfront/*path" => redirect("/panel/*path") + +end diff --git a/lib/personal_research.rb b/lib/personal_research.rb new file mode 100644 index 0000000..b276f2e --- /dev/null +++ b/lib/personal_research.rb @@ -0,0 +1,4 @@ +require "personal_research/engine" + +module PersonalResearch +end diff --git a/lib/personal_research/engine.rb b/lib/personal_research/engine.rb new file mode 100644 index 0000000..336765f --- /dev/null +++ b/lib/personal_research/engine.rb @@ -0,0 +1,23 @@ +module PersonalResearch + class Engine < Rails::Engine + initializer "personal_research" do + OrbitApp.registration "PersonalResearch",:type=> 'ModuleApp' do + module_label 'module_name.personal_research' + base_url File.expand_path File.dirname(__FILE__) + personal_plugin :enable => true, :sort_number => '20', :app_name=>"Research", :intro_app_name=>"PersonalResearchIntro",:path=>"panel/personal_research/plugin/profile",:front_path=>"panel/personal_research/front_end/profile",:admin_path=>"/panel/personal_research/back_end/researchs",:i18n=>'module_name.personal_research' + + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + + front_end do + app_page 'researchs' do + frontend_i18n "personal_research.frontend.researchs" + end + end + end + end + end +end diff --git a/lib/personal_research/version.rb b/lib/personal_research/version.rb new file mode 100644 index 0000000..6397011 --- /dev/null +++ b/lib/personal_research/version.rb @@ -0,0 +1,3 @@ +module PersonalResearch + VERSION = "0.0.1" +end diff --git a/lib/tasks/personal_research_tasks.rake b/lib/tasks/personal_research_tasks.rake new file mode 100644 index 0000000..630c3ff --- /dev/null +++ b/lib/tasks/personal_research_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :personal_research do +# # Task goes here +# end diff --git a/personal_research.gemspec b/personal_research.gemspec new file mode 100644 index 0000000..0a88ec5 --- /dev/null +++ b/personal_research.gemspec @@ -0,0 +1,23 @@ +$:.push File.expand_path("../lib", __FILE__) + +# Maintain your gem's version: +require "personal_research/version" + +# Describe your gem and declare its dependencies: +Gem::Specification.new do |s| + s.name = "personal_research" + s.version = PersonalResearch::VERSION + s.authors = ["RulingDigital"] + s.email = ["service@rulingcom.com"] + s.homepage = "http://www.rulingcom.com" + s.summary = "" + s.description = "Orbit PersonalResearch module" + + s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] + s.test_files = Dir["test/**/*"] + + # s.add_dependency "rails", "~> 3.1.8" + # s.add_dependency "jquery-rails" + + s.add_development_dependency "sqlite3" +end diff --git a/personal_research.json b/personal_research.json new file mode 100644 index 0000000..ea5726b --- /dev/null +++ b/personal_research.json @@ -0,0 +1,12 @@ +{ + "title": "personal_research", + "object": "research", + "version": "0.1", + "organization": "Rulingcom", + "author": "RD dep", + "intro": "A simple blog……", + "update_info": "Some info", + "create_date": "09-05-2012", + "enable_frontend": true, + "has_plugin": true +} diff --git a/script/rails b/script/rails new file mode 100644 index 0000000..23bd81f --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby.exe +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +ENGINE_PATH = File.expand_path('../..', __FILE__) +load File.expand_path('../../test/dummy/script/rails', __FILE__) diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile new file mode 100644 index 0000000..3645852 --- /dev/null +++ b/test/dummy/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Dummy::Application.load_tasks diff --git a/test/dummy/app/assets/javascripts/application.js b/test/dummy/app/assets/javascripts/application.js new file mode 100644 index 0000000..37c7bfc --- /dev/null +++ b/test/dummy/app/assets/javascripts/application.js @@ -0,0 +1,9 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/test/dummy/app/assets/stylesheets/application.css b/test/dummy/app/assets/stylesheets/application.css new file mode 100644 index 0000000..fc25b57 --- /dev/null +++ b/test/dummy/app/assets/stylesheets/application.css @@ -0,0 +1,7 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at + * the top of the compiled file, but it's generally better to create a new file per style scope. + *= require_self + *= require_tree . +*/ \ No newline at end of file diff --git a/test/dummy/app/controllers/application_controller.rb b/test/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000..e8065d9 --- /dev/null +++ b/test/dummy/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery +end diff --git a/test/dummy/app/helpers/application_helper.rb b/test/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/test/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/test/dummy/app/mailers/.gitkeep b/test/dummy/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/models/.gitkeep b/test/dummy/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/views/layouts/application.html.erb b/test/dummy/app/views/layouts/application.html.erb new file mode 100644 index 0000000..9a8a761 --- /dev/null +++ b/test/dummy/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Dummy + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/test/dummy/config.ru b/test/dummy/config.ru new file mode 100644 index 0000000..1989ed8 --- /dev/null +++ b/test/dummy/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Dummy::Application diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb new file mode 100644 index 0000000..cb910b0 --- /dev/null +++ b/test/dummy/config/application.rb @@ -0,0 +1,45 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +Bundler.require +require "personal_research" + +module Dummy + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end + diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb new file mode 100644 index 0000000..eba0681 --- /dev/null +++ b/test/dummy/config/boot.rb @@ -0,0 +1,10 @@ +require 'rubygems' +gemfile = File.expand_path('../../../../Gemfile', __FILE__) + +if File.exist?(gemfile) + ENV['BUNDLE_GEMFILE'] = gemfile + require 'bundler' + Bundler.setup +end + +$:.unshift File.expand_path('../../../../lib', __FILE__) \ No newline at end of file diff --git a/test/dummy/config/database.yml b/test/dummy/config/database.yml new file mode 100644 index 0000000..51a4dd4 --- /dev/null +++ b/test/dummy/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +development: + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: sqlite3 + database: db/test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + database: db/production.sqlite3 + pool: 5 + timeout: 5000 diff --git a/test/dummy/config/environment.rb b/test/dummy/config/environment.rb new file mode 100644 index 0000000..3da5eb9 --- /dev/null +++ b/test/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Dummy::Application.initialize! diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb new file mode 100644 index 0000000..95a50b9 --- /dev/null +++ b/test/dummy/config/environments/development.rb @@ -0,0 +1,30 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb new file mode 100644 index 0000000..ca2c588 --- /dev/null +++ b/test/dummy/config/environments/production.rb @@ -0,0 +1,60 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to Rails.root.join("public/assets") + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify +end diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb new file mode 100644 index 0000000..6810c91 --- /dev/null +++ b/test/dummy/config/environments/test.rb @@ -0,0 +1,39 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/test/dummy/config/initializers/backtrace_silencers.rb b/test/dummy/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/test/dummy/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/test/dummy/config/initializers/inflections.rb b/test/dummy/config/initializers/inflections.rb new file mode 100644 index 0000000..9e8b013 --- /dev/null +++ b/test/dummy/config/initializers/inflections.rb @@ -0,0 +1,10 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end diff --git a/test/dummy/config/initializers/mime_types.rb b/test/dummy/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/test/dummy/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/test/dummy/config/initializers/secret_token.rb b/test/dummy/config/initializers/secret_token.rb new file mode 100644 index 0000000..179d0b9 --- /dev/null +++ b/test/dummy/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Dummy::Application.config.secret_token = 'b792c5762056bbba452d7add125e012a983c701a8e3b32948c92bace3ce28f72ccb6af53d34b057d11193cf59678ed8e017a033b8329a40468b20ba6341a439b' diff --git a/test/dummy/config/initializers/session_store.rb b/test/dummy/config/initializers/session_store.rb new file mode 100644 index 0000000..952473f --- /dev/null +++ b/test/dummy/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# Dummy::Application.config.session_store :active_record_store diff --git a/test/dummy/config/initializers/wrap_parameters.rb b/test/dummy/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..999df20 --- /dev/null +++ b/test/dummy/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/test/dummy/config/locales/en.yml b/test/dummy/config/locales/en.yml new file mode 100644 index 0000000..179c14c --- /dev/null +++ b/test/dummy/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb new file mode 100644 index 0000000..bb509f2 --- /dev/null +++ b/test/dummy/config/routes.rb @@ -0,0 +1,58 @@ +Dummy::Application.routes.draw do + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end diff --git a/test/dummy/lib/assets/.gitkeep b/test/dummy/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/log/.gitkeep b/test/dummy/log/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/public/404.html b/test/dummy/public/404.html new file mode 100644 index 0000000..9a48320 --- /dev/null +++ b/test/dummy/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/test/dummy/public/422.html b/test/dummy/public/422.html new file mode 100644 index 0000000..83660ab --- /dev/null +++ b/test/dummy/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/test/dummy/public/500.html b/test/dummy/public/500.html new file mode 100644 index 0000000..b80307f --- /dev/null +++ b/test/dummy/public/500.html @@ -0,0 +1,26 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+

We've been notified about this issue and we'll take a look at it shortly.

+
+ + diff --git a/test/dummy/public/favicon.ico b/test/dummy/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/script/rails b/test/dummy/script/rails new file mode 100644 index 0000000..81eab02 --- /dev/null +++ b/test/dummy/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby.exe +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/test/integration/navigation_test.rb b/test/integration/navigation_test.rb new file mode 100644 index 0000000..97a94c9 --- /dev/null +++ b/test/integration/navigation_test.rb @@ -0,0 +1,10 @@ +require 'test_helper' + +class NavigationTest < ActionDispatch::IntegrationTest + fixtures :all + + # test "the truth" do + # assert true + # end +end + diff --git a/test/personal_research_test.rb b/test/personal_research_test.rb new file mode 100644 index 0000000..7248443 --- /dev/null +++ b/test/personal_research_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PersonalResearchTest < ActiveSupport::TestCase + test "truth" do + assert_kind_of Module, PersonalResearch + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..dcd3b27 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,10 @@ +# Configure Rails Environment +ENV["RAILS_ENV"] = "test" + +require File.expand_path("../dummy/config/environment.rb", __FILE__) +require "rails/test_help" + +Rails.backtrace_cleaner.remove_silencers! + +# Load support files +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }