summaryrefslogtreecommitdiff
path: root/app/views/users/edit_notifications.html.erb
blob: 09766354234f5b6cb2a04f46390c05c294cf1c88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<% title "Edit Notification Settings: #{@user.name}" %>

<%
  def can_edit?
    (@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?)
  end
%>

<%= link_to @user.name, @user %> → Edit Notification Settings
<h1>Edit Notification Settings</h1>


<%= form_for @user do |f| %>
<p>Email me when someone...</p>
  <table>
    <tbody>
      <tr>
        <td>replies to my thread</td>
        <td>
          <%= f.check_box :mail_own_thread_reply, disabled: !can_edit? %>
        </td>
      </tr>
      <tr>
        <td>replies to a thread I already replied to</td>
        <td>
          <%= f.check_box :mail_other_thread_reply, disabled: !can_edit? %>
        </td>
      </tr>
      <tr>
        <td>
          comments my blog post<br>
          <i>(Currently used for staff only)</i>
        </td>
        <td>
          <%= f.check_box :mail_own_blogpost_comment, disabled: !can_edit? %>
        </td>
      </tr>
      <tr>
        <td>comments a blog post I already commented</td>
        <td>
          <%= f.check_box :mail_other_blogpost_comment, disabled: !can_edit? %>
        </td>
      </tr>
      <tr>
        <td>
          mentions me in a thread or comment
        </td>
        <td>
          <%= f.check_box :mail_mention, disabled: !can_edit? %>
        </td>
      </tr>
    </tbody>
  </table>
  <h3>Public Key</h1>
  <p>All notification emails will be encrypted with this key if you supply it.</p>
  <%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----", disabled: !can_edit? %>
  <p><%= f.submit "Save changes", class: "btn blue left", disabled: !can_edit? %></p>
  <div class="clear"></div>

  <% if !@user.is?(current_user) && !current_user.confirmed? %>
    <span class='red-alert'>You must confirm your own email before you can edit other user's notification settings.</span>
  <% elsif !@user.confirmed? && @user.is?(current_user) %>
    <span class='red-alert'>You need to confirm your email before you can edit your notification settings.</span>
  <% end %>
<% end %>