Skip to content

Commit

Permalink
Merge branch '1.7' of https://github.com/nadineproject/nadine into 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jsayles committed Dec 30, 2016
2 parents dffd8da + 33de3a5 commit 480686a
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 100 deletions.
53 changes: 18 additions & 35 deletions members/static/css/members.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,6 @@ p {
background-color: RGBA(66, 98, 113, 1);
}

/*@-moz-document url-prefix() {
#jumbo-img {
width: 100%;
max-width: 100%;
}
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
#jumbo-img {
max-width: 100%;
}
}*/

.side-nav {
background-color: RGBA(80, 80, 80, 1);
padding-top: 2%;
Expand Down Expand Up @@ -178,26 +165,12 @@ p {
}

#jumbo-img {
content: url(../img/jumbo.png);
width: 100%;
margin: 0;
padding: 0;
box-sizing: border-box;
}

#jumbo-img:after {
/*for firefox*/
content: url(../img/jumbo.png);
/*width: 100%;
margin: 0;
padding: 0;
box-sizing: border-box;*/
}

@-moz-document url-prefix() {
#jumbo-img { width: 100%; max-width: -moz-max-content; }
}

#logo {
float: left;
padding-left: 1%;
Expand All @@ -215,6 +188,10 @@ p {
}

/* Body */
.row.main {
margin-bottom: 0;
}

.messages {
margin-top: 3%;
}
Expand Down Expand Up @@ -522,7 +499,7 @@ div.link-formset.row.dynamic-form {
}

.delete-row {
margin-top: 4%;
/*margin-top: 4%;*/
margin-left: 5%;
}

Expand Down Expand Up @@ -714,7 +691,7 @@ textarea#id_bio {
}

.org-list {
padding-left: 5%;
margin-left: 5%;
}

.org-card {
Expand Down Expand Up @@ -835,8 +812,7 @@ h5.org-members {
.org-form {
background: RGBA(239, 238, 231, 1);
padding: 2%;
width: 80%;
margin-left: 10%;
min-width: 600px;
}

.org-form .org-label {
Expand Down Expand Up @@ -1916,6 +1892,7 @@ footer.sticky-footer {
}

@media only screen and (max-width: 1100px) {

p.pf-input.form-url.col.s6.offset-s2, p.cap-label.col.s6.offset-s2 {
margin-left: 0;
}
Expand All @@ -1929,7 +1906,7 @@ footer.sticky-footer {
}

.link-formset .btn-floating {
margin-top: 4%;
/*margin-top: 4%;*/
}

.btn-floating {
Expand All @@ -1941,10 +1918,9 @@ footer.sticky-footer {
width: 2%;
}


#profile_form, #registration_form {
margin-left: 2%;
min-width: 900px;
min-width: 600px;
}

#profile_form input {
Expand All @@ -1969,6 +1945,9 @@ footer.sticky-footer {
.eModal-content {
margin-top: 10%;
}
.org-list {
margin-left: 10%;
}
}


Expand Down Expand Up @@ -2036,6 +2015,10 @@ footer.sticky-footer {
.prof-tabs, . {
margin-bottom: 10%;
}

select#id_public_profile.browser-default, select#id_public.browser-default {
width: 50%;
}
}

@media only screen and (max-width: 843px) {
Expand Down Expand Up @@ -2113,7 +2096,7 @@ footer.sticky-footer {
right: 0;
bottom: 0;
left: 0;
position: absolute;
/*position: absolute;*/
}

.prof-img, .edit-img, .locked-img, .org-img {
Expand Down
4 changes: 2 additions & 2 deletions members/templates/members/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ <h2 id='add-event-header'>Add Event to Public Calendar</h2>
<script>
$(document).ready(function() {
$('.button-collapse').sideNav();

$('.timepicker').timepicker({
timeFormat: 'h:mm p',
interval: 30,
Expand Down Expand Up @@ -211,7 +211,7 @@ <h2 id='add-event-header'>Add Event to Public Calendar</h2>
center: 'title',
right: 'month,basicWeek,basicDay'
};
options.defaultView = 'basicWeek';
options.defaultView = 'listWeek';
} else {
options.header = {
left: 'prev,next today',
Expand Down
2 changes: 1 addition & 1 deletion members/templates/members/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

{% block top_nav %}
<div id='jumbotron'>
<img id='jumbo-img'/>
<img id='jumbo-img' src="{% static 'img/jumbo.png' %}"/>
<div id='logo'>
<a href="#"><img class='logo-img' src='{% static "img/logo.png" %}'/></a>
</div>
Expand Down
12 changes: 11 additions & 1 deletion members/templates/members/mail_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
{% block sub-title %}Mail | {% endblock %}

{% block style %}

@media only screen and (max-width: 750px) {
footer.main-footer {
background: RGBA(61, 61, 61, .9);
clear: both;
width: 100%;
right: 0;
bottom: 0;
left: 0;
position: inherit;
}
}
{% endblock %}

{%block sub-head %}
Expand Down
25 changes: 19 additions & 6 deletions members/templates/members/org_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,28 @@
{% block sub-title %}Organization | {% endblock %}

{% block style %}
@media only screen and (max-width: 1100px) {
.row .col.offset-s1.s10 {
margin-left: 0;
}

.row .col.s10 {
width: 100%;
}
}
{% endblock %}

{% block content %}
<h3 class='oswald' style='text-align: center;'>Edit {{ organization.name}}</h3>
<form class='org-form' method="POST" action="." enctype="multipart/form-data">
{% if page_message %}
<div>
<p style='color:red;text-align:center;'>
<strong> {{ page_message }} </strong>
</p>
<br />
</div>
{% endif %}
<form class='org-form s12 m12 l12' method="POST" action="." enctype="multipart/form-data">
{{ form.org_id }}
<table>
<tr>
Expand Down Expand Up @@ -96,10 +113,6 @@ <h5 class='oswald links-header'>Links</h5>
{% for link_form in org_link_formset %}
<div class='link-formset row'>
<div class='col s10'>
<div class='row headers'>
<p class='cap-label col s4'><strong>Link Type</strong></p>
<p class='cap-label col s6 offset-s2'><strong>Link URL</strong></p>
</div>
<div class='row'>
<p class='pf-input url-type col s4'>{{ link_form.url_type }}</p>
<p class='pf-input form-url col s6 offset-s2'>{{ link_form.url }}</p>
Expand All @@ -124,7 +137,7 @@ <h5 class='oswald links-header'>Links</h5>
<script>
$(document).ready(function() {
$('.button-collapse').sideNav();

$("option").each(function() {
$(this).text($(this).text().charAt(0).toUpperCase() + $(this).text().slice(1));
});
Expand Down
11 changes: 10 additions & 1 deletion members/templates/members/org_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@
{% block sub-title %}Organization | {% endblock %}

{% block style %}
@media only screen and (max-width: 1100px) {
.row .col.offset-s1.s10 {
margin-left: 0;
}

.row .col.s10 {
width: 100%;
}
}
{% endblock %}

{% block content %}
<h3 class='oswald' style='text-align:center;'>Organizations at {{ site.name }}</h3>
<div class='ui-widget row'>
<form class='col s12 m7 l7 offset-m6 offset-l6' id='org-search-form' action="." method='POST'>
{% csrf_token %}
<input class='col s9' id='org-search' name='terms' type='text' placeholder="Search for an Organization" />
<input class='col s8' id='org-search' name='terms' type='text' placeholder="Search for an Organization" />
<input class='btn search-btn col s3 m2 l2' type='submit' value='Search' />
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion members/templates/members/org_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
position: absolute;
}

.row {
.row {
margin-bottom: 0;
}
}
Expand Down
16 changes: 11 additions & 5 deletions members/templates/members/profile_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
padding: 1em;
display: none;
}

@media only screen and (max-width: 1100px) {
.row .col.offset-s1.s10 {
margin-left: 0;
}

.row .col.s10 {
width: 100%;
}
}
{% endblock %}

{% block content %}
Expand Down Expand Up @@ -259,11 +269,7 @@ <h3 style='text-align:left;'>Websites</h3>
{% for link_form in link_formset %}
<div class='link-formset row'>
<div class='col s10'>
<div class='row headers'>
<p class='cap-label col s4'><strong>Link Type</strong></p>
<p class='cap-label col s6 offset-s2'><strong>Link URL</strong></p>
</div>
<div class='row'>
<div class='row urls'>
<p class='pf-input url-type col s4'>{{ link_form.url_type }}</p>
<p class='pf-input form-url col s6 offset-s2'>{{ link_form.url }}</p>
</div>
Expand Down
44 changes: 24 additions & 20 deletions members/views/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def org_add(request):
@login_required
@user_passes_test(is_active_member, login_url='member_not_active')
def org_edit(request, org_id):
page_message = None
org = get_object_or_404(Organization, id=org_id)
if not (request.user.is_staff or org.can_edit(request.user)):
return HttpResponseForbidden("Forbidden")
Expand All @@ -102,32 +103,35 @@ def org_edit(request, org_id):
org_link_formset = OrgFormSet(request.POST)
form.public = request.POST['public']
try:
if form.is_valid() and org_link_formset.is_valid():
for link in link_data:
del_url = link.get('url')
org.websites.filter(url=del_url).delete()
for link_form in org_link_formset:
if not link_form.cleaned_data.get('org_id'):
link_form.cleaned_data['org_id'] = org.id
try:
if link_form.is_valid():
url_type = link_form.cleaned_data.get('url_type')
url = link_form.cleaned_data.get('url')

if url_type and url:
link_form.save()
except Exception as e:
print("Could not save website: %s" % str(e))

form.save()
return HttpResponseRedirect(reverse('member_org_view', kwargs={'org_id': org.id}))
if form.is_valid():
if org_link_formset.is_valid():
for link in link_data:
del_url = link.get('url')
org.websites.filter(url=del_url).delete()
for link_form in org_link_formset:
if not link_form.cleaned_data.get('org_id'):
link_form.cleaned_data['org_id'] = org.id
try:
if link_form.is_valid():
url_type = link_form.cleaned_data.get('url_type')
url = link_form.cleaned_data.get('url')

if url_type and url:
link_form.save()
except Exception as e:
print("Could not save website: %s" % str(e))

form.save()
return HttpResponseRedirect(reverse('member_org_view', kwargs={'org_id': org.id}))
else:
page_message = 'There was an error saving your websites. Please make sure they have a valid URL and URL type.'
except Exception as e:
messages.add_message(request, messages.ERROR, "Could not save: %s" % str(e))
else:
form = OrganizationForm(instance=org)
org_link_formset = OrgFormSet(initial=link_data)

context = {'organization': org, 'form':form, 'org_link_formset': org_link_formset}
context = {'organization': org, 'form':form, 'org_link_formset': org_link_formset, 'page_message': page_message}
return render(request, 'members/org_edit.html', context)


Expand Down

0 comments on commit 480686a

Please sign in to comment.