##// END OF EJS Templates
Checkbox to subscribe replied or created thread
neko259 -
r1625:eebd28d6 default
parent child Browse files
Show More
@@ -11,7 +11,7 b' CacheTimeout = 600'
11 MaxTextLength = 30000
11 MaxTextLength = 30000
12 MaxFileSize = 8000000
12 MaxFileSize = 8000000
13 LimitFirstPosting = true
13 LimitFirstPosting = true
14 LimitPostingSpeed = true
14 LimitPostingSpeed = false
15 PowDifficulty = 0
15 PowDifficulty = 0
16 # Delay in seconds
16 # Delay in seconds
17 PostingDelay = 30
17 PostingDelay = 30
@@ -177,6 +177,7 b' class PostForm(NeboardForm):'
177 threads = forms.CharField(required=False, label=_('Additional threads'),
177 threads = forms.CharField(required=False, label=_('Additional threads'),
178 widget=forms.TextInput(attrs={ATTRIBUTE_PLACEHOLDER:
178 widget=forms.TextInput(attrs={ATTRIBUTE_PLACEHOLDER:
179 '123 456 789'}))
179 '123 456 789'}))
180 subscribe = forms.BooleanField(required=False, label=_('Subscribe to thread'))
180
181
181 guess = forms.CharField(widget=forms.HiddenInput(), required=False)
182 guess = forms.CharField(widget=forms.HiddenInput(), required=False)
182 timestamp = forms.CharField(widget=forms.HiddenInput(), required=False)
183 timestamp = forms.CharField(widget=forms.HiddenInput(), required=False)
@@ -328,6 +329,9 b' class PostForm(NeboardForm):'
328 else:
329 else:
329 return []
330 return []
330
331
332 def is_subscribe(self):
333 return self.cleaned_data['subscribe']
334
331 def _clean_text_file(self):
335 def _clean_text_file(self):
332 text = self.cleaned_data.get('text')
336 text = self.cleaned_data.get('text')
333 file = self.get_file()
337 file = self.get_file()
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -551,3 +551,6 b' msgstr "\xd0\xa3\xd0\xb4\xd0\xb0\xd0\xbb\xd0\xb8\xd1\x82\xd1\x8c \xd1\x82\xd0\xb5\xd0\xbc\xd1\x83"'
551
551
552 msgid "Messages per day/week/month:"
552 msgid "Messages per day/week/month:"
553 msgstr "Сообщений за день/неделю/месяц:"
553 msgstr "Сообщений за день/неделю/месяц:"
554
555 msgid "Subscribe to thread"
556 msgstr "Подписаться на тему" No newline at end of file
@@ -23,7 +23,7 b''
23 for the JavaScript code in this page.
23 for the JavaScript code in this page.
24 */
24 */
25
25
26 var CLASS_POST = '.post'
26 var CLASS_POST = '.post';
27
27
28 var POST_ADDED = 0;
28 var POST_ADDED = 0;
29 var POST_UPDATED = 1;
29 var POST_UPDATED = 1;
@@ -152,6 +152,16 b' function getThreadDiff() {'
152
152
153 // TODO Process removed posts if any
153 // TODO Process removed posts if any
154 $('.metapanel').attr('data-last-update', data.last_update);
154 $('.metapanel').attr('data-last-update', data.last_update);
155
156 if (data.subscribed == 'True') {
157 var favButton = $('.not_fav');
158
159 if (favButton.length > 0) {
160 favButton.attr('value', 'unsubscribe');
161 favButton.removeClass('not_fav');
162 favButton.addClass('fav');
163 }
164 }
155 },
165 },
156 'json'
166 'json'
157 )
167 )
@@ -153,6 +153,10 b' class AllThreadsView(PostMixin, FileUplo'
153 # when creating this one
153 # when creating this one
154 post.notify_clients()
154 post.notify_clients()
155
155
156 if form.is_subscribe():
157 settings_manager = get_settings_manager(request)
158 settings_manager.add_or_read_fav_thread(post)
159
156 if html_response:
160 if html_response:
157 return redirect(post.get_absolute_url())
161 return redirect(post.get_absolute_url())
158
162
@@ -27,6 +27,7 b" PARAMETER_UPDATED = 'updated'"
27 PARAMETER_LAST_UPDATE = 'last_update'
27 PARAMETER_LAST_UPDATE = 'last_update'
28 PARAMETER_THREAD = 'thread'
28 PARAMETER_THREAD = 'thread'
29 PARAMETER_UIDS = 'uids'
29 PARAMETER_UIDS = 'uids'
30 PARAMETER_SUBSCRIBED = 'subscribed'
30
31
31 DIFF_TYPE_HTML = 'html'
32 DIFF_TYPE_HTML = 'html'
32 DIFF_TYPE_JSON = 'json'
33 DIFF_TYPE_JSON = 'json'
@@ -67,6 +68,9 b' def api_get_threaddiff(request):'
67 format_type=diff_type, request=request))
68 format_type=diff_type, request=request))
68 json_data[PARAMETER_LAST_UPDATE] = str(thread.last_edit_time)
69 json_data[PARAMETER_LAST_UPDATE] = str(thread.last_edit_time)
69
70
71 settings_manager = get_settings_manager(request)
72 json_data[PARAMETER_SUBSCRIBED] = str(settings_manager.thread_is_fav(opening_post))
73
70 # If the tag is favorite, update the counter
74 # If the tag is favorite, update the counter
71 settings_manager = get_settings_manager(request)
75 settings_manager = get_settings_manager(request)
72 favorite = settings_manager.thread_is_fav(opening_post)
76 favorite = settings_manager.thread_is_fav(opening_post)
@@ -142,6 +142,11 b' class ThreadView(BaseBoardView, PostMixi'
142 images=images)
142 images=images)
143 post.notify_clients()
143 post.notify_clients()
144
144
145 if form.is_subscribe():
146 settings_manager = get_settings_manager(request)
147 settings_manager.add_or_read_fav_thread(
148 post_thread.get_opening_post())
149
145 if html_response:
150 if html_response:
146 if opening_post:
151 if opening_post:
147 return redirect(post.get_absolute_url())
152 return redirect(post.get_absolute_url())
General Comments 0
You need to be logged in to leave comments. Login now