Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Use new admin settings-based UI customization approach (see IQSS/data…
Browse files Browse the repository at this point in the history
  • Loading branch information
tdilauro authored Feb 28, 2017
1 parent e57e1d3 commit 7e1aad1
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 148 deletions.
22 changes: 22 additions & 0 deletions dataverse.pb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,27 @@
vars:
load_mdblocks: true
mail_relay: smtp.johnshopkins.edu
dv_ui_use_custom_header: true
dv_ui_repo:
url: "https://github.com/jhu-sheridan-libraries/dataverse.git"
branch: "2003-instance-branding-on-v4.6"
dv_ui_custom_values:
- { prop: ":instanceLogoFile",
val: "/resources/images/libraries.logo.small.horizontal.white.cropped.png",
desc: "URL (relative or absolute) for instance logo file" }
- { prop: ":instanceNameFull",
val: "Johns Hopkins University Data Archive",
desc: "Full branded name for this Dataverse instance" }
- { prop: ":instanceNameShort", val: "JHU Data Archive",
desc: "Short branded name for this Dataverse instance" }
- { prop: ":instanceTextFull",
val: "Johns Hopkins University Data Management Services",
desc: "Full upper right-hand text for wider window" }
- { prop: ":instanceTextShort", val: "JHU DMS",
desc: "Short upper right-hand text for narrow window" }
- { prop: ":instanceTextLink", val: "http://dms.data.jhu.edu/",
desc: "Link for click on upper right-hand branding text" }
- { prop: ":instanceLogoLink", val: "http://www.library.jhu.edu/",
desc: "Link for click on instance branding logo" }
roles:
- role: dataverse
39 changes: 39 additions & 0 deletions roles/dataverse/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,45 @@ rserve_user: rserve
rserve_pass: "{{ rserve_pass_protected }}"
rserve_port: 6311


###############################################################################
# Settings for UI instance branding configuration
# When any values are changed to override these variables, all
# properties associated with that variable will be overriden. So
# all desired values must be re-specified.
###############################################################################

dv_ui_use_custom_header: false
dv_ui_use_custom_footer: false

dv_ui_custom_values:
- { prop: ":instanceLogoFile", val: "http://dataverse.org/files/dataverseorg/files/dv-rings-tranparent.png",
desc: "URL (relative or absolute) for instance logo file" }
# If ":instanceBrandingHeader" is set to true, the following properties should
# should be set elsewhere.
# - { prop: ":instanceNameFull", val: "set :instanceNameFull",
# desc: "Full branded name for this Dataverse instance" }
# - { prop: ":instanceNameShort", val: "set :instanceNameShort",
# desc: "Short branded name for this Dataverse instance" }
# - { prop: ":instanceTextFull", val: "set :instanceTextFull",
# desc: "Full upper right-hand text for wider window" }
# - { prop: ":instanceTextShort", val: "set :instanceTextShort",
# desc: "Short upper right-hand text for narrow window" }
# - { prop: ":instanceTextLink", val: "set :instanceTextLink",
# desc: "Link for click on upper right-hand branding text" }
# - { prop: ":instanceLogoLink", val: "http://dataverse.example.org/",
# desc: "Link for click on instance branding logo" }
dv_ui_custom_css_classes:
- { prop: ":instanceNameFullClasses", val: "hidden-xs",
desc: "hide the instance fullname when window too narrow" }
- { prop: ":instanceNameShortClasses", val: "hidden-sm hidden-md hidden-lg hidden-xl",
desc: "hide the short version of the when window not too narrow for wide text" }
- { prop: ":instanceTextFullClasses", val: "hidden-xs hidden-sm",
desc: "hide the long version of right-hand text when window too narrow" }
- { prop: ":instanceTextShortClasses", val: "hidden-md hidden-lg hidden-xl",
desc: "hide the short version of right-hand text when window not too narrow for long text" }


###############################################################################
# Mail configuration
###############################################################################
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

34 changes: 34 additions & 0 deletions roles/dataverse/tasks/dv-custom-ui-overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- mode: yaml -*-
# vi: set ft=yaml :

---

###############################################################################
# These tasks are needed until such time as these/similar customizations
# make it into a Dataverse release.
###############################################################################

- name: set some base directories for UI overrides
set_fact:
dv_repo_dir: "/tmp/dataverse/repo"
dv_repo_webapp_dir: "src/main/webapp"

- name: (TEMPORARY) clone the dataverse repository with UI changes to overwrite distro
git:
repo: "{{ dv_ui_repo.url }}"
dest: "{{ dv_repo_dir }}"
version: "{{ dv_ui_repo.branch }}"

- name: (TEMPORARY) copy relevant updated UI files
copy: src="{{ dv_repo_dir }}/{{ dv_repo_webapp_dir}}/{{ item }}"
dest="{{ dv_application_directory }}/{{ item }}"
owner="{{ dv_gf_user }}" group="{{ dv_gf_group }}" mode=0644
remote_src=true
with_items:
- "instance_header.xhtml"
- "resources/css/instance-header-overrides.css"
- "dataverse_header.xhtml"
- "dataverse_template.xhtml"

- name: (TEMPORARY) remove cloned dataverse repository
file: path="{{ dv_repo_dir }}" state=absent
47 changes: 26 additions & 21 deletions roles/dataverse/tasks/dv-custom-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,45 @@
---

###############################################################################
# Branding & UI customization updates
# NB: These are brittle and may need to be fixed between releases
# Update UI settings
###############################################################################

- name: a note on these customizations
debug: msg="These UI customizations are brittle and may need to be updated for new releases."
- name: configure admin settings that drive UI customizations
become: yes
become_user: "{{ dv_gf_user }}"
uri:
url: "{{ instance_api }}/admin/settings/{{item.prop}}"
body: "{{ item.val }}"
method: PUT
validate_certs: no
with_items:
- { prop: ":instanceBrandingHeader", val: "{{ dv_ui_use_custom_header |lower }}",
desc: "whether or not to use a branding header" }
- { prop: ":instanceBrandingFooter", val: "{{ dv_ui_use_custom_footer |lower }}",
desc: "whether or not to use a branding footer" }
- "{{ dv_ui_custom_values }}"
- "{{ dv_ui_custom_css_classes }}"


###############################################################################
# Copy custom files into the application
###############################################################################

- name: set some base directories for later use
set_fact:
dv_customization_directory: "ui-customization/dv-{{ instance_ui_customization_version }}"
dv_application_directory: "{{ dv_gf_root }}/glassfish/domains/{{ dv_gf_domain }}/applications/{{ dataverse_app_name }}"

- name: copy new custom files to the web site
- name: copy local custom files into the web app
become: yes
become_user: "{{ dv_gf_user }}"
copy: src="{{ dv_customization_directory }}/{{ item.src }}"
copy: src="ui-customization/{{ item.src }}"
dest="{{ dv_application_directory }}/{{ item.dest }}"
owner="{{ dv_gf_user }}" group="{{ dv_gf_user }}" mode=0644
with_items:
- { src: "instance_header.xhtml", dest: ""}
- { src: "images/", dest: "/resources/images"}


- name: apply custom UI patches
become: yes
become_user: "{{ dv_gf_user }}"
patch: src="{{ dv_customization_directory }}/{{ item }}.patch"
basedir="{{ dv_application_directory }}"
remote_src=no
with_items:
- Bundle.properties
- dataverse_header.xhtml
- dataverse_template.xhtml
- { src: "common/images/", dest: "/resources/images"}

# (Temporary) Some
- include: dv-custom-ui-overrides.yaml

- name: clean up custom UI /tmp files
file: name=/tmp/dv-custom-ui state=absent

0 comments on commit 7e1aad1

Please sign in to comment.