From 58fd1e858210fa0b2f1a36d103e7b6cd5a364c41 Mon Sep 17 00:00:00 2001 From: spez Date: Wed, 3 Sep 2008 11:54:59 -0700 Subject: [PATCH] changed the styling of the subreddit edit page. changed the styling of buttons sitewide --- r2/r2/controllers/api.py | 2 +- r2/r2/controllers/errors.py | 2 +- r2/r2/controllers/validator/validator.py | 2 +- r2/r2/public/static/reddit.css | 53 ++- r2/r2/public/static/utils.js | 3 +- r2/r2/templates/createsubreddit.html | 533 ++++++++++++----------- r2/r2/templates/prefoptions.html | 31 +- 7 files changed, 315 insertions(+), 311 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 5c2f6e0e3..3eede94ac 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -883,7 +883,7 @@ class ApiController(RedditController): elif res._chk_errors((errors.NO_TITLE, errors.TITLE_TOO_LONG)): res._hide('example_title') res._focus('title') - elif res._chk_error(errors.INVALID_SUBREDDIT_TYPE): + elif res._chk_error(errors.INVALID_OPTION): pass elif res._chk_errors((errors.BAD_CNAME, errors.USED_CNAME)): res._hide('example_domain') diff --git a/r2/r2/controllers/errors.py b/r2/r2/controllers/errors.py index 214dd1270..8949d71c2 100644 --- a/r2/r2/controllers/errors.py +++ b/r2/r2/controllers/errors.py @@ -59,7 +59,7 @@ error_list = dict(( ('BANNED_DOMAIN', "Domain banned"), ('BAD_CNAME', "that domain isn't going to work"), ('USED_CNAME', "that cname is already in use"), - ('INVALID_SUBREDDIT_TYPE', _('that option is not valid')), + ('INVALID_OPTION', _('that option is not valid')), ('DESC_TOO_LONG', _('description is too long')), ('CHEATER', 'what do you think you\'re doing there?'), ('BAD_EMAILS', _('the following emails are invalid: %(emails)s')), diff --git a/r2/r2/controllers/validator/validator.py b/r2/r2/controllers/validator/validator.py index 00ea2f8fb..3edfcb40f 100644 --- a/r2/r2/controllers/validator/validator.py +++ b/r2/r2/controllers/validator/validator.py @@ -623,7 +623,7 @@ class VOneOf(Validator): def run(self, val): if self.options and val not in self.options: - c.errors.add(errors.INVALID_SUBREDDIT_TYPE) + c.errors.add(errors.INVALID_OPTION) return self.default else: return val diff --git a/r2/r2/public/static/reddit.css b/r2/r2/public/static/reddit.css index 77f005133..44a54c052 100644 --- a/r2/r2/public/static/reddit.css +++ b/r2/r2/public/static/reddit.css @@ -47,17 +47,16 @@ a:focus { -moz-outline-style: none; } div.autosize { display: table; width: 1px} div.autosize > div { display: table-cell; } -.btn { background-color:#e9e9e9; border: 1px solid #369; padding: 2px;} - input.txt { background-color:#f7f7f7; border: 1px solid #369; } +input[type=checkbox], input[type=radio] { margin-top: .4em; } + /* forms */ .iform th { text-align: right; color: black; font-weight: normal; text-transform: lowercase; } -.iform button {background-color:#e9e9e9; border: 1px solid #369; vertical-align: bottom} .wrong {color: red; font-weight: normal} .subform input.text { width: 25em } @@ -586,8 +585,9 @@ before enabling */ .infobar { background-color: #f6e69f; - padding: 0px 10px; + padding: 5px 10px; margin: 5px 310px 5px 5px; + border: 1px solid orange; } .menuarea { @@ -756,9 +756,7 @@ a.star { text-decoration: none; color: #ff8b60 } float: left; } .commentreply .buttons button { - margin: 0px; - margin-right: 5px; - border-top: none; + margin: 5px; } .commentreply table.help { @@ -914,9 +912,6 @@ a.star { text-decoration: none; color: #ff8b60 } } .login-form-side button { - font-size: 12px; - padding: 2px 3px 2px 3px; - width: 4em; float: right; } @@ -1028,13 +1023,6 @@ a.star { text-decoration: none; color: #ff8b60 } padding: 1px; } -.loginform button { - border: 1px solid #369; - background-color:#e9e9e9; - margin-left: 5px; - margin-right: 10px; -} - .loginform #captcha { width: 250px; } @@ -1082,7 +1070,6 @@ a.star { text-decoration: none; color: #ff8b60 } } .usertable { margin-left: 10px;} -.usertable .pretty-form button { padding: 0px 3px; } /*overwrite pretty-form*/ .usertable { font-size: larger } .usertable td { padding: 0 .7em } .usertable { white-space: nowrap } @@ -1204,21 +1191,30 @@ a.star { text-decoration: none; color: #ff8b60 } vertical-align: top; } -.pretty-form input[type=checkbox] {margin: 3px .5em;} -.pretty-form p {margin: 3px .5em;} -.pretty-form input[type=radio] {margin: 3px .5em 0px .5em; vertical-align:top} +.pretty-form p {margin: 3px ;} +.pretty-form input[type=checkbox], +.pretty-form input[type=radio] {margin: 2px .5em 0px .5em; } .pretty-form img { margin: 3px .5em} .pretty-form input[type=text], .pretty-form textarea, -.pretty-form input[type=password] { border: 1px solid gray; width: 25em} +.pretty-form input[type=password] { + border: 1px solid gray; + width: 300px; + padding: 2px; +} + +.pretty-form .infobar { + width: 285px; + margin: 5px; + } .pretty-form input[type=text], +.pretty-form input[type=file], .pretty-form input[type=password], .pretty-form select, .pretty-form b, .pretty-form textarea, -.pretty-form button { margin: 3px .5em; padding: 1px; } -.pretty-form button { padding: 2px} +.pretty-form button { margin: 3px .5em; } .pretty-form th { text-align: right } /*pref page boxes*/ @@ -1246,14 +1242,17 @@ a.star { text-decoration: none; color: #ff8b60 } .opt-form { font-size: larger } .opt-form form { display: inline; } +/* pref table - used for preferences and edit subreddit pages */ .preftable th { padding: 10px; font-weight: bold; vertical-align: top; - text-align: left; + text-align: right; } -.preftable td.prefright { padding: 10px } -.preftable .spacer { margin-top: 5px; margin-bottom: 5px; } +.preftable td.prefright { padding: 8px 0;} +.preftable .spacer { margin-bottom: 5px; } +.preftable .note { width: 100%; vertical-align: top; padding-top: 10px; } +.save-button { margin-left: 5px; } .over18 button { margin: 0 10px 0 10px; padding: 5px} diff --git a/r2/r2/public/static/utils.js b/r2/r2/public/static/utils.js index 63a122ab9..3fe83bd69 100644 --- a/r2/r2/public/static/utils.js +++ b/r2/r2/public/static/utils.js @@ -299,7 +299,6 @@ function gotoTextboxLine(textboxID, lineNo) { function uploadHeaderImage(status) { var form = $('upload-header-image'); - var iframe = $('upload-header-iframe'); form.op.value = 'upload'; $('img-status').innerHTML = status; @@ -312,7 +311,6 @@ function uploadHeaderImage(status) { function deleteHeaderImage(status) { var form = $('upload-header-image'); - var iframe = $('upload-header-iframe'); form.reset(); form.op.value = 'delete'; @@ -337,6 +335,7 @@ function completedUploadHeaderImage(status,img_src,op) { } else { $('header-img-preview').src = img_src; show('delete-header-img'); + hide('submit-header-img'); show('header-img-preview-container'); } } diff --git a/r2/r2/templates/createsubreddit.html b/r2/r2/templates/createsubreddit.html index 0d6bc472c..f79718739 100644 --- a/r2/r2/templates/createsubreddit.html +++ b/r2/r2/templates/createsubreddit.html @@ -52,275 +52,263 @@ function update_title() { - %if thing.site: -

${_("manage your reddit")}

- %else: - %if thing.name: -

- ${_("that subreddit doesn't exist, but you can create it here.")}

- %endif -

${_("create a reddit")}

+%if thing.site: +

${_("manage your reddit")}

+%else: + %if thing.name: +

+ ${_("that subreddit doesn't exist, but you can create it here.")}

%endif +

${_("create a reddit")}

+%endif -
- %if thing.site: - - %endif - - - - - - - - - - - - - - - - - - - %if c.user_is_admin: - - - - - - - - - - - - - - - - - - - - - - - - - - %endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - %if thing.site: - ${thing.site.name} - %else: - - %endif - - %if not thing.site: - ${error_field("SUBREDDIT_EXISTS", "span")} - ${error_field("BAD_SR_NAME", "span")} - - ${_("no spaces, e.g. slashdot")} - - %endif -
- - - %if thing.site: - - %else: - - %endif - - ${error_field("NO_TITLE", "span")} - ${error_field("TITLE_TOO_LONG", "span")} - %if not thing.site: - - ${_("e.g. slashdot: news for nerds, stuff that matters")} - - %endif -
- - - - - ${error_field("DESC_TOO_LONG", "span")} -
- - - - -
- - - %if thing.site: - - %else: - - %endif -
- - - %if thing.site: - - %else: - - %endif -
- - - %if thing.site: - - %else: - - %endif -
- - - %if thing.site: - - %else: - - %endif -
- - - <% - default_lang = thing.site and thing.site.lang or c.lang or '' - default_lang = default_lang.split('-')[0] - default_lang = 'en' if len(default_lang) != 2 else default_lang - %> - ${language_tool(all_langs = True, default_lang = default_lang)} -
- - - - ${radio_type(_("public"), _("anyone can view and submit"))} - ${radio_type(_("restricted"), _("anyone can view, but only contributors can submit links"))} - ${radio_type(_("private"), _("only contributors can view and submit"))} -
-
${error_field("INVALID_SUBREDDIT_TYPE", "span")}
- - -
- - -
- - - %if thing.site: - - %else: - - %endif - - ${error_field("BAD_CNAME", "span")} - ${error_field("USED_CNAME", "span")} - %if not thing.site: - - ${_("e.g. reddit.slashdot.org (optional)")} - - %endif -
- - %if thing.site: - - %else: - - %endif - - - ${error_field("RATELIMIT", "span")} -
-
- -%if thing.site and thing.site.can_change_stylesheet(c.user) and not g.css_killswitch: -

${_('change the look')}

- - + + %if thing.site: + + %endif +
- + - - - - + + + + + + + + + + + %if c.user_is_admin: + + + + + + + + + + + + + + + + + + + + + + + + + + %endif + + + + + + + + + + + + + + + + + + + + + + + + +
- + -

${plain_link(_('edit the stylesheet'), - '/about/stylesheet', - sr_path = True)}

+
+ %if thing.site: + ${thing.site.name} + %else: + + %endif + + %if not thing.site: + ${error_field("SUBREDDIT_EXISTS", "span")} + ${error_field("BAD_SR_NAME", "span")} + + ${_("no spaces, e.g. slashdot")} + + %endif
- - + + + + %if thing.site: + + %else: + + %endif + + ${error_field("NO_TITLE", "span")} + ${error_field("TITLE_TOO_LONG", "span")} + %if not thing.site: + + ${_("e.g. slashdot: news for nerds, stuff that matters")} + + %endif +
+ + + + + ${error_field("DESC_TOO_LONG", "span")} +
+ + + + +
+ + + %if thing.site: + + %else: + + %endif +
+ + + %if thing.site: + + %else: + + %endif +
+ + + %if thing.site: + + %else: + + %endif +
+ + + %if thing.site: + + %else: + + %endif +
+ + + <% + default_lang = thing.site and thing.site.lang or c.lang or '' + default_lang = default_lang.split('-')[0] + default_lang = 'en' if len(default_lang) != 2 else default_lang + %> + ${language_tool(all_langs = True, default_lang = default_lang)} +
+ + + + ${radio_type(_("public"), _("anyone can view and submit"))} + ${radio_type(_("restricted"), _("anyone can view, but only contributors can submit links"))} + ${radio_type(_("private"), _("only contributors can view and submit"))} +
+
+ + +
+ + +
+ + + %if thing.site: + + %else: + + %endif + + + what's this? + ${error_field("BAD_CNAME", "span")} + ${error_field("USED_CNAME", "span")} +
+ + +
+ + %if thing.site and thing.site.can_change_stylesheet(c.user) and not g.css_killswitch: + + + + %endif
+ ${_("look and feel")} + +
+ ${plain_link(_("edit the stylesheet"), + "/about/stylesheet", + _sr_path = True)} + + (${_("leaves this page")}) +
+
+ + +
-%endif + +
+ <% + if thing.site: + name = "edit" + text = _("save options") + else: + name = "create" + text = _("create") + %> + + + + ${error_field("RATELIMIT", "span")} +
diff --git a/r2/r2/templates/prefoptions.html b/r2/r2/templates/prefoptions.html index 9dd43c4d9..20511eb4c 100644 --- a/r2/r2/templates/prefoptions.html +++ b/r2/r2/templates/prefoptions.html @@ -113,14 +113,10 @@ ${_("link options")} - ${checkbox(_("show me new links on the front page"), "organic")} -
- ${checkbox(_("compress the link display"), "compress")} -
- ${checkbox(_("don't show links after i've liked them"), "hide_ups")} -
- ${checkbox(_("don't show links after i've disliked them"), "hide_downs")} -
+

${checkbox(_("show me new links on the front page"), "organic")}

+

${checkbox(_("compress the link display"), "compress")}

+

${checkbox(_("don't show links after i've liked them"), "hide_ups")}

+

${checkbox(_("don't show links after i've disliked them"), "hide_downs")}

<% # stuff I can soon delete: _("display") @@ -129,15 +125,18 @@ _("don't show me comments with a score less than") _("comments by default") %> - ${unsafe(_("display %(num)s links at once") % \ - dict(num=capture(link_options)))} -
+

+ ${unsafe(_("display %(num)s links at once") % \ + dict(num=capture(link_options)))} +

<% input = capture(num_input, c.user.pref_min_link_score, 'min_link_score') %> +

${unsafe(_("don't show me sites with a score less than %(num)s") % dict(num = input))} ${_("(blank for none)")} +

@@ -147,10 +146,12 @@ input = capture(num_input, c.user.pref_min_comment_score, 'min_comment_score') %> - ${unsafe(_("don't show me comments with a score less than %(num)s") % dict(num = input))} - ${_("(blank for none)")} -
- <% +

+ ${unsafe(_("don't show me comments with a score less than %(num)s") % dict(num = input))} + ${_("(blank for none)")} +

+

+ <% input = capture(num_input, c.user.pref_num_comments, 'num_comments') %>