From 1d0ea6718f7a0ae5885bf96f6276ee6f95a63b15 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 25 Sep 2013 18:11:02 +0800 Subject: [PATCH] brief added to desktop for all plugins --- .../javascripts/ckeditor/jquery-ckeditor.js | 10 ++++ app/assets/javascripts/desktop/desktop.js | 3 ++ .../javascripts/desktop/orbitdesktop.js | 31 +++++++---- app/controllers/desktop_controller.rb | 1 + app/views/desktop/index.html.erb | 2 +- .../personal_book/desktop/personal_books.js | 8 ++- .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../personal_books/books_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_book/config/routes.rb | 2 + .../desktop/conference_pages.js | 7 +++ .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../desktop/conference_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_conference/config/routes.rb | 1 + .../desktop/personal_diploma.js | 8 ++- .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../personal_diplomas/diploma_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_diploma/config/routes.rb | 1 + .../desktop/personal_experiences.js | 8 ++- .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../experience_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_experience/config/routes.rb | 1 + .../personal_honor/desktop/personal_honors.js | 9 +++- .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../personal_honors/honors_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_honor/config/routes.rb | 1 + .../personal_journal/desktop/journal_pages.js | 20 +++---- .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../desktop/journal_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_journal/config/routes.rb | 1 + .../personal_lab/desktop/personal_lab.js | 8 ++- .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../desktop/personal_labs/lab_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_lab/config/routes.rb | 1 + .../desktop/personal_patent.js | 8 +++ .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../personal_patents/patent_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_patent/config/routes.rb | 1 + .../desktop/personal_project.js | 8 ++- .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../personal_projects/project_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_project/config/routes.rb | 1 + .../desktop/personal_research.js | 8 +++ .../desktop/plugin_intros_controller.rb | 32 +++++++++++ .../research_window.html.erb | 1 + .../desktop/plugin_intros/_form.html.erb | 54 +++++++++++++++++++ .../desktop/plugin_intros/edit.html.erb | 3 ++ .../desktop/plugin_intros/new.html.erb | 3 ++ .../personal_research/config/routes.rb | 1 + 75 files changed, 1055 insertions(+), 25 deletions(-) create mode 100644 app/assets/javascripts/ckeditor/jquery-ckeditor.js create mode 100644 vendor/built_in_modules/personal_book/app/controllers/panel/personal_book/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_diploma/app/controllers/panel/personal_diploma/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_diploma/app/views/panel/personal_diploma/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_diploma/app/views/panel/personal_diploma/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_diploma/app/views/panel/personal_diploma/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_experience/app/controllers/panel/personal_experience/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_experience/app/views/panel/personal_experience/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_experience/app/views/panel/personal_experience/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_experience/app/views/panel/personal_experience/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_honor/app/controllers/panel/personal_honor/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_honor/app/views/panel/personal_honor/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_honor/app/views/panel/personal_honor/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_honor/app/views/panel/personal_honor/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_lab/app/controllers/panel/personal_lab/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app/controllers/panel/personal_patent/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_patent/app/views/panel/personal_patent/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app/views/panel/personal_patent/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_patent/app/views/panel/personal_patent/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_project/app/controllers/panel/personal_project/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/plugin_intros/new.html.erb create mode 100644 vendor/built_in_modules/personal_research/app/controllers/panel/personal_research/desktop/plugin_intros_controller.rb create mode 100644 vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/plugin_intros/_form.html.erb create mode 100644 vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/plugin_intros/edit.html.erb create mode 100644 vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/plugin_intros/new.html.erb diff --git a/app/assets/javascripts/ckeditor/jquery-ckeditor.js b/app/assets/javascripts/ckeditor/jquery-ckeditor.js new file mode 100644 index 00000000..cb329a15 --- /dev/null +++ b/app/assets/javascripts/ckeditor/jquery-ckeditor.js @@ -0,0 +1,10 @@ +/* + Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +(function(a){CKEDITOR.config.jqueryOverrideVal="undefined"==typeof CKEDITOR.config.jqueryOverrideVal?!0:CKEDITOR.config.jqueryOverrideVal;"undefined"!=typeof a&&(a.extend(a.fn,{ckeditorGet:function(){var a=this.eq(0).data("ckeditorInstance");if(!a)throw"CKEditor is not initialized yet, use ckeditor() with a callback.";return a},ckeditor:function(g,d){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if(!a.isFunction(g))var k=d,d=g,g=k;var i=[],d=d||{};this.each(function(){var b= +a(this),c=b.data("ckeditorInstance"),f=b.data("_ckeditorInstanceLock"),h=this,j=new a.Deferred;i.push(j.promise());if(c&&!f)g&&g.apply(c,[this]),j.resolve();else if(f)c.once("instanceReady",function(){setTimeout(function(){c.element?(c.element.$==h&&g&&g.apply(c,[h]),j.resolve()):setTimeout(arguments.callee,100)},0)},null,null,9999);else{if(d.autoUpdateElement||"undefined"==typeof d.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)d.autoUpdateElementJquery=!0;d.autoUpdateElement=!1;b.data("_ckeditorInstanceLock", +!0);c=a(this).is("textarea")?CKEDITOR.replace(h,d):CKEDITOR.inline(h,d);b.data("ckeditorInstance",c);c.on("instanceReady",function(d){var e=d.editor;setTimeout(function(){if(e.element){d.removeListener();e.on("dataReady",function(){b.trigger("dataReady.ckeditor",[e])});e.on("setData",function(a){b.trigger("setData.ckeditor",[e,a.data])});e.on("getData",function(a){b.trigger("getData.ckeditor",[e,a.data])},999);e.on("destroy",function(){b.trigger("destroy.ckeditor",[e])});e.on("save",function(){a(h.form).submit(); +return!1},null,null,20);if(e.config.autoUpdateElementJquery&&b.is("textarea")&&a(h.form).length){var c=function(){b.ckeditor(function(){e.updateElement()})};a(h.form).submit(c);a(h.form).bind("form-pre-serialize",c);b.bind("destroy.ckeditor",function(){a(h.form).unbind("submit",c);a(h.form).unbind("form-pre-serialize",c)})}e.on("destroy",function(){b.removeData("ckeditorInstance")});b.removeData("_ckeditorInstanceLock");b.trigger("instanceReady.ckeditor",[e]);g&&g.apply(e,[h]);j.resolve()}else setTimeout(arguments.callee, +100)},0)},null,null,9999)}});var f=new a.Deferred;this.promise=f.promise();a.when.apply(this,i).then(function(){f.resolve()});this.editor=this.eq(0).data("ckeditorInstance");return this}}),CKEDITOR.config.jqueryOverrideVal&&(a.fn.val=CKEDITOR.tools.override(a.fn.val,function(g){return function(d){if(arguments.length){var k=this,i=[],f=this.each(function(){var b=a(this),c=b.data("ckeditorInstance");if(b.is("textarea")&&c){var f=new a.Deferred;c.setData(d,function(){f.resolve()});i.push(f.promise()); +return!0}return g.call(b,d)});if(i.length){var b=new a.Deferred;a.when.apply(this,i).done(function(){b.resolveWith(k)});return b.promise()}return f}var f=a(this).eq(0),c=f.data("ckeditorInstance");return f.is("textarea")&&c?c.getData():g.call(f)}})))})(window.jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/desktop/desktop.js b/app/assets/javascripts/desktop/desktop.js index 2890d85d..66a8f2c4 100644 --- a/app/assets/javascripts/desktop/desktop.js +++ b/app/assets/javascripts/desktop/desktop.js @@ -19,3 +19,6 @@ //= require select2 //= require jquery.isotope.min.js //= require orbit_js_1.0.1-front-end +//= require ckeditor/init +//= require ckeditor/jquery-ckeditor + diff --git a/app/assets/javascripts/desktop/orbitdesktop.js b/app/assets/javascripts/desktop/orbitdesktop.js index 9b924a31..81579d99 100755 --- a/app/assets/javascripts/desktop/orbitdesktop.js +++ b/app/assets/javascripts/desktop/orbitdesktop.js @@ -20,6 +20,7 @@ //for forms //form-type = "ajax_form" will turn form to ajax submit //notification = string will display after the form is succesfully submitted +//response-type = "json"|"script"|"xml|html" default is json //for layout tinyscrollbar //content-layout="datalist|column|simple" datalist is for data list from database.. column is usually for forms and some other pages.. simple is without any columns, the page will be displayed as it is.. base width will be considered the default width for tinyscrollbar @@ -247,16 +248,12 @@ var orbitDesktop = function(dom){ $("body").on("submit","form[form-type=ajax_form]",function(){ var callback_method = $(this).attr("callback-method"), - dt = null, + dt = ($(this).attr("response-type") == null ? "json" : $(this).attr("response-type")), notification = $(this).attr("notification"); - dt = $(this).attr("response-type"); - if(dt == null){ - dt = "json"; - } var options = { dataType : dt, - resetForm : true, - success:function(responseText, statusText, xhr, $form){ + resetForm : false, + success: function(responseText, statusText, xhr, $form){ if(typeof callback_method != "undefined"){ if(callback_method != ""){ window.o[o.data_method][callback_method](responseText,statusText,xhr,$form); @@ -265,7 +262,7 @@ var orbitDesktop = function(dom){ if(typeof notification == "string") o.notify(notification,"success"); }, - error:function(){ + error: function(){ o.notify("Please try again later!","imp"); } } @@ -451,7 +448,7 @@ var orbitDesktop = function(dom){ var ist = function(){ $('#holder').css('height', $('#container').height() - 72); - $('.tinycanvas').css('height', $('#panel_r').height() - 36); + $('.tinycanvas').css('height', $('#holder').height() - 36); var dom = $("*[isotope=true]").isotope({ layoutMode: 'fitColumns', onLayout: function($elems, instance){ @@ -698,6 +695,15 @@ var orbitDesktop = function(dom){ } }) o.highlight_sub_menu_item(dom); + } else { + o.lastlink = dom.attr("href"); + $.ajax({ + url : dom.attr("href"), + type : "get", + success : function(data){ + o.layout_data(data); + } + }) } if(dom.length == 0) o.layout_data(data); @@ -1868,6 +1874,13 @@ var orbitDesktop = function(dom){ } } } + this.enablelanguageSelect = function(){ + $(".language_select a").click(function(event) { + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); + return false; + }); + } this.minimizeBarManager = function(){ var minimizedApps = [], minimizeBar = $("#minimizebar"); diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index ab5856d1..5be83a8a 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -10,6 +10,7 @@ class DesktopController< ApplicationController def index @desktop = current_user.desktop @currentusername = current_user.name + @currentname = current_user.first_name + current_user.last_name @title = "Desktop - " + @currentusername @section = @desktop.sections.first end diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb index 2290f7d6..9796ade7 100644 --- a/app/views/desktop/index.html.erb +++ b/app/views/desktop/index.html.erb @@ -100,6 +100,6 @@ o.notify("We turn off the animation (javascript) for you, but still you can turn it on",10); } } - o.notify("Welcome "+o.currentUsername+"!!","alert",3); + o.notify("Welcome <%= @currentname %>!!","alert",3); diff --git a/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js b/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js index 739f98cb..08a63fdb 100644 --- a/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js +++ b/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js @@ -84,7 +84,13 @@ orbitDesktop.prototype.initializePersonalBook = function(target,url,cache){ // t uploadFiles(); languageSelect(); } - + this.initializePersonalBook.brief = function(){ + o.enablelanguageSelect(); + $("textarea.editor").ckeditor({ + height: 300, + width: $(".overview").width() - 20 + }); + } this.initializePersonalBook.coAuthorformCallback = function(data){ if(data.success){ diff --git a/vendor/built_in_modules/personal_book/app/controllers/panel/personal_book/desktop/plugin_intros_controller.rb b/vendor/built_in_modules/personal_book/app/controllers/panel/personal_book/desktop/plugin_intros_controller.rb new file mode 100644 index 00000000..aee4700a --- /dev/null +++ b/vendor/built_in_modules/personal_book/app/controllers/panel/personal_book/desktop/plugin_intros_controller.rb @@ -0,0 +1,32 @@ +class Panel::PersonalBook::Desktop::PluginIntrosController < ApplicationController + + def index + @intro = PersonalBookIntro.where(:user_id => current_user.id.to_s).first + if @intro.blank? + @intro = PersonalBookIntro.new + render "new", :layout => false + else + render "edit", :layout => false + end + end + + def create + @intro = PersonalBookIntro.new(params[:personal_book_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 = PersonalBookIntro.find(params[:id]) + if @intro.update_attributes(params[:personal_book_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/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/books_window.html.erb b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/books_window.html.erb index 4f299ab1..137e19da 100644 --- a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/books_window.html.erb +++ b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/books_window.html.erb @@ -17,6 +17,7 @@