From a90eb90822b453064650d1869e687f85bb0d500b Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 16:20:21 -0400 Subject: [PATCH 1/9] small fixes in backbone --- app/assets/javascripts/metamaps/Metamaps.Backbone.js | 6 +++--- app/assets/javascripts/metamaps/Metamaps.Views.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/metamaps/Metamaps.Backbone.js b/app/assets/javascripts/metamaps/Metamaps.Backbone.js index 6b858bda..c85f08c2 100644 --- a/app/assets/javascripts/metamaps/Metamaps.Backbone.js +++ b/app/assets/javascripts/metamaps/Metamaps.Backbone.js @@ -30,7 +30,7 @@ Metamaps.Backbone.Map = Backbone.Model.extend({ name: this.get('name'), desc: this.get('desc'), username: this.getUser().get('name'), - mkPermission: this.get("permission").substring(0, 2), + mkPermission: this.get("permission") ? this.get("permission").substring(0, 2) : "commons", editPermission: this.authorizeToEdit(Metamaps.Active.Mapper) ? 'canEdit' : 'cannotEdit', topicCount: this.getTopics().length, synapseCount: this.getSynapses().length, @@ -52,8 +52,8 @@ Metamaps.Backbone.MapsCollection = Backbone.Collection.extend({ a = a.get(this.sortBy); b = b.get(this.sortBy); if (this.sortBy === 'name') { - a = a.toLowerCase(); - b = b.toLowerCase(); + a = a ? a.toLowerCase() : ""; + b = b ? b.toLowerCase() : ""; } return a > b ? 1 : a < b ? -1 : 0; }, diff --git a/app/assets/javascripts/metamaps/Metamaps.Views.js b/app/assets/javascripts/metamaps/Metamaps.Views.js index 91588f33..fc4da130 100644 --- a/app/assets/javascripts/metamaps/Metamaps.Views.js +++ b/app/assets/javascripts/metamaps/Metamaps.Views.js @@ -46,6 +46,9 @@ Metamaps.Views.init = function () { this.listenTo(this.collection, 'errorOnFetch', this.handleError); }, render: function () { + + Metamaps.Loading.loader.hide(); + var that = this; this.$el.empty(); @@ -56,7 +59,6 @@ Metamaps.Views.init = function () { }); }, handleSuccess: function () { - Metamaps.Loading.loader.hide(); this.render(); }, handleError: function () { From 341f9b9bdd3a70f8584a9860ac6ac4deb87b542b Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 19:13:25 -0400 Subject: [PATCH 2/9] home page styling --- .../javascripts/metamaps/Metamaps.Router.js | 16 ++- app/assets/javascripts/src/main.js | 50 ++++++++ app/assets/stylesheets/clean.css | 61 +++++++++- app/views/layouts/application.html.erb | 2 +- app/views/main/home.html.erb | 111 ++++-------------- app/views/main/requestinvite.html.erb | 3 +- config/application.rb | 2 + 7 files changed, 146 insertions(+), 99 deletions(-) diff --git a/app/assets/javascripts/metamaps/Metamaps.Router.js b/app/assets/javascripts/metamaps/Metamaps.Router.js index 30cbe567..d40666c1 100644 --- a/app/assets/javascripts/metamaps/Metamaps.Router.js +++ b/app/assets/javascripts/metamaps/Metamaps.Router.js @@ -22,10 +22,12 @@ // all this only for the logged in home page if (Metamaps.Active.Mapper) { + + Metamaps.Famous.yield.hide(); + Metamaps.Famous.explore.set('mine'); Metamaps.Famous.explore.show(); - $('.yield').fadeOut(300); $('.mapsWrapper').fadeIn(300); Metamaps.GlobalUI.Search.open(); @@ -41,12 +43,14 @@ } // logged out home page else { + + Metamaps.Famous.yield.show(); + Metamaps.Famous.explore.hide(); Metamaps.GlobalUI.Search.unlock(); Metamaps.GlobalUI.Search.close(0, true); - $('.yield').fadeIn(300); $('.mapsWrapper').fadeOut(300); } @@ -79,8 +83,9 @@ Metamaps.GlobalUI.Search.open(); Metamaps.GlobalUI.Search.lock(); - - $('.yield').fadeOut(300); + + Metamaps.Famous.yield.hide(); + $('.mapsWrapper').fadeIn(300); Metamaps.Famous.explore.set(section); @@ -103,9 +108,8 @@ $('.wrapper').removeClass('homePage explorePage'); $('.wrapper').addClass('mapPage'); - $('.yield').fadeOut(300); + Metamaps.Famous.yield.hide(); $('.mapsWrapper').fadeOut(300); - Metamaps.Famous.explore.hide(); // clear the visualization, if there was one, before showing its div again diff --git a/app/assets/javascripts/src/main.js b/app/assets/javascripts/src/main.js index b3f7c6b8..05f5e160 100644 --- a/app/assets/javascripts/src/main.js +++ b/app/assets/javascripts/src/main.js @@ -56,6 +56,56 @@ define(function(require, exports, module) { }; f.mainContext.add(f.viz.mod).add(f.viz.surf); + + // CONTENT / OTHER PAGES + f.yield = {}; + f.yield.surf = new Surface({ + size: [true, true], + classes: [], + properties: { + display: 'none' + } + }); + var loadYield = function () { + f.loadYield(); + f.yield.surf.removeListener('deploy',loadYield); + }; + if (!(Metamaps.currentSection === "map" || + Metamaps.currentSection === "explore" || + (Metamaps.currentSection === "" && Metamaps.Active.Mapper) )) { + f.yield.surf.on('deploy', loadYield); + } + f.yield.mod = new Modifier({ + origin: [0.5, 0.5], + opacity: 0 + }); + f.yield.show = function () { + f.yield.surf.setProperties({ "display":"block" }); + f.yield.mod.setOpacity( + 1, + { duration: 300 } + ); + }; + f.yield.hide = function () { + f.yield.mod.setOpacity( + 0, + { duration: 300 }, + function() { + f.yield.surf.setProperties({"display": "none"}); + } + ); + }; + f.mainContext.add(f.yield.mod).add(f.yield.surf); + + f.loadYield = function () { + Metamaps.Loading.loader.hide(); + var yield = document.getElementById('yield').innerHTML; + f.yield.surf.setContent(yield); + f.yield.surf.deploy(f.yield.surf._currTarget); + f.yield.show(); + }; + + // EXPLORE MAPS BAR f.explore = {}; f.explore.surf = new Surface({ diff --git a/app/assets/stylesheets/clean.css b/app/assets/stylesheets/clean.css index d46a1d4e..ea67b21b 100644 --- a/app/assets/stylesheets/clean.css +++ b/app/assets/stylesheets/clean.css @@ -22,7 +22,7 @@ margin:0; } -.yield { +#yield { display:none; } @@ -485,6 +485,65 @@ /* end upperRightUI */ + +/* homepage */ + +.homeWrapper { + width: 560px; + margin: 0 auto; + color: #424242; +} + +.homeTitle { + font-size: 48px; + line-height: 48px; + text-align: center; + margin-bottom: 20px; +} + +.homeIntro { + font-size: 23px; + line-height: 26px; + text-align: justify; + margin-bottom: 20px; +} + +.homeWrapper .green { + color: #4fc059; +} + +.homeVideo { + margin-bottom: 20px; +} + +.callToAction a { + display: block; + width: 220px; + height: 12px; + padding: 16px 0; + text-align: center; + border-radius: 2px; + font-size: 12px; + box-shadow: 0px 1px 1.5px rgba(0,0,0,0.12), 0 1px 1px rgba(0,0,0,0.24); + margin: 0 auto; + color: #FFFFFF; +} +.callToAction .requestInviteCTA { + background-color: #4fc059; + margin-bottom: 15px; +} +.callToAction .requestInviteCTA:hover { + background-color: #49ad4e; +} +.callToAction .exploreFeaturedCTA { + background-color: #a354cd; +} +.callToAction .exploreFeaturedCTA:hover { + background-color: #9150bc; +} + +/* end home page */ + /* infoAndHelp */ .infoAndHelp { diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 7099fce3..dda7faf1 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -61,7 +61,7 @@ <%= render :partial => 'layouts/upperelements' %> <%= render :partial => 'layouts/exploremaps' %> -
<%= yield %>
+ <%= yield %>
diff --git a/app/views/main/home.html.erb b/app/views/main/home.html.erb index 95b0a7d2..993edbc2 100644 --- a/app/views/main/home.html.erb +++ b/app/views/main/home.html.erb @@ -5,100 +5,31 @@ #%> <% if !authenticated? %> - -<% content_for :title, "Home | Metamaps" %> - -
- Image 01 -
- -
- -
-
-
- Welcome to Metamaps -
- - -
- a home on the web for -
    -
  • building shared knowledge
  • -
  • learning
  • -
  • visioning
  • -
  • conversing
  • -
  • collaborating
  • -
  • sensemaking
  • -
  • innovating
  • -
  • designing
  • -
  • playing
  • -
  • exploring
  • -
-
-
-
-
- -

- Request Invite - Explore Featured -

- explore featured maps from our community -
-

- -
-
-
- <% @maps.each_with_index do |map, index| %> - <% first = index == 0 ? true : false %> - <%= render :partial => 'main/homemap', :locals => { :map => map, :first => first } %> - <% end %> -
-
-
-
-
-
- - - + <% content_for :title, "Home | Metamaps" %> +
+
+
EXPERIENCE METAMAPS
+
+ metamaps.cc is a free and open source platform. It enables individuals, communities, and organizations to build and visualize their shared knowledge and unlock their collective intelligence... +
+ + +
+
+ <% elsif authenticated? %> - <% content_for :title, "My Maps | Metamaps" %> - - + <% end %> \ No newline at end of file diff --git a/app/views/main/requestinvite.html.erb b/app/views/main/requestinvite.html.erb index b7f0841a..4f0f2b18 100644 --- a/app/views/main/requestinvite.html.erb +++ b/app/views/main/requestinvite.html.erb @@ -6,11 +6,12 @@ <% content_for :title, "Request Invite | Metamaps" %> +
+
diff --git a/config/application.rb b/config/application.rb index c87ef5b7..d84d0c62 100644 --- a/config/application.rb +++ b/config/application.rb @@ -53,6 +53,8 @@ module Metamaps # Enable the asset pipeline config.assets.enabled = true config.assets.initialize_on_precompile = false + + config.assets.paths << "#{Rails.root}/app/assets/javascripts/src" # Version of your assets, change this if you want to expire all your assets config.assets.version = '2.0' From afed3657c205063e440a146a3f655da33c3ac7e8 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 19:15:01 -0400 Subject: [PATCH 3/9] removed vendor plugins --- .../assets/images/ui-bg_flat_0_aaaaaa_40x100.png | Bin .../assets/images/ui-bg_flat_75_ffffff_40x100.png | Bin .../assets/images/ui-bg_glass_55_fbf9ee_1x400.png | Bin .../assets/images/ui-bg_glass_65_ffffff_1x400.png | Bin .../assets/images/ui-bg_glass_75_dadada_1x400.png | Bin .../assets/images/ui-bg_glass_75_e6e6e6_1x400.png | Bin .../assets/images/ui-bg_glass_95_fef1ec_1x400.png | Bin .../images/ui-bg_highlight-soft_75_cccccc_1x100.png | Bin .../assets/images/ui-icons_222222_256x240.png | Bin .../assets/images/ui-icons_2e83ff_256x240.png | Bin .../assets/images/ui-icons_454545_256x240.png | Bin .../assets/images/ui-icons_888888_256x240.png | Bin .../assets/images/ui-icons_cd0a0a_256x240.png | Bin vendor/assets/javascripts/.gitkeep | 0 vendor/assets/stylesheets/.gitkeep | 0 vendor/plugins/.gitkeep | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename {vendor => app}/assets/images/ui-bg_flat_0_aaaaaa_40x100.png (100%) rename {vendor => app}/assets/images/ui-bg_flat_75_ffffff_40x100.png (100%) rename {vendor => app}/assets/images/ui-bg_glass_55_fbf9ee_1x400.png (100%) rename {vendor => app}/assets/images/ui-bg_glass_65_ffffff_1x400.png (100%) rename {vendor => app}/assets/images/ui-bg_glass_75_dadada_1x400.png (100%) rename {vendor => app}/assets/images/ui-bg_glass_75_e6e6e6_1x400.png (100%) rename {vendor => app}/assets/images/ui-bg_glass_95_fef1ec_1x400.png (100%) rename {vendor => app}/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png (100%) rename {vendor => app}/assets/images/ui-icons_222222_256x240.png (100%) rename {vendor => app}/assets/images/ui-icons_2e83ff_256x240.png (100%) rename {vendor => app}/assets/images/ui-icons_454545_256x240.png (100%) rename {vendor => app}/assets/images/ui-icons_888888_256x240.png (100%) rename {vendor => app}/assets/images/ui-icons_cd0a0a_256x240.png (100%) delete mode 100644 vendor/assets/javascripts/.gitkeep delete mode 100644 vendor/assets/stylesheets/.gitkeep delete mode 100644 vendor/plugins/.gitkeep diff --git a/vendor/assets/images/ui-bg_flat_0_aaaaaa_40x100.png b/app/assets/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from vendor/assets/images/ui-bg_flat_0_aaaaaa_40x100.png rename to app/assets/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/vendor/assets/images/ui-bg_flat_75_ffffff_40x100.png b/app/assets/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from vendor/assets/images/ui-bg_flat_75_ffffff_40x100.png rename to app/assets/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/vendor/assets/images/ui-bg_glass_55_fbf9ee_1x400.png b/app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png similarity index 100% rename from vendor/assets/images/ui-bg_glass_55_fbf9ee_1x400.png rename to app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png diff --git a/vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png b/app/assets/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png rename to app/assets/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/vendor/assets/images/ui-bg_glass_75_dadada_1x400.png b/app/assets/images/ui-bg_glass_75_dadada_1x400.png similarity index 100% rename from vendor/assets/images/ui-bg_glass_75_dadada_1x400.png rename to app/assets/images/ui-bg_glass_75_dadada_1x400.png diff --git a/vendor/assets/images/ui-bg_glass_75_e6e6e6_1x400.png b/app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png similarity index 100% rename from vendor/assets/images/ui-bg_glass_75_e6e6e6_1x400.png rename to app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png diff --git a/vendor/assets/images/ui-bg_glass_95_fef1ec_1x400.png b/app/assets/images/ui-bg_glass_95_fef1ec_1x400.png similarity index 100% rename from vendor/assets/images/ui-bg_glass_95_fef1ec_1x400.png rename to app/assets/images/ui-bg_glass_95_fef1ec_1x400.png diff --git a/vendor/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png similarity index 100% rename from vendor/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png rename to app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png diff --git a/vendor/assets/images/ui-icons_222222_256x240.png b/app/assets/images/ui-icons_222222_256x240.png similarity index 100% rename from vendor/assets/images/ui-icons_222222_256x240.png rename to app/assets/images/ui-icons_222222_256x240.png diff --git a/vendor/assets/images/ui-icons_2e83ff_256x240.png b/app/assets/images/ui-icons_2e83ff_256x240.png similarity index 100% rename from vendor/assets/images/ui-icons_2e83ff_256x240.png rename to app/assets/images/ui-icons_2e83ff_256x240.png diff --git a/vendor/assets/images/ui-icons_454545_256x240.png b/app/assets/images/ui-icons_454545_256x240.png similarity index 100% rename from vendor/assets/images/ui-icons_454545_256x240.png rename to app/assets/images/ui-icons_454545_256x240.png diff --git a/vendor/assets/images/ui-icons_888888_256x240.png b/app/assets/images/ui-icons_888888_256x240.png similarity index 100% rename from vendor/assets/images/ui-icons_888888_256x240.png rename to app/assets/images/ui-icons_888888_256x240.png diff --git a/vendor/assets/images/ui-icons_cd0a0a_256x240.png b/app/assets/images/ui-icons_cd0a0a_256x240.png similarity index 100% rename from vendor/assets/images/ui-icons_cd0a0a_256x240.png rename to app/assets/images/ui-icons_cd0a0a_256x240.png diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep deleted file mode 100644 index e69de29b..00000000 From 8fdae123d2ec36e9f12802ce60257dddc7c2b43f Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 19:17:32 -0400 Subject: [PATCH 4/9] application.css issue --- app/assets/stylesheets/application.css | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 649f2e2c..20201b97 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -9,7 +9,6 @@ * compiled file, but it's generally better to create a new file per style scope. * *= require_self - *= require_tree ../../../vendor/assets/stylesheets *= require_tree . *= require base *= require ForceDirected From 465b95753c39b355343cbaa1987075c2715ad40d Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 19:24:39 -0400 Subject: [PATCH 5/9] reorganize for functional famous operation --- app/views/layouts/application.html.erb | 2 +- {app/assets/javascripts/src => public}/main.js | 0 {app/assets/javascripts/src => public}/templates.js | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {app/assets/javascripts/src => public}/main.js (100%) rename {app/assets/javascripts/src => public}/templates.js (100%) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index dda7faf1..43150673 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -34,7 +34,7 @@ diff --git a/app/assets/javascripts/src/main.js b/public/main.js similarity index 100% rename from app/assets/javascripts/src/main.js rename to public/main.js diff --git a/app/assets/javascripts/src/templates.js b/public/templates.js similarity index 100% rename from app/assets/javascripts/src/templates.js rename to public/templates.js From b5962287820d8dad6204be64364630fef5fd52e6 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 19:35:18 -0400 Subject: [PATCH 6/9] restructuring for famous --- app/views/layouts/application.html.erb | 2 +- public/famous/main.js | 205 +++++++++++++++++++++++++ public/famous/templates.js | 86 +++++++++++ 3 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 public/famous/main.js create mode 100644 public/famous/templates.js diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 43150673..37d9284d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -34,7 +34,7 @@ diff --git a/public/famous/main.js b/public/famous/main.js new file mode 100644 index 00000000..05f5e160 --- /dev/null +++ b/public/famous/main.js @@ -0,0 +1,205 @@ +define(function(require, exports, module) { + // import dependencies + var Engine = require('famous/core/Engine'); + var Modifier = require('famous/core/Modifier'); + var Transform = require('famous/core/Transform'); + var Surface = require('famous/core/Surface'); + var Timer = require('famous/utilities/Timer'); + + var templates = require('templates'); + + // create the main context + var famous = document.getElementById('famousOverlay'); + + Metamaps.Famous = {}; + var f = Metamaps.Famous; + + f.mainContext = Engine.createContext(famous); + + + // INFOVIS + f.viz = {}; + f.viz.surf = new Surface({ + size: [undefined, undefined], + classes: [], + properties: { + display: 'none' + } + }); + var prepare = function () { + f.viz.show(); + Metamaps.JIT.prepareVizData(); + f.viz.surf.removeListener('deploy',prepare); + }; + if (Metamaps.currentSection === "map") { + f.viz.surf.on('deploy', prepare); + } + f.viz.mod = new Modifier({ + origin: [0.5, 0.5], + opacity: 0 + }); + f.viz.show = function () { + f.viz.surf.setProperties({ "display":"block" }); + f.viz.mod.setOpacity( + 1, + { duration: 300 } + ); + }; + f.viz.hide = function () { + f.viz.mod.setOpacity( + 0, + { duration: 300 }, + function() { + f.viz.surf.setProperties({"display": "none"}); + } + ); + }; + f.mainContext.add(f.viz.mod).add(f.viz.surf); + + + // CONTENT / OTHER PAGES + f.yield = {}; + f.yield.surf = new Surface({ + size: [true, true], + classes: [], + properties: { + display: 'none' + } + }); + var loadYield = function () { + f.loadYield(); + f.yield.surf.removeListener('deploy',loadYield); + }; + if (!(Metamaps.currentSection === "map" || + Metamaps.currentSection === "explore" || + (Metamaps.currentSection === "" && Metamaps.Active.Mapper) )) { + f.yield.surf.on('deploy', loadYield); + } + f.yield.mod = new Modifier({ + origin: [0.5, 0.5], + opacity: 0 + }); + f.yield.show = function () { + f.yield.surf.setProperties({ "display":"block" }); + f.yield.mod.setOpacity( + 1, + { duration: 300 } + ); + }; + f.yield.hide = function () { + f.yield.mod.setOpacity( + 0, + { duration: 300 }, + function() { + f.yield.surf.setProperties({"display": "none"}); + } + ); + }; + f.mainContext.add(f.yield.mod).add(f.yield.surf); + + f.loadYield = function () { + Metamaps.Loading.loader.hide(); + var yield = document.getElementById('yield').innerHTML; + f.yield.surf.setContent(yield); + f.yield.surf.deploy(f.yield.surf._currTarget); + f.yield.show(); + }; + + + // EXPLORE MAPS BAR + f.explore = {}; + f.explore.surf = new Surface({ + size: [undefined, 94], + content: templates.mineContent, + classes: ['exploreMapsBar', 'exploreElement'] + }); + f.explore.mod = new Modifier({ + origin: [0.5, 0], + transform: Transform.translate(0, -94, 0) + }); + f.explore.show = function () { + f.explore.mod.setTransform( + Transform.translate(0, 0, 0), + { duration: 300, curve: 'easeOut' } + ); + }; + f.explore.hide = function () { + f.explore.mod.setTransform( + Transform.translate(0, -94, 0), + { duration: 300, curve: 'easeIn' } + ); + }; + f.explore.set = function (section) { + var loggedIn = Metamaps.Active.Mapper ? 'Auth' : ''; + f.explore.surf.setContent(templates[section + loggedIn + 'Content']); + }; + f.mainContext.add(f.explore.mod).add(f.explore.surf); + + // LOGO + f.logo = {}; + f.logo.surf = new Surface({ + size: [258, 56], + content: templates.logoContent, + classes: [] + }); + + f.logo.mod = new Modifier({ + origin: [0.5, 1], + transform: Transform.translate(0, 56, 0) + }); + f.logo.show = function () { + f.logo.mod.setTransform( + Transform.translate(0, 0, 0), + { duration: 300, curve: 'easeOut' } + ); + }; + f.logo.hide = function () { + f.logo.mod.setTransform( + Transform.translate(0, 56, 0), + { duration: 300, curve: 'easeIn' } + ); + }; + f.mainContext.add(f.logo.mod).add(f.logo.surf); + + + // TOAST + f.toast = {}; + f.toast.surf = new Surface({ + size: [true, 42], + content: '', + classes: ['toast'] + }); + f.toast.mod = new Modifier({ + origin: [0, 1], + opacity: 0, + transform: Transform.translate(24, -24, 0) + }); + f.toast.show = function () { + f.toast.mod.setOpacity( + 1, + { duration: 300 } + ); + }; + f.toast.hide = function () { + f.toast.mod.setOpacity( + 0, + { duration: 300 } + ); + }; + f.mainContext.add(f.toast.mod).add(f.toast.surf); + + f.logo.show(); + if (Metamaps.currentSection === "explore") { + Metamaps.Loading.loader.hide(); + f.explore.set(Metamaps.currentPage); + f.explore.show(); + } + else if (Metamaps.currentSection === "") { + Metamaps.Loading.loader.hide(); + if (Metamaps.Active.Mapper) { + f.explore.set('mine'); + f.explore.show(); + } + else f.explore.set('featured'); + } +}); \ No newline at end of file diff --git a/public/famous/templates.js b/public/famous/templates.js new file mode 100644 index 00000000..c3649711 --- /dev/null +++ b/public/famous/templates.js @@ -0,0 +1,86 @@ +define(function(require, exports, module) { + +var t = {}; + +t.logoContent = ''; +t.logoContent += ''; + +/* logged out explore maps bars */ +t.activeContent = '
'; + t.activeContent += '
'; + t.activeContent += 'My Maps'; + t.activeContent += 'Recently Active'; + t.activeContent += 'Featured'; + t.activeContent += 'New'; + t.activeContent += '
'; + t.activeContent += ' Date: Sun, 10 Aug 2014 19:44:53 -0400 Subject: [PATCH 7/9] little fix for Util.splitLine --- app/assets/javascripts/metamaps/Metamaps.js | 2 +- config/application.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/javascripts/metamaps/Metamaps.js b/app/assets/javascripts/metamaps/Metamaps.js index b3d3b2b6..a069af54 100644 --- a/app/assets/javascripts/metamaps/Metamaps.js +++ b/app/assets/javascripts/metamaps/Metamaps.js @@ -1265,7 +1265,7 @@ Metamaps.Util = { // you may copy this code but please keep the copyright notice as well splitLine: function (st, n) { var b = ''; - var s = st; + var s = st ? st : ''; while (s.length > n) { var c = s.substring(0, n); var d = c.lastIndexOf(' '); diff --git a/config/application.rb b/config/application.rb index d84d0c62..d9f5f0f1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -54,8 +54,6 @@ module Metamaps config.assets.enabled = true config.assets.initialize_on_precompile = false - config.assets.paths << "#{Rails.root}/app/assets/javascripts/src" - # Version of your assets, change this if you want to expire all your assets config.assets.version = '2.0' end From 39140a06e66cc55425992dfed5340d8294b73116 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 10 Aug 2014 19:52:39 -0400 Subject: [PATCH 8/9] moved famous files --- app/assets/javascripts/metamaps/Metamaps.js | 2 +- public/main.js | 205 -------------------- public/templates.js | 86 -------- 3 files changed, 1 insertion(+), 292 deletions(-) delete mode 100644 public/main.js delete mode 100644 public/templates.js diff --git a/app/assets/javascripts/metamaps/Metamaps.js b/app/assets/javascripts/metamaps/Metamaps.js index a069af54..14fea45f 100644 --- a/app/assets/javascripts/metamaps/Metamaps.js +++ b/app/assets/javascripts/metamaps/Metamaps.js @@ -1332,7 +1332,7 @@ Metamaps.Realtime = { var mapperm = Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper); if (mapperm) { - self.socket = io.connect('http://localhost:5001'); + self.socket = io.connect('http://localhost:5001'); self.socket.on('connect', function () { console.log('socket connected'); self.setupSocket(); diff --git a/public/main.js b/public/main.js deleted file mode 100644 index 05f5e160..00000000 --- a/public/main.js +++ /dev/null @@ -1,205 +0,0 @@ -define(function(require, exports, module) { - // import dependencies - var Engine = require('famous/core/Engine'); - var Modifier = require('famous/core/Modifier'); - var Transform = require('famous/core/Transform'); - var Surface = require('famous/core/Surface'); - var Timer = require('famous/utilities/Timer'); - - var templates = require('templates'); - - // create the main context - var famous = document.getElementById('famousOverlay'); - - Metamaps.Famous = {}; - var f = Metamaps.Famous; - - f.mainContext = Engine.createContext(famous); - - - // INFOVIS - f.viz = {}; - f.viz.surf = new Surface({ - size: [undefined, undefined], - classes: [], - properties: { - display: 'none' - } - }); - var prepare = function () { - f.viz.show(); - Metamaps.JIT.prepareVizData(); - f.viz.surf.removeListener('deploy',prepare); - }; - if (Metamaps.currentSection === "map") { - f.viz.surf.on('deploy', prepare); - } - f.viz.mod = new Modifier({ - origin: [0.5, 0.5], - opacity: 0 - }); - f.viz.show = function () { - f.viz.surf.setProperties({ "display":"block" }); - f.viz.mod.setOpacity( - 1, - { duration: 300 } - ); - }; - f.viz.hide = function () { - f.viz.mod.setOpacity( - 0, - { duration: 300 }, - function() { - f.viz.surf.setProperties({"display": "none"}); - } - ); - }; - f.mainContext.add(f.viz.mod).add(f.viz.surf); - - - // CONTENT / OTHER PAGES - f.yield = {}; - f.yield.surf = new Surface({ - size: [true, true], - classes: [], - properties: { - display: 'none' - } - }); - var loadYield = function () { - f.loadYield(); - f.yield.surf.removeListener('deploy',loadYield); - }; - if (!(Metamaps.currentSection === "map" || - Metamaps.currentSection === "explore" || - (Metamaps.currentSection === "" && Metamaps.Active.Mapper) )) { - f.yield.surf.on('deploy', loadYield); - } - f.yield.mod = new Modifier({ - origin: [0.5, 0.5], - opacity: 0 - }); - f.yield.show = function () { - f.yield.surf.setProperties({ "display":"block" }); - f.yield.mod.setOpacity( - 1, - { duration: 300 } - ); - }; - f.yield.hide = function () { - f.yield.mod.setOpacity( - 0, - { duration: 300 }, - function() { - f.yield.surf.setProperties({"display": "none"}); - } - ); - }; - f.mainContext.add(f.yield.mod).add(f.yield.surf); - - f.loadYield = function () { - Metamaps.Loading.loader.hide(); - var yield = document.getElementById('yield').innerHTML; - f.yield.surf.setContent(yield); - f.yield.surf.deploy(f.yield.surf._currTarget); - f.yield.show(); - }; - - - // EXPLORE MAPS BAR - f.explore = {}; - f.explore.surf = new Surface({ - size: [undefined, 94], - content: templates.mineContent, - classes: ['exploreMapsBar', 'exploreElement'] - }); - f.explore.mod = new Modifier({ - origin: [0.5, 0], - transform: Transform.translate(0, -94, 0) - }); - f.explore.show = function () { - f.explore.mod.setTransform( - Transform.translate(0, 0, 0), - { duration: 300, curve: 'easeOut' } - ); - }; - f.explore.hide = function () { - f.explore.mod.setTransform( - Transform.translate(0, -94, 0), - { duration: 300, curve: 'easeIn' } - ); - }; - f.explore.set = function (section) { - var loggedIn = Metamaps.Active.Mapper ? 'Auth' : ''; - f.explore.surf.setContent(templates[section + loggedIn + 'Content']); - }; - f.mainContext.add(f.explore.mod).add(f.explore.surf); - - // LOGO - f.logo = {}; - f.logo.surf = new Surface({ - size: [258, 56], - content: templates.logoContent, - classes: [] - }); - - f.logo.mod = new Modifier({ - origin: [0.5, 1], - transform: Transform.translate(0, 56, 0) - }); - f.logo.show = function () { - f.logo.mod.setTransform( - Transform.translate(0, 0, 0), - { duration: 300, curve: 'easeOut' } - ); - }; - f.logo.hide = function () { - f.logo.mod.setTransform( - Transform.translate(0, 56, 0), - { duration: 300, curve: 'easeIn' } - ); - }; - f.mainContext.add(f.logo.mod).add(f.logo.surf); - - - // TOAST - f.toast = {}; - f.toast.surf = new Surface({ - size: [true, 42], - content: '', - classes: ['toast'] - }); - f.toast.mod = new Modifier({ - origin: [0, 1], - opacity: 0, - transform: Transform.translate(24, -24, 0) - }); - f.toast.show = function () { - f.toast.mod.setOpacity( - 1, - { duration: 300 } - ); - }; - f.toast.hide = function () { - f.toast.mod.setOpacity( - 0, - { duration: 300 } - ); - }; - f.mainContext.add(f.toast.mod).add(f.toast.surf); - - f.logo.show(); - if (Metamaps.currentSection === "explore") { - Metamaps.Loading.loader.hide(); - f.explore.set(Metamaps.currentPage); - f.explore.show(); - } - else if (Metamaps.currentSection === "") { - Metamaps.Loading.loader.hide(); - if (Metamaps.Active.Mapper) { - f.explore.set('mine'); - f.explore.show(); - } - else f.explore.set('featured'); - } -}); \ No newline at end of file diff --git a/public/templates.js b/public/templates.js deleted file mode 100644 index c3649711..00000000 --- a/public/templates.js +++ /dev/null @@ -1,86 +0,0 @@ -define(function(require, exports, module) { - -var t = {}; - -t.logoContent = ''; -t.logoContent += ''; - -/* logged out explore maps bars */ -t.activeContent = '
'; - t.activeContent += '
'; - t.activeContent += 'My Maps'; - t.activeContent += 'Recently Active'; - t.activeContent += 'Featured'; - t.activeContent += 'New'; - t.activeContent += '
'; - t.activeContent += ' Date: Mon, 11 Aug 2014 09:21:58 -0400 Subject: [PATCH 9/9] Update templates.js --- public/famous/templates.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/public/famous/templates.js b/public/famous/templates.js index c3649711..220d32cd 100644 --- a/public/famous/templates.js +++ b/public/famous/templates.js @@ -13,7 +13,6 @@ t.logoContent += ''; /* logged out explore maps bars */ t.activeContent = '
'; t.activeContent += '
'; - t.activeContent += 'My Maps'; t.activeContent += 'Recently Active'; t.activeContent += 'Featured'; t.activeContent += 'New'; @@ -23,7 +22,6 @@ t.activeContent += '
'; t.featuredContent = '
'; t.featuredContent += '
'; - t.featuredContent += 'My Maps'; t.featuredContent += 'Recently Active'; t.featuredContent += 'Featured'; t.featuredContent += 'New'; @@ -33,7 +31,6 @@ t.featuredContent += '
'; t.newContent = '
'; t.newContent += '
'; - t.newContent += 'My Maps'; t.newContent += 'Recently Active'; t.newContent += 'Featured'; t.newContent += 'New'; @@ -83,4 +80,4 @@ t.newAuthContent = '
'; t.newAuthContent += '
'; module.exports = t; -}); \ No newline at end of file +});