From 17f1c8f09156a482f708d413ed25e485f80ab5c8 Mon Sep 17 00:00:00 2001 From: Georg G Date: Tue, 3 Feb 2015 17:13:50 +0100 Subject: [PATCH] added user privileges modal --- app/views/user/_actions.html.haml | 10 +++++++- app/views/user/_modal_privileges.html.haml | 23 +++++++++++++++++++ .../user/_modal_privileges_item.html.haml | 9 ++++++++ app/views/user/show.html.haml | 2 ++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 app/views/user/_modal_privileges.html.haml create mode 100644 app/views/user/_modal_privileges_item.html.haml diff --git a/app/views/user/_actions.html.haml b/app/views/user/_actions.html.haml index b2b211e0..99114397 100644 --- a/app/views/user/_actions.html.haml +++ b/app/views/user/_actions.html.haml @@ -27,4 +27,12 @@ %li %a{href: '#', data: { action: 'report-user', target: user.screen_name }} %i.fa.fa-exclamation-triangle - Report \ No newline at end of file + Report + - if current_user.mod? + %li + %a{href: '#', data: { target: "#modal-privileges", toggle: :modal }} + %i.fa.fa-paw + Check + = succeed "'s" do + = user.screen_name + privileges \ No newline at end of file diff --git a/app/views/user/_modal_privileges.html.haml b/app/views/user/_modal_privileges.html.haml new file mode 100644 index 00000000..a9104dbe --- /dev/null +++ b/app/views/user/_modal_privileges.html.haml @@ -0,0 +1,23 @@ +#modal-privileges.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-privileges-label", :role => "dialog", :tabindex => "-1"} + .modal-dialog + .modal-content + .modal-header + %button.close{"data-dismiss" => "modal", :type => "button"} + %span{"aria-hidden" => "true"} × + %span.sr-only Close + %h4#modal-privileges-label.modal-title + Check + = succeed "'s" do + = @user.screen_name + privileges + .modal-body + %ul.list-group.groups--list + - unless @user.admin? + = render 'user/modal_privileges_item', privilege: 'banned', description: 'Hit the user with ye olde banhammer', user: @user + = render 'user/modal_privileges_item', privilege: 'blogger', description: 'The user gets that privilege if they blogged something (nice) about Retrospring.', user: @user + - if current_user.admin? + = render 'user/modal_privileges_item', privilege: 'supporter', description: 'oy vey muh shekels', user: @user + = render 'user/modal_privileges_item', privilege: 'moderator', user: @user + = render 'user/modal_privileges_item', privilege: 'admin', user: @user + .modal-footer + %button.btn.btn-primary{name: 'checked-privileges', type: :button, data: { dismiss: :modal }} Done \ No newline at end of file diff --git a/app/views/user/_modal_privileges_item.html.haml b/app/views/user/_modal_privileges_item.html.haml new file mode 100644 index 00000000..799b2892 --- /dev/null +++ b/app/views/user/_modal_privileges_item.html.haml @@ -0,0 +1,9 @@ +- description ||= '' +%li.list-group-item{id: "privilege-#{privilege}"} + .media + .pull-left.j2-table + %input.input--center{type: :checkbox, name: 'check-your-privileges', data: { type: privilege, user: user.screen_name }, checked: user.send("#{privilege}?"), autocomplete: 'off'} + .media-body + .list-group-item-heading= privilege.capitalize + - unless description.blank? + .list-group-item-text.text-muted.j2-up= description \ No newline at end of file diff --git a/app/views/user/show.html.haml b/app/views/user/show.html.haml index 087ecc93..a655c57d 100644 --- a/app/views/user/show.html.haml +++ b/app/views/user/show.html.haml @@ -17,3 +17,5 @@ .visible-xs= render 'shared/links' - if user_signed_in? = render 'user/modal_group_memberships' + - if current_user.mod? and @user != current_user + = render 'user/modal_privileges' \ No newline at end of file