Move all modals into shared views/modal directory

This commit is contained in:
Andreas Nedbal 2020-04-25 15:16:45 +02:00
parent 3885c24825
commit 96309eb8ba
14 changed files with 40 additions and 40 deletions

View File

@ -45,7 +45,7 @@ class Ajax::GroupController < ApplicationController
@status = :okay @status = :okay
@success = true @success = true
@message = I18n.t('messages.group.create.okay') @message = I18n.t('messages.group.create.okay')
@render = render_to_string(partial: 'user/modal_group_item', locals: { group: group, user: target_user }) @render = render_to_string(partial: 'modal/group/item', locals: { group: group, user: target_user })
end end
def destroy def destroy

View File

@ -29,6 +29,6 @@
= nav_entry t('views.sessions.new'), new_user_registration_path = nav_entry t('views.sessions.new'), new_user_registration_path
- if user_signed_in? - if user_signed_in?
= render 'shared/modal_ask_followers' = render 'modal/ask'
%button.btn.btn-primary.btn-fab.d-block.d-sm-none{"data-target" => "#modal-ask-followers", "data-toggle" => "modal", :type => "button"} %button.btn.btn-primary.btn-fab.d-block.d-sm-none{"data-target" => "#modal-ask-followers", "data-toggle" => "modal", :type => "button"}
%i.fa.fa-pencil-square-o %i.fa.fa-pencil-square-o

View File

@ -19,7 +19,7 @@
.tab-pane.active{role:"tabpanel", id: "grouplist"} .tab-pane.active{role:"tabpanel", id: "grouplist"}
%ul.list-group.groups--list %ul.list-group.groups--list
- current_user.groups.each do |group| - current_user.groups.each do |group|
= render 'user/modal_group_item', group: group, user: @user = render 'modal/group/item', group: group, user: @user
.tab-pane{role:"tabpanel", id: "create"} .tab-pane{role:"tabpanel", id: "create"}
.modal-body .modal-body
%input#new-group-name.form-control{type: :text, placeholder: t('views.modal.group.name')} %input#new-group-name.form-control{type: :text, placeholder: t('views.modal.group.name')}

View File

@ -0,0 +1,13 @@
#modal-passwd.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-passwd-label", :role => "dialog", :tabindex => "-1"}
.modal-dialog
.modal-content
.modal-header
%h5#modal-passwd-label.modal-title= t 'views.settings.account.modal.title'
%button.close{"data-dismiss" => "modal", :type => "button"}
%span{"aria-hidden" => "true"} ×
%span.sr-only= t 'views.actions.close'
.modal-body
= f.password_field :current_password, autocomplete: "off", label: t('views.settings.account.password_current'), help: t('views.settings.account.password_current_help')
.modal-footer
%button.btn.btn-default{"data-dismiss" => "modal", :type => "button"}= t 'views.actions.cancel'
%button.btn.btn-primary{:type => "submit"}= t 'views.actions.save'

View File

@ -0,0 +1,19 @@
#modal-privileges.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-privileges-label", :role => "dialog", :tabindex => "-1"}
.modal-dialog
.modal-content
.modal-header
%h5#modal-privileges-label.modal-title
= raw t('views.actions.privilege', user: @user.screen_name)
%button.close{"data-dismiss" => "modal", :type => "button"}
%span{"aria-hidden" => "true"} ×
%span.sr-only= t 'views.actions.close'
%ul.list-group.groups--list
= render :partial 'modal/privileges/item', privilege: 'blogger', description: t('views.modal.privilege.blogger'), user: @user
= render :partial 'modal/privileges/item', privilege: 'contributor', description: t('views.modal.privilege.contributor'), user: @user
= render :partial 'modal/privileges/item', privilege: 'translator', description: t('views.modal.privilege.translator'), user: @user
- if current_user.has_role?(:administrator)
= render :partial 'modal/privileges/item', privilege: 'supporter', description: t('views.modal.privilege.supporter'), user: @user
= render :partial 'modal/privileges/item', privilege: 'moderator', description: t('views.modal.privilege.moderator'),user: @user
= render :partial 'modal/privileges/item', privilege: 'admin', description: t('views.modal.privilege.admin'), user: @user
.modal-footer
%button.btn.btn-primary{name: 'checked-privileges', type: :button, data: { dismiss: :modal }}= t 'views.actions.done'

View File

@ -4,7 +4,7 @@
%ul.comments %ul.comments
- a.comments.order(:created_at).each do |comment| - a.comments.order(:created_at).each do |comment|
%li{data: { comment_id: comment.id }} %li{data: { comment_id: comment.id }}
%div{class: "ab-comment-smile-list", style: "height: 0; width: 0"}= render "shared/comment_smiles", comment: comment %div{class: "ab-comment-smile-list", style: "height: 0; width: 0"}= render "modal/comment_smiles", comment: comment
.media.comments--media .media.comments--media
.pull-left .pull-left
%img.img-rounded.answerbox--img{src: gravatar_url(comment.user)} %img.img-rounded.answerbox--img{src: gravatar_url(comment.user)}

View File

@ -7,20 +7,7 @@
.card .card
.card-body .card-body
= bootstrap_form_for(resource, as: resource_name, url: '/settings/account', html: { method: :put }) do |f| = bootstrap_form_for(resource, as: resource_name, url: '/settings/account', html: { method: :put }) do |f|
/ Password field modal = render 'modal/password', f: f
#modal-passwd.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-passwd-label", :role => "dialog", :tabindex => "-1"}
.modal-dialog
.modal-content
.modal-header
%h5#modal-passwd-label.modal-title= t 'views.settings.account.modal.title'
%button.close{"data-dismiss" => "modal", :type => "button"}
%span{"aria-hidden" => "true"} ×
%span.sr-only= t 'views.actions.close'
.modal-body
= f.password_field :current_password, autocomplete: "off", label: t('views.settings.account.password_current'), help: t('views.settings.account.password_current_help')
.modal-footer
%button.btn.btn-default{"data-dismiss" => "modal", :type => "button"}= t 'views.actions.cancel'
%button.btn.btn-primary{:type => "submit"}= t 'views.actions.save'
= devise_error_messages! = devise_error_messages!

View File

@ -1,19 +0,0 @@
#modal-privileges.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-privileges-label", :role => "dialog", :tabindex => "-1"}
.modal-dialog
.modal-content
.modal-header
%h5#modal-privileges-label.modal-title
= raw t('views.actions.privilege', user: @user.screen_name)
%button.close{"data-dismiss" => "modal", :type => "button"}
%span{"aria-hidden" => "true"} ×
%span.sr-only= t 'views.actions.close'
%ul.list-group.groups--list
= render 'user/modal_privileges_item', privilege: 'blogger', description: t('views.modal.privilege.blogger'), user: @user
= render 'user/modal_privileges_item', privilege: 'contributor', description: t('views.modal.privilege.contributor'), user: @user
= render 'user/modal_privileges_item', privilege: 'translator', description: t('views.modal.privilege.translator'), user: @user
- if current_user.has_role?(:administrator)
= render 'user/modal_privileges_item', privilege: 'supporter', description: t('views.modal.privilege.supporter'), user: @user
= render 'user/modal_privileges_item', privilege: 'moderator', description: t('views.modal.privilege.moderator'),user: @user
= render 'user/modal_privileges_item', privilege: 'admin', description: t('views.modal.privilege.admin'), user: @user
.modal-footer
%button.btn.btn-primary{name: 'checked-privileges', type: :button, data: { dismiss: :modal }}= t 'views.actions.done'

View File

@ -22,7 +22,7 @@
= t 'views.actions.load' = t 'views.actions.load'
.visible-xs= render 'shared/links' .visible-xs= render 'shared/links'
- if user_signed_in? - if user_signed_in?
= render 'user/modal_group_memberships' = render 'modal/group'
- if current_user.mod? and @user != current_user - if current_user.mod? and @user != current_user
= render 'user/modal_privileges' = render 'modal/privileges'
= render 'user/modal_ban' = render 'modal/ban'