diff --git a/Gemfile.lock b/Gemfile.lock index b104ef3e..e8f070d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,7 +91,6 @@ GEM execjs coffee-script-source (1.4.0) columnize (0.3.6) - curb (0.8.3) database_cleaner (0.9.1) debug_inspector (0.0.2) debugger (1.2.4) @@ -128,13 +127,6 @@ GEM multi_json (>= 1.3) rack-oauth2 (>= 0.14.4) tzinfo - feedzirra (0.0.24) - activesupport (>= 2.3.8) - builder (>= 2.1.2) - curb (>= 0.2.3) - loofah (>= 0.3.1) - nokogiri (> 0.0.0) - sax-machine (>= 0.0.12) ffi (1.4.0) haml (3.1.8) highline (1.6.15) @@ -149,8 +141,6 @@ GEM jquery-rails railties (>= 3.1.0) json (1.7.7) - loofah (1.2.1) - nokogiri (>= 1.4.4) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -285,10 +275,8 @@ GEM railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - sax-machine (0.1.0) - nokogiri (> 0.0.0) - select2-rails (3.3.0) - sass-rails (~> 3.2) + select2-rails (3.3.1) + sass-rails (>= 3.2) thor (~> 0.14) selenium-webdriver (2.30.0) childprocess (>= 0.2.5) @@ -368,7 +356,6 @@ DEPENDENCIES factory_girl_rails faker fb_graph - feedzirra impressionist! jquery-rails (= 2.1.4) jquery-ui-rails @@ -400,7 +387,7 @@ DEPENDENCIES rspec-rails (~> 2.0) rubyzip sass-rails - select2-rails + select2-rails (= 3.3.1) shoulda-matchers simplecov sinatra diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index a216b8a2..7ab2a07c 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -378,8 +378,8 @@ var orbitDesktop = function(dom){ }; this.layout_data = function(h){ - var $e; - var column_container,layout, base_width, total_width, gutter, no_of_entries = 0, pagination_link, pagination_variable; + var $e; + var column_container,layout, base_width , no_of_entries = 0, pagination_link , pagination_variable, gutter, total_width; o.paging = true; gutter = (!isNaN(gutter)) ? gutter : 12; this.layout_data.generate_layout_html = function(l){ @@ -393,6 +393,7 @@ var orbitDesktop = function(dom){ case "simple": total_columns++; temp_div.append(column_container.html()); + total_width = "auto"; break; case "datalist": no_of_entries = (typeof column_container.attr("per-column") != "undefined"? parseInt(column_container.attr("per-column")) : 4); @@ -411,7 +412,10 @@ var orbitDesktop = function(dom){ x = 0; temp_div.append(column); } - }); + }) + if(x != 0){ + temp_div.append(column); + } } total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null; break; @@ -419,17 +423,16 @@ var orbitDesktop = function(dom){ entries = column_container.find("div[column=true]"),x = 0,column; if(entries.length!=0){ entries.each(function(i,ul){ - column = $("
'); var $ul = $(''); $.each(tiles,function(i,tile){ - if(row >= 4){ - row = 1; - col++; - } var shape = tile.shape.split(" "); - x = parseInt(shape[0].substr(1,1)); - y = parseInt(shape[1].substr(1,1)); + // if(tile.title == "Weather")console.log("Big - row : " + tile.row + ", col : "+ tile.column); + // if(tile.title == "Google Scholar")console.log("Scholar - row : " + tile.row + ", col : "+ tile.column); + + // if(total_x % 2 != 0) + // row = row - y; + // if(i == 7)tile.row = null; + if(tile.row){ + row = tile.row; + col = tile.column; + x = parseInt(shape[0].substr(1,1)); + y = parseInt(shape[1].substr(1,1)); + }else{ + console.log(row + " : " + col); + x = parseInt(shape[0].substr(1,1)); + if(total_x % 2 == 0){ + row = row + y; + }else if(x == 1){ + col++; + } + y = parseInt(shape[1].substr(1,1)); + total_x = total_x + ( x * y ); + prev_y = y; + if(total_x > 8){ + row = 1; + total_x = 0; + col++; + } + } var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)]; var op = opacity[Math.floor(Math.random()*opacity.length)]; var f = (tile.fullsize?"fullsize":null); if(tile.data_category == "app") $li = $('
  • '+tile.title+'

  • '); - else - $li = $('
  • Loading

    '+tile.title+'

  • '); + else + $li = $('
  • Loading

    '+tile.title+'

  • '); - row = row + y; + $ul.append($li); }) diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index e61de791..0af95621 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -141,7 +141,9 @@ class DesktopController< ApplicationController link = "http://www.wikibooks.org" end end - gr << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"title"=>title,"fullsize"=>fullsize,"link"=>link} + gr << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"row"=>tile.row,"column"=>tile.column, "title"=>title,"fullsize"=>fullsize,"link"=>link} + + end # gr << a end @@ -194,29 +196,36 @@ class DesktopController< ApplicationController end def newpositions - @newpositions = params["newpos"] - @section = Section.find(params["sectionid"]) - @groupids = params["groupids"] - @groups = @section.groups - z = 0 - @newpositions.each do |grp| - x = 1 - grp.each do |tileid| - if x != 1 - y = 1 - tileid.each do |id| - @tile = Tile.find(id) - @tile.update_attributes({:position => y}) - if @tile.group_id != @groupids[z] - @tile.update_attributes({:group_id => @groupids[z]}) - end - y = y + 1 - end - z = z + 1 - end - x = x + 1 - end + @newpositions = params[:newpositions] + + @newpositions.each do |t| + @this_tile = t.last + @tile = Tile.find(@this_tile['id']) + @tile.update_attributes({:row => @this_tile['row'],:column => @this_tile['col']}) end + # @newpositions = params["newpos"] + # @section = Section.find(params["sectionid"]) + # @groupids = params["groupids"] + # @groups = @section.groups + # z = 0 + # @newpositions.each do |grp| + # x = 1 + # grp.each do |tileid| + # if x != 1 + # y = 1 + # tileid.each do |id| + # @tile = Tile.find(id) + # @tile.update_attributes({:position => y}) + # if @tile.group_id != @groupids[z] + # @tile.update_attributes({:group_id => @groupids[z]}) + # end + # y = y + 1 + # end + # z = z + 1 + # end + # x = x + 1 + # end + # end b = Array.new b << {"success"=>"true"} render :json=>b.to_json diff --git a/app/models/desktop/tile.rb b/app/models/desktop/tile.rb index 1da1dedc..13748a04 100644 --- a/app/models/desktop/tile.rb +++ b/app/models/desktop/tile.rb @@ -5,6 +5,8 @@ class Tile field :data_category field :data_content field :position, type: Integer + field :row, type: Integer + field :column, type: Integer field :shape field :fullsize, type: Boolean field :title diff --git a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb index a3a688fc..a6009ea6 100644 --- a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb +++ b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb @@ -6,13 +6,13 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr page = params[:page] page ||= 1 + @per_column = 5 + case @view_by when "abstract" @per_column = 1 when "file" @per_column = 2 - else - @per_column = 4 end if @view_by.nil?