This repository has been archived by the owner on Jun 24, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
newlink.html
166 lines (143 loc) · 5.6 KB
/
newlink.html
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
## The contents of this file are subject to the Common Public Attribution
## License Version 1.0. (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License at
## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
## License Version 1.1, but Sections 14 and 15 have been added to cover use of
## software over a computer network and provide for limited attribution for the
## Original Developer. In addition, Exhibit A has been modified to be
## consistent with Exhibit B.
##
## Software distributed under the License is distributed on an "AS IS" basis,
## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
## the specific language governing rights and limitations under the License.
##
## The Original Code is reddit.
##
## The Original Developer is the Initial Developer. The Initial Developer of
## the Original Code is reddit Inc.
##
## All portions of the code written by reddit are Copyright (c) 2006-2015
## reddit Inc. All Rights Reserved.
###############################################################################
<%!
from r2.lib.strings import strings
from r2.lib.pages import SubredditSelector, UserText
from r2.lib.template_helpers import add_sr, _wsf, format_html
from r2.lib.filters import safemarkdown
%>
<%namespace file="utils.html" import="error_field, submit_form, _a_buffered, text_with_links"/>
<%namespace name="utils" file="utils.html"/>
<%
if thing.default_sr:
sr = format_html(" %s", unsafe(_a_buffered(thing.default_sr.name, href=thing.default_sr.path)))
else:
sr = _("SaidIt")
%>
<h1>${_wsf("submit to %(sr)s", sr=sr)}</h1>
<%utils:submit_form onsubmit="return post_form(this, 'submit', linkstatus, null, true)"
action=${add_sr("/submit")},
_class="submit content warn-on-unload",
_id="newlink">
%if thing.show_link and thing.show_self:
${thing.formtabs_menu}
%endif
<div class="formtabs-content">
<div class="spacer">
%if thing.show_link:
<div id="link-desc" class="infobar">${strings.submit_link}</div>
%endif
%if thing.show_self:
<div id="text-desc" class="infobar">${strings.submit_text}</div>
%endif
</div>
<div class="spacer">
<%utils:round_field title="${_('title')}" id="title-field">
<textarea name="title" rows="2" required>${thing.title}</textarea>
${error_field("NO_TEXT", "title", "div")}
${error_field("TOO_LONG", "title", "div")}
</%utils:round_field>
</div>
%if thing.show_link:
<div class="spacer">
<%utils:round_field title="${_('url')}" id="url-field">
<input name="kind" value="link" type="hidden"/>
<input id="url" name="url" type="url" value="${thing.url}" required>
${error_field("NO_URL", "url", "div")}
${error_field("BAD_URL", "url", "div")}
${error_field("DOMAIN_BANNED", "url", "div")}
${error_field("ALREADY_SUB", "url", "div")}
${error_field("NO_LINKS", "sr")}
${error_field("NO_SELFS", "sr")}
<div id="suggest-title">
<span class="title-status"></span>
<button type="button" tabindex="100" onclick="fetch_title()">${_("suggest title")}</button>
</div>
</%utils:round_field>
</div>
%endif
%if thing.show_self:
<div class="spacer">
<%utils:round_field title="${_('text')}", description="${_('(optional)')}" id="text-field">
<input name="kind" value="self" type="hidden"/>
${UserText(None, text = thing.text, have_form = False, creating = True)}
${error_field("NO_SELFS", "sr")}
</%utils:round_field>
</div>
%endif
<div class="spacer">
<%utils:round_field title="${_('choose a sub')}" id="reddit-field">
${SubredditSelector(thing.default_sr, extra_subreddits=thing.extra_subreddits, required=True)}
</%utils:round_field>
</div>
<div class="spacer">
<div class="submit_text roundfield">
<h1>${_wsf('submitting to %(sr)s', sr=unsafe('/' + g.brander_community_abbr + '/<span class="sr"></span>'))}</h1>
<span class="content md-container">
%if thing.default_sr and thing.default_sr.submit_text:
${unsafe(safemarkdown(thing.default_sr.submit_text))}
%endif
</span>
</div>
</div>
<div class="spacer">
<%utils:round_field title="${_('options')}">
<input class="nomargin" type="checkbox" ${'checked="checked"' if c.user.pref_sendreplies else ''} name="sendreplies" id="sendreplies" data-send-checked="true"/>
<label for="sendreplies">
${_("send replies to my inbox")}
</label>
</%utils:round_field>
</div>
${thing.captcha}
</div>
<div class="roundfield info-notice">
${text_with_links(_("please be mindful of SaidIt's %(content_policy)s"),
content_policy=dict(
link_text=_("content policy"),
path="/r/SaidIt/comments/j1/the_saiditnet_terms_and_content_policy/",
target="_blank"),
good_reddiquette=dict(
link_text=_("good reddiquette"),
path="/wiki/reddiquette",
target="_blank"),
)}
</div>
<input name="resubmit" value="${thing.resubmit}" type="hidden"/>
<div class="spacer">
<button class="btn" name="submit" value="form" type="submit">${_("submit")}</button>
<span class="status"></span>
${error_field("RATELIMIT", "ratelimit")}
${error_field("INVALID_OPTION", "sr")}
${error_field("IN_TIMEOUT", "sr")}
</div>
</%utils:submit_form>
%if thing.show_self and thing.show_link:
<script type="text/javascript">
$(function() {
var form = $("#newlink");
if(form.length) {
var default_menu = form.find(".${thing.default_tab}-button:first");
select_form_tab(default_menu, "${thing.default_show}", "${thing.default_hide}");
}
});
</script>
%endif