use ruby new hash syntax

Esse commit está contido em:
Adriano Benin
2013-05-28 15:41:32 -03:00
commit 32856afaf6
78 arquivos alterados com 542 adições e 542 exclusões
+4 -4
Ver Arquivo
@@ -30,8 +30,8 @@ class Adm::FinancialsController < Adm::BaseController
project.user.moip_login,
project.display_goal,
"#{project.display_pledged} (#{project.progress}%)",
"#{view_context.number_to_currency project.backers.confirmed.sum('payment_service_fee'), :unit => 'R$', :precision => 2, :delimiter => '.'}",
"#{view_context.number_to_currency catarse_fee, :unit => 'R$', :precision => 0, :delimiter => '.' } (#{view_context.number_to_currency project.pledged - catarse_fee, :unit => 'R$', :precision => 0, :delimiter => '.'})",
"#{view_context.number_to_currency project.backers.confirmed.sum('payment_service_fee'), unit: 'R$', precision: 2, delimiter: '.'}",
"#{view_context.number_to_currency catarse_fee, unit: 'R$', precision: 0, delimiter: '.' } (#{view_context.number_to_currency project.pledged - catarse_fee, unit: 'R$', precision: 0, delimiter: '.'})",
"#{project.display_expires_at} (#{I18n.l(8.weekdays_from(project.expires_at).to_date)})",
"#{adm_reports_backer_reports_url(project_id: project.id, format: :csv)}",
project.state
@@ -39,8 +39,8 @@ class Adm::FinancialsController < Adm::BaseController
end
end
send_data csv_string,
:type => 'text/csv; charset=iso-8859-1; header=present',
:disposition => "attachment; filename=financials.csv"
type: 'text/csv; charset=iso-8859-1; header=present',
disposition: "attachment; filename=financials.csv"
end
end
end
+1 -1
Ver Arquivo
@@ -4,7 +4,7 @@ class Adm::UsersController < Adm::BaseController
before_filter :set_title
before_filter :set_totals
has_scope :by_id, :by_name, :by_email, :by_payer_email, :by_key, :has_credits, :has_credits_difference, :only => :index
has_scope :by_id, :by_name, :by_email, :by_payer_email, :by_key, :has_credits, :has_credits_difference, only: :index
protected
def set_totals
+1 -1
Ver Arquivo
@@ -85,7 +85,7 @@ class ApplicationController < ActionController::Base
end
def render_404
render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false
render file: "#{Rails.root}/public/404.html", status: 404, layout: false
end
def force_http
+5 -5
Ver Arquivo
@@ -1,14 +1,14 @@
class BackersController < ApplicationController
inherit_resources
defaults :resource_class => Backer, :collection_name => 'backs', :instance_name => 'back'
defaults resource_class: Backer, collection_name: 'backs', instance_name: 'back'
belongs_to :user
actions :index
respond_to :json, :only => [:index]
respond_to :json, only: [:index]
def index
index! do |format|
format.json{ return render :json => @backs.includes(:user, :reward, project: [:user, :category, :project_total]).to_json({:include_project => true, :can_manage => (can? :manage, @user)}) }
format.html{ return render :nothing => true, :status => 404 }
format.json{ return render json: @backs.includes(:user, :reward, project: [:user, :category, :project_total]).to_json({include_project: true, can_manage: (can? :manage, @user)}) }
format.html{ return render nothing: true, status: 404 }
end
end
@@ -23,7 +23,7 @@ class BackersController < ApplicationController
end
redirect_to user_path(parent, anchor: 'credits')
# render :json => {:status => status, :credits => current_user.reload.display_credits}
# render json: {status: status, credits: current_user.reload.display_credits}
end
protected
@@ -9,7 +9,7 @@ class Channels::ChannelsSubscribersController < Channels::BaseController
def create
begin
create! do |success,failure|
success.html{
success.html{
flash[:notice] = I18n.t('channels_subscribers.created')
return redirect_to root_path }
end
@@ -21,9 +21,9 @@ class Channels::ChannelsSubscribersController < Channels::BaseController
def destroy
destroy! do |success,failure|
success.html{
success.html{
flash[:notice] = I18n.t('channels_subscribers.deleted')
return redirect_to root_path
return redirect_to root_path
}
end
end
+1 -1
Ver Arquivo
@@ -1,5 +1,5 @@
class EmailsController < ApplicationController
def index
render :text => 'teste', :layout => 'email'
render text: 'teste', layout: 'email'
end
end
@@ -12,8 +12,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
where("authorizations.uid = :uid AND oauth_providers.name = :provider", {uid: omniauth[:uid], provider: p.name}).
first || User.create_with_omniauth(omniauth, current_user)
flash[:notice] = I18n.t("devise.omniauth_callbacks.success", :kind => p.name.capitalize)
sign_in @user, :event => :authentication
flash[:notice] = I18n.t("devise.omniauth_callbacks.success", kind: p.name.capitalize)
sign_in @user, event: :authentication
if @user.email
redirect_to(session[:return_to] || root_path)
session[:return_to] = nil
+3 -3
Ver Arquivo
@@ -1,12 +1,12 @@
class PasswordsController < Devise::PasswordsController
def create
self.resource = resource_class.where(:provider => 'devise').send_reset_password_instructions(params[resource_name])
self.resource = resource_class.where(provider: 'devise').send_reset_password_instructions(params[resource_name])
if successfully_sent?(resource)
respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name))
respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name))
else
flash[:failure] = resource.errors.full_messages.to_sentence
redirect_to root_url(:show_forgot_password => true)
redirect_to root_url(show_forgot_password: true)
end
end
+7 -7
Ver Arquivo
@@ -2,18 +2,18 @@ class Projects::BackersController < ApplicationController
inherit_resources
actions :index, :show, :new, :update_info, :review, :create
skip_before_filter :force_http, only: [:create, :update_info]
skip_before_filter :verify_authenticity_token, :only => [:moip]
skip_before_filter :verify_authenticity_token, only: [:moip]
load_and_authorize_resource
belongs_to :project
def update_info
resource.update_attributes(params[:backer])
render :json => {:message => 'updated'}
render json: {message: 'updated'}
end
def index
@backers = parent.backers.avaiable_to_count.order("confirmed_at DESC").page(params[:page]).per(10)
render :json => @backers.to_json(:can_manage => can?(:update, @project))
render json: @backers.to_json(can_manage: can?(:update, @project))
end
def show
@@ -28,12 +28,12 @@ class Projects::BackersController < ApplicationController
end
@create_url = ::Configuration[:secure_review_host] ?
project_backers_url(@project, {:host => ::Configuration[:secure_review_host], :protocol => 'https'}) :
project_backers_url(@project, {host: ::Configuration[:secure_review_host], protocol: 'https'}) :
project_backers_path(@project)
@title = t('projects.backers.new.title', :name => @project.name)
@backer = @project.backers.new(:user => current_user)
empty_reward = Reward.new(:id => 0, :minimum_value => 0, :description => t('projects.backers.new.no_reward'))
@title = t('projects.backers.new.title', name: @project.name)
@backer = @project.backers.new(user: current_user)
empty_reward = Reward.new(id: 0, minimum_value: 0, description: t('projects.backers.new.no_reward'))
@rewards = [empty_reward] + @project.rewards.order(:minimum_value)
@reward = @project.rewards.find params[:reward_id] if params[:reward_id]
@reward = nil if @reward and @reward.sold_out?
+9 -9
Ver Arquivo
@@ -5,9 +5,9 @@ class ProjectsController < ApplicationController
inherit_resources
has_scope :pg_search, :by_category_id, :recent, :expiring, :successful, :recommended, :not_expired
respond_to :html, :except => [:backers]
respond_to :json, :only => [:index, :show, :backers, :update]
skip_before_filter :detect_locale, :only => [:backers]
respond_to :html, except: [:backers]
respond_to :json, only: [:index, :show, :backers, :update]
skip_before_filter :detect_locale, only: [:backers]
def index
index! do |format|
@@ -51,7 +51,7 @@ class ProjectsController < ApplicationController
@project = current_user.projects.new(params[:project])
create!(:notice => t('projects.create.success')) do |success, failure|
create!(notice: t('projects.create.success')) do |success, failure|
success.html{ return redirect_to project_by_slug_path(@project.permalink) }
end
end
@@ -76,7 +76,7 @@ class ProjectsController < ApplicationController
@rewards = @project.rewards.includes(:project).rank(:row_order).all
@backers = @project.backers.confirmed.limit(12).order("confirmed_at DESC").all
fb_admins_add(@project.user.facebook_id) if @project.user.facebook_id
@update = @project.updates.where(:id => params[:update_id]).first if params[:update_id].present?
@update = @project.updates.where(id: params[:update_id]).first if params[:update_id].present?
}
rescue ActiveRecord::RecordNotFound
return render_404
@@ -84,7 +84,7 @@ class ProjectsController < ApplicationController
end
def video
project = Project.new(:video_url => params[:url])
project = Project.new(video_url: params[:url])
if project.video
render json: project.video.to_json
else
@@ -94,19 +94,19 @@ class ProjectsController < ApplicationController
def check_slug
project = Project.where("lower(permalink) = ?", params[:permalink].downcase)
render :json => {:available => project.empty?}.to_json
render json: {available: project.empty?}.to_json
end
def embed
@project = Project.find params[:id]
@title = @project.name
render :layout => 'embed'
render layout: 'embed'
end
def video_embed
@project = Project.find params[:id]
@title = @project.name
render :layout => 'embed'
render layout: 'embed'
end
def blog_posts
+1 -1
Ver Arquivo
@@ -6,7 +6,7 @@ class RewardsController < ApplicationController
def index
@rewards = Reward.find_by_project_id(params[:project_id])
render :json => @rewards
render json: @rewards
end
def show
+1 -1
Ver Arquivo
@@ -12,7 +12,7 @@ class UnsubscribesController < ApplicationController
end
end
flash[:notice] = t('users.current_user_fields.updated')
return redirect_to user_path(parent, :anchor => 'unsubscribes')
return redirect_to user_path(parent, anchor: 'unsubscribes')
end
end
+2 -2
Ver Arquivo
@@ -3,12 +3,12 @@ class UpdatesController < ApplicationController
load_and_authorize_resource
actions :index, :create, :destroy
respond_to :html, :only => [ :index, :create, :destroy ]
respond_to :html, only: [ :index, :create, :destroy ]
belongs_to :project
def index
index! do |format|
format.html{ return render :index, :layout => false }
format.html{ return render :index, layout: false }
end
end
+6 -6
Ver Arquivo
@@ -3,7 +3,7 @@ class UsersController < ApplicationController
load_and_authorize_resource new: [ :set_email ], except: [ :projects ]
inherit_resources
actions :show, :update, :unsubscribe_update, :request_refund, :set_email, :update_email
respond_to :json, :only => [:backs, :projects, :request_refund]
respond_to :json, only: [:backs, :projects, :request_refund]
def show
show!{
@@ -23,7 +23,7 @@ class UsersController < ApplicationController
update! do |success,failure|
success.html do
flash[:notice] = t('users.current_user_fields.updated')
redirect_to (session[:return_to] || user_path(@user, :anchor => 'settings'))
redirect_to (session[:return_to] || user_path(@user, anchor: 'settings'))
session[:return_to] = nil
return
end
@@ -34,7 +34,7 @@ class UsersController < ApplicationController
def update
update! do
flash[:notice] = t('users.current_user_fields.updated')
return redirect_to user_path(@user, :anchor => 'settings')
return redirect_to user_path(@user, anchor: 'settings')
end
end
@@ -45,7 +45,7 @@ class UsersController < ApplicationController
else
flash[:error] = @user.errors.full_messages.to_sentence
end
return redirect_to user_path(@user, :anchor => 'settings')
return redirect_to user_path(@user, anchor: 'settings')
end
def projects
@@ -53,12 +53,12 @@ class UsersController < ApplicationController
@projects = @user.projects.includes(:user, :category, :project_total).order("updated_at DESC")
@projects = @projects.visible unless @user == current_user
@projects = @projects.page(params[:page]).per(10)
render :json => @projects
render json: @projects
end
def credits
@user = User.find(params[:id])
@credits = @user.backs.can_refund.order(:id).all
render :json => @credits
render json: @credits
end
end
+2 -2
Ver Arquivo
@@ -44,11 +44,11 @@ class ProjectDecorator < Draper::Decorator
end
def display_pledged
number_to_currency source.pledged, :unit => 'R$', :precision => 0, :delimiter => '.'
number_to_currency source.pledged, unit: 'R$', precision: 0, delimiter: '.'
end
def display_goal
number_to_currency source.goal, :unit => 'R$', :precision => 0, :delimiter => '.'
number_to_currency source.goal, unit: 'R$', precision: 0, delimiter: '.'
end
+6 -6
Ver Arquivo
@@ -10,25 +10,25 @@ class UserDecorator < Draper::Decorator
source.uploaded_image.thumb_avatar.url || source.image_url || source.gravatar_url || '/assets/user.png'
end
def display_image_html options={:width => 119, :height => 121}
def display_image_html options={width: 119, height: 121}
(%{<div class="avatar_wrapper" style="width: #{options[:width]}px; height: #{options[:height]}px">} +
h.image_tag(display_image, :alt => "User", :style => "width: #{options[:width]}px; height: auto") +
h.image_tag(display_image, alt: "User", style: "width: #{options[:width]}px; height: auto") +
%{</div>}).html_safe
end
def short_name
truncate display_name, :length => 20
truncate display_name, length: 20
end
def medium_name
truncate display_name, :length => 42
truncate display_name, length: 42
end
def display_credits
number_to_currency source.credits, :unit => 'R$', :precision => 0, :delimiter => '.'
number_to_currency source.credits, unit: 'R$', precision: 0, delimiter: '.'
end
def display_total_of_backs
number_to_currency source.backs.confirmed.sum(:value), :unit => 'R$', :precision => 0, :delimiter => '.'
number_to_currency source.backs.confirmed.sum(:value), unit: 'R$', precision: 0, delimiter: '.'
end
end
+1 -1
Ver Arquivo
@@ -4,6 +4,6 @@ class CreditsMailer < ActionMailer::Base
def request_refund_from(backer)
@backer = backer
@user = backer.user
mail(from: "#{::Configuration[:company_name]} <#{::Configuration[:email_system]}>", to: ::Configuration[:email_payments], :subject => I18n.t('credits_mailer.request_refund_from.subject', :name => @backer.project.name))
mail(from: "#{::Configuration[:company_name]} <#{::Configuration[:email_system]}>", to: ::Configuration[:email_payments], subject: I18n.t('credits_mailer.request_refund_from.subject', name: @backer.project.name))
end
end
+1 -1
Ver Arquivo
@@ -7,7 +7,7 @@ class NotificationsMailer < ActionMailer::Base
address = Mail::Address.new from_email
address.display_name = (@notification.mail_params && @notification.mail_params.has_key?(:display_name)) ? @notification.mail_params[:display_name] : ::Configuration[:company_name]
subject = I18n.t("notifications.#{@notification.notification_type.name}.subject", @notification.mail_params)
@header = I18n.t("notifications.#{@notification.notification_type.name}.header", @notification.mail_params, :default => subject)
@header = I18n.t("notifications.#{@notification.notification_type.name}.header", @notification.mail_params, default: subject)
m = mail({
from: address.format,
to: @notification.user.email,
+19 -19
Ver Arquivo
@@ -7,7 +7,7 @@ class Backer < ActiveRecord::Base
schema_associations
validates_presence_of :project, :user, :value
validates_numericality_of :value, :greater_than_or_equal_to => 10.00
validates_numericality_of :value, greater_than_or_equal_to: 10.00
validate :reward_must_be_from_project
scope :by_id, ->(id) { where(id: id) }
@@ -15,11 +15,11 @@ class Backer < ActiveRecord::Base
scope :by_user_id, ->(user_id) { where(user_id: user_id) }
scope :user_name_contains, ->(term) { joins(:user).where("unaccent(upper(users.name)) LIKE ('%'||unaccent(upper(?))||'%')", term) }
scope :project_name_contains, ->(term) { joins(:project).where("unaccent(upper(projects.name)) LIKE ('%'||unaccent(upper(?))||'%')", term) }
scope :anonymous, where(:anonymous => true)
scope :credits, where(:credits => true)
scope :anonymous, where(anonymous: true)
scope :credits, where(credits: true)
scope :requested_refund, where(state: 'requested_refund')
scope :refunded, where(state: 'refunded')
scope :not_anonymous, where(:anonymous => false)
scope :not_anonymous, where(anonymous: false)
scope :confirmed, where(state: 'confirmed')
scope :not_confirmed, where("state <> 'confirmed'") # used in payment engines
scope :in_time_to_confirm, ->() { where(state: 'waiting_confirmation') }
@@ -64,10 +64,10 @@ class Backer < ActiveRecord::Base
def value_must_be_at_least_rewards_value
return unless reward
errors.add(:value, I18n.t('backer.value_must_be_at_least_rewards_value', :minimum_value => reward.display_minimum)) unless value >= reward.minimum_value
errors.add(:value, I18n.t('backer.value_must_be_at_least_rewards_value', minimum_value: reward.display_minimum)) unless value >= reward.minimum_value
end
validate :should_not_back_if_maximum_backers_been_reached, :on => :create
validate :should_not_back_if_maximum_backers_been_reached, on: :create
def should_not_back_if_maximum_backers_been_reached
return unless reward and reward.maximum_backers and reward.maximum_backers > 0
@@ -75,7 +75,7 @@ class Backer < ActiveRecord::Base
end
def display_value
number_to_currency value, :unit => "R$", :precision => 0, :delimiter => '.'
number_to_currency value, unit: "R$", precision: 0, delimiter: '.'
end
def available_rewards
@@ -88,26 +88,26 @@ class Backer < ActiveRecord::Base
def as_json(options={})
json_attributes = {
:id => id,
:anonymous => anonymous,
:confirmed => confirmed?,
:confirmed_at => display_confirmed_at,
:value => display_value,
:user => user.as_json(options.merge(:anonymous => anonymous)),
:display_value => nil,
:reward => nil
id: id,
anonymous: anonymous,
confirmed: confirmed?,
confirmed_at: display_confirmed_at,
value: display_value,
user: user.as_json(options.merge(anonymous: anonymous)),
display_value: nil,
reward: nil
}
if options and options[:can_manage]
json_attributes.merge!({
:display_value => display_value,
:reward => reward
display_value: display_value,
reward: reward
})
end
if options and options[:include_project]
json_attributes.merge!({:project => project})
json_attributes.merge!({project: project})
end
if options and options[:include_reward]
json_attributes.merge!({:reward => reward})
json_attributes.merge!({reward: reward})
end
json_attributes
end
+16 -16
Ver Arquivo
@@ -16,14 +16,14 @@ class Project < ActiveRecord::Base
delegate :display_status, :display_progress, :display_image, :display_expires_at,
:display_pledged, :display_goal, :remaining_days, :display_video_embed_url, :progress_bar,
:to => :decorator
to: :decorator
schema_associations
belongs_to :user
has_many :backers, :dependent => :destroy
has_many :rewards, :dependent => :destroy
has_many :updates, :dependent => :destroy
has_many :notifications, :dependent => :destroy
has_many :backers, dependent: :destroy
has_many :rewards, dependent: :destroy
has_many :updates, dependent: :destroy
has_many :notifications, dependent: :destroy
has_and_belongs_to_many :channels
@@ -38,7 +38,7 @@ class Project < ActiveRecord::Base
[:about, 'C']
],
associated_against: {user: [:name, :address_city ]},
:using => {tsearch: {:dictionary => "portuguese"}},
using: {tsearch: {dictionary: "portuguese"}},
ignoring: :accents
scope :by_progress, ->(progress) { joins(:project_total).where("project_totals.pledged >= projects.goal*?", progress.to_i/100.to_f) }
@@ -99,10 +99,10 @@ class Project < ActiveRecord::Base
validates :video_url, presence: true, if: ->(p) { p.state_name == 'online' }
validates_presence_of :name, :user, :category, :about, :headline, :goal, :permalink
validates_length_of :headline, :maximum => 140
validates_numericality_of :online_days, :less_than_or_equal_to => 60
validates_uniqueness_of :permalink, :allow_blank => true, :allow_nil => true, :case_sensitive => false
validates_format_of :permalink, with: /^(\w|-)*$/, :allow_blank => true, :allow_nil => true
validates_length_of :headline, maximum: 140
validates_numericality_of :online_days, less_than_or_equal_to: 60
validates_uniqueness_of :permalink, allow_blank: true, allow_nil: true, case_sensitive: false
validates_format_of :permalink, with: /^(\w|-)*$/, allow_blank: true, allow_nil: true
validates_format_of :video_url, with: Regexp.union(/https?:\/\/(www\.)?vimeo.com\/(\d+)/, VideoInfo::Youtube.new('').regex), message: I18n.t('project.video_regex_validation'), allow_blank: true
mount_uploader :video_thumbnail, LogoUploader
@@ -224,8 +224,8 @@ class Project < ActiveRecord::Base
time_to_go: time_to_go,
remaining_text: remaining_text,
embed_url: video ? video.embed_url : nil,
url: Rails.application.routes.url_helpers.project_by_slug_path(permalink, :locale => I18n.locale),
full_uri: Rails.application.routes.url_helpers.project_by_slug_url(permalink, :locale => I18n.locale),
url: Rails.application.routes.url_helpers.project_by_slug_path(permalink, locale: I18n.locale),
full_uri: Rails.application.routes.url_helpers.project_by_slug_url(permalink, locale: I18n.locale),
expired: expired?,
successful: successful? || reached_goal?,
waiting_funds: waiting_funds?,
@@ -245,7 +245,7 @@ class Project < ActiveRecord::Base
end
#NOTE: state machine things
state_machine :state, :initial => :draft do
state_machine :state, initial: :draft do
state :draft, value: 'draft'
state :rejected, value: 'rejected'
state :online, value: 'online'
@@ -293,10 +293,10 @@ class Project < ActiveRecord::Base
after_transition waiting_funds: :successful, do: :after_transition_of_wainting_funds_to_successful
after_transition draft: :online, do: :after_transition_of_draft_to_online
after_transition draft: :rejected, do: :after_transition_of_draft_to_rejected
after_transition any => [:failed, :successful], :do => :after_transition_of_any_to_failed_or_successful
after_transition :waiting_funds => [:failed, :successful], :do => :after_transition_of_waiting_funds_to_failed_or_successful
after_transition any => [:failed, :successful], do: :after_transition_of_any_to_failed_or_successful
after_transition waiting_funds: [:failed, :successful], do: :after_transition_of_waiting_funds_to_failed_or_successful
before_transition :waiting_funds => [:failed, :successful, :waiting_funds], :do => :check_waiting_confirmation_backers
before_transition waiting_funds: [:failed, :successful, :waiting_funds], do: :check_waiting_confirmation_backers
end
def check_waiting_confirmation_backers
+17 -17
Ver Arquivo
@@ -13,8 +13,8 @@ class Reward < ActiveRecord::Base
has_paper_trail
validates_presence_of :minimum_value, :description
validates_numericality_of :minimum_value, :greater_than_or_equal_to => 10.00
validates_numericality_of :maximum_backers, :only_integer => true, :greater_than => 0, :allow_nil => true
validates_numericality_of :minimum_value, greater_than_or_equal_to: 10.00
validates_numericality_of :maximum_backers, only_integer: true, greater_than: 0, allow_nil: true
scope :remaining, where("maximum_backers IS NULL OR (maximum_backers IS NOT NULL AND (SELECT COUNT(*) FROM backers WHERE state = 'confirmed' AND reward_id = rewards.id) < maximum_backers)")
scope :sort_asc, order('id ASC')
@@ -32,43 +32,43 @@ class Reward < ActiveRecord::Base
end
def display_remaining
I18n.t('reward.display_remaining', :remaining => remaining, :maximum => maximum_backers).html_safe
I18n.t('reward.display_remaining', remaining: remaining, maximum: maximum_backers).html_safe
end
def name
"<div class='reward_minimum_value'>#{minimum_value > 0 ? display_minimum+'+' : I18n.t('reward.dont_want')}</div><div class='reward_description'>#{h description}</div>#{'<div class="sold_out">' + I18n.t('reward.sold_out') + '</div>' if sold_out?}<div class='clear'></div>".html_safe
end
def display_minimum
number_to_currency minimum_value, :unit => 'R$', :precision => 2, :delimiter => '.'
number_to_currency minimum_value, unit: 'R$', precision: 2, delimiter: '.'
end
def short_description
truncate description, :length => 35
truncate description, length: 35
end
def medium_description
truncate description, :length => 65
truncate description, length: 65
end
def last_description
if versions.present?
reward = versions.last.reify(has_one: true)
auto_link(simple_format(reward.description), :html => {:target => :_blank})
auto_link(simple_format(reward.description), html: {target: :_blank})
end
end
def display_description
auto_link(simple_format(description), :html => {:target => :_blank})
auto_link(simple_format(description), html: {target: :_blank})
end
def as_json(options={})
{
:id => id,
:project_id => project_id,
:maximum_backers => maximum_backers,
:remaining => remaining,
:display_with_label => I18n.t('projects.rewards.reward_title', :minimum => display_minimum),
:display_minimum => display_minimum,
:description => description,
:short_description => short_description,
:medium_description => medium_description
id: id,
project_id: project_id,
maximum_backers: maximum_backers,
remaining: remaining,
display_with_label: I18n.t('projects.rewards.reward_title', minimum: display_minimum),
display_minimum: display_minimum,
description: description,
short_description: short_description,
medium_description: medium_description
}
end
end
+3 -3
Ver Arquivo
@@ -9,15 +9,15 @@ class Update < ActiveRecord::Base
def email_comment_html
auto_html(comment) do
html_escape :map => {
html_escape map: {
'&' => '&amp;',
'>' => '&gt;',
'<' => '&lt;',
'"' => '"'
}
email_image width: 513
redcloth :target => :_blank
link :target => :_blank
redcloth target: :_blank
link target: :_blank
end
end
+20 -20
Ver Arquivo
@@ -24,7 +24,7 @@ class User < ActiveRecord::Base
delegate :display_name, :display_image, :short_name, :display_image_html,
:medium_name, :display_credits, :display_total_of_backs,
:to => :decorator
to: :decorator
# Setup accessible (or protected) attributes for your model
attr_accessible :email,
:password,
@@ -59,15 +59,15 @@ class User < ActiveRecord::Base
mount_uploader :uploaded_image, LogoUploader
validates_length_of :bio, :maximum => 140
validates_length_of :bio, maximum: 140
validates :email, email: true, uniqueness: true, allow_nil: true, allow_blank: true
#validates :name, :presence => true, :if => :is_devise?
#validates :name, presence: true, if: :is_devise?
validates_presence_of :email, :if => :is_devise?
validates_uniqueness_of :email, :scope => :provider, :if => :is_devise?
validates_presence_of :password, :if => :password_required?
validates_confirmation_of :password, :if => :password_confirmation_required?
validates_length_of :password, :within => 6..128, :allow_blank => true
validates_presence_of :email, if: :is_devise?
validates_uniqueness_of :email, scope: :provider, if: :is_devise?
validates_presence_of :password, if: :password_required?
validates_confirmation_of :password, if: :password_confirmation_required?
validates_length_of :password, within: 6..128, allow_blank: true
schema_associations
has_many :oauth_providers, through: :authorizations
@@ -237,7 +237,7 @@ class User < ActiveRecord::Base
if total_backs == 2
I18n.t('user.backs_text.two')
elsif total_backs > 1
I18n.t('user.backs_text.many', :total => (total_backs-1))
I18n.t('user.backs_text.many', total: (total_backs-1))
else
I18n.t('user.backs_text.one')
end
@@ -253,22 +253,22 @@ class User < ActiveRecord::Base
if not options or (options and not options[:anonymous])
json_attributes.merge!({
:id => id,
:name => display_name,
:short_name => short_name,
:medium_name => medium_name,
:image => display_image,
:total_backs => total_backs,
:backs_text => backs_text,
:url => user_path(self),
:city => address_city,
:state => address_state
id: id,
name: display_name,
short_name: short_name,
medium_name: medium_name,
image: display_image,
total_backs: total_backs,
backs_text: backs_text,
url: user_path(self),
city: address_city,
state: address_state
})
end
if options and options[:can_manage]
json_attributes.merge!({
:email => email
email: email
})
end
+9 -9
Ver Arquivo
@@ -3,9 +3,9 @@
class LogoUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
version :project_thumb, :if => :is_project?
version :thumb, :if => :is_user?
version :thumb_avatar, :if => :is_user?
version :project_thumb, if: :is_project?
version :thumb, if: :is_user?
version :thumb_avatar, if: :is_user?
def extension_white_list
%w(jpg jpeg gif png) unless mounted_as == :video_thumbnail
@@ -26,18 +26,18 @@ class LogoUploader < CarrierWave::Uploader::Base
end
version :project_thumb do
process :resize_to_fill => [512,400]
process :convert => :png
process resize_to_fill: [512,400]
process convert: :png
end
version :thumb do
process :resize_to_fill => [260,170]
process :convert => :png
process resize_to_fill: [260,170]
process convert: :png
end
version :thumb_avatar do
process :resize_to_fit => [300,300]
process :convert => :png
process resize_to_fit: [300,300]
process convert: :png
end
protected
+12 -12
Ver Arquivo
@@ -9,7 +9,7 @@
strong= "#{@total_backs} "
= t('.total_backs')
| ·
strong= "#{number_to_currency @total_backed, :unit => 'R$', :precision => 0, :delimiter => '.'} "
strong= "#{number_to_currency @total_backed, unit: 'R$', precision: 0, delimiter: '.'} "
= t('.total_backed')
| ·
strong= "#{@total_users} "
@@ -85,33 +85,33 @@
h3= t('.backer_info', key: backer.key)
.modal-body style='text-align: left'
p
strong= t('.payment_method')
strong= t('.payment_method')
| &nbsp;
= backer.payment_method
p
strong= t('.payment_id')
| &nbsp;
strong= t('.payment_id')
| &nbsp;
= backer.payment_id
p
strong= t('.payer_email')
strong= t('.payer_email')
| &nbsp;
= backer.payer_email
p
strong= t('.user_email')
strong= t('.user_email')
| &nbsp;
= backer.user.email
= backer.user.email
p
strong= t('.payment_choice')
strong= t('.payment_choice')
| &nbsp;
= backer.payment_choice
p
strong= t('.created_at')
strong= t('.created_at')
| &nbsp;
= l(backer.created_at)
.modal-footer
button type='button' data-dismiss="modal" class="btn" OK
= link_to "#backerInfo#{backer.id}", :class => 'btn btn-mini', :'data-toggle' => 'modal' do
= link_to "#backerInfo#{backer.id}", class: 'btn btn-mini', data: {toggle:'modal'} do
i.icon-info-sign
td title=backer.project.name
= link_to project_by_slug_path(permalink: backer.project.permalink) do
@@ -127,7 +127,7 @@
- else
| -
.btn-group
= link_to 'javascript:void(0);', :"data-toggle" => 'dropdown', :class => 'btn btn-mini dropdown-toggle' do
= link_to 'javascript:void(0);', data: {toggle: 'dropdown'}, class: 'btn btn-mini dropdown-toggle' do
span.caret
ul.dropdown-menu
li title=("#{t('.no_reward')}" ) = link_to t('.no_reward'), change_reward_adm_backer_path(backer, reward_id: nil), method: :put
@@ -140,7 +140,7 @@
td= backer.state
td.bootstrap-twitter
.btn-group
= link_to 'javascript:void(0);', :"data-toggle" => 'dropdown', :class => 'btn btn-mini dropdown-toggle' do
= link_to 'javascript:void(0);', data: {toggle: 'dropdown'}, class: 'btn btn-mini dropdown-toggle' do
span.caret
ul.dropdown-menu
- if backer.confirmed?
+3 -3
Ver Arquivo
@@ -70,13 +70,13 @@
td= link_to (project.user.moip_login.blank? ? 'Não preenchido' : project.user.moip_login), user_path(project.user, anchor: :settings), target: '_blank'
td= project.display_goal
td= "#{project.display_pledged} (#{project.progress}%)"
td= number_to_currency project.backers.confirmed.sum('payment_service_fee'), :unit => 'R$', :precision => 2, :delimiter => '.'
td= number_to_currency project.backers.confirmed.sum('payment_service_fee'), unit: 'R$', precision: 2, delimiter: '.'
- catarse_fee = Configuration[:catarse_fee].to_f * project.pledged
td
= number_to_currency catarse_fee, :unit => 'R$', :precision => 0, :delimiter => '.'
= number_to_currency catarse_fee, unit: 'R$', precision: 0, delimiter: '.'
br
|(
= number_to_currency project.pledged - catarse_fee, :unit => 'R$', :precision => 0, :delimiter => '.'
= number_to_currency project.pledged - catarse_fee, unit: 'R$', precision: 0, delimiter: '.'
|)
td
= project.display_expires_at
+4 -4
Ver Arquivo
@@ -91,24 +91,24 @@
span.label= project.state
td
.btn-group
= link_to 'javascript:void(0);', :class => 'btn btn-mini dropdown-toggle', :"data-toggle"=> "dropdown" do
= link_to 'javascript:void(0);', class: 'btn btn-mini dropdown-toggle', data: {toggle: "dropdown"} do
b.caret
ul.dropdown-menu
- if project.can_approve?
li
= link_to approve_adm_project_path(project), :method => :put do
= link_to approve_adm_project_path(project), method: :put do
i.icon-ok
= t('.approve')
- if project.can_reject?
li
= link_to reject_adm_project_path(project), :method => :put do
= link_to reject_adm_project_path(project), method: :put do
i.icon-ban-circle
= t('.reject')
- if project.can_push_to_draft?
li
= link_to push_to_draft_adm_project_path(project), :method => :put do
= link_to push_to_draft_adm_project_path(project), method: :put do
i.icon-trash
= t('.send_to_draft')
= paginate @projects
+11 -11
Ver Arquivo
@@ -4,24 +4,24 @@
h1= t('.title')
.filters
.bootstrap-form.clearfix
= form_for adm_users_path, :method => :get, :class => 'form-horizontal' do |f|
= f.hidden_field :order_by, :name => :order_by, :value => params[:order_by]
= form_for adm_users_path, method: :get, class: 'form-horizontal' do |f|
= f.hidden_field :order_by, name: :order_by, value: params[:order_by]
fieldset
.input
= f.label :by_id, t('.id')
= f.text_field :by_id, :class => 'input-small', :name => :by_id, :value => params[:by_id]
= f.text_field :by_id, class: 'input-small', name: :by_id, value: params[:by_id]
.input
= f.label :by_name, t('.name')
= f.text_field :by_name, :class => 'input-small', :name => :by_name, :value => params[:by_name]
= f.text_field :by_name, class: 'input-small', name: :by_name, value: params[:by_name]
.input
= f.label :by_email, t('.email')
= f.text_field :by_email, :class => 'input-small', :name => :by_email, :value => params[:by_email]
= f.text_field :by_email, class: 'input-small', name: :by_email, value: params[:by_email]
.input
= f.label :by_payer_email, t('.payer_email')
= f.text_field :by_payer_email, :class => 'input-small', :name => :by_payer_email, :value => params[:by_payer_email]
= f.text_field :by_payer_email, class: 'input-small', name: :by_payer_email, value: params[:by_payer_email]
.input
= f.label :by_key, t('.key')
= f.text_field :by_key, :name => :by_key, :value => params[:by_key]
= f.text_field :by_key, name: :by_key, value: params[:by_key]
.bootstrap-twitter.input
.submit
= f.submit t('.submit'), class: 'btn btn-success'
@@ -35,10 +35,10 @@
strong= "#{@total_users} "
= t('.total_backers')
| ·
strong= "#{number_to_currency @total_backed, :precision => 0} "
strong= "#{number_to_currency @total_backed, precision: 0} "
= t('.total_backed')
| ·
strong= "#{number_to_currency @total_credits, :precision => 0} "
strong= "#{number_to_currency @total_credits, precision: 0} "
= t('.total_credits')
br
= paginate @users
@@ -63,8 +63,8 @@
tbody
- for user in @users do
tr id=user.id class=cycle("even", "odd")
td= link_to user.id, user_path(user), :target => '_blank'
td= link_to user.name, adm_backers_path(by_user_id: user.id), :target => '_blank'
td= link_to user.id, user_path(user), target: '_blank'
td= link_to user.name, adm_backers_path(by_user_id: user.id), target: '_blank'
td= user.email
td= user.user_total ? user.user_total.sum : 0
td= user.credits
+4 -4
Ver Arquivo
@@ -94,24 +94,24 @@
span.label= project.state
td
.btn-group
= link_to 'javascript:void(0);', :class => 'btn btn-mini dropdown-toggle', :"data-toggle"=> "dropdown" do
= link_to 'javascript:void(0);', class: 'btn btn-mini dropdown-toggle', data: {toggle: "dropdown"} do
b.caret
ul.dropdown-menu
- if project.can_approve?
li
= link_to approve_channels_adm_project_path(project), :method => :put do
= link_to approve_channels_adm_project_path(project), method: :put do
i.icon-ok
= t('.approve')
- if project.can_reject?
li
= link_to reject_channels_adm_project_path(project), :method => :put do
= link_to reject_channels_adm_project_path(project), method: :put do
i.icon-ban-circle
= t('.reject')
- if project.can_push_to_draft?
li
= link_to push_to_draft_channels_adm_project_path(project), :method => :put do
= link_to push_to_draft_channels_adm_project_path(project), method: :put do
i.icon-trash
= t('.send_to_draft')
= paginate @projects
+8 -8
Ver Arquivo
@@ -7,7 +7,7 @@
p= t('.legend_html')
.bootstrap-form
.clearfix
= semantic_form_for @project, :html => { :id => 'project_form' } do |form|
= semantic_form_for @project, html: { id: 'project_form' } do |form|
= form.inputs do
.input
.bootstrap-alert
@@ -17,7 +17,7 @@
= form.label :permalink, "#{t('activerecord.attributes.project.permalink')} *"
.input-prepend.permalink
span.add-on= "#{::Configuration[:base_url]}/"
= form.text_field :permalink, :class => 'permalink'
= form.text_field :permalink, class: 'permalink'
p.inline-hints
= t('.permalink_hint')
@@ -45,14 +45,14 @@
.alert
.important= t('.headline_important')
= form.label :headline, t('formtastic.labels.project.headline')
= form.text_field :headline, { :maxlength => 140 }
= form.text_field :headline, { maxlength: 140 }
p.inline-hints= t('formtastic.hints.project.headline')
.input
.bootstrap-alert
span
.alert
.important= t('.tags_important', :href => "http://www.catarse.me/explore").html_safe
.important= t('.tags_important', href: "http://www.catarse.me/explore").html_safe
= form.label :category, t('.category')
= form.select :category_id, Category.array
p.inline-hints= t('formtastic.hints.project.category')
@@ -61,7 +61,7 @@
.bootstrap-alert
span
.alert
.important= t('.important_html', :link => link_to("MoIP", "http://www.moip.com.br/", :target => :_blank))
.important= t('.important_html', link: link_to("MoIP", "http://www.moip.com.br/", target: :_blank))
= form.label :goal, t('formtastic.labels.project.goal')
= form.text_field :goal
p.inline-hints= t('formtastic.hints.project.goal').html_safe
@@ -115,11 +115,11 @@
.submit
fieldset.accept
= check_box_tag 'accept'
= label_tag 'accept', t('accept_terms_html', :link => link_to(t('terms'), 'http://suporte.catarse.me/knowledgebase/articles/190852-termo-de-uso-canal-asas', :target => :_blank)), :class => 'inline'
= label_tag 'accept', t('accept_terms_html', link: link_to(t('terms'), 'http://suporte.catarse.me/knowledgebase/articles/190852-termo-de-uso-canal-asas', target: :_blank)), class: 'inline'
fieldset
.bootstrap-twitter
.send
= submit_tag t('.submit'), :disabled => true, :id => 'project_submit', :class => 'btn_send'
= submit_tag t('.submit'), disabled: true, id: 'project_submit', class: 'btn_send'
span = t('.send_project')
/= form.submit t('.submit'), :disabled => true, :class => 'btn-large btn-block btn btn-warning', :id => 'project_submit', :style => 'width: 100%;'
/= form.submit t('.submit'), disabled: true, class: 'btn-large btn-block btn btn-warning', id: 'project_submit', style: 'width: 100%;'
.clearfix
+1 -1
Ver Arquivo
@@ -1,5 +1,5 @@
- content_for :js_templates do
= render :partial => 'project'
= render partial: 'project'
#page_content
.container
+2 -2
Ver Arquivo
@@ -52,10 +52,10 @@ html lang="#{I18n.locale}" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http:/
ul
li= link_to t('footer.links.about'), about_path
li= link_to t('footer.links.faq'), 'http://suporte.catarse.me/', :target => '_blank'
li= link_to t('footer.links.faq'), 'http://suporte.catarse.me/', target: '_blank'
li= link_to t('footer.links.terms'), t('footer.links.terms_link')
li= link_to t('footer.links.policy'), t('footer.links.policy_link')
li= link_to t('footer.links.contact'), 'http://suporte.catarse.me/', :target => '_blank'
li= link_to t('footer.links.contact'), 'http://suporte.catarse.me/', target: '_blank'
.opendata
h3= t('footer.titles.social')
.twitter
+3 -3
Ver Arquivo
@@ -12,14 +12,14 @@
- if can? :update, reward, :maximum_backers
= f.input :maximum_backers
.bootstrap-twitter
= f.submit :class => 'btn'
= f.submit class: 'btn'
.clearfix.bootstrap-twitter
= link_to [@project, reward], class: 'btn btn-danger', method: :delete, confirm: 'Are you sure?' do
i.icon-trash.icon-white
- if can?(:update, reward)
.bootstrap-twitter
= link_to "#reward#{reward.id}Editor", :class => 'edit_reward btn btn-mini pull-right btn-primary' do
= link_to "#reward#{reward.id}Editor", class: 'edit_reward btn btn-mini pull-right btn-primary' do
i.icon-pencil.icon-white
@@ -28,7 +28,7 @@
span.icon.sold_out
- else
span.icon.avaliable
h2= t('projects.rewards.reward_title', :minimum => reward.display_minimum).html_safe
h2= t('projects.rewards.reward_title', minimum: reward.display_minimum).html_safe
em= pluralize(reward.backers.confirmed.count, t('backer_singular'), t('backer_plural'))
.clearfix
p
+2 -2
Ver Arquivo
@@ -1,6 +1,6 @@
- if can? :update, @project
.bootstrap-form
= semantic_form_for [@project, Update.new(:user_id => current_user.id)] do |form|
= semantic_form_for [@project, Update.new(user_id: current_user.id)] do |form|
= form.inputs do
= form.input :title, as: :string, label: t('projects.project_updates.title')
= form.input :comment, as: :text, label: t('projects.project_updates.comment'), input_html: {rows: 10}
@@ -32,4 +32,4 @@
.loading_updates.hide= image_tag "loading.gif"
.updates_wrapper
= render :template => 'updates/index'
= render template: 'updates/index'
@@ -2,18 +2,18 @@
.resume_about
= image_tag "catarse/box_#{I18n.locale}.jpg"
.bootstrap-form
= form_tag(guidelines_path, :method => :get, :id => 'guidelines_form') do
= form_tag(guidelines_path, method: :get, id: 'guidelines_form') do
fieldset
.bootstrap-twitter
.button
= link_to t('.guidelines'), guidelines_path, :class=>'btn_explore'
= link_to t('.guidelines'), guidelines_path, class:'btn_explore'
span = t('.guidelines_subtitle')
.project_info
- if current_user
- if @recommended_projects
= render :partial => "project_header", :locals => {:title => t('projects.recommended_header.suggest_for_you'), :project => @recommended_projects.last} if @recommended_projects
= render partial: "project_header", locals: {title: t('projects.recommended_header.suggest_for_you'), project: @recommended_projects.last} if @recommended_projects
- else
= render :partial => "project_header", :locals => {:title => t('projects.recommended_header.highlight_project'), :project => @fourth_project} if @fourth_project
= render partial: "project_header", locals: {title: t('projects.recommended_header.highlight_project'), project: @fourth_project} if @fourth_project
- else
= render :partial => "project_header", :locals => {:title => t('projects.recommended_header.highlight_project'), :project => @fourth_project} if @fourth_project
= render partial: "project_header", locals: {title: t('projects.recommended_header.highlight_project'), project: @fourth_project} if @fourth_project
.clearfix
+2 -2
Ver Arquivo
@@ -7,8 +7,8 @@
a.close href='javascript:CATARSE.router.back()' X
#project_box_embed
iframe frameborder='0' height=box_height width=box_width src=embed_project_path(@project)
form.html= text_area_tag 'project_box_embed_html', '<iframe frameborder="0" height="' + box_height + '" src="' + embed_project_url(@project) + '" width="' + box_width + '"></iframe>', :readonly => true
form.html= text_area_tag 'project_box_embed_html', '<iframe frameborder="0" height="' + box_height + '" src="' + embed_project_url(@project) + '" width="' + box_width + '"></iframe>', readonly: true
#project_video_embed
iframe frameborder='0' height=video_height width=video_width src=video_embed_project_path(@project)
form.html= text_area_tag 'project_video_embed_html', '<iframe frameborder="0" height="' + video_height + '" src="' + video_embed_project_url(@project) + '" width="' + video_width + '"></iframe>', :readonly => true
form.html= text_area_tag 'project_video_embed_html', '<iframe frameborder="0" height="' + video_height + '" src="' + video_embed_project_url(@project) + '" width="' + video_width + '"></iframe>', readonly: true
.clearfix
+7 -7
Ver Arquivo
@@ -1,6 +1,6 @@
/ Temporaly using channels banner
= render :partial => 'recommended_header'
= render :partial => 'channels/projects/banner'
= render partial: 'recommended_header'
= render partial: 'channels/projects/banner'
#page_content
.container
.main
@@ -9,9 +9,9 @@
.title
h2= t('sections.selection.title')
.projects
= render :partial => 'project', :locals => {:project => @first_project, :custom_class => 'first' } if @first_project
= render :partial => 'project', :locals => {:project => @second_project } if @second_project
= render :partial => 'project', :locals => {:project => @third_project, :custom_class => 'last' } if @third_project
= render partial: 'project', locals: {project: @first_project, custom_class: 'first' } if @first_project
= render partial: 'project', locals: {project: @second_project } if @second_project
= render partial: 'project', locals: {project: @third_project, custom_class: 'last' } if @third_project
.explore_link
hr
= link_to t('main.links.selected'), explore_path(anchor: :recommended)
@@ -22,7 +22,7 @@
h2= t('sections.expiring.title')
.projects
- @expiring.each_with_index do |item,i|
== render 'project', :project => item, :custom_class => ((@expiring.length == (i+1) ? 'last' : false) || (i==0 ? 'first' : false))
== render 'project', project: item, custom_class: ((@expiring.length == (i+1) ? 'last' : false) || (i==0 ? 'first' : false))
.explore_link
hr
= link_to t('main.links.expiring'), explore_path(anchor: :expiring)
@@ -33,7 +33,7 @@
h2= t('sections.recents.title')
.projects
- @recent.each_with_index do |item,i|
== render 'project', :project => item, :custom_class => ((@recent.length == (i+1) ? 'last' : false) || (i==0 ? 'first' : false))
== render 'project', project: item, custom_class: ((@recent.length == (i+1) ? 'last' : false) || (i==0 ? 'first' : false))
.explore_link
hr
= link_to t('main.links.recents'), explore_path(anchor: :recent)
+18 -18
Ver Arquivo
@@ -7,7 +7,7 @@
p= t('.legend_html')
.bootstrap-form
.clearfix
= semantic_form_for @project, :html => { :id => 'project_form' } do |form|
= semantic_form_for @project, html: { id: 'project_form' } do |form|
= form.inputs do
.input.control-group.error
.input
@@ -18,7 +18,7 @@
= form.label :permalink, "#{t('activerecord.attributes.project.permalink')} *"
.input-prepend.permalink
span.add-on= "#{::Configuration[:base_url]}/"
= form.text_field :permalink, :class => "permalink #{'error' if @project.errors[:permalink].present?}"
= form.text_field :permalink, class: "permalink #{'error' if @project.errors[:permalink].present?}"
p.inline-hints
= t('.permalink_hint')
@@ -29,7 +29,7 @@
.alert
.important= t('.name_important')
= form.label :name, t('formtastic.labels.project.name')
= form.text_field :name, :class => "#{'error' if @project.errors[:name].present?}"
= form.text_field :name, class: "#{'error' if @project.errors[:name].present?}"
p.inline-hints= t('formtastic.hints.project.name')
.input
@@ -38,7 +38,7 @@
.alert
.important= t('.about_important')
= form.label :about, t('formtastic.labels.project.about')
= form.text_area :about, :class => "#{'error' if @project.errors[:about].present?}"
= form.text_area :about, class: "#{'error' if @project.errors[:about].present?}"
p.inline-hints= t('formtastic.hints.project.about')
.input
@@ -47,25 +47,25 @@
.alert
.important= t('.headline_important')
= form.label :headline, t('formtastic.labels.project.headline')
= form.text_field :headline, { :maxlength => 140, :class => "#{'error' if @project.errors[:headline].present?}" }
= form.text_field :headline, { maxlength: 140, class: "#{'error' if @project.errors[:headline].present?}" }
p.inline-hints= t('formtastic.hints.project.headline')
.input
.bootstrap-alert
span
.alert
.important= t('.tags_important', :href => "http://www.catarse.me/explore").html_safe
.important= t('.tags_important', href: "http://www.catarse.me/explore").html_safe
= form.label :category, t('.category')
= form.select :category_id, Category.array, :class => "#{'error' if @project.errors[:category].present?}"
= form.select :category_id, Category.array, class: "#{'error' if @project.errors[:category].present?}"
p.inline-hints= t('formtastic.hints.project.category')
.input
.bootstrap-alert
span
.alert
.important= t('.important_html', :link => link_to("MoIP", "http://www.moip.com.br/", :target => :_blank))
.important= t('.important_html', link: link_to("MoIP", "http://www.moip.com.br/", target: :_blank))
= form.label :goal, t('formtastic.labels.project.goal')
= form.text_field :goal, :class => "#{'error' if @project.errors[:goal].present?}"
= form.text_field :goal, class: "#{'error' if @project.errors[:goal].present?}"
p.inline-hints= t('formtastic.hints.project.goal').html_safe
.input
@@ -75,7 +75,7 @@
.important= t('.online_days_important')
= form.label :online_days, t('formtastic.labels.project.expires_at')
.input-append
= form.text_field :online_days, :class => "#{'error' if @project.errors[:online_days].present?}"
= form.text_field :online_days, class: "#{'error' if @project.errors[:online_days].present?}"
span.add-on= t('days')
p.inline-hints= t('formtastic.hints.project.online_days')
@@ -85,7 +85,7 @@
.alert
.important= t('.video_important')
= form.label :video_url, t('formtastic.labels.project.video_url')
= form.text_field :video_url, :class => "#{'error' if @project.errors[:video_url].present?}"
= form.text_field :video_url, class: "#{'error' if @project.errors[:video_url].present?}"
p.inline-hints= t('formtastic.hints.project.video_url').html_safe
.input
@@ -94,7 +94,7 @@
.alert
.important= t('.more_links_important')
= form.label :more_links, t('formtastic.labels.project.more_links')
= form.text_area :more_links, :class => "#{'error' if @project.errors[:more_links].present?}"
= form.text_area :more_links, class: "#{'error' if @project.errors[:more_links].present?}"
p.inline-hints= t('formtastic.hints.project.more_links')
.input
@@ -103,7 +103,7 @@
.alert
.important= t('.first_backers_important')
= form.label :first_backers, t('formtastic.labels.project.first_backers')
= form.text_area :first_backers, :class => "#{'error' if @project.errors[:first_backers].present?}"
= form.text_area :first_backers, class: "#{'error' if @project.errors[:first_backers].present?}"
p.inline-hints= t('formtastic.hints.project.first_backers')
.input
@@ -112,7 +112,7 @@
.alert
.important= t('.how_know_important')
= form.label :how_know, t('formtastic.labels.project.how_know')
= form.text_area :how_know, :class => "#{'error' if @project.errors[:how_know].present?}"
= form.text_area :how_know, class: "#{'error' if @project.errors[:how_know].present?}"
@@ -120,15 +120,15 @@
.submit
fieldset.accept
= form.check_box :accepted_terms
= form.label :accepted_terms, t('accept_terms_html', :link => link_to(t('terms'), t('footer.links.terms_link'), :target => :_blank)), :class => 'inline'
= form.label :accepted_terms, t('accept_terms_html', link: link_to(t('terms'), t('footer.links.terms_link'), target: :_blank)), class: 'inline'
- if @project.errors[:accepted_terms].present?
.bootstrap-twitter
.bootstrap-twitter
p.text-error= @project.errors[:accepted_terms].to_sentence
fieldset
.bootstrap-twitter
.send
= submit_tag t('.submit'), :id => 'project_submit', :class => 'btn_send'
= submit_tag t('.submit'), id: 'project_submit', class: 'btn_send'
span = t('.send_project')
/= form.submit t('.submit'), :disabled => true, :class => 'btn-large btn-block btn btn-warning', :id => 'project_submit', :style => 'width: 100%;'
/= form.submit t('.submit'), disabled: true, class: 'btn-large btn-block btn btn-warning', id: 'project_submit', style: 'width: 100%;'
.clearfix
+23 -23
Ver Arquivo
@@ -1,20 +1,20 @@
- content_for :js_templates do
= render :partial => 'backer'
= render :partial => 'project_templates'
= render partial: 'backer'
= render partial: 'project_templates'
- if can?(:update, @project)
= render :partial => 'sort_rewards'
= render partial: 'sort_rewards'
= content_for :meta_tags do
- if @update
meta name="description" content=@update.title
meta property="og:title" content=@update.title
meta property="og:description" content=@update.comment
meta property="og:url" content=project_by_slug_url(@project.permalink, :update_id => @update.id, :locale => I18n.locale)
meta property="og:url" content=project_by_slug_url(@project.permalink, update_id: @update.id, locale: I18n.locale)
- else
meta name="description" content=@project.headline
meta property="og:title" content=@project.name
meta property="og:description" content=@project.headline
meta property="og:url" content=project_by_slug_url(@project.permalink, :locale => I18n.locale)
meta property="og:url" content=project_by_slug_url(@project.permalink, locale: I18n.locale)
meta property="og:type" content='cause'
meta property="og:image" content=@project.display_image
meta property="og:site_name" content=::Configuration[:company_name]
@@ -43,29 +43,29 @@
#project_description[data-project=@project.to_json]
.project_image
= image_tag @project.display_image, :width=>'85px', :height => '67px'
= image_tag @project.display_image, width:'85px', height: '67px'
.section_header
h1= @project.name
h4= t('projects.project_header.without_city', :category_name => link_to(@project.category, explore_path(:anchor => @project.category.to_s.parameterize)), :author => link_to(@project.user.display_name, user_path(@project.user))).html_safe
h4= t('projects.project_header.without_city', category_name: link_to(@project.category, explore_path(anchor: @project.category.to_s.parameterize)), author: link_to(@project.user.display_name, user_path(@project.user))).html_safe
.tab_container
nav#project_menu
= link_to '#about', :id => 'about_link', :class => 'selected' do
= link_to '#about', id: 'about_link', class: 'selected' do
= t('.menu.about')
= link_to '#updates', :id => 'updates_link' do
= link_to '#updates', id: 'updates_link' do
= t('.menu.updates')
span.count=" (#{@project.updates.count})"
= link_to '#backers', :id => 'backers_link' do
= link_to '#backers', id: 'backers_link' do
= t('.menu.backers')
span.count=" (#{@project.total_backers})"
= link_to '#comments', :id => 'comments_link' do
= link_to '#comments', id: 'comments_link' do
= t('.menu.comments')
| &nbsp; (
fb:comments-count href="#{request.url}"
| )
- if can? :update, @project
= link_to '#edit', :id => 'edit_link' do
= link_to '#edit', id: 'edit_link' do
= t('.menu.edit')
= link_to '#reports', :id => 'reports_link' do
= link_to '#reports', id: 'reports_link' do
= t('.menu.reports')
.main
#project_content
@@ -91,7 +91,7 @@
em= t('statistics.backers.subtitle')
.item.goal
p= @project.display_pledged
em= t('statistics.goal.subtitle', :total => @project.display_goal).html_safe
em= t('statistics.goal.subtitle', total: @project.display_goal).html_safe
.item.time
- if @project.draft? || @project.rejected?
p= @project.online_days
@@ -105,35 +105,35 @@
= t("projects.back_project.display_status.#{@project.display_status}", goal: @project.display_goal, date: @project.display_expires_at)
- if @project.online? && (@project.expires_at > Time.now)
#pledge
= form_tag(new_project_backer_path(@project), :method => :get, :id => 'back_project_form') do
= form_tag(new_project_backer_path(@project), method: :get, id: 'back_project_form') do
fieldset
= submit_tag t('projects.back_project.submit'), :disabled => (not @project.online?)
= submit_tag t('projects.back_project.submit'), disabled: (not @project.online?)
#creator_profile
h3= t('project_by')
.avatar = @project.user.display_image_html :width => 80, :height => 80
.avatar = @project.user.display_image_html width: 80, height: 80
.personal_info
p.name
= link_to @project.user.display_name, user_path(@project.user)
#bio
p= @project.user.bio
#city
p.backer= t('count_backed_projects', :total => @project.user.total_backs)
p.backer= t('count_backed_projects', total: @project.user.total_backs)
p.city
| #{@project.user.address_city}
.user_social
ul
- if @project.user.facebook_link
li
= link_to "Perfil no facebook", @project.user.facebook_link, :target => '_blank', :class=> 'facebook'
= link_to "Perfil no facebook", @project.user.facebook_link, target: '_blank', class: 'facebook'
- if @project.user.twitter
li
= link_to "Perfil no twitter", @project.user.twitter_link, :target => '_blank', :class=> 'twitter'
= link_to "Perfil no twitter", @project.user.twitter_link, target: '_blank', class: 'twitter'
- if @project.user.email
li
= mail_to @project.user.email, @project.user.email, :target => '_blank', :class=> 'email'
= mail_to @project.user.email, @project.user.email, target: '_blank', class: 'email'
- if @project.user.other_link
li.other
= link_to @project.user.other_link, @project.user.other_link, :target => '_blank'
= link_to @project.user.other_link, @project.user.other_link, target: '_blank'
.clearfix
- if can?(:update, @project)
@@ -150,7 +150,7 @@
= f.input :minimum_value
= f.input :description
= f.input :maximum_backers
= f.submit :class => 'btn'
= f.submit class: 'btn'
#rewards= render 'project_rewards'
.clearfix
+28 -28
Ver Arquivo
@@ -7,59 +7,59 @@
p= t('.legend_html').html_safe
.clearfix
.bootstrap-form
= form_tag(send_mail_projects_path, :id => 'start_project_form') do
= form_tag(send_mail_projects_path, id: 'start_project_form') do
fieldset
.input
= image_tag "catarse/icon_heart.png", :class => 'heart'
= image_tag "catarse/icon_heart.png", class: 'heart'
= label_tag 'how_much_you_need', t('.how_much_you_need')
.input-prepend
span.add-on R$
= text_field_tag 'how_much_you_need'
p.inline-hints.much= t('.how_much_hint_html', :href => "http://blog.catarse.me/sua-campanha-no-catarse-precisa-de-um-empurrazinho/")
p.inline-hints.much= t('.how_much_hint_html', href: "http://blog.catarse.me/sua-campanha-no-catarse-precisa-de-um-empurrazinho/")
.bootstrap-alert
span
.alert
.important= t('.how_much_important', :link => link_to("MoIP", "http://www.moip.com.br/", :target => :_blank))
.important= t('.how_much_important', link: link_to("MoIP", "http://www.moip.com.br/", target: :_blank))
.input
= image_tag "catarse/icon_datestart.png", :class => 'date'
= image_tag "catarse/icon_datestart.png", class: 'date'
= label_tag 'days', t('.days')
= text_field_tag 'days'
.bootstrap-alert
span
.alert
.important= t('.days_important')
.important= t('.days_important')
p.inline-hints= t('.days_hint')
.input
= image_tag "catarse/icon_tag.png", :class => 'tag'
= image_tag "catarse/icon_tag.png", class: 'tag'
= label_tag 'category', t('.category')
= select_tag 'category', options_from_collection_for_select(Category.all, "name", "name"), include_blank: true
.bootstrap-alert
span
.alert
.important= t('.tags_important', :href => "http://www.catarse.me/explore").html_safe
.important= t('.tags_important', href: "http://www.catarse.me/explore").html_safe
p.inline-hints= t('.tags_hint')
.input
= image_tag "catarse/icon_calc.png", :class => 'calc'
= image_tag "catarse/icon_calc.png", class: 'calc'
= label_tag 'about', t('.about')
= text_area_tag 'about'
.bootstrap-alert
span
.alert
.important= t('.about_important')
.important= t('.about_important')
p.inline-hints= t('.about_hint')
.input
= image_tag "catarse/icon_gift.png", :class => 'gift'
= image_tag "catarse/icon_gift.png", class: 'gift'
= label_tag 'rewards', t('.rewards')
= text_area_tag 'rewards'
.bootstrap-alert
span
.alert
.important= t('.rewards_important')
.important= t('.rewards_important')
p.inline-hints= t('.rewards_hint')
.input
= image_tag "catarse/icon_vimeo.png", :class => 'video'
= image_tag "catarse/icon_vimeo.png", class: 'video'
= label_tag 'video', t('.video')
.input-prepend
span.add-on http://
@@ -67,40 +67,40 @@
.bootstrap-alert
span
.alert
.important= t('.video_important')
.important= t('.video_important')
p.inline-hints= t('.video_hint')
.input
= image_tag "catarse/icon_social.png", :class => 'social'
= label_tag 'facebook', t('.social'), :class => 'chanels'
= image_tag "catarse/icon_social.png", class: 'social'
= label_tag 'facebook', t('.social'), class: 'chanels'
.bootstrap-alert
span
.alert
.important= t('.social_important')
.important= t('.social_important')
.input-prepend
span.add-on Facebook
= text_field_tag 'facebook'
= text_field_tag 'facebook'
p.inline-hints= t('.facebook_hint')
.input-prepend
span.add-on Twitter
= text_field_tag 'twitter'
= text_field_tag 'twitter'
p.inline-hints= t('.twitter_hint')
.input
= image_tag "catarse/icon_link.png", :class => 'link'
= image_tag "catarse/icon_link.png", class: 'link'
= label_tag 'links', t('.links')
= text_area_tag 'links'
.bootstrap-alert
span
.alert
.important= t('.links_important')
.important= t('.links_important')
p.inline-hints= t('.links_hint')
.input
= image_tag "catarse/icon_logo.png", :class => 'logo'
= image_tag "catarse/icon_logo.png", class: 'logo'
= label_tag 'know_us_via', t('.know_us_via')
= text_area_tag 'know_us_via'
.bootstrap-alert
span
.alert
.important= t('.knowus_important')
.important= t('.knowus_important')
.input
= label_tag 'contact', t('.contact')
.input-prepend
@@ -111,11 +111,11 @@
.submit
fieldset.accept
= check_box_tag 'accept'
|
= label_tag 'accept', t('accept_terms_html', :link => link_to(t('terms'), terms_path, target: '_blank')), :class => 'inline'
|
= label_tag 'accept', t('accept_terms_html', link: link_to(t('terms'), terms_path, target: '_blank')), class: 'inline'
fieldset
.bootstrap-twitter
.send
= submit_tag t('.submit'), :disabled => true, :class => 'btn_send'
span = t('.send_project')
= submit_tag t('.submit'), disabled: true, class: 'btn_send'
span = t('.send_project')
.clearfix
+4 -4
Ver Arquivo
@@ -1,8 +1,8 @@
#video_embed
iframe src="#{@project.display_video_embed_url}" width="364" height="200"
h1= link_to @project.name, project_by_slug_path(permalink: @project.permalink), :target => '__blank'
h1= link_to @project.name, project_by_slug_path(permalink: @project.permalink), target: '__blank'
#video_embed_footer
h2 #{t('.a_project_by_html', :link => link_to(@project.user.display_name, user_path(@project.user), :target => '__blank'))}
h2 #{t('.a_project_by_html', link: link_to(@project.user.display_name, user_path(@project.user), target: '__blank'))}
#platform_link
= link_to root_path, :target => '__blank' do
= image_tag "logo.png", :title => ::Configuration[:company_name]
= link_to root_path, target: '__blank' do
= image_tag "logo.png", title: ::Configuration[:company_name]
+4 -4
Ver Arquivo
@@ -6,19 +6,19 @@
- for update in @project.updates.includes(:project).order('created_at DESC')
li
.flag
.time= l(update.created_at, :format => :updates)
.time= l(update.created_at, format: :updates)
.clearfix
h3= link_to "#updates/#{update.id}", :id => "updates/#{update.id}" do
h3= link_to "#updates/#{update.id}", id: "updates/#{update.id}" do
= update.title
.comment= raw(update.comment_html)
.midia
.social
.update_share
- url = project_by_slug_url(@project.permalink, :update_id => update.id, :locale => I18n.locale)
- url = project_by_slug_url(@project.permalink, update_id: update.id, locale: I18n.locale)
.twitter_share= render_twitter text: "#{update.title}", url: url
.facebook_share= render_facebook_like href: url, width: '360'
- if can? :manage, update
= link_to t('projects.project_updates.destroy'), project_update_path(:project_id => @project.id, :id => update.id), :confirm => t('projects.project_updates.destroy_confirmation'), :remote => true, :method => :delete, :class => 'destroy_update'
= link_to t('projects.project_updates.destroy'), project_update_path(project_id: @project.id, id: update.id), confirm: t('projects.project_updates.destroy_confirmation'), remote: true, method: :delete, class: 'destroy_update'
.deleting_update.hide= image_tag "loading.gif"
+2 -2
Ver Arquivo
@@ -65,6 +65,6 @@ script type="text/template" id="user_back_template"
.tell_about
p= t('tell_about_this_back')
ul
li= link_to image_tag('catarse/facebook_black_icon.png'), "http://www.facebook.com/sharer.php?u=<%= encodeURIComponent(project['full_uri']) %>&t=#{t('share_my_backs')}<%= encodeURIComponent(project['name']) %>".html_safe, :target => '_blank'
li= link_to image_tag('catarse/twitter_black_icon.png'), "http://twitter.com/share?text=#{t('share_my_backs')}<%= encodeURIComponent(project['name']) %>&url=<%= encodeURIComponent(project['full_uri']) %>".html_safe, :target => '_blank'
li= link_to image_tag('catarse/facebook_black_icon.png'), "http://www.facebook.com/sharer.php?u=<%= encodeURIComponent(project['full_uri']) %>&t=#{t('share_my_backs')}<%= encodeURIComponent(project['name']) %>".html_safe, target: '_blank'
li= link_to image_tag('catarse/twitter_black_icon.png'), "http://twitter.com/share?text=#{t('share_my_backs')}<%= encodeURIComponent(project['name']) %>&url=<%= encodeURIComponent(project['full_uri']) %>".html_safe, target: '_blank'
.clearfix
+28 -28
Ver Arquivo
@@ -5,41 +5,41 @@
.bootstrap-form
= semantic_form_for @user do |f|
= f.inputs do
p= f.input :uploaded_image, :as => :file, :label => t('.submit_text')
p= f.input :uploaded_image, as: :file, label: t('.submit_text')
= f.actions do
.bootstrap-twitter
p= f.action :submit, :button_html => {:value => t('.submit'), :class => 'btn', :id => 'image_upload_btn'}
p= f.action :submit, button_html: {value: t('.submit'), class: 'btn', id: 'image_upload_btn'}
li
#gravatar_hint.alert.alert-info
= link_to 'http://gravatar.com/', :target => :_blank do
= image_tag 'gravatar.png', :id => 'gravatar_logo'
p= t('.gravatar_hint_html', :link => link_to('Gravatar', 'http://gravatar.com/', :target => :_blank))
= link_to 'http://gravatar.com/', target: :_blank do
= image_tag 'gravatar.png', id: 'gravatar_logo'
p= t('.gravatar_hint_html', link: link_to('Gravatar', 'http://gravatar.com/', target: :_blank))
.clearfix
- unless @user.has_facebook_authentication?
#my_facebook
h1= t('.my_facebook')
ul
li
= link_to t('layouts.login.login_with_facebook'), user_omniauth_authorize_path(provider: 'facebook', locale: nil), :class => 'facebook_start'
= link_to t('layouts.login.login_with_facebook'), user_omniauth_authorize_path(provider: 'facebook', locale: nil), class: 'facebook_start'
#my_data
h1= t('.my_data')
ul
li
.bootstrap-form
= semantic_form_for @user, :html => {:method => :put, id: 'user_form'} do |f|
= semantic_form_for @user, html: {method: :put, id: 'user_form'} do |f|
.profile
= f.input :id, :as => :string, :input_html => { :disabled => 'disabled'}
= f.input :full_name, :required => true, :as => :string
= f.input :cpf, :as => :string, :input_html => {:autocomplete => 'off'}, label: (t('activerecord.attributes.user.cpf') + link_to(t('activerecord.attributes.user.cpf_hint'), 'http://suporte.catarse.me/knowledgebase/articles/162312-o-catarse-emite-nota-fiscal', {title: t('activerecord.attributes.user.cpf_hint_title') })).html_safe
= f.input :state_inscription, :as => :string
= f.input :name, :required => false, :as => :string
= f.input :address_street, :as => :string
= f.input :address_number, :as => :string
= f.input :address_complement, :required => false, :as => :string
= f.input :address_neighbourhood, :as => :string
= f.input :address_zip_code, :as => :string, :input_html => {:autocomplete => 'off'}
= f.input :address_city, :as => :string
= f.input :address_state, :as => :select, :collection => State.array
= f.input :id, as: :string, input_html: { disabled: 'disabled'}
= f.input :full_name, required: true, as: :string
= f.input :cpf, as: :string, input_html: {autocomplete: 'off'}, label: (t('activerecord.attributes.user.cpf') + link_to(t('activerecord.attributes.user.cpf_hint'), 'http://suporte.catarse.me/knowledgebase/articles/162312-o-catarse-emite-nota-fiscal', {title: t('activerecord.attributes.user.cpf_hint_title') })).html_safe
= f.input :state_inscription, as: :string
= f.input :name, required: false, as: :string
= f.input :address_street, as: :string
= f.input :address_number, as: :string
= f.input :address_complement, required: false, as: :string
= f.input :address_neighbourhood, as: :string
= f.input :address_zip_code, as: :string, input_html: {autocomplete: 'off'}
= f.input :address_city, as: :string
= f.input :address_state, as: :select, collection: State.array
.socialmidia
.div
= f.label :twitter, t('.twitter')
@@ -51,29 +51,29 @@
= f.label :other_link, t('.other_link')
= f.text_field :other_link
= f.input :moip_login, label: (t('activerecord.attributes.user.moip_login') + ' ' + link_to(t('activerecord.attributes.user.moip_login_hint'), "http://suporte.catarse.me/knowledgebase/articles/153570-como-criar-uma-conta-no-moip")).html_safe
= f.input :phone_number, :required => false, :as => :string
= f.input :email, :as => :string
= f.input :phone_number, required: false, as: :string
= f.input :email, as: :string
= hidden_field_tag 'id', @user.id
= f.input :newsletter, as: :boolean, label: t('.newsletter')
= f.input :bio, :hint => t('.bio_limit'), :as => :text, :input_html => { :rows => 5, :cols => 20, :maxlength => 140 }
= f.input :bio, hint: t('.bio_limit'), as: :text, input_html: { rows: 5, cols: 20, maxlength: 140 }
.bootstrap-twitter
p= f.submit t('.update_social_info'), :class => 'btn', :id => "user_submit"
p= f.submit t('.update_social_info'), class: 'btn', id: "user_submit"
#change_password
h1= t('.change_password')
ul
li
.bootstrap-form
= form_for(@user, :url => {:action => "update_password"}, :html => { :method => :put, :class => 'skip_feed_event', id: 'password_form' }) do |f|
= form_for(@user, url: {action: "update_password"}, html: { method: :put, class: 'skip_feed_event', id: 'password_form' }) do |f|
span.hint= t('.current_password_hint').html_safe
br
.div
= f.label :current_password
= f.password_field :current_password, :class=>'empty'
= f.password_field :current_password, class:'empty'
.div
= f.label :password, t('passwords.edit.label_new_password')
= f.password_field :password, :class=>'empty'
= f.password_field :password, class:'empty'
.div
= f.label :password_confirmation
= f.password_field :password_confirmation, :class=>'empty'
= f.password_field :password_confirmation, class:'empty'
.bootstrap-twitter
p= f.submit 'OK', :class => 'btn', id: 'password_submit'
p= f.submit 'OK', class: 'btn', id: 'password_submit'
+2 -2
Ver Arquivo
@@ -51,8 +51,8 @@ script type="text/template" id="user_project_template"
.tell_about
p= t('tell_about_this_project')
ul
li= link_to image_tag('catarse/facebook_black_icon.png'), "http://www.facebook.com/sharer.php?u=<%= encodeURIComponent(full_uri) %>&t=#{t('share_my_projects')}<%= encodeURIComponent(name) %>".html_safe, :target => '_blank'
li= link_to image_tag('catarse/twitter_black_icon.png'), "http://twitter.com/share?text=#{t('share_my_projects')}<%= encodeURIComponent(name) %>&url=<%= encodeURIComponent(full_uri) %>".html_safe, :target => '_blank'
li= link_to image_tag('catarse/facebook_black_icon.png'), "http://www.facebook.com/sharer.php?u=<%= encodeURIComponent(full_uri) %>&t=#{t('share_my_projects')}<%= encodeURIComponent(name) %>".html_safe, target: '_blank'
li= link_to image_tag('catarse/twitter_black_icon.png'), "http://twitter.com/share?text=#{t('share_my_projects')}<%= encodeURIComponent(name) %>&url=<%= encodeURIComponent(full_uri) %>".html_safe, target: '_blank'
.actions
.bootstrap-twitter
a href="<%= url %>#edit" class="btn"
+1 -1
Ver Arquivo
@@ -20,4 +20,4 @@
= u.input :user_id, as: :hidden
= u.input :notification_type_id, as: :hidden
p= f.submit t('users.current_user_fields.update_social_info'), :class => 'btn', :id => "unsubscribe_submit"
p= f.submit t('users.current_user_fields.update_social_info'), class: 'btn', id: "unsubscribe_submit"
+14 -14
Ver Arquivo
@@ -26,26 +26,26 @@
ul
- if can? :manage, @user
li.email
= mail_to @user.email, @user.email, :target => '_blank'
= mail_to @user.email, @user.email, target: '_blank'
- if @user.facebook_link
li.facebook
= link_to t('.user_social.facebook'), @user.facebook_link, :target => '_blank'
= link_to t('.user_social.facebook'), @user.facebook_link, target: '_blank'
- if @user.twitter
li.twitter
= link_to t('.user_social.twitter'), @user.twitter_link, :target => '_blank'
= link_to t('.user_social.twitter'), @user.twitter_link, target: '_blank'
- if @user.other_link
li.other
= link_to @user.other_link, @user.other_link, :target => '_blank'
= link_to @user.other_link, @user.other_link, target: '_blank'
.tab_container
nav#user_profile_menu
= link_to t('.tabs.backed_projects'), '#backs', :id => 'backed_projects_link', :class => 'selected'
= link_to t('.tabs.created_projects'), '#projects', :id => 'created_projects_link'
/ = link_to t('.tabs.comments'), '#comments', :id => 'comments_link'
= link_to t('.tabs.backed_projects'), '#backs', id: 'backed_projects_link', class: 'selected'
= link_to t('.tabs.created_projects'), '#projects', id: 'created_projects_link'
/ = link_to t('.tabs.comments'), '#comments', id: 'comments_link'
- if can? :manage, @user
= link_to t('.tabs.credits'), '#credits', :id => 'credits_link'
= link_to t('.tabs.settings'), '#settings', :id => 'settings_link'
= link_to t('.tabs.unsubscribes'), '#unsubscribes', :id => 'unsubscribes_link'
= link_to t('.tabs.credits'), '#credits', id: 'credits_link'
= link_to t('.tabs.settings'), '#settings', id: 'settings_link'
= link_to t('.tabs.unsubscribes'), '#unsubscribes', id: 'unsubscribes_link'
.clearfix
#user_profile_content
#user_backed_projects.content
@@ -57,7 +57,7 @@
= render 'current_user_fields'
#user_credits.content.hide
.current_credits
p= t('credits.index.current_credits_html', :credits => @user.display_credits)
p= t('credits.index.current_credits_html', credits: @user.display_credits)
.table_title
p= I18n.t('credits.index.refunds_title')
@@ -72,7 +72,7 @@
- @credits.each do |credit|
tr[id="back_#{credit.id}"]
td.project_name
= link_to credit.project.name, credit.project, :class => 'link_project'
= link_to credit.project.name, credit.project, class: 'link_project'
td.date= I18n.l(credit.created_at.to_date)
td.value= credit.display_value
td.term= I18n.l(credit.refund_deadline.to_date)
@@ -93,9 +93,9 @@
.modal-footer
button type='button' data-dismiss="modal" class="btn"
= t('credits.modal.reject_btn')
= link_to request_refund_user_backer_path(@user, credit), :class => 'btn', :'data-dimiss' => 'modal' do
= link_to request_refund_user_backer_path(@user, credit), class: 'btn', data: {dismiss: 'modal'} do
= t('credits.modal.accept_btn')
= link_to t('credits.index.request_refund'), "#requestRefundModal#{credit.id}", :'data-toggle' => 'modal', :class => 'link_project'
= link_to t('credits.index.request_refund'), "#requestRefundModal#{credit.id}", data: {toggle: 'modal'}, class: 'link_project'
.bootstrap-alert
.alert.alert-info
= t('credits.index.important_html')
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@ require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
Bundler.require *Rails.groups(assets: %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@@ -25,7 +25,7 @@ module Catarse
config.filter_parameters += [:password, :password_confirmation]
config.time_zone = 'Brasilia'
config.generators do |g|
g.test_framework :rspec, :fixture => false, :views => false
g.test_framework :rspec, fixture: false, views: false
end
config.active_record.observers = [
:backer_observer, :user_observer, :notification_observer,
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
CarrierWave.configure do |config|
if Rails.env.production? and Configuration[:aws_access_key]
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => Configuration[:aws_access_key],
:aws_secret_access_key => Configuration[:aws_secret_key]
provider: 'AWS',
aws_access_key_id: Configuration[:aws_access_key],
aws_secret_access_key: Configuration[:aws_secret_key]
}
config.fog_directory = Configuration[:aws_bucket]
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
+3 -3
Ver Arquivo
@@ -65,7 +65,7 @@ Devise.setup do |config|
# :http_auth and :token_auth by adding those symbols to the array below.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing :skip => :sessions to `devise_for` in your config/routes.rb
# passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# ==> Configuration for :database_authenticatable
@@ -113,7 +113,7 @@ Devise.setup do |config|
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# :secure => true in order to force SSL only cookies.
# secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
@@ -229,7 +229,7 @@ Devise.setup do |config|
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
+1 -1
Ver Arquivo
@@ -47,7 +47,7 @@
# Specifies if labels/hints for input fields automatically be looked up using I18n.
# Default value: false. Overridden for specific fields by setting value to true,
# i.e. :label => true, or :hint => true (or opposite depending on initialized value)
# i.e. label: true, or hint: true (or opposite depending on initialized value)
Formtastic::FormBuilder.i18n_lookups_by_default = true
# You can add custom inputs or override parts of Formtastic by subclassing SemanticFormBuilder and
+6 -6
Ver Arquivo
@@ -1,12 +1,12 @@
begin
if Rails.env.production?
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => Configuration[:sendgrid_user_name],
:password => Configuration[:sendgrid],
:domain => 'heroku.com'
address: 'smtp.sendgrid.net',
port: '587',
authentication: :plain,
user_name: Configuration[:sendgrid_user_name],
password: Configuration[:sendgrid],
domain: 'heroku.com'
}
ActionMailer::Base.delivery_method = :smtp
end
+2 -2
Ver Arquivo
@@ -1,9 +1,9 @@
# Be sure to restart your server when you modify this file.
if Rails.env.production? && Configuration[:base_domain]
Catarse::Application.config.session_store :cookie_store, :key => '_catarse_session', :domain => Configuration[:base_domain]
Catarse::Application.config.session_store :cookie_store, key: '_catarse_session', domain: Configuration[:base_domain]
else
Catarse::Application.config.session_store :cookie_store, :key => '_catarse_session'
Catarse::Application.config.session_store :cookie_store, key: '_catarse_session'
end
# Use the database for sessions instead of the cookie-based default,
+12 -12
Ver Arquivo
@@ -2,9 +2,9 @@ require 'sidekiq/web'
Catarse::Application.routes.draw do
match '/thank_you' => "static#thank_you"
devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" }
devise_for :users, controllers: { omniauth_callbacks: "omniauth_callbacks" }
devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" }
devise_for :users, controllers: { omniauth_callbacks: "omniauth_callbacks" }
check_user_admin = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.admin }
filter :locale, exclude: /\/auth\//
@@ -14,12 +14,12 @@ Catarse::Application.routes.draw do
mount Sidekiq::Web => '/sidekiq'
end
mount CatarsePaypalExpress::Engine => "/", :as => :catarse_paypal_express
mount CatarseMoip::Engine => "/", :as => :catarse_moip
mount CatarsePaypalExpress::Engine => "/", as: :catarse_paypal_express
mount CatarseMoip::Engine => "/", as: :catarse_moip
# Non production routes
if Rails.env.development?
resources :emails, :only => [ :index ]
resources :emails, only: [ :index ]
end
# Channels
@@ -34,7 +34,7 @@ Catarse::Application.routes.draw do
end
end
end
get '/', to: 'profiles#show', :as => :profile
get '/', to: 'profiles#show', as: :profile
get '/how-it-works', to: 'profiles#how_it_works', as: :about
resources :projects, only: [:new, :create, :show] do
collection do
@@ -56,11 +56,11 @@ Catarse::Application.routes.draw do
get "/faq", to: "static#faq", as: :faq
match "/explore" => "explore#index", :as => :explore
match "/explore#:quick" => "explore#index", :as => :explore_quick
match "/credits" => "credits#index", :as => :credits
match "/explore" => "explore#index", as: :explore
match "/explore#:quick" => "explore#index", as: :explore_quick
match "/credits" => "credits#index", as: :credits
match "/reward/:id" => "rewards#show", :as => :reward
match "/reward/:id" => "rewards#show", as: :reward
resources :posts, only: [:index, :create]
namespace :reports do
@@ -91,13 +91,13 @@ Catarse::Application.routes.draw do
end
end
resources :users do
resources :backers, :only => [:index] do
resources :backers, only: [:index] do
member do
match :request_refund
end
end
resources :unsubscribes, :only => [:create]
resources :unsubscribes, only: [:create]
member do
get 'projects'
get 'credits'
+3 -3
Ver Arquivo
@@ -8,7 +8,7 @@ module CatarseAutoHtml
def catarse_auto_html_for options={}
self.auto_html_for options[:field] do
html_escape :map => {
html_escape map: {
'&' => '&amp;',
'>' => '&gt;',
'<' => '&lt;',
@@ -16,8 +16,8 @@ module CatarseAutoHtml
image
youtube width: options[:video_width], height: options[:video_height], wmode: "opaque"
vimeo width: options[:video_width], height: options[:video_height]
redcloth :target => :_blank
link :target => :_blank
redcloth target: :_blank
link target: :_blank
end
end
end
+7 -7
Ver Arquivo
@@ -3,13 +3,13 @@ require 'spec_helper'
describe BackersController do
subject{ response }
let(:project){ FactoryGirl.create(:project, state: 'successful') }
let(:backer){ FactoryGirl.create(:backer, state: 'confirmed', :project => project) }
let(:backer){ FactoryGirl.create(:backer, state: 'confirmed', project: project) }
let(:current_user){ nil }
let(:format){ 'json' }
before do
::Configuration[:base_url] = 'http://catarse.me'
controller.stub(:current_user).and_return(current_user)
get :index, :user_id => backer.user.id, :locale => 'pt', :format => format
get :index, user_id: backer.user.id, locale: 'pt', format: format
end
describe "GET index" do
@@ -20,20 +20,20 @@ describe BackersController do
context "when user can not manage the profile or is anonymous" do
its(:status){ should == 200 }
its(:body){ should == [backer].to_json({:include_project => true, :can_manage => false}) }
its(:body){ should == [backer].to_json({include_project: true, can_manage: false}) }
end
context "when user can manage the profile" do
let(:current_user){ backer.user }
its(:status){ should == 200 }
its(:body){ should == [backer].to_json({:include_project => true, :can_manage => true}) }
its(:body){ should == [backer].to_json({include_project: true, can_manage: true}) }
end
end
describe "POST request_refund" do
let(:successful_project){ FactoryGirl.create(:project, state: 'successful') }
let(:failed_project){ FactoryGirl.create(:project, state: 'failed') }
let(:backer){ FactoryGirl.create(:backer, state: 'confirmed', :user => user, :project => failed_project) }
let(:backer){ FactoryGirl.create(:backer, state: 'confirmed', user: user, project: failed_project) }
let(:user){ FactoryGirl.create(:user, password: 'current_password', password_confirmation: 'current_password', authorizations: [FactoryGirl.create(:authorization, uid: 666, oauth_provider: FactoryGirl.create(:oauth_provider, name: 'facebook'))]) }
before do
@@ -65,7 +65,7 @@ describe BackersController do
context "when current_user have a unconfirmed backer" do
let(:current_user) { user }
let(:unconfirmed_backer) { FactoryGirl.create(:backer, :state => 'pending', :user => user, :project => failed_project) }
let(:unconfirmed_backer) { FactoryGirl.create(:backer, state: 'pending', user: user, project: failed_project) }
before { post :request_refund, { user_id: user.id, id: unconfirmed_backer.id } }
it do
@@ -78,7 +78,7 @@ describe BackersController do
context "when current_user is not owner of the backer" do
let(:current_user) { FactoryGirl.create(:user) }
let(:other_back) { FactoryGirl.create(:backer, :project => failed_project) }
let(:other_back) { FactoryGirl.create(:backer, project: failed_project) }
let(:user) { other_back.user }
before { post :request_refund, { user_id: user.id, id: other_back.id } }
+5 -5
Ver Arquivo
@@ -139,7 +139,7 @@ describe ProjectsController do
describe "GET embed" do
before do
get :embed, :id => project, :locale => :pt
get :embed, id: project, locale: :pt
end
its(:status){ should == 200 }
end
@@ -147,14 +147,14 @@ describe ProjectsController do
describe "GET show" do
context "when we have update_id in the querystring" do
let(:project){ FactoryGirl.create(:project) }
let(:update){ FactoryGirl.create(:update, :project => project) }
before{ get :show, :permalink => project.permalink, :update_id => update.id, :locale => :pt }
let(:update){ FactoryGirl.create(:update, project: project) }
before{ get :show, permalink: project.permalink, update_id: update.id, locale: :pt }
it("should assign update to @update"){ assigns(:update).should == update }
end
context "when we have permalink and do not pass permalink in the querystring" do
let(:project){ FactoryGirl.create(:project, :permalink => 'test') }
before{ get :show, :id => project, :locale => :pt }
let(:project){ FactoryGirl.create(:project, permalink: 'test') }
before{ get :show, id: project, locale: :pt }
it{ should redirect_to project_by_slug_path(project.permalink) }
end
end
+3 -3
Ver Arquivo
@@ -7,20 +7,20 @@ describe StaticController do
subject{ response }
describe 'GET guidelines' do
before{ get :guidelines, {:locale => :pt} }
before{ get :guidelines, {locale: :pt} }
it{ should be_success }
its(:body){ should =~ /#{I18n.t('static.guidelines.title')}/ }
its(:body){ should =~ /#{I18n.t('static.guidelines.subtitle')}/ }
end
describe 'GET faq' do
before{ get :faq, {:locale => :pt} }
before{ get :faq, {locale: :pt} }
it{ should be_success }
its(:body){ should =~ /#{I18n.t('static.faq.title')}/ }
end
describe "GET sitemap" do
before{ get :sitemap, {:locale => :pt} }
before{ get :sitemap, {locale: :pt} }
it{ should be_success }
end
@@ -17,14 +17,14 @@ describe UnsubscribesController do
unsub = FactoryGirl.create(:unsubscribe, project_id: @project.id, user_id: user.id, notification_type_id: @notification_type.id)
post :create, user_id: user.id, locale: 'pt', user: { unsubscribes_attributes: {'1' => {subscribed:'1', id: unsub.id, project_id: @project.id, user_id: user.id, notification_type_id: @notification_type.id}}}
end
it("should destroy the unsubscribe"){ Unsubscribe.where(:user_id => user.id, :project_id => @project.id).count.should == 0 }
it("should destroy the unsubscribe"){ Unsubscribe.where(user_id: user.id, project_id: @project.id).count.should == 0 }
end
context "when we do not have such unsubscribe" do
before do
post :create, user_id: user.id, locale: 'pt', user: { unsubscribes_attributes: {'1' => {subscribed:'0', project_id: @project.id, user_id: user.id, notification_type_id: @notification_type.id}}}
end
it("should create an unsubscribe"){ Unsubscribe.where(:user_id => user.id, :project_id => @project.id).count.should == 1 }
it("should create an unsubscribe"){ Unsubscribe.where(user_id: user.id, project_id: @project.id).count.should == 1 }
end
end
+7 -7
Ver Arquivo
@@ -7,12 +7,12 @@ describe UpdatesController do
subject{ response }
describe "GET index" do
before{ get :index, :project_id => update.project.id, :locale => 'pt', :format => 'html' }
before{ get :index, project_id: update.project.id, locale: 'pt', format: 'html' }
its(:status){ should == 200 }
end
describe "DELETE destroy" do
before { delete :destroy, :project_id => update.project.id, :id => update.id, :locale => 'pt' }
before { delete :destroy, project_id: update.project.id, id: update.id, locale: 'pt' }
context 'When user is a guest' do
its(:status) { should == 302 }
end
@@ -34,24 +34,24 @@ describe UpdatesController do
end
describe "POST create" do
before{ post :create, :project_id => update.project.id, :locale => 'pt', :update => {:title => 'title', :comment => 'update comment'} }
before{ post :create, project_id: update.project.id, locale: 'pt', update: {title: 'title', comment: 'update comment'} }
context 'When user is a guest' do
it{ Update.where(:project_id => update.project.id).count.should == 1}
it{ Update.where(project_id: update.project.id).count.should == 1}
end
context "When user is a registered user but don't the project owner" do
let(:current_user){ FactoryGirl.create(:user) }
it{ Update.where(:project_id => update.project.id).count.should == 1}
it{ Update.where(project_id: update.project.id).count.should == 1}
end
context 'When user is admin' do
let(:current_user) { FactoryGirl.create(:user, admin: true) }
it{ Update.where(:project_id => update.project.id).count.should == 2}
it{ Update.where(project_id: update.project.id).count.should == 2}
end
context 'When user is project_owner' do
let(:current_user) { update.project.user }
it{ Update.where(:project_id => update.project.id).count.should == 2}
it{ Update.where(project_id: update.project.id).count.should == 2}
end
end
end
+7 -7
Ver Arquivo
@@ -10,7 +10,7 @@ describe UsersController do
let(:successful_project){ FactoryGirl.create(:project, state: 'successful') }
let(:failed_project){ FactoryGirl.create(:project, state: 'failed') }
let(:backer){ FactoryGirl.create(:backer, state: 'confirmed', :user => user, :project => failed_project) }
let(:backer){ FactoryGirl.create(:backer, state: 'confirmed', user: user, project: failed_project) }
let(:user){ FactoryGirl.create(:user, password: 'current_password', password_confirmation: 'current_password', authorizations: [FactoryGirl.create(:authorization, uid: 666, oauth_provider: FactoryGirl.create(:oauth_provider, name: 'facebook'))]) }
let(:current_user){ user }
@@ -22,7 +22,7 @@ describe UsersController do
user.reload
user.twitter.should == 'test'
end
it{ should redirect_to user_path(user, :anchor => 'settings') }
it{ should redirect_to user_path(user, anchor: 'settings') }
end
describe "GET set_email" do
@@ -43,19 +43,19 @@ describe UsersController do
context "with wrong current password" do
let(:current_password){ 'wrong_password' }
it{ flash[:error].should_not be_empty }
it{ should redirect_to user_path(user, :anchor => 'settings') }
it{ should redirect_to user_path(user, anchor: 'settings') }
end
context "with wrong confirmation" do
let(:password_confirmation){ 'newpassword_wrong_confirmation' }
it{ flash[:error].should_not be_empty }
it{ should redirect_to user_path(user, :anchor => 'settings') }
it{ should redirect_to user_path(user, anchor: 'settings') }
end
context "with right current password and right confirmation" do
it{ flash[:notice].should_not be_empty }
it{ flash[:error].should be_nil }
it{ should redirect_to user_path(user, :anchor => 'settings') }
it{ should redirect_to user_path(user, anchor: 'settings') }
end
end
@@ -83,14 +83,14 @@ describe UsersController do
user.reload
user.email.should == 'new_email@bar.com'
end
it{ should redirect_to user_path(user, :anchor => 'settings') }
it{ should redirect_to user_path(user, anchor: 'settings') }
end
end
describe "GET show" do
before do
FactoryGirl.create(:notification_type, name: 'updates')
get :show, :id => user.id, :locale => 'pt'
get :show, id: user.id, locale: 'pt'
end
it{ assigns(:fb_admins).should include(user.facebook_id.to_i) }
+4 -4
Ver Arquivo
@@ -1,23 +1,23 @@
require 'spec_helper'
describe ProjectDecorator do
let(:project){ FactoryGirl.create(:project, :about => 'Foo Bar http://www.foo.bar <javascript>xss()</javascript>"Click here":http://click.here') }
let(:project){ FactoryGirl.create(:project, about: 'Foo Bar http://www.foo.bar <javascript>xss()</javascript>"Click here":http://click.here') }
describe "#display_image" do
subject{ project.display_image }
context "when we have a video_url without thumbnail" do
let(:project){ FactoryGirl.create(:project, :uploaded_image => nil, :image_url => nil, :video_thumbnail => nil) }
let(:project){ FactoryGirl.create(:project, uploaded_image: nil, image_url: nil, video_thumbnail: nil) }
it{ should == project.video.thumbnail_large }
end
context "when we have a video_thumbnail" do
let(:project){ FactoryGirl.create(:project, :image_url => nil, :video_thumbnail => File.open("#{Rails.root}/spec/fixtures/image.png")) }
let(:project){ FactoryGirl.create(:project, image_url: nil, video_thumbnail: File.open("#{Rails.root}/spec/fixtures/image.png")) }
it{ should == project.video_thumbnail.url }
end
context "when we have a thumbnail and an image_url" do
let(:project){ FactoryGirl.create(:project, :image_url => 'http://test.com/image', :video_thumbnail => File.open("#{Rails.root}/spec/fixtures/image.png")) }
let(:project){ FactoryGirl.create(:project, image_url: 'http://test.com/image', video_thumbnail: File.open("#{Rails.root}/spec/fixtures/image.png")) }
it{ should == 'http://test.com/image' }
end
end
+11 -11
Ver Arquivo
@@ -9,29 +9,29 @@ describe UserDecorator do
subject{ user.display_name }
context "when we only have a full name" do
let(:user){ FactoryGirl.create(:user, name: nil, :full_name => "Full Name") }
let(:user){ FactoryGirl.create(:user, name: nil, full_name: "Full Name") }
it{ should == 'Full Name' }
end
context "when we have only a name" do
let(:user){ FactoryGirl.create(:user, :name => nil, :name => 'name') }
let(:user){ FactoryGirl.create(:user, name: nil, name: 'name') }
it{ should == 'name' }
end
context "when we have a name and a full name" do
let(:user){ FactoryGirl.create(:user, :name => 'name', :full_name => 'full name') }
let(:user){ FactoryGirl.create(:user, name: 'name', full_name: 'full name') }
it{ should == 'name' }
end
context "when we have no name" do
let(:user){ FactoryGirl.create(:user, :name => nil, :nickname => nil) }
let(:user){ FactoryGirl.create(:user, name: nil, nickname: nil) }
it{ should == I18n.t('user.no_name') }
end
end
describe "#display_image_html" do
let(:user){ FactoryGirl.build(:user, :image_url => 'image.jpg', :uploaded_image => nil )}
let(:options){ {:width => 300, :height => 300} }
let(:user){ FactoryGirl.build(:user, image_url: 'image.jpg', uploaded_image: nil )}
let(:options){ {width: 300, height: 300} }
subject{ user.display_image_html(options) }
it{ should == "<div class=\"avatar_wrapper\" style=\"width: #{options[:width]}px; height: #{options[:height]}px\"><img alt=\"User\" src=\"/assets/#{user.display_image}\" style=\"width: #{options[:width]}px; height: auto\" /></div>" }
end
@@ -40,9 +40,9 @@ describe UserDecorator do
subject{ user.display_image }
context "when we have an uploaded image" do
let(:user){ FactoryGirl.build(:user, :uploaded_image => 'image.png' )}
let(:user){ FactoryGirl.build(:user, uploaded_image: 'image.png' )}
before do
image = stub(:url => 'image.png')
image = stub(url: 'image.png')
image.stub(:thumb_avatar).and_return(image)
user.stub(:uploaded_image).and_return(image)
end
@@ -50,17 +50,17 @@ describe UserDecorator do
end
context "when we have an image url" do
let(:user){ FactoryGirl.build(:user, :image_url => 'image.png') }
let(:user){ FactoryGirl.build(:user, image_url: 'image.png') }
it{ should == 'image.png' }
end
context "when we have an email" do
let(:user){ FactoryGirl.create(:user, :image_url => nil, :email => 'diogob@gmail.com') }
let(:user){ FactoryGirl.create(:user, image_url: nil, email: 'diogob@gmail.com') }
it{ should == "https://gravatar.com/avatar/5e2a237dafbc45f79428fdda9c5024b1.jpg?default=#{::Configuration[:base_url]}/assets/user.png" }
end
context "when we do not have an image nor an email" do
let(:user){ FactoryGirl.create(:user, :image_url => nil, :email => nil) }
let(:user){ FactoryGirl.create(:user, image_url: nil, email: nil) }
it{ should == '/assets/user.png' }
end
end
+15 -15
Ver Arquivo
@@ -30,8 +30,8 @@ FactoryGirl.define do
factory :project do |f|
f.name "Foo bar"
f.permalink { generate(:permalink) }
f.association :user, :factory => :user
f.association :category, :factory => :category
f.association :user, factory: :user
f.association :category, factory: :category
f.about "Foo bar"
f.headline "Foo bar"
f.goal 10000
@@ -48,27 +48,27 @@ FactoryGirl.define do
end
factory :unsubscribe do |f|
f.association :user, :factory => :user
f.association :project, :factory => :project
f.association :notification_type, :factory => :notification_type
f.association :user, factory: :user
f.association :project, factory: :project
f.association :notification_type, factory: :notification_type
end
factory :notification do |f|
f.association :user, :factory => :user
f.association :backer, :factory => :backer
f.association :project, :factory => :project
f.association :notification_type, :factory => :notification_type
f.association :user, factory: :user
f.association :backer, factory: :backer
f.association :project, factory: :project
f.association :notification_type, factory: :notification_type
end
factory :reward do |f|
f.association :project, :factory => :project
f.association :project, factory: :project
f.minimum_value 10.00
f.description "Foo bar"
end
factory :backer do |f|
f.association :project, :factory => :project
f.association :user, :factory => :user
f.association :project, factory: :project
f.association :user, factory: :user
f.confirmed_at Time.now
f.value 10.00
f.state 'confirmed'
@@ -76,7 +76,7 @@ FactoryGirl.define do
end
factory :payment_notification do |f|
f.association :backer, :factory => :backer
f.association :backer, factory: :backer
f.extra_data {}
end
@@ -107,8 +107,8 @@ FactoryGirl.define do
end
factory :update do |f|
f.association :project, :factory => :project
f.association :user, :factory => :user
f.association :project, factory: :project
f.association :user, factory: :user
f.title "My title"
f.comment "This is a comment"
f.comment_html "<p>This is a comment</p>"
+1 -1
Ver Arquivo
@@ -1,7 +1,7 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :users_oauth_provider, :class => 'UsersOauthProviders' do
factory :users_oauth_provider, class: 'UsersOauthProviders' do
oauth_provider 1
user_id 1
uid "MyText"
+4 -4
Ver Arquivo
@@ -20,7 +20,7 @@ describe "Projects" do
before do
FactoryGirl.create(:project, state: 'online', online_days: 30, online_date: Time.now)
FactoryGirl.create(:project, state: 'online', online_days: -30)
visit root_path(:locale => :pt)
visit root_path(locale: :pt)
end
it "should show recent projects" do
@@ -33,7 +33,7 @@ describe "Projects" do
before do
FactoryGirl.create(:project, name: 'Foo', state: 'online', online_days: 30, recommended: true)
FactoryGirl.create(:project, name: 'Lorem', state: 'online', online_days: 30, recommended: false)
visit explore_path(:locale => :pt)
visit explore_path(locale: :pt)
sleep 3
end
it "should show recommended projects" do
@@ -59,7 +59,7 @@ describe "Projects" do
describe "new and create" do
before do
login
visit new_project_path(:locale => :pt)
visit new_project_path(locale: :pt)
end
it "should present the form and save the data" do
@@ -82,7 +82,7 @@ describe "Projects" do
before do
login
visit project_path(project, :locale => :pt)
visit project_path(project, locale: :pt)
end
it 'edit tab should be present' do
+4 -4
Ver Arquivo
@@ -1,7 +1,7 @@
require 'spec_helper'
describe NotificationsMailer do
let(:notification){ create(:notification, :notification_type => create(:notification_type, :name => 'confirm_backer'), :mail_params => {:project_name => create(:project).name}, :user => create(:user)) }
let(:notification){ create(:notification, notification_type: create(:notification_type, name: 'confirm_backer'), mail_params: {project_name: create(:project).name}, user: create(:user)) }
subject{ NotificationsMailer.notify(notification) }
before do
@@ -10,9 +10,9 @@ describe NotificationsMailer do
::Configuration['company_name'] = 'Catarse'
Mail::Message.any_instance.stub(:deliver)
NotificationsMailer.any_instance.should_receive(:mail).with({
:from => "#{::Configuration[:company_name]} <#{::Configuration[:email_contact]}>",
:to => notification.user.email,
:subject => I18n.t('notifications.confirm_backer.subject', :project_name => notification.project.name)
from: "#{::Configuration[:company_name]} <#{::Configuration[:email_contact]}>",
to: notification.user.email,
subject: I18n.t('notifications.confirm_backer.subject', project_name: notification.project.name)
})
end
+5 -5
Ver Arquivo
@@ -31,7 +31,7 @@ describe Backer do
project1 = create(:project)
project2 = create(:project)
backer.project = project1
reward = create(:reward, :project => project2)
reward = create(:reward, project: project2)
backer.should be_valid
backer.reward = reward
backer.should_not be_valid
@@ -39,8 +39,8 @@ describe Backer do
it "should have a value at least equal to reward's minimum value" do
project = create(:project)
reward = create(:reward, :minimum_value => 500, :project => project)
backer = build(:backer, :reward => reward, :project => project)
reward = create(:reward, minimum_value: 500, project: project)
backer = build(:backer, reward: reward, project: project)
backer.value = 499.99
backer.should_not be_valid
backer.value = 500.00
@@ -268,12 +268,12 @@ describe Backer do
describe "#display_value" do
context "when the value has decimal places" do
subject{ build(:backer, :value => 99.99).display_value }
subject{ build(:backer, value: 99.99).display_value }
it{ should == "R$ 100" }
end
context "when the value does not have decimal places" do
subject{ build(:backer, :value => 1).display_value }
subject{ build(:backer, value: 1).display_value }
it{ should == "R$ 1" }
end
end
+14 -14
Ver Arquivo
@@ -208,8 +208,8 @@ describe Project do
describe ".expired" do
before do
@p = create(:project, :online_days => -1)
create(:project, :online_days => 1)
@p = create(:project, online_days: -1)
create(:project, online_days: 1)
end
subject{ Project.expired}
it{ should == [@p] }
@@ -217,8 +217,8 @@ describe Project do
describe ".not_expired" do
before do
@p = create(:project, :online_days => 1)
create(:project, :online_days => -1)
@p = create(:project, online_days: 1)
create(:project, online_days: -1)
end
subject{ Project.not_expired }
it{ should == [@p] }
@@ -226,8 +226,8 @@ describe Project do
describe ".expiring" do
before do
@p = create(:project, :online_days => 14)
create(:project, :online_days => -1)
@p = create(:project, online_days: 14)
create(:project, online_days: -1)
end
subject{ Project.expiring }
it{ should == [@p] }
@@ -235,8 +235,8 @@ describe Project do
describe ".not_expiring" do
before do
@p = create(:project, :online_days => 15)
create(:project, :online_days => -1)
@p = create(:project, online_days: 15)
create(:project, online_days: -1)
end
subject{ Project.not_expiring }
it{ should == [@p] }
@@ -244,8 +244,8 @@ describe Project do
describe ".recent" do
before do
@p = create(:project, :online_date => (Time.now - 4.days))
create(:project, :online_date => (Time.now - 15.days))
@p = create(:project, online_date: (Time.now - 4.days))
create(:project, online_date: (Time.now - 15.days))
end
subject{ Project.recent }
it{ should == [@p] }
@@ -429,12 +429,12 @@ describe Project do
subject{ project.expired? }
context "when expires_at is in the future" do
let(:project){ Project.new :expires_at => 2.seconds.from_now }
let(:project){ Project.new expires_at: 2.seconds.from_now }
it{ should be_false }
end
context "when expires_at is in the past" do
let(:project){ Project.new :expires_at => 2.seconds.ago }
let(:project){ Project.new expires_at: 2.seconds.ago }
it{ should be_true }
end
end
@@ -442,12 +442,12 @@ describe Project do
describe "#in_time?" do
subject{ project.in_time? }
context "when expires_at is in the future" do
let(:project){ Project.new :expires_at => 2.seconds.from_now }
let(:project){ Project.new expires_at: 2.seconds.from_now }
it{ should be_true }
end
context "when expires_at is in the past" do
let(:project){ Project.new :expires_at => 2.seconds.ago }
let(:project){ Project.new expires_at: 2.seconds.ago }
it{ should be_false }
end
end
+7 -7
Ver Arquivo
@@ -2,20 +2,20 @@ require 'spec_helper'
describe ProjectTotal do
before do
@project_id = FactoryGirl.create(:backer, :value => 10.0, :state => 'pending').project_id
FactoryGirl.create(:backer, :value => 10.0, :state => 'confirmed', :project_id => @project_id)
FactoryGirl.create(:backer, :value => 10.0, :state => 'waiting_confirmation', :project_id => @project_id)
FactoryGirl.create(:backer, :value => 10.0, :state => 'refunded', :project_id => @project_id)
FactoryGirl.create(:backer, :value => 10.0, :state => 'requested_refund', :project_id => @project_id)
@project_id = FactoryGirl.create(:backer, value: 10.0, state: 'pending').project_id
FactoryGirl.create(:backer, value: 10.0, state: 'confirmed', project_id: @project_id)
FactoryGirl.create(:backer, value: 10.0, state: 'waiting_confirmation', project_id: @project_id)
FactoryGirl.create(:backer, value: 10.0, state: 'refunded', project_id: @project_id)
FactoryGirl.create(:backer, value: 10.0, state: 'requested_refund', project_id: @project_id)
end
describe "#pledged" do
subject{ ProjectTotal.where(:project_id => @project_id).first.pledged }
subject{ ProjectTotal.where(project_id: @project_id).first.pledged }
it{ should == 30 }
end
describe "#total_backers" do
subject{ ProjectTotal.where(:project_id => @project_id).first.total_backers }
subject{ ProjectTotal.where(project_id: @project_id).first.total_backers }
it{ should == 3 }
end
end
+3 -3
Ver Arquivo
@@ -32,7 +32,7 @@ describe Reward do
end
it "should have a minimum value" do
r = FactoryGirl.build(:reward, :minimum_value => nil)
r = FactoryGirl.build(:reward, minimum_value: nil)
r.should_not be_valid
end
@@ -57,7 +57,7 @@ describe Reward do
end
it "should have a description" do
r = FactoryGirl.build(:reward, :description => nil)
r = FactoryGirl.build(:reward, description: nil)
r.should_not be_valid
end
@@ -132,7 +132,7 @@ describe Reward do
it "should have a HTML-safe name that is a HTML composition from minimum_value, description and sold_out" do
I18n.locale = :pt
r = FactoryGirl.build(:reward, :minimum_value => 0, :description => "Description", :maximum_backers => 0)
r = FactoryGirl.build(:reward, minimum_value: 0, description: "Description", maximum_backers: 0)
r.name.should == "<div class='reward_minimum_value'>Não quero recompensa</div><div class='reward_description'>Description</div><div class=\"sold_out\">Esgotada</div><div class='clear'></div>"
r.maximum_backers = 1
r.name.should == "<div class='reward_minimum_value'>Não quero recompensa</div><div class='reward_description'>Description</div><div class='clear'></div>"
+14 -14
Ver Arquivo
@@ -14,35 +14,35 @@ describe Update do
end
describe ".create" do
subject{ create(:update, :comment => "this is a comment\n") }
subject{ create(:update, comment: "this is a comment\n") }
its(:comment_html){ should == "<p>this is a comment</p>" }
end
describe "#email_comment_html" do
subject{ create(:update, :comment => "this is a comment\nhttp://vimeo.com/6944344\nhttp://catarse.me/assets/catarse/logo164x54.png").email_comment_html }
subject{ create(:update, comment: "this is a comment\nhttp://vimeo.com/6944344\nhttp://catarse.me/assets/catarse/logo164x54.png").email_comment_html }
it{ should == "<p>this is a comment<br />\n<a href=\"http://vimeo.com/6944344\" target=\"_blank\">http://vimeo.com/6944344</a><br />\n<img src=\"http://catarse.me/assets/catarse/logo164x54.png\" alt=\"\" style=\"max-width:513px\" /></p>" }
end
describe "#notify_backers" do
before do
Notification.rspec_reset
create(:notification_type, :name => 'updates')
create(:notification_type, name: 'updates')
@project = create(:project)
backer = create(:backer, state: 'confirmed', :project => @project)
create(:backer, state: 'confirmed', :project => @project, :user => backer.user)
backer = create(:backer, state: 'confirmed', project: @project)
create(:backer, state: 'confirmed', project: @project, user: backer.user)
@project.reload
ActionMailer::Base.deliveries = []
@update = Update.create!(:user => @project.user, :project => @project, :comment => "this is a comment\nhttp://vimeo.com/6944344\nhttp://catarse.me/assets/catarse/logo164x54.png")
@update = Update.create!(user: @project.user, project: @project, comment: "this is a comment\nhttp://vimeo.com/6944344\nhttp://catarse.me/assets/catarse/logo164x54.png")
Notification.should_receive(:create_notification_once).with(:updates, backer.user,
{update_id: @update.id, user_id: backer.user.id},
:project_name => backer.project.name,
:project_owner => backer.project.user.display_name,
:project_owner_email => backer.project.user.email,
:from => @update.project.user.email,
:display_name => backer.project.user.display_name,
:update_title => @update.title,
:update => @update,
:update_comment => @update.email_comment_html).once
project_name: backer.project.name,
project_owner: backer.project.user.display_name,
project_owner_email: backer.project.user.email,
from: @update.project.user.email,
display_name: backer.project.user.display_name,
update_title: @update.title,
update: @update,
update_comment: @update.email_comment_html).once
end
it 'should call Notification.create_notification once' do
+31 -31
Ver Arquivo
@@ -1,7 +1,7 @@
require 'spec_helper'
describe User do
let(:user){ FactoryGirl.create(:user, :provider => "foo", :uid => "bar") }
let(:user){ FactoryGirl.create(:user, provider: "foo", uid: "bar") }
let(:unfinished_project){ FactoryGirl.create(:project, state: 'online') }
let(:successful_project){ FactoryGirl.create(:project, state: 'successful') }
let(:failed_project){ FactoryGirl.create(:project, state: 'failed') }
@@ -38,9 +38,9 @@ describe User do
context "when he has credits in the user_total" do
before do
b = FactoryGirl.create(:backer, :state => 'confirmed', :value => 100, :project => failed_project)
b = FactoryGirl.create(:backer, state: 'confirmed', value: 100, project: failed_project)
@u = b.user
b = FactoryGirl.create(:backer, :state => 'confirmed', :value => 100, :project => successful_project)
b = FactoryGirl.create(:backer, state: 'confirmed', value: 100, project: successful_project)
end
it{ should == [@u] }
end
@@ -53,7 +53,7 @@ describe User do
@u = backer.user
p.extra_data = {'payer_email' => 'foo@bar.com'}
p.save!
p = FactoryGirl.create(:payment_notification, :backer => backer)
p = FactoryGirl.create(:payment_notification, backer: backer)
p.extra_data = {'payer_email' => 'another_email@bar.com'}
p.save!
p = FactoryGirl.create(:payment_notification)
@@ -70,7 +70,7 @@ describe User do
@u = b.user
b.key = 'abc'
b.save!
b = FactoryGirl.create(:backer, :user => @u)
b = FactoryGirl.create(:backer, user: @u)
b.key = 'abcde'
b.save!
b = FactoryGirl.create(:backer)
@@ -92,8 +92,8 @@ describe User do
describe ".by_name" do
before do
@u = FactoryGirl.create(:user, :name => 'Foo Bar')
FactoryGirl.create(:user, :name => 'Baz Qux')
@u = FactoryGirl.create(:user, name: 'Foo Bar')
FactoryGirl.create(:user, name: 'Baz Qux')
end
subject{ User.by_name 'Bar' }
it{ should == [@u] }
@@ -101,8 +101,8 @@ describe User do
describe ".by_email" do
before do
@u = FactoryGirl.create(:user, :email => 'foo@bar.com')
FactoryGirl.create(:user, :email => 'another_email@bar.com')
@u = FactoryGirl.create(:user, email: 'foo@bar.com')
FactoryGirl.create(:user, email: 'another_email@bar.com')
end
subject{ User.by_email 'foo@bar' }
it{ should == [@u] }
@@ -111,35 +111,35 @@ describe User do
describe ".who_backed_project" do
subject{ User.who_backed_project(successful_project.id) }
before do
@backer = FactoryGirl.create(:backer, :state => 'confirmed', :project => successful_project)
FactoryGirl.create(:backer, :state => 'confirmed', :project => successful_project, :user => @backer.user)
FactoryGirl.create(:backer, :state => 'pending', :project => successful_project)
@backer = FactoryGirl.create(:backer, state: 'confirmed', project: successful_project)
FactoryGirl.create(:backer, state: 'confirmed', project: successful_project, user: @backer.user)
FactoryGirl.create(:backer, state: 'pending', project: successful_project)
end
it{ should == [@backer.user] }
end
describe ".backer_totals" do
before do
FactoryGirl.create(:backer, :state => 'confirmed', :value => 100, :credits => false, :project => successful_project)
FactoryGirl.create(:backer, :state => 'confirmed', :value => 50, :credits => false, :project => successful_project)
user = FactoryGirl.create(:backer, :state => 'confirmed', :value => 25, :project => failed_project).user
FactoryGirl.create(:backer, state: 'confirmed', value: 100, credits: false, project: successful_project)
FactoryGirl.create(:backer, state: 'confirmed', value: 50, credits: false, project: successful_project)
user = FactoryGirl.create(:backer, state: 'confirmed', value: 25, project: failed_project).user
user.save!
@u = FactoryGirl.create(:user)
end
context "when we call upon user without backs" do
subject{ User.where(:id => @u.id).backer_totals }
it{ should == {:users => 0.0, :backers => 0.0, :backed => 0.0, :credits => 0.0} }
subject{ User.where(id: @u.id).backer_totals }
it{ should == {users: 0.0, backers: 0.0, backed: 0.0, credits: 0.0} }
end
context "when we call without scopes" do
subject{ User.backer_totals }
it{ should == {:users => 3.0, :backers => 3.0, :backed => 175.0, :credits => 25.0} }
it{ should == {users: 3.0, backers: 3.0, backed: 175.0, credits: 25.0} }
end
context "when we call with scopes" do
subject{ User.has_credits.backer_totals }
it{ should == {:users => 1.0, :backers => 1.0, :backed => 25.0, :credits => 25.0} }
it{ should == {users: 1.0, backers: 1.0, backed: 25.0, credits: 25.0} }
end
end
@@ -215,13 +215,13 @@ describe User do
describe "#credits" do
before do
@u = FactoryGirl.create(:user)
FactoryGirl.create(:backer, :state => 'confirmed', :credits => false, :value => 100, :user_id => @u.id, :project => successful_project)
FactoryGirl.create(:backer, :state => 'confirmed', :credits => false, :value => 100, :user_id => @u.id, :project => unfinished_project)
FactoryGirl.create(:backer, :state => 'confirmed', :credits => false, :value => 200, :user_id => @u.id, :project => failed_project)
FactoryGirl.create(:backer, :state => 'confirmed', :credits => true, :value => 100, :user_id => @u.id, :project => successful_project)
FactoryGirl.create(:backer, :state => 'confirmed', :credits => true, :value => 50, :user_id => @u.id, :project => unfinished_project)
FactoryGirl.create(:backer, :state => 'confirmed', :credits => true, :value => 100, :user_id => @u.id, :project => failed_project)
FactoryGirl.create(:backer, :state => 'requested_refund', :credits => false, :value => 200, :user_id => @u.id, :project => failed_project)
FactoryGirl.create(:backer, state: 'confirmed', credits: false, value: 100, user_id: @u.id, project: successful_project)
FactoryGirl.create(:backer, state: 'confirmed', credits: false, value: 100, user_id: @u.id, project: unfinished_project)
FactoryGirl.create(:backer, state: 'confirmed', credits: false, value: 200, user_id: @u.id, project: failed_project)
FactoryGirl.create(:backer, state: 'confirmed', credits: true, value: 100, user_id: @u.id, project: successful_project)
FactoryGirl.create(:backer, state: 'confirmed', credits: true, value: 50, user_id: @u.id, project: unfinished_project)
FactoryGirl.create(:backer, state: 'confirmed', credits: true, value: 100, user_id: @u.id, project: failed_project)
FactoryGirl.create(:backer, state: 'requested_refund', credits: false, value: 200, user_id: @u.id, project: failed_project)
end
subject{ @u.credits }
it{ should == 50.0 }
@@ -240,10 +240,10 @@ describe User do
subject{user.recommended_projects}
before do
user2, p1, @p2, @p3 = FactoryGirl.create(:user),FactoryGirl.create(:project), FactoryGirl.create(:project, state: :online), FactoryGirl.create(:project, state: :draft)
FactoryGirl.create(:backer, :state => 'confirmed', :user => user2, :project => p1)
FactoryGirl.create(:backer, :state => 'confirmed', :user => user2, :project => @p2)
FactoryGirl.create(:backer, :state => 'confirmed', :user => user2, :project => @p3)
FactoryGirl.create(:backer, :state => 'confirmed', :user => user, :project => p1)
FactoryGirl.create(:backer, state: 'confirmed', user: user2, project: p1)
FactoryGirl.create(:backer, state: 'confirmed', user: user2, project: @p2)
FactoryGirl.create(:backer, state: 'confirmed', user: user2, project: @p3)
FactoryGirl.create(:backer, state: 'confirmed', user: user, project: p1)
end
it{ should == [@p2]}
end
@@ -281,7 +281,7 @@ describe User do
end
describe "#remember_me_hash" do
subject{ FactoryGirl.create(:user, :provider => "foo", :uid => "bar").remember_me_hash }
subject{ FactoryGirl.create(:user, provider: "foo", uid: "bar").remember_me_hash }
it{ should == "27fc6690fafccbb0fc0b8f84c6749644" }
end
+13 -13
Ver Arquivo
@@ -1,10 +1,10 @@
require 'spec_helper'
describe BackerObserver do
let(:project_owner_backer_confirmed){ create(:notification_type, :name => 'project_owner_backer_confirmed') }
let(:confirm_backer){ create(:notification_type, :name => 'confirm_backer') }
let(:project_success){ create(:notification_type, :name => 'project_success') }
let(:backer){ create(:backer, :key => 'should be updated', :payment_method => 'should be updated', :state => 'confirmed', :confirmed_at => nil) }
let(:project_owner_backer_confirmed){ create(:notification_type, name: 'project_owner_backer_confirmed') }
let(:confirm_backer){ create(:notification_type, name: 'confirm_backer') }
let(:project_success){ create(:notification_type, name: 'project_success') }
let(:backer){ create(:backer, key: 'should be updated', payment_method: 'should be updated', state: 'confirmed', confirmed_at: nil) }
subject{ backer }
before do
@@ -23,9 +23,9 @@ describe BackerObserver do
describe "before_save" do
context "when payment_choice is updated to BoletoBancario" do
let(:backer){ create(:backer, :key => 'should be updated', :payment_method => 'should be updated', :state => 'confirmed', :confirmed_at => Time.now) }
let(:backer){ create(:backer, key: 'should be updated', payment_method: 'should be updated', state: 'confirmed', confirmed_at: Time.now) }
before do
Notification.should_receive(:create_notification).with(:payment_slip, backer.user, :backer => backer, :project_name => backer.project.name)
Notification.should_receive(:create_notification).with(:payment_slip, backer.user, backer: backer, project_name: backer.project.name)
backer.payment_choice = 'BoletoBancario'
backer.save!
end
@@ -33,15 +33,15 @@ describe BackerObserver do
end
context "when project reached the goal" do
let(:project){ create(:project, :state => 'failed', :goal => 20) }
let(:backer){ create(:backer, :key => 'should be updated', :payment_method => 'should be updated', :state => 'confirmed', :confirmed_at => Time.now, :value => 20) }
let(:project){ create(:project, state: 'failed', goal: 20) }
let(:backer){ create(:backer, key: 'should be updated', payment_method: 'should be updated', state: 'confirmed', confirmed_at: Time.now, value: 20) }
before do
project_total = mock()
project_total.stub(:pledged).and_return(20.0)
project_total.stub(:total_backers).and_return(1)
project.stub(:project_total).and_return(project_total)
backer.project = project
Notification.should_receive(:create_notification).with(:project_success, backer.project.user, :project => backer.project)
Notification.should_receive(:create_notification).with(:project_success, backer.project.user, project: backer.project)
backer.save!
end
it("should notify the project owner"){ subject }
@@ -49,7 +49,7 @@ describe BackerObserver do
context "when project is already successful" do
let(:project){ create(:project, state: 'successful') }
let(:backer){ create(:backer, :key => 'should be updated', :payment_method => 'should be updated', :state => 'confirmed', :confirmed_at => Time.now, :project => project) }
let(:backer){ create(:backer, key: 'should be updated', payment_method: 'should be updated', state: 'confirmed', confirmed_at: Time.now, project: project) }
before do
Notification.should_receive(:create_notification).never
backer.save!
@@ -61,7 +61,7 @@ describe BackerObserver do
context 'notify the backer' do
before do
Notification.should_receive(:create_notification).at_least(:once).with(:confirm_backer,
backer.user, :backer => backer, :project_name => backer.project.name)
backer.user, backer: backer, project_name: backer.project.name)
end
it("should send confirm_backer notification"){ subject }
@@ -71,7 +71,7 @@ describe BackerObserver do
context 'notify project owner about this backer' do
before do
Notification.should_receive(:create_notification).at_least(:once).with(:project_owner_backer_confirmed,
backer.project.user, :backer => backer, :project_name => backer.project.name)
backer.project.user, backer: backer, project_name: backer.project.name)
end
it("should send project_owner_backer_confirmed notification"){ subject }
@@ -80,7 +80,7 @@ describe BackerObserver do
end
context "when is already confirmed" do
let(:backer){ create(:backer, :key => 'should be updated', :payment_method => 'should be updated', :state => 'confirmed', :confirmed_at => Time.now) }
let(:backer){ create(:backer, key: 'should be updated', payment_method: 'should be updated', state: 'confirmed', confirmed_at: Time.now) }
before do
Notification.should_receive(:create_notification).never
end
@@ -4,7 +4,7 @@ describe PaymentNotificationObserver do
describe 'before_save' do
before do
Notification.rspec_reset
create(:notification_type, :name => 'processing_payment')
create(:notification_type, name: 'processing_payment')
end
context "when payment is being processed" do
+22 -22
Ver Arquivo
@@ -1,18 +1,18 @@
require 'spec_helper'
describe ProjectObserver do
let(:new_draft_project){ create(:notification_type, :name => 'new_draft_project') }
let(:confirm_backer){ create(:notification_type, :name => 'confirm_backer') }
let(:project_received){ create(:notification_type, :name => 'project_received') }
let(:project_in_wainting_funds){ create(:notification_type, :name => 'project_in_wainting_funds') }
let(:adm_project_deadline){ create(:notification_type, :name => 'adm_project_deadline') }
let(:project_success){ create(:notification_type, :name => 'project_success') }
let(:backer_successful){ create(:notification_type, :name => 'backer_project_successful') }
let(:backer_unsuccessful){ create(:notification_type, :name => 'backer_project_unsuccessful') }
let(:pending_backer_unsuccessful){ create(:notification_type, :name => 'pending_backer_project_unsuccessful') }
let(:project_visible){ create(:notification_type, :name => 'project_visible') }
let(:project_rejected){ create(:notification_type, :name => 'project_rejected') }
let(:backer){ create(:backer, :key => 'should be updated', :payment_method => 'should be updated', :state => 'confirmed', :confirmed_at => nil) }
let(:new_draft_project){ create(:notification_type, name: 'new_draft_project') }
let(:confirm_backer){ create(:notification_type, name: 'confirm_backer') }
let(:project_received){ create(:notification_type, name: 'project_received') }
let(:project_in_wainting_funds){ create(:notification_type, name: 'project_in_wainting_funds') }
let(:adm_project_deadline){ create(:notification_type, name: 'adm_project_deadline') }
let(:project_success){ create(:notification_type, name: 'project_success') }
let(:backer_successful){ create(:notification_type, name: 'backer_project_successful') }
let(:backer_unsuccessful){ create(:notification_type, name: 'backer_project_unsuccessful') }
let(:pending_backer_unsuccessful){ create(:notification_type, name: 'pending_backer_project_unsuccessful') }
let(:project_visible){ create(:notification_type, name: 'project_visible') }
let(:project_rejected){ create(:notification_type, name: 'project_rejected') }
let(:backer){ create(:backer, key: 'should be updated', payment_method: 'should be updated', state: 'confirmed', confirmed_at: nil) }
let(:project) { create(:project, goal: 3000) }
subject{ backer }
@@ -48,7 +48,7 @@ describe ProjectObserver do
end
describe "before_save" do
let(:project){ create(:project, :video_url => 'http://vimeo.com/11198435')}
let(:project){ create(:project, video_url: 'http://vimeo.com/11198435')}
context "when project is approved" do
before do
project.should_receive(:download_video_thumbnail).never
@@ -56,7 +56,7 @@ describe ProjectObserver do
end
it "should call create_notification and do not call download_video_thumbnail" do
Notification.should_receive(:create_notification_once).with(:project_visible, project.user, {project_id: project.id}, {:project => project})
Notification.should_receive(:create_notification_once).with(:project_visible, project.user, {project_id: project.id}, {project: project})
project.approve
end
end
@@ -82,7 +82,7 @@ describe ProjectObserver do
before do
create(:backer, project: project, value: 200, state: 'confirmed')
Notification.should_receive(:create_notification_once).with(:project_in_wainting_funds, project.user, {project_id: project.id}, {:project => project})
Notification.should_receive(:create_notification_once).with(:project_in_wainting_funds, project.user, {project_id: project.id}, {project: project})
end
it("should notify the project owner"){ project.finish }
@@ -123,8 +123,8 @@ describe ProjectObserver do
describe "notify_backers" do
context "when project is successful" do
let(:project){ create(:project, :goal => 30, :online_days => -7, :state => 'waiting_funds') }
let(:backer){ create(:backer, :key => 'should be updated', :payment_method => 'should be updated', :state => 'confirmed', :confirmed_at => Time.now, :value => 30, :project => project) }
let(:project){ create(:project, goal: 30, online_days: -7, state: 'waiting_funds') }
let(:backer){ create(:backer, key: 'should be updated', payment_method: 'should be updated', state: 'confirmed', confirmed_at: Time.now, value: 30, project: project) }
before do
Notification.should_receive(:create_notification_once).at_least(:once)
@@ -135,8 +135,8 @@ describe ProjectObserver do
end
context "when project is unsuccessful" do
let(:project){ create(:project, :goal => 30, :online_days => -7, :state => 'waiting_funds') }
let(:backer){ create(:backer, :key => 'should be updated', :payment_method => 'should be updated', :state => 'confirmed', :confirmed_at => Time.now, :value => 20) }
let(:project){ create(:project, goal: 30, online_days: -7, state: 'waiting_funds') }
let(:backer){ create(:backer, key: 'should be updated', payment_method: 'should be updated', state: 'confirmed', confirmed_at: Time.now, value: 20) }
before do
Notification.should_receive(:create_notification_once).at_least(:once)
backer.save!
@@ -146,7 +146,7 @@ describe ProjectObserver do
end
context "when project is unsuccessful with pending backers" do
let(:project){ create(:project, :goal => 30, :online_days => -7, :state => 'waiting_funds') }
let(:project){ create(:project, goal: 30, online_days: -7, state: 'waiting_funds') }
before do
create(:backer, project: project, key: 'ABC1', payment_method: 'ABC', payment_token: 'ABC', value: 20, state: 'confirmed')
@@ -163,7 +163,7 @@ describe ProjectObserver do
end
describe '#notify_owner_that_project_is_successful' do
let(:project){ create(:project, :goal => 30, :online_days => -7, :state => 'waiting_funds') }
let(:project){ create(:project, goal: 30, online_days: -7, state: 'waiting_funds') }
before do
::Configuration[:facebook_url] = 'http://facebook.com/foo'
@@ -194,7 +194,7 @@ describe ProjectObserver do
end
describe "#notify_admin_that_project_reached_deadline" do
let(:project){ create(:project, :goal => 30, :online_days => -7, :state => 'waiting_funds') }
let(:project){ create(:project, goal: 30, online_days: -7, state: 'waiting_funds') }
let(:user) { create(:user, email: 'foo@foo.com')}
before do
::Configuration[:email_payments] = 'foo@foo.com'
+1 -1
Ver Arquivo
@@ -9,7 +9,7 @@ describe UpdateObserver do
end
it "should send to queue" do
update = Update.create!(:user => @project.user, :project => @project, :comment => "this is a comment")
update = Update.create!(user: @project.user, project: @project, comment: "this is a comment")
NotifyUpdateWorker.jobs.size.should == 1
end
end
+1 -1
Ver Arquivo
@@ -1,3 +1,3 @@
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
config.include Devise::TestHelpers, type: :controller
end