diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 303c64f5f..897c5cc52 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -2436,6 +2436,9 @@ class UserList(Templated): to be listing in this UserList instance""" raise NotImplementedError + def can_remove_self(self): + return False + @property def container_name(self): return c.site._fullname @@ -2718,6 +2721,10 @@ class ContributorList(UserList): class ModList(UserList): """Moderator list for a reddit.""" type = 'moderator' + remove_self_action = _('leave') + remove_self_title = _('you are a moderator of this subreddit. %(action)s') + remove_self_confirm = _('stop being a moderator?') + remove_self_final = _('you are no longer a moderator') @property def form_title(self): @@ -2727,6 +2734,9 @@ class ModList(UserList): def table_title(self): return _("moderators of %(reddit)s") % dict(reddit = c.site.name) + def can_remove_self(self): + return c.user_is_loggedin and c.site.is_moderator(c.user) + def editable_fn(self, user): if not c.user_is_loggedin: return False diff --git a/r2/r2/public/static/css/reddit.css b/r2/r2/public/static/css/reddit.css index c98c4e240..dc06e0d22 100644 --- a/r2/r2/public/static/css/reddit.css +++ b/r2/r2/public/static/css/reddit.css @@ -1859,6 +1859,42 @@ label + #moresearchinfo { .usertable td, .usertable th { padding: 0 .7em } .usertable { white-space: nowrap } +.usertable .remove-self { + display: inline-block; + margin: 1em 0 .5em; + padding: 11px 15px; + border: 1px solid #bbb; + border-radius: 2px; +} + +.usertable .moderator.remove-self { + background: #fdffe8; +} + +.usertable .remove-self .option.main:before { + margin-right: 7px; +} + +.usertable .remove-self .option { + display: inline; +} + +.usertable .remove-self .togglebutton, .usertable .remove-self .error { + display: none; + font-size: inherit; + border-left: 1px solid #bbb; + padding: 4px 15px; + padding-right: 0; + margin-left: 10px; +} + +.usertable .remove-self .active .togglebutton { + display: inline; +} + +.usertable .remove-self .error.active { + display: inline; +} .aboutpage { margin-right: 320px; } .aboutpage p { margin: 5px; } @@ -4254,7 +4290,7 @@ dd { margin-left: 20px; } font-size: 130%; } -.titlebox form.toggle { +.titlebox form.toggle, .leavemoderator { margin: 0; padding: 5px 0px; font-size: smaller; @@ -4262,7 +4298,8 @@ dd { margin-left: 20px; } background: white none no-repeat scroll center left; } -.titlebox form.leavemoderator-button:before, +.usertable .remove-self .main:before, +.titlebox .leavemoderator:before, .titlebox form.leavecontributor-button:before, .icon-menu .reddit-edit:before, .icon-menu .reddit-traffic:before, @@ -4284,7 +4321,7 @@ dd { margin-left: 20px; } margin-right: 5px; } -.titlebox form.leavemoderator-button:before { +.titlebox .leavemoderator:before, .moderator.remove-self .main:before { background-image: url(../shield.png); /* SPRITE */ } diff --git a/r2/r2/templates/printablebuttons.html b/r2/r2/templates/printablebuttons.html index 927b739b8..74ef5e2db 100644 --- a/r2/r2/templates/printablebuttons.html +++ b/r2/r2/templates/printablebuttons.html @@ -377,21 +377,22 @@ question = None, format = '%(link)s', format_arg = 'link', - hidden_data = {})"> + hidden_data = {}, + _class = '')"> <% if question is None: question = _("are you sure?") - link = ('' + link = ('' + title + '') link = format % {format_arg : link} link = unsafe(link.replace(" <", " <").replace("> ", "> ")) %> -