Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class ApplicationController < ActionController::Base
before_filter :configure_permitted_parameters, if: :devise_controller?
after_filter :store_location

include Pundit
protect_from_forgery
Expand Down Expand Up @@ -30,16 +31,28 @@ def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :username
end

def store_location

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assignment Branch Condition size for store_location is too high. [34.48/15]

# store last url - this is needed for post-login redirect to whatever the
# user last visited.
return unless request.get?
paths = ["/users/sign_in", "/users/sign_up", "/users/password/new",
"/users/password/edit", "/users/confirmation", "/users/sign_out"]
if !paths.include?(request.path) && !request.xhr?
session[:previous_url] = request.fullpath
end
end

def after_sign_in_path_for(user)
if user.members.present?
if user.members.any? &:manager
users_path
session[:previous_url] ||
if user.members.present?
if user.members.any? &:manager
users_path
else
users_path
end
else
users_path
page_path("home")
end
else
page_path("home")
end
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/views/offers/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
= link_to @offer, data: {method: :DELETE, confirm: "sure?" }, :class => "btn btn-danger" do
= glyph :trash
= t ".delete"
- else
- elsif current_user
= link_to(give_time_user_path(@offer.user, offer: @offer.id), {:class => "btn btn-success"}) do
= glyph(:time)
= t "global.give_time"
8 changes: 5 additions & 3 deletions app/views/shared/_post.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
= t '.created_at'
= l post.created_at.to_date, format: :short


.col-md-9


%p.lead= post.description

- unless current_user
.alert.alert-info
= t("posts.show.info", type: post.class.model_name.human, organization: post.organization.name)
= link_to t("layouts.application.login"), new_user_session_path, class: "btn btn-primary"
6 changes: 6 additions & 0 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ ca:
tags:
alpha_grouped_index:
maintitle: "Etiquetes Disponibles"

terms:
accept: Acceptar

offers:
index:
offered_by: "Ofertat per %{size} persones"
Expand All @@ -207,6 +209,10 @@ ca:
new:
submit: Crear demanda

posts:
show:
info: "%{type} de %{organization} per veure les dades de la persona has de"

categories:
index:
all: Totes
Expand Down
6 changes: 6 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ en:
tags:
alpha_grouped_index:
maintitle: Available Tags

terms:
accept: Accept

offers:
index:
offered_by: "Offered by %{size} people"
Expand All @@ -210,6 +212,10 @@ en:
submit: Create inquiry
edit:
submit: Change inquiry

posts:
show:
info: "%{type} of %{organization} to see person's details you have to"
categories:
index:
all: All
Expand Down
7 changes: 7 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ es:
tags:
alpha_grouped_index:
maintitle: "Etiquetas Disponibles"

terms:
accept: Aceptar

offers:
index:
offered_by: "Ofrecido por %{size} personas"
Expand All @@ -210,6 +212,11 @@ es:
submit: Crear demanda
edit:
submit: Cambiar demanda

posts:
show:
info: "%{type} de %{organization} para ver los datos de la persona tienes que"

categories:
index:
all: Todas
Expand Down