Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1397 #1400

Merged
merged 1 commit into from
Apr 27, 2018
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
19 changes: 10 additions & 9 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ def store_location
end

def after_sign_in_path_for(resource)
if from_external_domain? || request.referer.eql?(new_user_session_url(:protocol => 'https')) || request.referer.eql?(new_user_registration_url(:protocol => 'https'))
referer_path = URI(request.referer).path unless request.referer.nil? or nil
if from_external_domain? || referer_path.eql?(new_user_session_path) || referer_path.eql?(new_user_registration_path) || referer_path.nil?
root_path
else
return request.referer unless request.referer.nil?
root_path
request.referer
end
end

def after_sign_up_path_for(resource)
if from_external_domain? or request.referer.eql?(new_user_session_url(:protocol => 'https'))
referer_path = URI(request.referer).path unless request.referer.nil? or nil
if from_external_domain? || referer_path.eql?(new_user_session_path) || referer_path.nil?
root_path
else
request.referer
Expand All @@ -85,11 +86,11 @@ def failed_create_error(obj, obj_name)
def failed_update_error(obj, obj_name)
"#{_('Could not update your %{o}.') % {o: obj_name}} #{errors_to_s(obj)}"
end

def failed_destroy_error(obj, obj_name)
"#{_('Could not delete the %{o}.') % {o: obj_name}} #{errors_to_s(obj)}"
end

def success_message(obj_name, action)
"#{_('Successfully %{action} your %{object}.') % {object: obj_name, action: action}}"
end
Expand All @@ -108,7 +109,7 @@ def is_json_array_of_objects?(string)

private
# Override rails default render action to look for a branded version of a
# template instead of using the default one. If no override exists, the
# template instead of using the default one. If no override exists, the
# default version in ./app/views/[:controller]/[:action] will be used
#
# The path in the app/views/branded/ directory must match the the file it is
Expand All @@ -117,7 +118,7 @@ def is_json_array_of_objects?(string)
def prepend_view_paths
prepend_view_path "app/views/branded"
end

def errors_to_s(obj)
if obj.errors.count > 0
msg = "<br />"
Expand All @@ -126,7 +127,7 @@ def errors_to_s(obj)
msg += "#{_(e)} - #{_(m)}<br />"
else
msg += "'#{obj[e]}' - #{_(m)}<br />"
end
end
end
msg
end
Expand Down
28 changes: 16 additions & 12 deletions app/views/shared/_access_controls.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
<%= _('Sign in') %>
</a>
</li>
<li role="presentation">
<a href="#create-account-form" role="tab" aria-controls="create-account-form" data-toggle="tab">
<%= _('Create account') %>
</a>
</li>
<% unless isActivePage(new_user_registration_path, true) %>
<li role="presentation">
<a href="#create-account-form" role="tab" aria-controls="create-account-form" data-toggle="tab">
<%= _('Create account') %>
</a>
</li>
<% end %>
</ul>

<div class="tab-content">
Expand All @@ -18,14 +20,16 @@
<div class="panel-body">
<%= render :partial => 'shared/sign_in_form' %>
</div>
</div>
</div>
</div>
<div id="create-account-form" role="tabpanel" class="tab-pane">
<div class="panel panel-default">
<div class="panel-body">
<%= render :partial => 'shared/create_account_form', locals: {extended: false} %>
<% unless isActivePage(new_user_registration_path, true) %>
<div id="create-account-form" role="tabpanel" class="tab-pane">
<div class="panel panel-default">
<div class="panel-body">
<%= render :partial => 'shared/create_account_form', locals: {extended: false} %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>