...
 
Commits (3)
......@@ -31,7 +31,7 @@ def home():
form.populate_obj(signup)
db.session.add(signup)
db.session.commit()
flash( gettext('Your email has been added to the notification list: %s' % signup.email), 'success')
flash( gettext("Your email has been added to the notification list: ") + signup.email, 'success')
return redirect(url_for('.home'))
else:
flash( gettext('Your email has already been added to the notification list'), 'error')
......@@ -252,6 +252,13 @@ def admin_org(page=1):
@main.route("/message/edit/<int:mid>", methods=['GET', 'POST'])
@login_required
def message_edit(mid=0):
delete = request.args.get('delete')
if delete:
Message.query.filter_by(id=mid).delete()
db.session.commit()
flash(gettext("Deleted Message ") + str(mid), "success")
return redirect(url_for('.logging'))
message = Message.query.filter_by(id=mid).first()
form = MessageEditForm(obj=message)
if form.validate_on_submit():
......@@ -261,7 +268,7 @@ def message_edit(mid=0):
message.location = locationfinder(message.location.encode('utf-8'))
db.session.add(message)
db.session.commit()
flash(gettext('Message %s edited.' % message.id ))
flash(gettext("Message") + str(message.id) + gettext(" edited.") )
return redirect(url_for('.logging'))
return render_template("message_edit.html", data=message, form=form)
......@@ -287,7 +294,7 @@ def signups():
if delete:
Signup.query.filter_by(id=int(delete)).delete()
db.session.commit()
flash(gettext("Deleted user %s" % (delete)), "success")
flash(gettext("Deleted email ") + str(delete), "success")
return redirect(url_for(".signups"))
users = Signup.query.order_by(Signup.created).all()
......@@ -296,7 +303,7 @@ def signups():
@main.route("/logout")
def logout():
logout_user()
flash(gettext("You are logged out."), "success")
flash(gettext("You are logged out"), "success")
return redirect(url_for(".home"))
......@@ -446,7 +453,9 @@ def message_public(mid=False, page=1):
message = Message.query.filter(Message.delivered == 't').order_by(Message.created.desc()).paginate(page, ppp, False)
if not message:
return gettext('The message with id %s could not be found.' % mid)
flash (gettext("The message with id ") + str(mid) + gettext("could not be found"), 'error')
return redirect(url_for('.messages'))
return render_template('message.html', data = message)
''' end public info pages '''
......
......@@ -13,13 +13,10 @@
{% block css %}
{% endblock %}
{#
{% block meta %}
<meta name="description" content="">
<meta name="author" content="">
{% endblock %}
<script src="{{ url_for('static', filename='js/vendor/modernizr.min.js') }}"></script>
#}
{% if current_user.is_authenticated() %}
<script data-require="jquery@*" data-semver="2.0.3" src="https://code.jquery.com/jquery-2.0.3.min.js"></script>
<script data-require="bootstrap@*" data-semver="3.1.1" src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
{% endif %}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.3.2/css/simple-line-icons.css" rel='stylesheet' type='text/css'>
......
......@@ -29,7 +29,7 @@
</div>
<div class="form-group" style="width: 50%">
{{ form.subject.label }}
{{ form.subject(class_="form-control", value="VMA Viktigt meddelande till allmänheten") }}
{{ form.subject(class_="form-control", value="VMA - Viktigt meddelande till allmänheten") }}
{% if form.subject.errors %}
{% for e in form.subject.errors %}
<p class="help-block">{{ e }}</p>
......
......@@ -15,7 +15,7 @@
<ul class="nav navbar-nav">
{% if current_user.is_authenticated() %}
{% if current_user.admin %}
<li><a href="{{ url_for('.dashboard') }}"><span class="icon-feed"></span> Send </a></li>
<li><a href="{{ url_for('.dashboard') }}"><span class="icon-feed"></span> {{ _("Send") }} </a></li>
{% endif %}
{% endif %}
</ul>
......@@ -24,20 +24,20 @@
<ul class="nav navbar-nav">
{% if current_user.is_authenticated() %}
{% if current_user.admin %}
<li><a href="{{ url_for('.logging') }}"><span class="icon-list"></span> Logs </a></li>
<li><a href="{{ url_for('.topics') }}"><span class="icon-list"></span> Topics </a></li>
<li><a href="{{ url_for('.volunteer') }}"><span class="icon-list"></span> Volunteers </a></li>
<li><a href="{{ url_for('.signups') }}"><span class="icon-people"></span> Signups</a></li>
<li><a href="{{ url_for('.logging') }}"><span class="icon-list"></span> {{ _("Logs") }} </a></li>
<li><a href="{{ url_for('.topics') }}"><span class="icon-list"></span> {{ _("Topics") }} </a></li>
<li><a href="{{ url_for('.volunteer') }}"><span class="icon-list"></span> {{ _("Volunteers") }} </a></li>
<li><a href="{{ url_for('.signups') }}"><span class="icon-people"></span> {{ _("Signups") }} </a></li>
{% endif %}
<li><a href="{{ url_for('.users') }}"><span class="icon-people"></span> Users</a></li>
<li><a href="{{ url_for('.users') }}"><span class="icon-people"></span> {{ _("Users") }} </a></li>
{% if current_user.name %}
<p class="navbar-text"><span class="icon-user"></span> {{current_user.name}}</p>
{% else %}
<p class="navbar-text"><span class="icon-user"></span> {{current_user.email}}</p>
{% endif %}
<li><a href="{{ url_for('.logout') }}"><span class="icon-logout"></span> Sign out</a></li>
<li><a href="{{ url_for('.logout') }}"><span class="icon-logout"></span> {{ _("Sign out") }} </a></li>
{% else %}
<li><a href="{{ url_for('.login') }}"><span class="icon-login"></span> Sign in</a></li>
<li><a href="{{ url_for('.login') }}"><span class="icon-login"></span> {{ _("Sign in") }} </a></li>
{% endif %}
</ul>
</div><!-- /.navbar-collapse -->
......
......@@ -2,44 +2,86 @@
{% block title %}Message log{% endblock %}
{% block body %}
{% block modal %}
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
</div>
<div class="modal-body">
<p>You are about to delete this entry, this procedure is irreversible.</p>
<p>Do you want to proceed?</p>
<p class="debug-url"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<a class="btn btn-danger btn-ok">Delete</a>
</div>
</div>
</div>
</div>
{% endblock %}
<div class="container-fluid">
<div class="row">
<form role="form" action="" method="post"> {{ form.hidden_tag() }}
<div class="col-sm-12">
<p>Active: <br/>{{ form.active() }}
<div class="col-sm-4">
To:<br/>
{{ data.topic.name }}
</div>
<div class="col-sm-8">
Active: <br/>{{ form.active() }}
{% if form.active.errors %}
{% for e in form.active.errors %}
<p class="help-block">{{ e }}</p>
{% endfor %}
{% endif %}
</p>
<p>To:<br/> {{ data.topic.name }} </p>
<p>Subject:<br/> {{ form.subject(size=80) }}
</div>
</div>{# end row #}
<div class="row">
<div class="col-sm-12">
Subject:<br/> {{ form.subject(size=80) }}
{% if form.subject.errors %}
{% for e in form.subject.errors %}
<p class="help-block">{{ e }}</p>
{% endfor %}
{% endif %}
</p>
<p>Message:<br/>
</div>{# end col #}
</div>{# end row #}
<div class="row">
<div class="col-sm-12">
Message:<br/>
<textarea cols="80" id="message" name="message" rows="10">{{ data.message | b64decode }}</textarea>
{% if form.message.errors %}
{% for e in form.subject.errors %}
<p class="help-block">{{ e }}</p>
{% endfor %}
{% endif %}
</p>
<p>Location:<br/>
<input id="location" name="location" size="70" type="text" value="{% if 'display_name' in data.location[0] %}{{data.location[0].display_name }}{% else %}{{ data.location }}{% endif %}">
</div>{# end col #}
</div>{# end row #}
<div class="row">
<div class="col-sm-12">
<p>Location:</p>
<input id="location" name="location" size="80" type="text" value="{% if 'display_name' in data.location[0] %}{{data.location[0].display_name }}{% else %}{{ data.location }}{% endif %}">
{% if form.location.errors %}
{% for e in form.location.errors %}
<p class="help-block">{{ e }}</p>
{% endfor %}
{% endif %}
</p>
<p>URL for more information: {{ form.url(size=80) }}
</div>{# end col #}
</div>{# end row #}
<div class="row">
<div class="col-sm-12">
<p>URL for more information: <i>Optional</i></p>
<p>{{ form.url(size=80) }}
{% if form.url.errors %}
{% for e in form.url.errors %}
<p class="help-block">{{ e }}</p>
......@@ -50,12 +92,33 @@
{% if data.updated %}
- Updated at: {{ data.updated.strftime('%y-%m-%d %H:%M:%S') }}
{% endif %}
</div>
<div>
<button type="submit" class="btn btn-primary">Update</button> (Update will not send a new message, only update the backend/API).
</div>
</div>{# end col #}
</div>{# end row #}
<div class="row">
<div class="col-sm-8">
<p>
<button type="submit" class="btn btn-primary">Update</button>
</p>
<p>(Update will not send a new message, only update the backend/API).</p>
</form>
</div>
</div>
<div class="col-sm-4" style="float: right;">
<button class="btn btn-default" data-href="{{ url_for('.message_edit', mid=data.id, delete=True) }}" data-toggle="modal" data-target="#confirm-delete">
Delete this entry - <span class="icon-shield"></span>
</button>
{#
<a href="#" data-toggle="modal" data-href="{{ url_for('.message_edit', mid=data.id, delete=True) }}" class="btn btn-danger" role="button"> Delete this message - <span class="icon-shield"></span></a>
#}
</div>{# end col #}
</div>{# end row #}
</div>
<script>
$('#confirm-delete').on('show.bs.modal', function(e) {
$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
$('.debug-url').html('Delete Message: <strong>{{ data.raw.identifier }}</strong>');
});
</script>
{% endblock %}
......@@ -4,6 +4,29 @@
{% block body %}
{% block modal %}
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
</div>
<div class="modal-body">
<p>You are about to delete this entry, this procedure is irreversible.</p>
<p>Do you want to proceed?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<a class="btn btn-danger btn-ok">Delete</a>
</div>
</div>
</div>
</div>
{% endblock %}
<div class="container">
<h2>Signups</h2>
{% if data %}
......@@ -19,11 +42,20 @@
{{ u.created.strftime('%Y-%m-%d %H:%M:%S') }}
</div>
<div class="col-md-1">
<a href="{{ url_for('.signups', delete=u.id) }}"> <span class="icon-shield"></a>
<button class="btn btn-default" data-href="{{ url_for('.signups', delete=u.id) }}" data-toggle="modal" data-target="#confirm-delete">
<span class="icon-shield"></span>
</button>
</div>
</div>{# end row #}
{% endfor %}
{% endif %}{# end data #}
</div>{# end container #}
</div>
<script>
$('#confirm-delete').on('show.bs.modal', function(e) {
$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});
</script>
{% endblock %}
# Swedish translations for Hesa Fredrika
# MIT LICENSE - 2017 Hesa Fredrika AB
# This file is distributed under the same license as the Hesa Fredrika Project (MIT license)
# FIRST AUTHOR <f@mekk.com>
# This file is distributed under the same license as the Hesa Fredrika
# Project (MIT license)
# FIRST AUTHOR <f@mekk.com>
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: code@hesafredrika.se\n"
"POT-Creation-Date: 2017-07-27 19:09+0200\n"
"POT-Creation-Date: 2017-07-27 21:18+0200\n"
"PO-Revision-Date: 2015-11-18 22:48+0100\n"
"Last-Translator: Fredrik Lundhag <fredrik@hesafredrika.se>\n"
"Language: sv\n"
......@@ -47,7 +48,7 @@ msgstr "Fel email eller lösenord"
msgid "Active"
msgstr "Aktiv"
#: fredrika/forms.py:61 fredrika/forms.py:83
#: fredrika/forms.py:61 fredrika/forms.py:83 fredrika/main/views.py:271
msgid "Message"
msgstr "Meddelande"
......@@ -76,9 +77,8 @@ msgid "Note"
msgstr "Notering"
#: fredrika/main/views.py:34
#, python-format
msgid "Your email has been added to the notification list: %s"
msgstr "Din emailadress har blivit tillagd %s"
msgid "Your email has been added to the notification list: "
msgstr "Din emailadress har lagts till på vår lista: "
#: fredrika/main/views.py:37
msgid "Your email has already been added to the notification list"
......@@ -92,36 +92,76 @@ msgstr "Platsen kunde inte hittas"
msgid "Your message was sent added to the send queue"
msgstr "Ditt meddelande är lagt i kön"
#: fredrika/main/views.py:264
#, python-format
msgid "Message %s edited."
msgstr "Meddelande %s ändrades"
#: fredrika/main/views.py:259
msgid "Deleted Message "
msgstr "Tog bort meddelande "
#: fredrika/main/views.py:277
#: fredrika/main/views.py:271
msgid " edited."
msgstr " ändrat."
#: fredrika/main/views.py:284
msgid "You are logged in"
msgstr "Du är inloggad"
#: fredrika/main/views.py:290
#, python-format
msgid "Deleted user %s"
msgstr "Tog bort user %s"
#: fredrika/main/views.py:299
msgid "You are logged out."
msgstr "Du är utloggad."
#: fredrika/main/views.py:297
msgid "Deleted email "
msgstr "Tog bort email "
#: fredrika/main/views.py:306
msgid "You are logged out"
msgstr "Du är utloggad"
#: fredrika/main/views.py:313
msgid "You can only see this if you are logged in!"
msgstr "Du kan bara se detta när du är inloggad!"
#: fredrika/main/views.py:449
#, python-format
msgid "The message with id %s could not be found."
msgstr "Meddelandet med id %s kunde inte hittas."
#: fredrika/main/views.py:456
msgid "The message with id "
msgstr "Meddelandet med id "
#: fredrika/main/views.py:456
msgid "could not be found"
msgstr ""
#: fredrika/templates/dashboard.html:9
msgid "To send a message, enter your text and select the topic, then press send."
msgstr "För att skicka ett meddelande, skriv in text, välj topic och klicka på Skicka"
msgstr ""
"För att skicka ett meddelande, skriv in text, välj topic och klicka på "
"Skicka"
#: fredrika/templates/dashboard.html:59 fredrika/templates/header.html:18
#: fredrika/templates/index.html:83
msgid "Send"
msgstr "Skicka"
#: fredrika/templates/header.html:27
msgid "Logs"
msgstr "Loggar"
#: fredrika/templates/header.html:28
msgid "Topics"
msgstr "Ämnen"
#: fredrika/templates/header.html:29
msgid "Volunteers"
msgstr "Organisatione"
#: fredrika/templates/header.html:30
msgid "Signups"
msgstr "Utskick"
#: fredrika/templates/header.html:32
msgid "Users"
msgstr "Användare"
#: fredrika/templates/header.html:38
msgid "Sign out"
msgstr "Logga ut"
#: fredrika/templates/header.html:40
msgid "Sign in"
msgstr "Logga in"
#: fredrika/templates/index.html:21
msgid ""
......@@ -149,10 +189,6 @@ msgstr "Lägg till dig på vår epostlista och få ett mail när appen släpps!"
msgid "Mandatory"
msgstr "Obligatorisk"
#: fredrika/templates/index.html:83
msgid "Send"
msgstr "Skicka"
#: fredrika/templates/message.html:3
msgid "Message log"
msgstr "Meddelanden"
......@@ -185,3 +221,36 @@ msgstr "Föregående sida"
msgid "Next page"
msgstr "Nästa sida"
#~ msgid "Your email has been added to the notification list: %s"
#~ msgstr "Din emailadress har blivit tillagd %s"
#~ msgid "Deleted Message: %s"
#~ msgstr "Tog bort meddelande: %s"
#~ msgid "Deleted user %%s"
#~ msgstr "Tog bort user %%s"
#~ msgid "Deleted Message %s"
#~ msgstr ""
#~ msgid "Message %s edited."
#~ msgstr "Meddelande %s ändrades"
#~ msgid "Deleted Message: "
#~ msgstr "Tog bort meddelande: "
#~ msgid "edited."
#~ msgstr "ändrades"
#~ msgid "Deleted user %s"
#~ msgstr "Tog bort user %s"
#~ msgid "You are logged out."
#~ msgstr "Du är utloggad."
#~ msgid "The message with id %s could not be found."
#~ msgstr "Meddelandet med id %s kunde inte hittas."
#~ msgid " could not be found"
#~ msgstr " kunde inte hittas"
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2017-07-27 19:09+0200\n"
"POT-Creation-Date: 2017-07-27 21:18+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -46,7 +46,7 @@ msgstr ""
msgid "Active"
msgstr ""
#: fredrika/forms.py:61 fredrika/forms.py:83
#: fredrika/forms.py:61 fredrika/forms.py:83 fredrika/main/views.py:271
msgid "Message"
msgstr ""
......@@ -75,8 +75,7 @@ msgid "Note"
msgstr ""
#: fredrika/main/views.py:34
#, python-format
msgid "Your email has been added to the notification list: %s"
msgid "Your email has been added to the notification list: "
msgstr ""
#: fredrika/main/views.py:37
......@@ -91,37 +90,75 @@ msgstr ""
msgid "Your message was sent added to the send queue"
msgstr ""
#: fredrika/main/views.py:264
#, python-format
msgid "Message %s edited."
#: fredrika/main/views.py:259
msgid "Deleted Message "
msgstr ""
#: fredrika/main/views.py:277
msgid "You are logged in"
#: fredrika/main/views.py:271
msgid " edited."
msgstr ""
#: fredrika/main/views.py:290
#, python-format
msgid "Deleted user %s"
#: fredrika/main/views.py:284
msgid "You are logged in"
msgstr ""
#: fredrika/main/views.py:299
msgid "You are logged out."
#: fredrika/main/views.py:297
msgid "Deleted email "
msgstr ""
#: fredrika/main/views.py:306
msgid "You are logged out"
msgstr ""
#: fredrika/main/views.py:313
msgid "You can only see this if you are logged in!"
msgstr ""
#: fredrika/main/views.py:449
#, python-format
msgid "The message with id %s could not be found."
#: fredrika/main/views.py:456
msgid "The message with id "
msgstr ""
#: fredrika/main/views.py:456
msgid "could not be found"
msgstr ""
#: fredrika/templates/dashboard.html:9
msgid "To send a message, enter your text and select the topic, then press send."
msgstr ""
#: fredrika/templates/dashboard.html:59 fredrika/templates/header.html:18
#: fredrika/templates/index.html:83
msgid "Send"
msgstr ""
#: fredrika/templates/header.html:27
msgid "Logs"
msgstr ""
#: fredrika/templates/header.html:28
msgid "Topics"
msgstr ""
#: fredrika/templates/header.html:29
msgid "Volunteers"
msgstr ""
#: fredrika/templates/header.html:30
msgid "Signups"
msgstr ""
#: fredrika/templates/header.html:32
msgid "Users"
msgstr ""
#: fredrika/templates/header.html:38
msgid "Sign out"
msgstr ""
#: fredrika/templates/header.html:40
msgid "Sign in"
msgstr ""
#: fredrika/templates/index.html:21
msgid ""
"Get important public announces, weather warnings and other important "
......@@ -144,10 +181,6 @@ msgstr ""
msgid "Mandatory"
msgstr ""
#: fredrika/templates/index.html:83
msgid "Send"
msgstr ""
#: fredrika/templates/message.html:3
msgid "Message log"
msgstr ""
......