Skip to content

Commit

Permalink
Fix #361: organization logo visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
clash99 authored and Ian Ross committed Jul 11, 2016
1 parent ba2e041 commit 143e299
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 19 deletions.
10 changes: 6 additions & 4 deletions cadasta/templates/organization/organization_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h2>{% trans "Organization Overview" %}</h2>
<!-- Starter text -->
<h3 style="text-transform: none;">{% trans "You're ready to go" %}</h3>
<p>
{% trans "You have successfully created your organization. You're now ready to add your first location." %}
{% trans "You have successfully created your organization. You're now ready to add your first project." %}
</p>
<div class="btn-full">
<a href="{% url 'organization:project-add' organization.slug %}" class="btn btn-primary btn-lg" role="button">
Expand All @@ -57,9 +57,11 @@ <h3 style="text-transform: none;">{% trans "You're ready to go" %}</h3>
<!-- Right detail -->
<div class="col-md-4 detail col-height">
<section>
<div class="org-logo">
<img src="{{ organization.logo }}" alt="{{ organization.name }}" />
</div>
{% if organization.logo %}
<div class="org-logo">
<img src="{{ organization.logo }}" alt="{{ organization.name }}" />
</div>
{% endif %}
<p>{{ organization.description }}<p>
<div class="divider-thick"></div>
<!-- Starter text -->
Expand Down
12 changes: 8 additions & 4 deletions cadasta/templates/organization/project_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ <h4>{{ proj.name }}</h4>
<p class="visible-xs-block">Organization: {{ proj.organization.name }}</p>
</td>
<td class="hidden-xs">
<div class="org-logo">
<span class="hidden">{{ proj.organization.name }}</span><!-- needed for sorting -->
<img src="{{ proj.organization.logo }}" class="org-logo" alt="{{ proj.organization.name }}"/>
</div>
{% if proj.organization.logo %}
<div class="org-logo">
<span class="hidden">{{ proj.organization.name }}</span><!-- needed for sorting -->
<img src="{{ proj.organization.logo }}" class="org-logo" alt="{{ proj.organization.name }}"/>
</div>
{% else %}
<p class="org-name-alt">{{ proj.organization.name }}</p>
{% endif %}
</td>
<td class="hidden-xs hidden-sm">{{ proj.country.name }}</td>
<td class="hidden-xs hidden-sm">{{ proj.last_updated|default_if_none:"&mdash;" }}</td>
Expand Down
9 changes: 5 additions & 4 deletions functional_tests/pages/Organization.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from .base import Page
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException


class OrganizationPage(Page):
BY_MODAL_FADE = (By.CSS_SELECTOR, "div.modal.fade.in")
BY_MODAL_BACKDROP = (By.CLASS_NAME, 'modal-backdrop')
BY_ORG_LOGO = (By.CLASS_NAME, 'org-logo')
BY_ORG_OVERVIEW = (
By.XPATH, "//h2[normalize-space(.)='Organization Overview']"
)

def __init__(self, test):
super().__init__(test)
Expand Down Expand Up @@ -43,7 +44,7 @@ def get_table_row(self, xpath=""):
def go_to_organization_page(self, new=False):
row = "[2]" if new else "[1]"
org_page = self.get_table_row(row)
self.click_through(org_page, self.BY_ORG_LOGO)
self.click_through(org_page, self.BY_ORG_OVERVIEW)

def get_org_description_and_members(self):
return self.get_page_content(
Expand Down Expand Up @@ -77,7 +78,7 @@ def get_urls_input(self):

def click_on_submit_button(self):
submit = self.get_edit_modal_form("button[@name='submit']")
self.click_through(submit, self.BY_ORG_LOGO)
self.click_through(submit, self.BY_ORG_OVERVIEW)

def get_fields(self):
return {
Expand Down
4 changes: 3 additions & 1 deletion functional_tests/pages/OrganizationList.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .base import Page
from .Organization import OrganizationPage
from selenium.webdriver.common.by import By
from selenium.common.exceptions import ElementNotVisibleException

Expand Down Expand Up @@ -80,7 +81,8 @@ def get_fields(self):
def click_submit_button(self):
fields = self.get_fields()
self.click_through(
fields['add'], (By.CLASS_NAME, 'org-logo'))
fields['add'], OrganizationPage.BY_ORG_OVERVIEW
)

def click_close_button(self, button):
cancel = self.test.link(button)
Expand Down
15 changes: 11 additions & 4 deletions functional_tests/pages/ProjectList.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from selenium.common.exceptions import NoSuchElementException

from .base import Page
from django_countries import countries

Expand Down Expand Up @@ -41,9 +43,14 @@ def check_project_list(self, projects):

cells = row.find_elements_by_tag_name('td')
actual_org_slug = onclick_items[2]
img = cells[1].find_element_by_tag_name('img')
actual_org_logo = img.get_attribute('src')
actual_org_name = img.get_attribute('alt')
try:
img = cells[1].find_element_by_tag_name('img')
actual_org_logo = img.get_attribute('src')
actual_org_name = img.get_attribute('alt')
except NoSuchElementException:
actual_org_logo = None
alt = cells[1].find_elements_by_class_name('org-name-alt')
actual_org_name = alt[0].text
actual_project_name = (
cells[0].find_element_by_tag_name('h4').text
)
Expand All @@ -64,7 +71,7 @@ def check_project_list(self, projects):
expected_org_logo = (
target_project['_org_logo']
if target_project['_org_logo']
else self.url + 'None'
else None
)
assert actual_org_logo == expected_org_logo
assert actual_project_name == target_project['name']
Expand Down
2 changes: 1 addition & 1 deletion provision/roles/cadasta/application/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
become: yes
become_user: "{{ app_user }}"
get_url: url=http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip
dest="{{ application_path }}cadasta/geography/data"
dest="{{ application_path }}cadasta/geography/data/ne_10m_admin_0_countries.zip"

- name: Unzip world boundary data files
become: yes
Expand Down
2 changes: 1 addition & 1 deletion provision/roles/testing/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
become: yes
become_user: root
get_url: url=https://ftp.mozilla.org/pub/firefox/releases/46.0.1/linux-x86_64/en-US/firefox-46.0.1.tar.bz2
dest=/opt
dest=/opt/firefox-46.0.1.tar.bz2

- name: Unpack Firefox 46 install bundle
become: yes
Expand Down

0 comments on commit 143e299

Please sign in to comment.