diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 33217d25..948b88bb 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -12,7 +12,8 @@ //confirm-message ="Some message", this will prompt user with a confirm box and show the message before ajax call is made. //"toggle-onclick" = "classes to get toggle" this will toggle classes on toggle when a tags are clicked. //"delete-item" = "true" this will remove its respective item from the list. - +//"pagination-link" = "url" this url will be used for pagination.. this will override last link url. +//"pagination-var" = "variable to send paramater with url for pagination" this will enable pagination with this attribute for that view. //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 @@ -335,7 +336,7 @@ var orbitDesktop = function(dom){ var w = (!isNaN(base_width) ? base_width * total_columns : null); return {"markup":temp_div.html(),"width":w,"total":entries.length}; } - $("div[container=true]").html(h).find("div.overview").wrap('
'); + $("div[container=true]").html(h).find("div.overview").wrap('
'); $("div[container=true]").find("div.tinycanvas").prepend('
'); var f = o.layout_data.generate_layout_html(h) $("div[container=true] div.overview").html(f.markup); @@ -920,59 +921,94 @@ var orbitDesktop = function(dom){ this.initializeSectionsManager = function(target,url,cache){ // this is init function for section manager var elementParent,element,slabel; var bindHandlers = function(){ // this is bind handler for section manager page - var groupWrapperWidth = 0; - $("div#sections .group").width(400); - $("div#sections .group").each(function(){groupWrapperWidth+=$(this).width();}) + var groupWrapperWidth = 0; + $("div#sections .group").each(function(){groupWrapperWidth+=$(this).width();}) groupWrapperWidth+=200; - groupWrapperHeight = $(".group").height() + 20; - $("#group_wrapper").width(groupWrapperWidth); - $("div#sections #group_wrapper .grp").sortable({ - start:function(){ - slabel = $(this).siblings('.section_label'); - slabel.find('li:hidden').stop(1,1).fadeIn(500); - }, - stop:function(){ - slabel.find('li:not(:nth-child(1))').stop(1,1).fadeOut(500); - } - }); - $("div#sections .section_label li:not(:nth-child(1))").droppable({ - drop:function(event, ui){ - elementParent = ui.draggable.parents('.group'); - var $item = $( this ), - $list = $( '#'+$item.data("category") ); + groupWrapperHeight = $(".group").height() + 20; + $("#group_wrapper").width(groupWrapperWidth); - if($list.children('.element').length>=24){ - o.notify("Section is full.","alert"); - } - else{ - ui.draggable.hide('fast',function(){ - $(this).appendTo($list).fadeIn(); + var sortingoptions = { + start:function(){ + slabel = $(this).parent().siblings('.section_label'); + slabel.find('li:hidden').stop(1,1).fadeIn(500); + }, + stop:function(){ + slabel.find('li:not(:nth-child(1))').stop(1,1).fadeOut(500); + } + } + $("div#sections #group_wrapper .appgroup").sortable(sortingoptions); + + $("div#sections .section_label li:not(:nth-child(1))").droppable({ + drop:function(event, ui){ + elementParent = ui.draggable.parents('.group'); + elementParentUl = ui.draggable.parents(".appgroup"); + var $item = $( this ), + $list = $( '#'+$item.data("category") ); + if($list.children('.element').length>=24){ + o.notify("Section is full.","alert"); + }else{ + ui.draggable.hide('fast',function(){ + var newul = false; + if($list.find("ul").length == 0){ + $list.append(('')); + newul = true; + }else if($list.find("ul:eq(0) li").length == 7){ + $list.append(('')); + newul = true; + } + $(this).appendTo($list.find("ul:last")).fadeIn(); + var next_group = elementParent.find(".grp ul").eq(elementParentUl.index() + 1); + if(elementParentUl.index() == 0){ + if(elementParentUl.find("li").length < 7){ + + var element_to_shift = next_group.find("li").eq(0); + if(element_to_shift.length != 0){ + elementParentUl.append(element_to_shift); + } + } + } + + if(next_group.find("li").length == 0){ + next_group.remove(); + } + if(elementParentUl.find("li").length == 0){ + elementParentUl.remove(); + } + + if(elementParent.find(".grp ul").length == 0){ + elementParent.find(".grp").addClass("no_app"); + }else{ + elementParent.find(".grp").removeClass("no_app"); + } + + if(newul){ + $("div#sections #group_wrapper .appgroup").sortable(sortingoptions); + $list.removeClass("no_app"); + } + }); + + $.post("/desktop/save_desktop_settings",{"save":"appnewsection","appid":ui.draggable.attr("id"),"newsectionid":$(this).data("content"),"desktopid":o.desktopId}); + if(o.sectionId == $(this).data("content") || o.sectionId == elementParent.attr("id")){ + o.desktopData["home"]=""; + } + } + $(this).find('span.tile').addClass('op06',400); + }, + over:function(){ + $(this).find('span.tile').removeClass('op06'); + }, + out:function(){ + $(this).find('span.tile').addClass('op06'); + }, + accept: '.to_drop' }); - $.post("/desktop/save_desktop_settings",{"save":"appnewsection","appid":ui.draggable.attr("id"),"newsectionid":$(this).data("content"),"desktopid":o.desktopId}); - if(o.sectionId == $(this).data("content") || o.sectionId == elementParent.attr("id")){ - o.desktopData["home"]=""; - } - } - $(this).find('span.tile').addClass('op06',400); - }, - over:function(){ - $(this).find('span.tile').removeClass('op06'); - }, - out:function(){ - $(this).find('span.tile').addClass('op06'); - }, - accept: '.to_drop' - }); - - - }; var loadApps = function(){ // this loads apps from db to in each sections $.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){ var $group,$lii,$li; var z=0; for(section in o.sectionList){ - $group = $('
'); + $group = $('
'); for(x=0;x<4;x++){ if(x==0){ $li = $('
  • '+o.sectionList[z].name+'
  • '); @@ -987,19 +1023,27 @@ var orbitDesktop = function(dom){ $("div#group_wrapper").append($group); } - var yy=1,y=0; - $.each(appss,function(i,apps){ - $.each(apps,function(i,app){ - $li = $('
  • '+app.title+'

  • '); - - $("ul#section"+yy).append($li); + var x = 0; + $.each(appss,function(i,apps){ + x = 0; + $.each(apps,function(y,app){ + x++; + if(x == 1){ + $ul = $(''); + } + $li = $('
  • '+app.title+'

  • '); + $ul.append($li); + if(x == 7){ + $("div#group_wrapper div#section"+(i+1)).append($ul); + $("div#group_wrapper div#section"+(i+1)).removeClass("no_app") + x = 0; + } }) - if(y==1){ - y=-1; - yy++; + if(x != 0){ + $("div#group_wrapper div#section"+(i+1)).append($ul); + $("div#group_wrapper div#section"+(i+1)).removeClass("no_app") } - y++; }) bindHandlers(); }) diff --git a/app/assets/stylesheets/desktop/desktop-main.css b/app/assets/stylesheets/desktop/desktop-main.css index 485667a4..7517a3c3 100644 --- a/app/assets/stylesheets/desktop/desktop-main.css +++ b/app/assets/stylesheets/desktop/desktop-main.css @@ -442,7 +442,8 @@ a:focus { outline: none; } #group_wrapper {} -.grp { height:528px; } +.grp { height:528px; float: left; } +.appgroup { float: left;} .g_col { height: 516px; float: left; diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb index 37230db8..b14a54eb 100644 --- a/app/views/desktop/index.html.erb +++ b/app/views/desktop/index.html.erb @@ -4,7 +4,7 @@
  • Home
  • diff --git a/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js b/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js index a60201e0..7c6e46e5 100644 --- a/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js +++ b/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js @@ -211,7 +211,8 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){ this.initializeConferencePapers.coauthorRelationEditForm = function(data){ if(data.success){ o.notify(data.msg,"success"); - $("#co_author_relation_table").html(data.newvalue); + var x = o.layout_data.generate_layout_html(data.newvalue); + $("div[container=true] div.overview").html(x.markup); }else{ o.notify(data.msg,"alert"); } diff --git a/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_author_relations_controller.rb b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_author_relations_controller.rb index 62ad9fa7..696cc490 100644 --- a/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_author_relations_controller.rb +++ b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_author_relations_controller.rb @@ -40,6 +40,7 @@ class Panel::PersonalConference::Desktop::ConferenceCoAuthorRelationsController if @conference_co_author_relation.update_attributes(params[:conference_co_author_relation]) @conference_co_author_relations = ConferenceCoAuthorRelation.all newv = render_to_string partial: "show_form", object: @conference_co_author_relations + newv = '
    ' + newv + '
    ' render json: {success: true, msg: t('update_success'), newvalue: newv}.to_json else error_msg = @conference_co_author.errors.full_messages.join("
    ")