diff --git a/owl.py b/owl.py index 1a41f846c288691b8a98757132330af174831337..4c53658f83ee66cc9b3c763d362170eced5fc0b3 100644 --- a/owl.py +++ b/owl.py @@ -528,6 +528,7 @@ class EditPostForm(FlaskForm): comment = wtforms.TextAreaField("Comment:", validators=[validators.Length(max=65536)]) points = wtforms.DecimalField("Points:", validators=[validators.Optional()]) submit = wtforms.SubmitField("Submit") + silent_submit = wtforms.SubmitField("Silent submit") delete = wtforms.SubmitField("☠ Delete post ☠") @@ -665,7 +666,8 @@ def edit_post(cident, pid): db_query("UPDATE owl_posts SET modified=CURRENT_TIMESTAMP WHERE pid=%s", (pid,)) else: db_query("UPDATE owl_posts SET created=CURRENT_TIMESTAMP, modified=NULL WHERE pid=%s", (pid,)) - db_query("INSERT INTO owl_notify(pid) VALUES(%s) ON CONFLICT DO NOTHING", (pid,)) + if not form.silent_submit.data: + db_query("INSERT INTO owl_notify(pid) VALUES(%s) ON CONFLICT DO NOTHING", (pid,)) flash('Post changed.', 'info') db_connection.commit() diff --git a/static/owl.css b/static/owl.css index 631bed6ecc4c03db3fbd2a19ef6c4d8d7bb742ae..b991cdd6b3e54915533ffdb80ff419df5d4d040d 100644 --- a/static/owl.css +++ b/static/owl.css @@ -298,32 +298,27 @@ h1 { background: #ccccff; } -input[type='submit'] { +button, input[type='submit'] { background-color: white; - color: #1c561d; - border: 1px solid #0c560d; + color: #0000aa; + border: 1px solid blue; border-radius: 4px; padding: 0.2ex 0.8ex; font: inherit; cursor: pointer; } -input[type='submit']:hover { - background-color: #dff0d8; +button:hover, input[type='submit']:hover { + background-color: #ccccff; } -button { - background-color: white; - color: #0000aa; - border: 1px solid blue; - border-radius: 4px; - padding: 0.2ex 0.8ex; - font: inherit; - cursor: pointer; +.write, input[type='submit'].write { + color: #1c561d; + border-color: #0c560d; } -button:hover { - background-color: #ccccff; +.write:hover, input[type='submit'].write:hover { + background-color: #dff0d8; } .danger, input[type='submit'].danger { diff --git a/templates/admin-edit-topic.html b/templates/admin-edit-topic.html index 21af024fbb880cb59017e36f05a4b302457d1d45..79dee78c3f9909ae7f1c68cb9e38ec89626251ea 100644 --- a/templates/admin-edit-topic.html +++ b/templates/admin-edit-topic.html @@ -24,7 +24,7 @@ {{ field('public', 'topic is visible to students') }} {{ field('notify', 'send notifications on all posts now') }} </table> - <p class=buttons>{{ form.submit() }} + <p class=buttons>{{ form.submit(class='write') }} {% if tid != None %} <a class=button href='{{ url_for('admin_edit_topic', cident=g.course.ident, copy_tid=tid) }}'>Copy</a> <p>{{ form.delete(class='danger') }} (including {{ post_count }} posts) diff --git a/templates/admin-topic-graders.html b/templates/admin-topic-graders.html index 11c717e19184d3135d3f4415bad22d7572f8c065..261f33c8513ea7be9d355e6e762870bf31257eea 100644 --- a/templates/admin-topic-graders.html +++ b/templates/admin-topic-graders.html @@ -13,7 +13,7 @@ {{ form.csrf_token }} {{ form.uid }} <b>{{ s.full_name }}</b>: - {{ form.unassign }} + {{ form.unassign(class='write') }} </form></li> {% endfor %} </ul> @@ -25,7 +25,7 @@ {{ form.csrf_token }} {{ form.uid }} <b>{{ s.full_name }}</b>: - {{ form.assign }} + {{ form.assign(class='write') }} </form></li> {% endfor %} </ul> diff --git a/templates/edit-post.html b/templates/edit-post.html index 9384d08dff2c150531aff100e1d15750f6f6fcf9..f524c8f711d55809f9b81a8a4d64bd4290342487 100644 --- a/templates/edit-post.html +++ b/templates/edit-post.html @@ -20,8 +20,9 @@ <div id=preview> </div> </div> - <p>{{ form.submit() }} + <p>{{ form.submit(class='write') }} + {{ form.silent_submit(class='write',title="Submit, but do not send notifications.") }} <button type=button onclick='javascript:window.owl.preview()'>Preview</button> - <p>{{ form.delete() }} + <p>{{ form.delete(class='danger') }} </form> {% endblock %} diff --git a/templates/join.html b/templates/join.html index d6b53403debc69bc5a9d71c60ea485d1345728e2..3f14403881d08a73fa018edbffcb7b8da476a8fa 100644 --- a/templates/join.html +++ b/templates/join.html @@ -9,6 +9,6 @@ <form method="POST" action="?"> {{ form.csrf_token }} Enrollment token: {{ form.token(size=64) }} - <input type=submit value='Go!'> + <input type=submit class=write value='Go!'> </form> {% endblock %} diff --git a/templates/settings.html b/templates/settings.html index 8f250cd2e9efe35cf5dff553c9eb115d5e276c19..04929fc823888766cca439ed759e600cd579a860 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -11,6 +11,6 @@ <tr><td>Notify on own posts:<td>{{ form.notify_self() }} <tr><td>Show PDF attachments inline:<td>{{ form.inline_att() }} </table> - <p>{{ form.submit() }} + <p>{{ form.submit(class='write') }} </form> {% endblock %} diff --git a/templates/topic.html b/templates/topic.html index 656ba39f4310bf0f4641477637c2172277711700..c8e71f63f6954657a6ad4c26a07a6a7b664fa204 100644 --- a/templates/topic.html +++ b/templates/topic.html @@ -103,7 +103,7 @@ <div id=preview> </div> </div> - <p>{{ form.submit() }} + <p>{{ form.submit(class='write') }} <button type=button onclick='javascript:window.owl.preview()'>Preview</button> </form> {% endblock %}