minor styling changes

This commit is contained in:
Kyle Mahan 2015-04-19 12:46:02 -07:00
parent 2e20ead09b
commit 9cfa2e4739
5 changed files with 97 additions and 53 deletions

View file

@ -438,12 +438,16 @@ article {
label {
font-weight: bold;
display: inline-block;
margin-bottom: 5px;
margin: 5px 0 2px 0;
max-width: 100%; }
textarea, input[type="text"], input[type="url"] {
width: 100%;
margin: 0.25em 0; }
margin: 0.25em 0;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: 0x 1px 1px rgba(0, 0, 0, 0.075) inset; }
textarea.input-25, input[type="text"].input-25, input[type="url"].input-25 {
width: 23%; }
textarea.input-50, input[type="text"].input-50, input[type="url"].input-50 {
@ -451,6 +455,20 @@ textarea, input[type="text"], input[type="url"] {
textarea.input-75, input[type="text"].input-75, input[type="url"].input-75 {
width: 73%; }
button {
border: 1px solid #cccccc;
background: #efefef;
color: #003366;
border-radius: 4px;
padding: 4px 10px;
margin: 5px 5px 5px 0;
box-shadow: 0 1px 1px #ccc; }
button:hover {
background: white; }
button:active {
box-shadow: 0 0;
margin: 6px 4px 4px 1px; }
.micropub-form .content {
height: 1em;
width: calc(100% - 1.4em - 96px);

View file

@ -127,7 +127,7 @@ article {
label {
font-weight: bold;
display: inline-block;
margin-bottom: 5px;
margin: 5px 0 2px 0;
max-width: 100%;
}
@ -135,6 +135,11 @@ textarea, input[type="text"], input[type="url"] {
width: 100%;
margin: 0.25em 0;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: 0x 1px 1px rgba(0, 0, 0, 0.075) inset;
&.input-25 {
width: 23%;
}
@ -146,6 +151,24 @@ textarea, input[type="text"], input[type="url"] {
}
}
button {
border: 1px solid rgb(204, 204, 204);
background: #efefef;
color: #003366;
border-radius: 4px;
padding: 4px 10px;
margin: 5px 5px 5px 0;
box-shadow: 0 1px 1px #ccc;
&:hover {
background: white;
}
&:active {
box-shadow: 0 0;
margin: 6px 4px 4px 1px;
}
}
.micropub-form {
.content {
height: 1em;

View file

@ -235,20 +235,19 @@ def notify_feed_updated(session, feed, entries):
reverse=True)
for s in feed.subscriptions:
for user in s.users:
with flask_app.test_request_context():
flask_login.login_user(user, remember=True)
message = json.dumps({
'user': user.id,
'feed': feed.id,
'entries': [
render_template('_entry.jinja2', feed=feed, entry=e)
for e in entries
],
})
for topic in ('user={}'.format(user.id),
'user={}&feed={}'.format(user.id, feed.id)):
redis.publish('woodwind_notify:{}'.format(topic), message)
with flask_app.test_request_context():
flask_login.login_user(s.user, remember=True)
message = json.dumps({
'user': s.user.id,
'feed': feed.id,
'entries': [
render_template('_entry.jinja2', feed=feed, entry=e)
for e in entries
],
})
for topic in ('user:{}'.format(s.user.id),
'subsc:{}'.format(s.id)):
redis.publish('woodwind_notify:{}'.format(topic), message)
def is_content_equal(e1, e2):

View file

@ -20,33 +20,25 @@
{% for s in subscriptions %}
<article>
<article>
<form class="edit-subscription" action="{{ url_for('.edit_subscription') }}" method="POST">
<input type="hidden" name="id" value="{{ s.id }}"/>
<label>Name</label>
<input type="text" name="name" value="{{ s.name }}"/>
<label>Tags</label>
<input type="text" name="tags" value="{{ (s.tags or []) | join(',') }}"/>
<label>URL</label>
<input type="text" name="feed" value="{{ s.feed.feed }}" disabled />
<button type="submit">Save Edits</button>
</form>
<div>
<a href="{{ url_for('.index', subscription=s.id) }}">View only posts from this feed</a>
<a target="_blank" href="{{ url_for('.index', subscription=s.id) }}">View Posts</a>
<br/>
<a class="show-details" data-target="details-{{loop.index}}" href="#">Show Details</a>
</div>
<form action="{{ url_for('.edit_subscription') }}" method="POST">
<input type="hidden" name="id" value="{{ s.id }}"/>
<label>Name</label>
<input type="text" name="name" value="{{ s.name }}"/>
<label>URL</label>
<input type="text" name="feed" value="{{ s.feed.feed }}" editable="false" />
<button type="submit">Save Edits</button>
</form>
<form action="{{ url_for('.update_feed') }}" method="POST">
<input type="hidden" name="id" value="{{ s.feed.id }}"/>
<button type="submit">Poll Now</button>
</form>
<form action="{{ url_for('.unsubscribe') }}" method="POST">
<input type="hidden" name="id" value="{{ s.id }}"/>
<button type="submit">Unsubscribe</button>
</form>
<a class="show-details" data-target="details-{{loop.index}}" href="#">Show Details</a>
<div class="feed-details" id="details-{{loop.index}}">
<strong>Details</strong>
<ul>
@ -59,24 +51,37 @@
<li>PuSH expiry: {{s.feed.push_expiry | relative_time}}</li>
</ul>
</div>
<form action="{{ url_for('.update_feed') }}" method="POST" style="display:inline">
<input type="hidden" name="id" value="{{ s.feed.id }}"/>
<button type="submit">Poll Now</button>
</form>
<form action="{{ url_for('.unsubscribe') }}" method="POST" style="display:inline">
<input type="hidden" name="id" value="{{ s.id }}"/>
<button type="submit">Unsubscribe</button>
</form>
</article>
{% endfor %}
{% endblock body %}
{% block foot %}
<script>
$(function() {
<script>
$(function() {
$(".feed-details").css({display: "none"});
$(".feed-details").css({display: "none"});
$(".show-details").click(function(evt) {
$(".show-details").click(function(evt) {
evt.preventDefault();
var target = $(this).data("target");
$("#" + target).css({display: "inherit"});
$(this).css({display: "none"});
});
});
});
</script>
});
</script>
{% endblock foot %}

View file

@ -53,10 +53,9 @@ def index():
if not subsc:
flask.abort(404)
entry_query = entry_query.filter(Subscription.id == subsc_id)
ws_topic = 'user={}&feed={}'.format(subsc.user.id,
subsc.feed.id)
ws_topic = 'subsc:{}'.format(subsc.id)
else:
ws_topic = 'user={}'.format(flask_login.current_user.id)
ws_topic = 'user:{}'.format(flask_login.current_user.id)
entries = entry_query.order_by(Entry.retrieved.desc(),
Entry.published.desc())\
@ -130,9 +129,9 @@ def update_all():
def unsubscribe():
subsc_id = flask.request.form.get('id')
subsc = Subscription.query.get(subsc_id)
subsc.delete()
db.session.delete(subsc)
db.session.commit()
flask.flash('Unsubscribed {} ({})'.format(subsc.name))
flask.flash('Unsubscribed {}'.format(subsc.name))
return flask.redirect(flask.url_for('.subscriptions'))