From 06dc53749a4bd94e2f722e8d28738a31b5866359 Mon Sep 17 00:00:00 2001
From: Juan Manuel Azambuja <juan@wyeworks.com>
Date: Mon, 4 Mar 2013 11:18:04 -0200
Subject: [PATCH] delete unused javascript views

---
 Changelog.md                                  |  1 +
 .../app/views/profile_info_view.js            |  9 ---
 .../app/views/services_selector_view.js       | 39 -------------
 app/assets/templates/profile-info_tpl.jst.hbs | 55 -------------------
 .../templates/services-selector_tpl.jst.hbs   |  9 ---
 .../app/views/services_selector_view_spec.js  | 53 ------------------
 6 files changed, 1 insertion(+), 165 deletions(-)
 delete mode 100644 app/assets/javascripts/app/views/profile_info_view.js
 delete mode 100644 app/assets/javascripts/app/views/services_selector_view.js
 delete mode 100644 app/assets/templates/profile-info_tpl.jst.hbs
 delete mode 100644 app/assets/templates/services-selector_tpl.jst.hbs
 delete mode 100644 spec/javascripts/app/views/services_selector_view_spec.js

diff --git a/Changelog.md b/Changelog.md
index 44aba5be2e..78b660f779 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -13,6 +13,7 @@
 
 ## Refactor
 
+* Delete unnecessary javascript views. [#4059] (https://github.com/diaspora/diaspora/pull/4059)
 * Add a configuration entry to set max-age header to Amazon S3 resources. [#4048](https://github.com/diaspora/diaspora/pull/4048)
 * Refactor people_controller#show and photos_controller#index [#4002](https://github.com/diaspora/diaspora/issues/4002)
 * Modularize layout [#3944](https://github.com/diaspora/diaspora/pull/3944)
diff --git a/app/assets/javascripts/app/views/profile_info_view.js b/app/assets/javascripts/app/views/profile_info_view.js
deleted file mode 100644
index ccba39a54b..0000000000
--- a/app/assets/javascripts/app/views/profile_info_view.js
+++ /dev/null
@@ -1,9 +0,0 @@
-app.views.ProfileInfo = app.views.Base.extend({
-  templateName : "profile-info",
-
-  tooltipSelector : "*[rel=tooltip]",
-
-  initialize : function(){
-    this.model.bind("change", this.render, this)
-  }
-});
\ No newline at end of file
diff --git a/app/assets/javascripts/app/views/services_selector_view.js b/app/assets/javascripts/app/views/services_selector_view.js
deleted file mode 100644
index 43cb65328f..0000000000
--- a/app/assets/javascripts/app/views/services_selector_view.js
+++ /dev/null
@@ -1,39 +0,0 @@
-app.views.ServicesSelector = app.views.Base.extend({
-
-  templateName : "services-selector",
-
-  events : {
-    "click label" : "askForAuth"
-  },
-
-  tooltipSelector : "img",
-
-  services : [
-    'facebook',
-    'twitter',
-    'tumblr'
-  ],
-
-  presenter : function() {
-    var selectedServices = this.model.get('services');
-
-    return _.extend(this.defaultPresenter(), {
-      services :_.map(this.services, function(service){
-        return {
-          name : service,
-          checked :_.include(selectedServices, service)
-        }
-      })
-    })
-  },
-
-  askForAuth : function(evt){
-    var $target = $(evt.target);
-
-    if(app.currentUser.isServiceConfigured($target.data('provider'))) { return }
-
-    var serviceUrl = $target.data('url')
-    window.open(serviceUrl, 'popup', 'height=400,width=500')
-  }
-
-});
diff --git a/app/assets/templates/profile-info_tpl.jst.hbs b/app/assets/templates/profile-info_tpl.jst.hbs
deleted file mode 100644
index d914fa9b02..0000000000
--- a/app/assets/templates/profile-info_tpl.jst.hbs
+++ /dev/null
@@ -1,55 +0,0 @@
-<div id="profile-header">
-    <div class="profile-image-container" style="background-image : url('{{avatar.large}}')"></div>
-    <h3>
-        {{name}}
-    </h3>
-
-    <div id="profile-stats">
-        {{#if location}}
-            <span class="stat">
-                <a href="http://maps.google.com/maps?q={{location}}" target="_blank">
-                    <i class="icon-map-marker icon-white"></i>
-                </a>
-                {{location}}
-            </span>
-            <span class="divider">•</span>
-        {{/if}}
-
-        {{#if birthday}}
-            <span class="stat">
-                <img src='{{imageUrl "buttons/bday@2x-white.png"}}' class="cake" />
-                {{birthday}}
-            </span>
-            <span class="divider">•</span>
-        {{/if}}
-
-        <span class="stat services">
-            <a href="https://facebook.com" class="service" target="_blank">
-                <img src='{{imageUrl "buttons/service-icons/fb@2x-white.png"}}' />
-            </a>
-            <a href="https://twitter.com" class="service" target="_blank">
-                <img src='{{imageUrl "buttons/service-icons/twitter@2x-white.png"}}' />
-            </a>
-            <a href="https://tumblr.com" class="service" target="_blank">
-                <img src='{{imageUrl "buttons/service-icons/tumblr@2x-white.png"}}' />
-            </a>
-        </span>
-
-        {{#if is_own_profile}}
-            <span class="edit-control">
-                <span class="divider">•</span>
-                    <a href="/profile/edit" title="Edit Profile" rel="tooltip" style="margin-left:2px;">
-                        <i class="icon-cog icon-white"></i>
-                    </a>
-                </span>
-            </span>
-        {{/if}}
-    </div>
-
-    <div id="profile-bio">
-        <p>
-            {{bio}}
-        </p>
-    </div>
-</div>
-
diff --git a/app/assets/templates/services-selector_tpl.jst.hbs b/app/assets/templates/services-selector_tpl.jst.hbs
deleted file mode 100644
index eaec5629f6..0000000000
--- a/app/assets/templates/services-selector_tpl.jst.hbs
+++ /dev/null
@@ -1,9 +0,0 @@
-<!--*CSS MAGIC* CHECKBOX IS HIDDEN AND IS CHECKED BY CLICKING THE LABEL, CHANGE THIS AT YOUR OWN PERIL, RUN JASMINE AFTER-->
-<form class="magic-service-selector">
-    {{#each services}}
-        <input id="services[{{name}}]" type="checkbox" name="services[{{name}}]" class="services" value="{{name}}" {{#if checked}}checked="checked"{{/if}}/>
-        <label for="services[{{name}}]">
-            <img class="legacy-provider-image" src="/assets/buttons/{{name}}_hov@2x.png" data-provider="{{name}}" data-url="/auth/{{name}}" title="Share on {{name}}" />
-        </label>
-    {{/each}}
-</form>
diff --git a/spec/javascripts/app/views/services_selector_view_spec.js b/spec/javascripts/app/views/services_selector_view_spec.js
deleted file mode 100644
index 2857825d28..0000000000
--- a/spec/javascripts/app/views/services_selector_view_spec.js
+++ /dev/null
@@ -1,53 +0,0 @@
-describe("app.views.ServicesSelector", function(){
-  beforeEach(function(){
-    loginAs({
-      services : [
-        { provider : "facebook" }
-      ]
-    });
-
-    this.view = new app.views.ServicesSelector({model : factory.statusMessage()});
-  });
-
-  describe("rendering", function(){
-    beforeEach(function(){
-      this.view.setElement("#jasmine_content")
-      this.view.render();
-    });
-
-    it("displays all services", function(){
-      var checkboxes = $(this.view.el).find('input[type="checkbox"]');
-      expect(checkboxes.val()).toBe("facebook");
-    });
-
-    // this tests the crazy css we have in a bassackwards way
-    // check out toggling the services on the new publisher and make sure it works if you change stuff.
-    it("selects the checkbox when the image is clicked", function(){
-      expect($("label[for='services[facebook]'] img").is(".magic-service-selector input:not(:checked) + label img")).toBeTruthy();
-      this.view.$("input[value='facebook']").select()
-
-      expect($("label[for='services[facebook]'] img").is(".magic-service-selector input:not(:checked) + label img")).toBeFalsy();
-    });
-  });
-
-  describe("askForAuth", function() {
-    beforeEach( function(){
-      this.evt = jQuery.Event("click");
-      this.evt.target = "<label data-url='testing' data-provider='facebook'>"
-
-      spyOn(window, "open")
-    });
-
-    it("opens a window if app.currentUser does not have the service configured", function() {
-      app.currentUser.set({configured_services : []})
-      this.view.askForAuth(this.evt)
-      expect(window.open).toHaveBeenCalled()
-    });
-
-    it("doesn't open a window if app.currentUser has the service already configured", function() {
-      app.currentUser.set({configured_services : ['facebook']})
-      this.view.askForAuth(this.evt)
-      expect(window.open).not.toHaveBeenCalled()
-    });
-  })
-});
-- 
GitLab