rails_base 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +32 -0
- data/Rakefile +32 -0
- data/app/assets/config/rails_base/manifest.js +3 -0
- data/app/assets/images/rails_base/favicon.ico +0 -0
- data/app/assets/javascripts/rails_base/admin.js +2 -0
- data/app/assets/javascripts/rails_base/application.js +22 -0
- data/app/assets/javascripts/rails_base/cable.js +13 -0
- data/app/assets/javascripts/rails_base/mfa_auth.coffee +3 -0
- data/app/assets/javascripts/rails_base/secondary_authentication.coffee +3 -0
- data/app/assets/javascripts/rails_base/sessions.js +152 -0
- data/app/assets/javascripts/rails_base/user_settings.coffee +3 -0
- data/app/assets/stylesheets/rails_base/admin.css +4 -0
- data/app/assets/stylesheets/rails_base/application.scss +15 -0
- data/app/assets/stylesheets/rails_base/mfa_auth.scss +3 -0
- data/app/assets/stylesheets/rails_base/scaffolds.scss +84 -0
- data/app/assets/stylesheets/rails_base/secondary_authentication.scss +3 -0
- data/app/assets/stylesheets/rails_base/user_settings.scss +3 -0
- data/app/controllers/rails_base/admin_controller.rb +315 -0
- data/app/controllers/rails_base/application_controller.rb +153 -0
- data/app/controllers/rails_base/errors_controller.rb +29 -0
- data/app/controllers/rails_base/mfa_auth_controller.rb +50 -0
- data/app/controllers/rails_base/secondary_authentication_controller.rb +224 -0
- data/app/controllers/rails_base/switch_user_controller.rb +29 -0
- data/app/controllers/rails_base/user_settings_controller.rb +81 -0
- data/app/controllers/rails_base/users/passwords_controller.rb +19 -0
- data/app/controllers/rails_base/users/registrations_controller.rb +80 -0
- data/app/controllers/rails_base/users/sessions_controller.rb +108 -0
- data/app/helpers/rails_base/admin_helper.rb +107 -0
- data/app/helpers/rails_base/appearance_helper.rb +58 -0
- data/app/helpers/rails_base/application_helper.rb +26 -0
- data/app/helpers/rails_base/capture_reference_helper.rb +57 -0
- data/app/helpers/rails_base/mfa_auth_helper.rb +2 -0
- data/app/helpers/rails_base/secondary_authentication_helper.rb +2 -0
- data/app/helpers/rails_base/user_field_validators.rb +108 -0
- data/app/helpers/rails_base/user_settings_helper.rb +22 -0
- data/app/jobs/rails_base/application_job.rb +10 -0
- data/app/jobs/twilio_job.rb +9 -0
- data/app/mailers/rails_base/application_mailer.rb +9 -0
- data/app/mailers/rails_base/email_verification_mailer.rb +22 -0
- data/app/mailers/rails_base/event_mailer.rb +16 -0
- data/app/models/admin_action.rb +119 -0
- data/app/models/rails_base/application_record.rb +22 -0
- data/app/models/rails_base/user_constants.rb +28 -0
- data/app/models/secret.rb +37 -0
- data/app/models/short_lived_data.rb +132 -0
- data/app/models/user.rb +143 -0
- data/app/services/rails_base/admin_risky_mfa_send.rb +80 -0
- data/app/services/rails_base/admin_update_attribute.rb +100 -0
- data/app/services/rails_base/authentication/authenticate_user.rb +28 -0
- data/app/services/rails_base/authentication/constants.rb +60 -0
- data/app/services/rails_base/authentication/decision_twofa_type.rb +76 -0
- data/app/services/rails_base/authentication/destroy_user.rb +45 -0
- data/app/services/rails_base/authentication/mfa_set_encrypt_token.rb +32 -0
- data/app/services/rails_base/authentication/mfa_validator.rb +88 -0
- data/app/services/rails_base/authentication/modify_password.rb +67 -0
- data/app/services/rails_base/authentication/send_forgot_password.rb +26 -0
- data/app/services/rails_base/authentication/send_login_mfa_to_user.rb +77 -0
- data/app/services/rails_base/authentication/send_verification_email.rb +103 -0
- data/app/services/rails_base/authentication/session_token_verifier.rb +31 -0
- data/app/services/rails_base/authentication/single_sign_on_create.rb +44 -0
- data/app/services/rails_base/authentication/single_sign_on_send.rb +101 -0
- data/app/services/rails_base/authentication/single_sign_on_verify.rb +42 -0
- data/app/services/rails_base/authentication/sso_verify_email.rb +43 -0
- data/app/services/rails_base/authentication/update_phone_send_verification.rb +46 -0
- data/app/services/rails_base/authentication/verify_forgot_password.rb +46 -0
- data/app/services/rails_base/email_change.rb +20 -0
- data/app/services/rails_base/encryption.rb +87 -0
- data/app/services/rails_base/name_change.rb +71 -0
- data/app/services/rails_base/service_base.rb +65 -0
- data/app/services/rails_base/service_logging.rb +23 -0
- data/app/views/layouts/rails_base/application.html.erb +185 -0
- data/app/views/layouts/rails_base/mailer.html.erb +13 -0
- data/app/views/layouts/rails_base/mailer.text.erb +1 -0
- data/app/views/new.html.erb +4 -0
- data/app/views/rails_base/admin/history.html.erb +26 -0
- data/app/views/rails_base/admin/index.html.erb +149 -0
- data/app/views/rails_base/admin/show_config.html.erb +18 -0
- data/app/views/rails_base/devise/confirmations/new.html.erb +16 -0
- data/app/views/rails_base/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/rails_base/devise/mailer/email_changed.html.erb +7 -0
- data/app/views/rails_base/devise/mailer/password_change.html.erb +3 -0
- data/app/views/rails_base/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/rails_base/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/rails_base/devise/passwords/edit.html.erb +25 -0
- data/app/views/rails_base/devise/passwords/new.html.erb +27 -0
- data/app/views/rails_base/devise/registrations/edit.html.erb +43 -0
- data/app/views/rails_base/devise/registrations/new.html.erb +123 -0
- data/app/views/rails_base/devise/sessions/new.html.erb +4 -0
- data/app/views/rails_base/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/rails_base/devise/shared/_links.html.erb +25 -0
- data/app/views/rails_base/devise/unlocks/new.html.erb +16 -0
- data/app/views/rails_base/email_verification_mailer/email_verification.html.erb +25 -0
- data/app/views/rails_base/email_verification_mailer/event.html.erb +20 -0
- data/app/views/rails_base/email_verification_mailer/forgot_password.html.erb +22 -0
- data/app/views/rails_base/errors/internal_error.html.erb +1 -0
- data/app/views/rails_base/errors/not_found.html.erb +1 -0
- data/app/views/rails_base/errors/unacceptable.html.erb +1 -0
- data/app/views/rails_base/event_mailer/event.html.erb +10 -0
- data/app/views/rails_base/mfa_auth/mfa_code.html.erb +10 -0
- data/app/views/rails_base/secondary_authentication/after_email_login_session_new.html.erb +3 -0
- data/app/views/rails_base/secondary_authentication/forgot_password.html.erb +9 -0
- data/app/views/rails_base/secondary_authentication/remove_me.html.erb +1 -0
- data/app/views/rails_base/secondary_authentication/static.html.erb +5 -0
- data/app/views/rails_base/shared/_admin_actions_modal.html.erb +65 -0
- data/app/views/rails_base/shared/_admin_config_class.html.erb +52 -0
- data/app/views/rails_base/shared/_admin_history.html.erb +86 -0
- data/app/views/rails_base/shared/_admin_modify_email.html.erb +78 -0
- data/app/views/rails_base/shared/_admin_modify_name.html.erb +107 -0
- data/app/views/rails_base/shared/_admin_modify_phone.html.erb +87 -0
- data/app/views/rails_base/shared/_admin_modify_text.html.erb +35 -0
- data/app/views/rails_base/shared/_admin_risky_change.html.erb +57 -0
- data/app/views/rails_base/shared/_admin_risky_mfa.html.erb +74 -0
- data/app/views/rails_base/shared/_admin_selector_dropdown.html.erb +70 -0
- data/app/views/rails_base/shared/_admin_toggle_button.html.erb +72 -0
- data/app/views/rails_base/shared/_admin_warning_alert.html.erb +7 -0
- data/app/views/rails_base/shared/_appearance_mode_selector.html.erb +183 -0
- data/app/views/rails_base/shared/_custom_form_validation_javascript.html.erb +129 -0
- data/app/views/rails_base/shared/_enable_mfa_auth_modal.html.erb +105 -0
- data/app/views/rails_base/shared/_error_pages.html.erb +123 -0
- data/app/views/rails_base/shared/_logged_in_header.html.erb +123 -0
- data/app/views/rails_base/shared/_logged_out_header.html.erb +14 -0
- data/app/views/rails_base/shared/_mfa_input_layout.html.erb +5 -0
- data/app/views/rails_base/shared/_mfa_input_layout_default.html.erb +97 -0
- data/app/views/rails_base/shared/_mfa_input_layout_fallback.html.erb +55 -0
- data/app/views/rails_base/shared/_modify_mfa_auth_modal.html.erb +20 -0
- data/app/views/rails_base/shared/_password_confirm_javascript.html.erb +71 -0
- data/app/views/rails_base/shared/_reset_password_form.html.erb +111 -0
- data/app/views/rails_base/shared/_session_create_form.html.erb +32 -0
- data/app/views/rails_base/shared/_session_timeout_modal.html.erb +76 -0
- data/app/views/rails_base/switch_user/_widget.html.erb +5 -0
- data/app/views/rails_base/user_settings/_confirm_destroy_user.html.erb +42 -0
- data/app/views/rails_base/user_settings/_destroy_user.html.erb +106 -0
- data/app/views/rails_base/user_settings/_modify_name.html.erb +71 -0
- data/app/views/rails_base/user_settings/_modify_password.html.erb +101 -0
- data/app/views/rails_base/user_settings/_modify_password_update_password.html.erb +2 -0
- data/app/views/rails_base/user_settings/index.html.erb +54 -0
- data/config/initializers/01_rails_config.rb +19 -0
- data/config/initializers/admin_action_helper.rb +88 -0
- data/config/initializers/browser.rb +4 -0
- data/config/initializers/default_logged_in_headers.rb +23 -0
- data/config/initializers/devise.rb +314 -0
- data/config/initializers/encryption.rb +2 -0
- data/config/initializers/switch_user.rb +58 -0
- data/config/initializers/switch_user_helper.rb +29 -0
- data/config/locales/devise.en.yml +65 -0
- data/config/locales/en.yml +58 -0
- data/config/routes.rb +114 -0
- data/db/migrate/20210212175453_devise_create_rails_base_users.rb +56 -0
- data/db/migrate/20210212190537_create_rails_base_short_lived_data.rb +19 -0
- data/db/migrate/20210212192645_create_rails_base_secrets.rb +11 -0
- data/db/migrate/20210406015744_create_rails_base_admin_actions.rb +17 -0
- data/db/seeds.rb +23 -0
- data/lib/link_decision_helper.rb +71 -0
- data/lib/rails_base.rb +50 -0
- data/lib/rails_base/admin/action_cache.rb +99 -0
- data/lib/rails_base/admin/action_helper.rb +134 -0
- data/lib/rails_base/admin/default_index_tile.rb +176 -0
- data/lib/rails_base/admin/index_tile.rb +186 -0
- data/lib/rails_base/config.rb +52 -0
- data/lib/rails_base/configuration/active_job.rb +38 -0
- data/lib/rails_base/configuration/admin.rb +231 -0
- data/lib/rails_base/configuration/app.rb +52 -0
- data/lib/rails_base/configuration/appearance.rb +131 -0
- data/lib/rails_base/configuration/authentication.rb +37 -0
- data/lib/rails_base/configuration/base.rb +209 -0
- data/lib/rails_base/configuration/display/background_color.rb +25 -0
- data/lib/rails_base/configuration/display/btn_danger.rb +25 -0
- data/lib/rails_base/configuration/display/btn_dark.rb +25 -0
- data/lib/rails_base/configuration/display/btn_info.rb +25 -0
- data/lib/rails_base/configuration/display/btn_light.rb +25 -0
- data/lib/rails_base/configuration/display/btn_primary.rb +25 -0
- data/lib/rails_base/configuration/display/btn_secondary.rb +25 -0
- data/lib/rails_base/configuration/display/btn_success.rb +25 -0
- data/lib/rails_base/configuration/display/btn_warning.rb +25 -0
- data/lib/rails_base/configuration/display/footer.rb +54 -0
- data/lib/rails_base/configuration/display/navbar.rb +25 -0
- data/lib/rails_base/configuration/display/table_body.rb +25 -0
- data/lib/rails_base/configuration/display/table_header.rb +25 -0
- data/lib/rails_base/configuration/display/text.rb +26 -0
- data/lib/rails_base/configuration/exceptions_app.rb +25 -0
- data/lib/rails_base/configuration/login_behavior.rb +17 -0
- data/lib/rails_base/configuration/mailer.rb +116 -0
- data/lib/rails_base/configuration/mfa.rb +84 -0
- data/lib/rails_base/configuration/owner.rb +17 -0
- data/lib/rails_base/configuration/redis.rb +29 -0
- data/lib/rails_base/configuration/user.rb +43 -0
- data/lib/rails_base/engine.rb +51 -0
- data/lib/rails_base/version.rb +10 -0
- data/lib/tasks/rails_base_tasks.rake +4 -0
- data/lib/twilio_helper.rb +26 -0
- data/lib/velocity_limiter.rb +91 -0
- metadata +619 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if resource.errors.any? %>
|
2
|
+
<div id="error_explanation">
|
3
|
+
<h2>
|
4
|
+
<%= I18n.t("errors.messages.not_saved",
|
5
|
+
count: resource.errors.count,
|
6
|
+
resource: resource.class.model_name.human.downcase)
|
7
|
+
%>
|
8
|
+
</h2>
|
9
|
+
<ul>
|
10
|
+
<% resource.errors.full_messages.each do |message| %>
|
11
|
+
<li><%= message %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
+
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
10
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
+
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Resend unlock instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
5
|
+
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit "Resend unlock instructions" %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<p>Hello <%= @user.full_name %>!</p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
Welcome to <%= RailsBase.config.app.communication_name %>. Where you have the ability to keep track of all of your optiosn accross different companies and life events
|
5
|
+
</br>
|
6
|
+
Please finish your registration by following this <a href="<%=@sso_url_for_user%>" target="_blank"> Registration Link </a>
|
7
|
+
</br>
|
8
|
+
</br>
|
9
|
+
Best wishes,</br>
|
10
|
+
<%= Rails.application.class.parent_name %> team
|
11
|
+
|
12
|
+
</p>
|
13
|
+
</br>
|
14
|
+
</br>
|
15
|
+
</br>
|
16
|
+
Cant click the link? <a href="<%=@sso_url_for_user%>" target="_blank"> <%=@sso_url_for_user%>
|
17
|
+
</a>
|
18
|
+
|
19
|
+
|
20
|
+
</br>
|
21
|
+
</br>
|
22
|
+
Best wishes,</br>
|
23
|
+
<%= RailsBase.config.app.communication_name %> team </br>
|
24
|
+
Visit us at <a href="<%= RailsBase::EmailVerificationMailer::CONTACT_URL %>" target="_blank">
|
25
|
+
<%= RailsBase::EmailVerificationMailer::CONTACT_URL %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<p>Hello <%= @user.full_name %>!</p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
Event: <%= @event %> has occurred on your accont.
|
5
|
+
</p>
|
6
|
+
<% if @msg %>
|
7
|
+
<p>
|
8
|
+
<%= @msg %>
|
9
|
+
</p>
|
10
|
+
<% end %>
|
11
|
+
<p>
|
12
|
+
If this is in error please login to your account: <a href=<%= RailsBase::ApplicationMailer::CONTACT_URL %>> Login link for <%= Rails.application.class.parent_name %> </a>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
</br>
|
16
|
+
</br>
|
17
|
+
Best wishes,</br>
|
18
|
+
<%= RailsBase.config.app.communication_name %> team
|
19
|
+
</br>
|
20
|
+
<a href=<%= RailsBase::ApplicationMailer::CONTACT_URL %>> <%= RailsBase::ApplicationMailer::CONTACT_URL %> </a>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<p>Heya <%= @user.full_name %>!</p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
Your email has begun the forget password flow. If this was not you, do not worry, your data is safe and sound. Feel free to disregard this email. </br>
|
5
|
+
If you did forget your email please
|
6
|
+
<a href="<%=@sso_url_for_user%>" target="_blank">
|
7
|
+
Click Me
|
8
|
+
</a>
|
9
|
+
to initialize the password reset flow for your account.
|
10
|
+
</p>
|
11
|
+
|
12
|
+
</br>
|
13
|
+
Cant click the link? <a href="<%=@sso_url_for_user%>" target="_blank"> <%=@sso_url_for_user%>
|
14
|
+
</a>
|
15
|
+
|
16
|
+
|
17
|
+
</br>
|
18
|
+
</br>
|
19
|
+
Best wishes,</br>
|
20
|
+
<%= RailsBase.config.app.communication_name %> team</br>
|
21
|
+
Visit us at <a href="<%= RailsBase::EmailVerificationMailer::CONTACT_URL %>" target="_blank">
|
22
|
+
<%= RailsBase::EmailVerificationMailer::CONTACT_URL %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: 'rails_base/shared/error_pages', locals: { status: @status, msg: @message } %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: 'rails_base/shared/error_pages', locals: { status: @status, msg: @message } %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: 'rails_base/shared/error_pages', locals: { status: @status, msg: @message } %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
<div class="row" >
|
3
|
+
<div class="col-md-8 offset-md-2" style="position: absolute; top:25%">
|
4
|
+
<%= render partial: 'rails_base/shared/mfa_input_layout', locals: { url: RailsBase.url_routes.mfa_code_verify_path, size: 30, masked_phone: @masked_phone }%>
|
5
|
+
<br>
|
6
|
+
<div class="text-center">
|
7
|
+
<%= button_to 'Resend MFA', RailsBase.url_routes.resend_mfa_path, method: :post, class: 'btn btn_warning', style: 'width: 25%;' %>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
<% if @mfa_flow %>
|
3
|
+
<h3 class='text-center'>If you did not receive a text with instructions, please go through the flow again</h2>
|
4
|
+
<%= render partial: 'rails_base/shared/mfa_input_layout', locals: { url: RailsBase.url_routes.forgot_password_with_mfa_auth_path(data: @data), size: 30, masked_phone: @user.masked_phone }%>
|
5
|
+
<% else %>
|
6
|
+
<h2 class='text-center'>Reset your password <%= @user.full_name%></h2>
|
7
|
+
<%= render partial: 'rails_base/shared/reset_password_form', locals: { sign_in_flow: true, url: RailsBase.url_routes.reset_password_auth_path(data: @data) }%>
|
8
|
+
<% end %>
|
9
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: 'rails_base/shared/mfa_input_layout', locals: { url: mfa_code_verify_url, size: 30, masked_phone: 8675309}%>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div class="row" >
|
2
|
+
<div class="col-md-6 offset-md-3"style="position: absolute; top:25%">
|
3
|
+
<%= button_to 'Resend Verification Email', RailsBase.url_routes.resend_email_verification_path, method: :post, class: 'align-middle btn btn_warning btn-lg btn-block', style: 'font-size: 30px' %>
|
4
|
+
</div>
|
5
|
+
</div>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<!-- Modal -->
|
2
|
+
<div class="modal fade" id="railsBaseAdminActionsModal" tabindex="-1" role="dialog" aria-labelledby="railsBaseAdminActionsModalTitle" aria-hidden="true">
|
3
|
+
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
|
4
|
+
<div class="modal-content">
|
5
|
+
<div class="modal-header text-center">
|
6
|
+
<h3 class="modal-title w-100" id="railsBaseAdminActionsModalTitle"> <strong>Notice!</strong> </h3>
|
7
|
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
8
|
+
<span aria-hidden="true">×</span>
|
9
|
+
</button>
|
10
|
+
</div>
|
11
|
+
<div class="modal-body">
|
12
|
+
<h5> Admins have made actions recently on your account. Aknowledge to clear alert. </h5>
|
13
|
+
</br>
|
14
|
+
<% @__admin_actions_array.reverse.each do |action, time| %>
|
15
|
+
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
16
|
+
<div class="row">
|
17
|
+
<div class="adminactionalerts col-md-9 border-bottom border-dark">
|
18
|
+
<%= action %>
|
19
|
+
</div>
|
20
|
+
<div class="col-md-3 text-right">
|
21
|
+
<%= time %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
25
|
+
<span aria-hidden="true">×</span>
|
26
|
+
</button>
|
27
|
+
</div>
|
28
|
+
<% end%>
|
29
|
+
</div>
|
30
|
+
<div class="modal-footer">
|
31
|
+
<button type="button" id='ackAdminActionAccept' class="btn btn-block btn_warning">Acknowledge</button>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<script type="text/javascript">
|
38
|
+
$(document).ready(function(){
|
39
|
+
if($(window).width() > 720) {
|
40
|
+
$('.adminactionalerts').removeClass('border-bottom')
|
41
|
+
$('.adminactionalerts').addClass('border-right')
|
42
|
+
}
|
43
|
+
});
|
44
|
+
$('#railsBaseAdminActionsModal').modal('show')
|
45
|
+
$('#ackAdminActionAccept').click(function( event ) {
|
46
|
+
rb_ackowledge_actions();
|
47
|
+
});
|
48
|
+
|
49
|
+
function rb_ackowledge_actions(){
|
50
|
+
$.ajax({
|
51
|
+
type: "POST",
|
52
|
+
url: "<%= RailsBase.url_routes.admin_ack_path%>",
|
53
|
+
headers: { 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') },
|
54
|
+
dataType: 'json',
|
55
|
+
data: {'time': '<%= Time.now.to_i %>' },
|
56
|
+
success: function(data) {
|
57
|
+
$('#railsBaseAdminActionsModal').modal('hide')
|
58
|
+
_rails_base_display_success('Acknowledged previous Admin Actions.')
|
59
|
+
},
|
60
|
+
error: function(xhr, status, error) {
|
61
|
+
_rails_base_display_alert('Failed to acknowledged previous Admin Actions.')
|
62
|
+
}
|
63
|
+
})
|
64
|
+
}
|
65
|
+
</script>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<% humanize_var = var.to_s.delete('@') %>
|
2
|
+
<h2 class='<%= appearance_text_class %>'> <%= klass.name.demodulize %> </h2>
|
3
|
+
<div class='table-responsive' style="overflow-x:auto; width: inherit !important;" >
|
4
|
+
<table class="tableFixHead table table-striped table-bordered">
|
5
|
+
<thead class="thead-dark text-center">
|
6
|
+
<th style="width: 20%"> <%= rename&.name&.demodulize&.titleize || humanize_var.titleize %> config </th>
|
7
|
+
<th style="width: 20%"> Value </th>
|
8
|
+
<th style="width: 60%"> Description </th>
|
9
|
+
</thead>
|
10
|
+
<tbody class='text-center'>
|
11
|
+
<% klass::DEFAULT_VALUES.each do |name, object| %>
|
12
|
+
<tr>
|
13
|
+
<td> <%= "#{prepend_shit}." if prepend_shit %><%= humanize_var %>.<%= name %> </td>
|
14
|
+
<% case object[:type] %>
|
15
|
+
<% when :proc %>
|
16
|
+
<td>
|
17
|
+
<% users = users_for_proc(instance.public_send(name)) %>
|
18
|
+
<a tabindex="0" class="btn btn_secondary" role="button" data-toggle="popover" data-trigger="focus" title="Users with ability" data-html=true data-content="<%=users.join('</br>')%>">View Users</a>
|
19
|
+
</td>
|
20
|
+
<% when :string_proc %>
|
21
|
+
<td>
|
22
|
+
<span>
|
23
|
+
<p class="font-italic"> Sample output: </p> "<%= raw instance.public_send(name, current_user) %>"
|
24
|
+
</span>
|
25
|
+
</td>
|
26
|
+
<% when :duration %>
|
27
|
+
<td> <%= instance.public_send(name).inspect %> </td>
|
28
|
+
<% when :array %>
|
29
|
+
<td>
|
30
|
+
<% array = array_for_proc(object[:decipher], instance.public_send(name)) %>
|
31
|
+
<a tabindex="0" class="btn btn_secondary" role="button" data-toggle="popover" data-trigger="focus" title="Configured List" data-html=true data-content="<%=array.join('</br>')%>">View List</a>
|
32
|
+
</td>
|
33
|
+
<% else %>
|
34
|
+
<td>
|
35
|
+
<% if object[:secret] %>
|
36
|
+
< Secret Value >
|
37
|
+
<% elsif object[:popover] %>
|
38
|
+
<% array = object[:decipher].call(instance.public_send(name)) %>
|
39
|
+
<a tabindex="0" class="btn btn_secondary" role="button" data-toggle="popover" data-trigger="focus" title="Configured List" data-html=true data-content="<%=array.join('</br>')%>">View List</a>
|
40
|
+
<% elsif object[:decipher] %>
|
41
|
+
<%= object[:decipher].call(instance.public_send(name)).to_s %>
|
42
|
+
<% else %>
|
43
|
+
<%= raw instance.public_send(name) %>
|
44
|
+
<% end %>
|
45
|
+
</td>
|
46
|
+
<% end %>
|
47
|
+
<td> <%= object[:description] %> </td>
|
48
|
+
</tr>
|
49
|
+
<% end %>
|
50
|
+
</tbody>
|
51
|
+
</table>
|
52
|
+
</div>
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<div class='table-responsive' style="overflow-x:auto; width: inherit !important;">
|
2
|
+
<table class="tableFixHead table table-striped table-bordered">
|
3
|
+
<thead class="thead-dark text-center">
|
4
|
+
<th> AdminUser </th>
|
5
|
+
<th> User </th>
|
6
|
+
<th> Action </th>
|
7
|
+
<th> Changed From </th>
|
8
|
+
<th> Changed To </th>
|
9
|
+
<th> Long Action </th>
|
10
|
+
<th> Created </th>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<% paginated_records.each do |action| %>
|
14
|
+
<tr>
|
15
|
+
<td style="white-space: nowrap;">
|
16
|
+
<% au = action.admin_user %>
|
17
|
+
<%= "[#{au.admin.to_s.ljust(10, ' ')}]<#{au.id.to_s.rjust(6, ' ')}> : #{au.full_name} " %>
|
18
|
+
</td>
|
19
|
+
<td style="white-space: nowrap;">
|
20
|
+
<% u = action.user %>
|
21
|
+
<%= "<#{u.id.to_s.rjust(6, ' ')} > : #{u.full_name}" rescue '----'%>
|
22
|
+
</td>
|
23
|
+
<td style="white-space: nowrap;"> <%= action.action %> </td>
|
24
|
+
<td style="white-space: nowrap;"> <%= action.change_from || 'N/a' %> </td>
|
25
|
+
<td style="white-space: nowrap;"> <%= action.change_to || 'N/a' %> </td>
|
26
|
+
<td> <%= action.long_action || 'N/a' %> </td>
|
27
|
+
<td style="white-space: nowrap;"> <%= action.created_at %> </td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<nav aria-label="Page navigation">
|
35
|
+
<ul class="pagination justify-content-center">
|
36
|
+
<li class="page-item <%= 'disabled' unless paginate_admin_can_prev?(page_number: @starting_page, count_on_page: @count_on_page) %>">
|
37
|
+
<p class="page-link" onClick="submit_paginate(<%= @starting_page - 1%>, <%= @starting_page %>, <%= @count_on_page %>)" style='cursor: pointer;'>Prev</p>
|
38
|
+
</li>
|
39
|
+
<% paginate_admin_history_range(start: @starting_page).each do |page| %>
|
40
|
+
<% next unless page > 0 %>
|
41
|
+
<% klasses = paginante_class_names(curr_page: @starting_page, page_number: page, count_on_page: @count_on_page) %>
|
42
|
+
<li class="page-item <%= klasses %>">
|
43
|
+
<% unless klasses.include?('disable') %>
|
44
|
+
<p style='cursor: pointer; 'class="page-link page-item-admin-history-number" data-value='<%= page %>' onClick="submit_paginate(<%= page %>, <%= @starting_page %>, <%= @count_on_page %>)"> <%= page %> </p>
|
45
|
+
<% else %>
|
46
|
+
<p class="page-link" data-value='<%= page %>' > <%= page %> </p>
|
47
|
+
<% end %>
|
48
|
+
</li>
|
49
|
+
<% end %>
|
50
|
+
<li class="page-item page-item-admin-next <%= 'disabled' unless paginate_admin_can_next?(page_number: @starting_page, count_on_page: @count_on_page) %>">
|
51
|
+
<p class="page-link" onClick="submit_paginate(<%= @starting_page + 1%>, <%= @starting_page %>, <%= @count_on_page %>)" style='cursor: pointer;'>Next</p>
|
52
|
+
</li>
|
53
|
+
<li>
|
54
|
+
</li>
|
55
|
+
</ul>
|
56
|
+
<ul class="pagination justify-content-center" style="margin-top: -20px;">
|
57
|
+
<div class='justify-content-center'>
|
58
|
+
<div class='row'>
|
59
|
+
<div class="col-md">
|
60
|
+
<div class='input-group'>
|
61
|
+
<div class="input-group-prepend">
|
62
|
+
<div class="input-group-text">Elements</div>
|
63
|
+
</div>
|
64
|
+
<%= select_tag 'pagination_count', options_for_select(AdminAction::DEFAULT_PAGE_COUNT_SELECT_RANGE, @count_on_page), class: 'form-control', onchange: "submit_paginate(#{@starting_page}, #{@starting_page}, #{@count_on_page})" %>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
<div class="col-md">
|
68
|
+
<div class='input-group'>
|
69
|
+
<div class="input-group-prepend">
|
70
|
+
<div class="input-group-text">User</div>
|
71
|
+
</div>
|
72
|
+
<%= select_tag 'rb_user_select', options_for_select(paginate_get_users_array, @starting_user), class: 'form-control', onchange: "submit_paginate(#{@starting_page}, #{@starting_page}, #{@count_on_page})" %>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
<div class="col-md">
|
76
|
+
<div class='input-group'>
|
77
|
+
<div class="input-group-prepend">
|
78
|
+
<div class="input-group-text">Admin</div>
|
79
|
+
</div>
|
80
|
+
<%= select_tag 'rb_admin_user_select', options_for_select(paginate_get_admins_array, @starting_admin), class: 'form-control', onchange: "submit_paginate(#{@starting_page}, #{@starting_page}, #{@count_on_page})" %>
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
</ul>
|
86
|
+
</nav>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<% modal_prepend = "admin_#{(10**10*rand).to_i}_modify_email" %>
|
2
|
+
|
3
|
+
<div class="modal-dialog modal-lg" role="document">
|
4
|
+
<div class="modal-content">
|
5
|
+
<div class="modal-header text-center">
|
6
|
+
<h4 class="col-12 modal-title text-center" id="exampleModalLabel">
|
7
|
+
!¡ Risky Change Warning !¡
|
8
|
+
</h4>
|
9
|
+
</div>
|
10
|
+
<div class="modal-body" style="text-align: center;">
|
11
|
+
<h4>Modify Email for <%= user.full_name %>:</h4>
|
12
|
+
<div class="col-auto">
|
13
|
+
<label class="sr-only" for="inlineFormInputGroup">Email</label>
|
14
|
+
<div class="input-group mb-2">
|
15
|
+
<div class="input-group-prepend">
|
16
|
+
<div class="input-group-text">Email</div>
|
17
|
+
</div>
|
18
|
+
<input type="email" class="form-control" id="modify_email" placeholder="<%= user.email %>">
|
19
|
+
<div class="invalid-feedback">
|
20
|
+
<%= "Invalid Email. Try again" %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<div class="col-auto my-1">
|
25
|
+
<button id='<%= modal_prepend %>' class="btn btn_success">Submit</button>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<div class="modal-footer">
|
29
|
+
<button type="button" class="mr-auto btn btn_secondary" data-dismiss="modal">Close</button>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<%
|
35
|
+
values = [
|
36
|
+
{ name: "#modify_email", criteria: { required: true, pattern: :email, enforce_blur: false }},
|
37
|
+
]
|
38
|
+
function_name = "#{modal_prepend}_custom"
|
39
|
+
submit_method = "#{modal_prepend}_submit"
|
40
|
+
%>
|
41
|
+
|
42
|
+
<%= render partial: 'rails_base/shared/custom_form_validation_javascript', locals: { function_name: function_name, values: values } %>
|
43
|
+
|
44
|
+
<script type="text/javascript">
|
45
|
+
|
46
|
+
function <%= submit_method %>(){
|
47
|
+
var email = $('#modify_email').val()
|
48
|
+
var data = { 'email': email, 'id': '<%= user.id%>' }
|
49
|
+
console.table(data)
|
50
|
+
$.ajax({
|
51
|
+
type: "POST",
|
52
|
+
url: "<%= RailsBase.url_routes.admin_upate_email_path%>",
|
53
|
+
headers: { 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') },
|
54
|
+
dataType: 'json',
|
55
|
+
data: data,
|
56
|
+
success: function(data) {
|
57
|
+
console.log(`modify_id: #<%= modify_id %>`)
|
58
|
+
$('#<%= modify_id %>').text(data.email)
|
59
|
+
hide_shared_admin_modal();
|
60
|
+
_rails_base_display_success(data.message)
|
61
|
+
},
|
62
|
+
error: function(xhr, status, error) {
|
63
|
+
hide_shared_admin_modal();
|
64
|
+
_rails_base_display_alert(xhr.responseJSON.message)
|
65
|
+
}
|
66
|
+
})
|
67
|
+
}
|
68
|
+
|
69
|
+
$('#<%= modal_prepend %>').click(function( event ) {
|
70
|
+
if (<%= function_name %>() == true){
|
71
|
+
console.log('found it to be true')
|
72
|
+
<%= submit_method %>();
|
73
|
+
return
|
74
|
+
}
|
75
|
+
console.log('found it to be false')
|
76
|
+
|
77
|
+
});
|
78
|
+
</script>
|