Revert to including all helpers everywhere, because the rest of the team prefers it that way
This commit is contained in:
parent
efd5c4f500
commit
71e77d59b3
18 changed files with 51 additions and 41 deletions
|
|
@ -3,8 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
clear_helpers
|
||||
helper :layout, :error_messages, :markdownify, :aspect_global
|
||||
has_mobile_fu
|
||||
protect_from_forgery :except => :receive
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class AspectsController < ApplicationController
|
||||
helper :comments, :aspect_memberships, :likes
|
||||
before_filter :authenticate_user!
|
||||
before_filter :save_sort_order, :only => :index
|
||||
before_filter :ensure_page, :only => :index
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class ContactsController < ApplicationController
|
||||
helper :aspect_memberships
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def new
|
||||
|
|
|
|||
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
class LikesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
helper :likes
|
||||
before_filter :authenticate_user!
|
||||
|
||||
|
||||
respond_to :html, :mobile, :json
|
||||
|
||||
|
||||
def create
|
||||
target = current_user.find_visible_post_by_id params[:post_id]
|
||||
positive = (params[:positive] == 'true') ? true : false
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class PeopleController < ApplicationController
|
||||
helper :comments, :likes
|
||||
before_filter :authenticate_user!, :except => [:show]
|
||||
|
||||
respond_to :html
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class PhotosController < ApplicationController
|
||||
helper :comments, :people
|
||||
before_filter :authenticate_user!
|
||||
|
||||
respond_to :html, :json
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file.
|
||||
|
||||
class ServicesController < ApplicationController
|
||||
helper :aspect_memberships
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class SocketsController < ApplicationController
|
||||
helper :comments, :likes
|
||||
include ApplicationHelper
|
||||
include SocketsHelper
|
||||
include Rails.application.routes.url_helpers
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class StatusMessagesController < ApplicationController
|
||||
helper :comments, :likes
|
||||
before_filter :authenticate_user!
|
||||
|
||||
respond_to :html
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class TagsController < ApplicationController
|
||||
helper :comments, :likes
|
||||
skip_before_filter :count_requests
|
||||
skip_before_filter :set_invites
|
||||
skip_before_filter :which_action_and_user
|
||||
|
|
@ -41,6 +40,7 @@ class TagsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@aspect = :tag
|
||||
if current_user
|
||||
@posts = StatusMessage.joins(:contacts).where(:pending => false).where(
|
||||
Contact.arel_table[:user_id].eq(current_user.id).or(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
class UsersController < ApplicationController
|
||||
helper :language
|
||||
require File.join(Rails.root, 'lib/diaspora/ostatus_builder')
|
||||
require File.join(Rails.root, 'lib/diaspora/exporter')
|
||||
require File.join(Rails.root, 'lib/collect_user_photos')
|
||||
|
|
|
|||
|
|
@ -7,10 +7,6 @@ module ApplicationHelper
|
|||
timeago(obj.created_at)
|
||||
end
|
||||
|
||||
def time_for_sort(post)
|
||||
post.created_at
|
||||
end
|
||||
|
||||
def timeago(time, options={})
|
||||
options[:class] ||= "timeago"
|
||||
content_tag(:abbr, time.to_s, options.merge(:title => time.iso8601)) if time
|
||||
|
|
|
|||
|
|
@ -3,14 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
module AspectsHelper
|
||||
def next_page_path
|
||||
aspects_path(:max_time => @posts.last.send(session[:sort_order].to_sym).to_i, :a_ids => params[:a_ids])
|
||||
end
|
||||
|
||||
def time_for_sort post
|
||||
post.send(session[:sort_order].to_sym)
|
||||
end
|
||||
|
||||
def remove_link(aspect)
|
||||
if aspect.contacts.size == 0
|
||||
link_to I18n.t('aspects.helper.remove'), aspect, :method => :delete, :confirm => I18n.t('aspects.helper.are_you_sure')
|
||||
|
|
|
|||
|
|
@ -27,8 +27,4 @@ module PeopleHelper
|
|||
I18n.l bday, :format => I18n.t('date.formats.birthday_with_year')
|
||||
end
|
||||
end
|
||||
|
||||
def next_page_path
|
||||
person_path(@person, :max_time => @posts.last.created_at.to_i)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
23
app/helpers/stream_helper.rb
Normal file
23
app/helpers/stream_helper.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
module StreamHelper
|
||||
def next_page_path
|
||||
if controller.instance_of?(TagsController)
|
||||
tag_path(@tag, :max_time => @posts.last.created_at.to_i)
|
||||
elsif controller.instance_of?(PeopleController)
|
||||
person_path(@person, :max_time => @posts.last.created_at.to_i)
|
||||
elsif controller.instance_of?(AspectsController)
|
||||
aspects_path(:max_time => @posts.last.send(session[:sort_order].to_sym).to_i, :a_ids => params[:a_ids])
|
||||
end
|
||||
end
|
||||
|
||||
def time_for_sort post
|
||||
if controller.instance_of?(AspectsController)
|
||||
post.send(session[:sort_order].to_sym)
|
||||
else
|
||||
post.created_at
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -3,7 +3,4 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
module TagsHelper
|
||||
def next_page_path
|
||||
tag_path(@tag, :max_time => @posts.last.created_at.to_i)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -71,11 +71,4 @@ describe ApplicationHelper do
|
|||
person_link(@person).should_not include("<h1>")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#time_for_sort" do
|
||||
it "returns created_at" do
|
||||
post = @user.post(:status_message, :text => "hello", :public => true, :to => 'all')
|
||||
time_for_sort(post).should == post.created_at
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
24
spec/helpers/stream_helper_spec.rb
Normal file
24
spec/helpers/stream_helper_spec.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Copyright (c) 2011, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe StreamHelper do
|
||||
before do
|
||||
@post = Factory(:status_message)
|
||||
end
|
||||
describe "#time_for_sort" do
|
||||
it "returns sort_order for an aspectscontroller" do
|
||||
sort_order = :stored_in_session
|
||||
stub!(:controller).and_return(AspectsController.new)
|
||||
stub!(:session).and_return({:sort_order => sort_order})
|
||||
@post.should_receive(sort_order)
|
||||
time_for_sort(@post)
|
||||
end
|
||||
it "returns post.created_at otherwise" do
|
||||
stub!(:controller).and_return(mock())
|
||||
time_for_sort(@post).should == @post.created_at
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue