delete unused javascript views

This commit is contained in:
Juan Manuel Azambuja 2013-03-04 11:18:04 -02:00
parent ecd93bca6f
commit 06dc53749a
6 changed files with 1 additions and 165 deletions

View file

@ -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)

View file

@ -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)
}
});

View file

@ -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')
}
});

View file

@ -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>

View file

@ -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>

View file

@ -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()
});
})
});