-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Multiple models support #54
Open
kenzo-tanaka
wants to merge
39
commits into
igorkasyanchuk:master
Choose a base branch
from
kenzo-tanaka:feat/customized
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
6fec326
Add klass names to template
kenzo-tanaka a86b194
Add default value of klass names
kenzo-tanaka 4ff39eb
Get new params as for switching login class
kenzo-tanaka ba8ed2c
Add klasses method to any_login.rb
kenzo-tanaka 885e07e
Display login forms
kenzo-tanaka c95b3e9
Fix `any_login_select` method
kenzo-tanaka 93032fc
Add klass arg to `any_login_previous_select` method
kenzo-tanaka ca4d982
Add klass arg to `current_user_information` method
kenzo-tanaka fa9d292
Remove log file
kenzo-tanaka c8ae86d
Fix default value of klass names
kenzo-tanaka 0fa738f
Fix JavaScript
kenzo-tanaka c78726b
Fix #any_login -> .any_login
kenzo-tanaka 8c2fb9b
Fix CSS id to class
kenzo-tanaka a51faae
Remove old form
kenzo-tanaka a8da931
Fix styles
kenzo-tanaka 6430595
Fix prompt
kenzo-tanaka 992d979
Fix JavaScript
kenzo-tanaka ac462b1
Fix login method
kenzo-tanaka 6fced36
Fix devise.rb
kenzo-tanaka 228929d
Fix style
kenzo-tanaka 89b45ac
Fix view to pass tests
kenzo-tanaka a04f90d
Fix id to class
kenzo-tanaka d6fab62
Fix tests
kenzo-tanaka d52011f
Fix styles to display all login form
kenzo-tanaka bc2976e
Add Staff model
kenzo-tanaka 1b36eda
Add devise to staff
kenzo-tanaka 6b26c6b
Fix klass_name to klass_names
kenzo-tanaka aeb9a5e
Fix model
kenzo-tanaka 3dd3a76
Add test staffs
kenzo-tanaka a75d80f
Fix routes
kenzo-tanaka 7fedc7c
Fix navigation test
kenzo-tanaka 36adfab
To escape id duplication, specify id = nil
kenzo-tanaka 724b127
Fix navigation test
kenzo-tanaka 99e1b91
tweak
kenzo-tanaka b4c7f94
Fix icon margin
kenzo-tanaka c165db5
Update README.md
kenzo-tanaka 9e8d627
Update README.md
kenzo-tanaka 9e40d23
Use existing klass_name option for both single and multi-model support
rbclark f93cb6b
Remove AnyLogin.klass and utilize klasses everywhere instead.
rbclark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,10 @@ def user_id | |
params[:back_to_previous_id].presence || params[:selected_id].presence || params[:id] | ||
end | ||
|
||
def klass | ||
params[:as].constantize | ||
end | ||
Comment on lines
+44
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This parameter is the login class (ex. |
||
|
||
def previous | ||
cookies[AnyLogin.cookie_name] ||= "" | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,21 @@ | |
<link rel="stylesheet" href="<%= any_login.css_path %>"> | ||
|
||
<div id='any_login' class='<%= any_login_klasses %>'> | ||
<%= form_tag any_login.sign_in_path, :method => :post, :id => 'any_login_form' do %> | ||
<label for="any_login_form_toggle" id="any_login_form_toggle_label"> | ||
<%= render 'any_login/svg/user', :title => AnyLogin.klass %> | ||
</label> | ||
<input type="checkbox" id="any_login_form_toggle" <%= AnyLogin.auto_show ? "checked" : "" %>> | ||
<span id='any_login_box'> | ||
<%= any_login_select %> | ||
or by | ||
<%= any_login_id_input %> | ||
<%= any_login_submit %> | ||
<span id='current_user_information'><%= current_user_information %></span> | ||
<%= any_login_previous_select %> | ||
</span> | ||
<% end %> | ||
<label for="any_login_form_toggle" class="any_login_form_toggle_label"> | ||
<%= render 'any_login/svg/user' %> | ||
</label> | ||
<input type="checkbox" id="any_login_form_toggle" <%= AnyLogin.auto_show ? "checked" : "" %>> | ||
|
||
<span id="any_login_box"> | ||
<% AnyLogin.klasses.each do |klass| %> | ||
<%= form_tag any_login.sign_in_path(as: klass.to_s), :method => :post, :class => 'any_login_form' do %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set the login class here. |
||
<%= any_login_select(klass) %> | ||
or by | ||
<%= any_login_id_input %> | ||
<%= any_login_submit %> | ||
<span class='current_user_information'><%= current_user_information(klass) %></span> | ||
<%= any_login_previous_select(klass) %> | ||
<% end %> | ||
<% end %> | ||
</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,10 @@ class NavigationTest < ActionDispatch::IntegrationTest | |
test "it properly logs users in and allows access to the secret page" do | ||
visit "/" | ||
|
||
find("#any_login_form_toggle_label").click | ||
find(".any_login_form_toggle_label").click | ||
# There is an instability in the test suite where the option on the dropdown sometimes shows | ||
# up as `1` and sometimes shows up as `[email protected]`. This works around the issue. | ||
find('#selected_id option:last-of-type').select_option | ||
find("select option:last-of-type", match: :first).select_option | ||
|
||
visit "/about" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Staff < ActiveRecord::Base | ||
# Include default devise modules. Others available are: | ||
# :confirmable, :lockable, :timeoutable and :omniauthable | ||
devise :database_authenticatable, :registerable, | ||
:recoverable, :rememberable, :trackable, :validatable | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed css id to class, because some login forms would be displayed.