Skip to content
Extraits de code Groupes Projets
Valider 89f21e87 rédigé par Steffen van Bergerem's avatar Steffen van Bergerem
Parcourir les fichiers

Remove unused code

parent 2a47b889
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 1 ajout et 213 suppressions
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
app.views.PhotoViewer = app.views.Base.extend({
templateName : "photo-viewer",
presenter : function(){
return { photos : this.model.get("photos") }; //json array of attributes, not backbone models, yet.
}
});
// @license-end
<a href="{{object_url}}" class="stream-photo-link">
<img src="{{image_url}}" data-small-photo="{{image_url}}" data-full-photo="{{image_url}}" class="stream-photo" />
</a>
<div class="photo-set">
{{#each photos}}
<div class="img-bounding-box">
<img src="{{sizes.large}}"/>
</div>
{{/each}}
</div>
\ No newline at end of file
{{#people}}
{{#linkToAuthor this}}
{{{personImage this "small"}}}
{{/linkToAuthor}}
{{/people}}
...@@ -6,9 +6,8 @@ class PeopleController < ApplicationController ...@@ -6,9 +6,8 @@ class PeopleController < ApplicationController
before_action :authenticate_user!, except: %i(show stream hovercard) before_action :authenticate_user!, except: %i(show stream hovercard)
before_action :find_person, only: %i(show stream hovercard) before_action :find_person, only: %i(show stream hovercard)
respond_to :html, :except => [:tag_index] respond_to :html
respond_to :json, :only => [:index, :show] respond_to :json, :only => [:index, :show]
respond_to :js, :only => [:tag_index]
rescue_from ActiveRecord::RecordNotFound do rescue_from ActiveRecord::RecordNotFound do
render :file => Rails.root.join('public', '404').to_s, render :file => Rails.root.join('public', '404').to_s,
...@@ -64,13 +63,6 @@ class PeopleController < ApplicationController ...@@ -64,13 +63,6 @@ class PeopleController < ApplicationController
render :json => { :search_count => @people.count, :search_html => @answer_html }.to_json render :json => { :search_count => @people.count, :search_html => @answer_html }.to_json
end end
def tag_index
profiles = Profile.tagged_with(params[:name]).where(:searchable => true).select('profiles.id, profiles.person_id')
@people = Person.where(:id => profiles.map{|p| p.person_id}).paginate(:page => params[:page], :per_page => 15)
respond_with @people
end
# renders the persons user profile page # renders the persons user profile page
def show def show
mark_corresponding_notifications_read if user_signed_in? mark_corresponding_notifications_read if user_signed_in?
......
...@@ -109,34 +109,6 @@ class PhotosController < ApplicationController ...@@ -109,34 +109,6 @@ class PhotosController < ApplicationController
end end
end end
def edit
if @photo = current_user.photos.where(:id => params[:id]).first
respond_with @photo
else
redirect_to person_photos_path(current_user.person)
end
end
def update
photo = current_user.photos.where(:id => params[:id]).first
if photo
if current_user.update_post( photo, photo_params )
flash.now[:notice] = I18n.t 'photos.update.notice'
respond_to do |format|
format.js{ render :json => photo, :status => 200 }
end
else
flash.now[:error] = I18n.t 'photos.update.error'
respond_to do |format|
format.html{ redirect_to [:edit, photo] }
format.js{ render :status => 403 }
end
end
else
redirect_to person_photos_path(current_user.person)
end
end
private private
def photo_params def photo_params
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
= stream.title = stream.title
= render 'publisher/publisher', publisher_aspects_for(stream) = render 'publisher/publisher', publisher_aspects_for(stream)
= render 'aspects/no_posts_message'
#gs-shim{:title => popover_with_close_html("3. #{t('.stay_updated')}"), 'data-content' => t('.stay_updated_explanation')} #gs-shim{:title => popover_with_close_html("3. #{t('.stay_updated')}"), 'data-content' => t('.stay_updated_explanation')}
......
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
#no_posts.hidden.empty_message
= t('.start_talking')
$("#people_stream").html("<%= escape_javascript(render("index", :people => @people)) %>");
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%h2= "#{t('.editing')} #{@photo.processed_image}"
%div{id: @photo.id}
#show_photo
= image_tag @photo.url(:scaled_full)
= form_for @photo do |photo|
= photo.label :text
= photo.text_field :text, value: @photo.text
= photo.submit
var tagName = "<%= escape_javascript(@tag.name) %>"
$("#followed_tags_listing").find("#tag-following-"+tagName).slideUp(100);
app.flashMessages.success(Diaspora.I18n.t("tags.wasnt_that_interesting", {tagName: tagName}));
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
$(document).bind("mobileinit", function() {
$.extend($.mobile, {
ajaxLinksEnabled: false,
ajaxEnabled: false,
ajaxFormsEnabled: false
});
$.mobile.selectmenu.prototype.options.nativeMenu = false;
});
$(document).ready(function(){
$(".like_action.inactive").bind('tap', function(evt){
evt.preventDefault();
var target = $(this),
postId = target.data('post-id');
$.ajax({
url: '/posts/'+postId+'/likes.json',
type: 'POST',
complete: function(data){
target.addClass('inactive')
.removeClass('active')
.data('post-id', postId);
}
});
});
$(".like_action.active").bind('tap', function(evt){
evt.preventDefault();
var target = $(this),
postId = $(this).data('post-id'),
likeId = $(this).data('like-id');
$.ajax({
url: '/posts/'+postId+'/likes/'+likeId+'.json',
type: 'DELETE',
complete: function(data){
target.addClass('inactive')
.removeClass('active')
.data('like-id', '');
}
});
});
});
...@@ -116,21 +116,6 @@ describe PeopleController, :type => :controller do ...@@ -116,21 +116,6 @@ describe PeopleController, :type => :controller do
end end
end end
describe '#tag_index' do
it 'works for js' do
xhr :get, :tag_index, :name => 'jellybeans', :format => :js
expect(response).to be_success
end
it 'returns awesome people who have that tag' do
f = FactoryGirl.create(:person)
f.profile.tag_string = "#seeded"
f.profile.save
xhr :get, :tag_index, :name => 'seeded', :format => :js
expect(assigns[:people].count).to eq(1)
end
end
describe "#show performance", :performance => true do describe "#show performance", :performance => true do
before do before do
require 'benchmark' require 'benchmark'
......
...@@ -175,18 +175,6 @@ describe PhotosController, :type => :controller do ...@@ -175,18 +175,6 @@ describe PhotosController, :type => :controller do
end end
end end
describe '#edit' do
it "succeeds when user owns the photo" do
get :edit, :id => @alices_photo.id
expect(response).to be_success
end
it "redirects when the user does not own the photo" do
get :edit, :id => @bobs_photo.id
expect(response).to redirect_to(:action => :index, :person_id => alice.person.guid.to_s)
end
end
describe '#destroy' do describe '#destroy' do
it 'let a user delete his message' do it 'let a user delete his message' do
delete :destroy, :id => @alices_photo.id delete :destroy, :id => @alices_photo.id
...@@ -217,33 +205,6 @@ describe PhotosController, :type => :controller do ...@@ -217,33 +205,6 @@ describe PhotosController, :type => :controller do
end end
end end
describe "#update" do
it "updates the caption of a photo" do
put :update, :id => @alices_photo.id, :photo => { :text => "now with lasers!" }, :format => :js
expect(@alices_photo.reload.text).to eq("now with lasers!")
end
it "doesn't allow mass assignment of person" do
new_user = FactoryGirl.create(:user)
params = { :text => "now with lasers!", :author => new_user }
put :update, :id => @alices_photo.id, :photo => params, :format => :js
expect(@alices_photo.reload.author).to eq(alice.person)
end
it "doesn't allow mass assignment of person_id" do
new_user = FactoryGirl.create(:user)
params = { :text => "now with lasers!", :author_id => new_user.id }
put :update, :id => @alices_photo.id, :photo => params, :format => :js
expect(@alices_photo.reload.author_id).to eq(alice.person.id)
end
it 'redirects if you do not have access to the post' do
params = { :text => "now with lasers!" }
put :update, :id => @bobs_photo.id, :photo => params
expect(response).to redirect_to(:action => :index, :person_id => alice.person.guid.to_s)
end
end
describe "#make_profile_photo" do describe "#make_profile_photo" do
it 'should return a 201 on a js success' do it 'should return a 201 on a js success' do
xhr :get, :make_profile_photo, :photo_id => @alices_photo.id, :format => 'js' xhr :get, :make_profile_photo, :photo_id => @alices_photo.id, :format => 'js'
......
describe("app.views.PhotoViewer", function(){
beforeEach(function(){
this.model = factory.post({
photos : [
factory.photoAttrs({sizes : {large : "http://tieguy.org/me.jpg"}}),
factory.photoAttrs({sizes : {large : "http://whatthefuckiselizabethstarkupto.com/none_knows.gif"}}) //SIC
]
});
this.view = new app.views.PhotoViewer({model : this.model});
});
describe("rendering", function(){
it("should have an image for each photoAttr on the model", function(){
this.view.render();
expect(this.view.$("img").length).toBe(2);
expect(this.view.$("img[src='http://tieguy.org/me.jpg']")).toExist();
});
});
});
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter