Before we begin

https://github.com/inveniosoftware/iugw2017/tree/master/0-prerequisites Initialize Vagrant

$ sudo mount /dev/sdb1 /mnt
$ vagrant box add -n iugw2017-demosite-web /mnt/iugw2017-demosite-web.box
Start Vagrant

  $ git clone https://github.com/inveniosoftware/iugw2017
  $ cd iugw2017
  $ vagrant up

Login to the vagrant VM


$ vagrant destroy
        

            # Vagrantfile for IUGW2017.

            Vagrant.configure("2") do |config|

              if Vagrant.has_plugin?("vagrant-cachier")
                config.cache.scope = :box
              end

              config.vm.define "web" do |web|
                web.vm.box = "iugw2017-demosite-web"
                web.vm.hostname = 'web'
                web.vm.network "forwarded_port", guest: 80, host: 80
                web.vm.network "forwarded_port", guest: 5000, host: 5000
                web.vm.network "private_network", ip: ENV.fetch('INVENIO_WEB_HOST','192.168.50.10')
                web.vm.provider :virtualbox do |vb|
                  vb.customize ["modifyvm", :id, "--memory", "4028"]
                  vb.customize ["modifyvm", :id, "--cpus", 2]
                end
              end

            end
        

$ vagrant up
      

IUGW

Customization

User guide

The goal of this tutorial

Customize Invenio v3


http://invenio.readthedocs.io/en/iugw2017/usersguide/tutorial/customize.html

Open the following link


goo.gl/yv0srb

Login to the vagrant VM


$ laptop> vagrant ssh web
$ vagrant> workon invenio
	

Install the module invenio-beauty


$ vagrant> cd /vagrant/2-customization/invenio-beauty
$ vagrant> pip install .
$ vagrant> invenio collect
$ vagrant> invenio run -h 0.0.0.0

Now open on your browser

http://192.168.50.10/

Modify the logo

Modify the logo

Open invenio.cfg

~/.virtualenv/var/instance/invenio.cfg

$ cdvirtualenv var/instance/
$ vim invenio.cfg

Modify the logo

add the following code


				THEME_LOGO = 'images/unicorn.png'
				THEME_FRONTPAGE_TITLE = 'Unicorn Institute'
  

in

~/.virtualenv/var/instance/invenio.cfg

Modify the logo

now run on your terminal


$ invenio run -h 0.0.0.0

Now open on your browser

http://192.168.50.10/

Facets

Facets

Open invenio.cfg

~/.virtualenv/var/instance/invenio.cfg

	$ cdvirtualenv var/instance/
	$ vim invenio.cfg
	

Facets

add the following code


from invenio_records_rest.facets import terms_filter

RECORDS_REST_FACETS = {
'marc21': {
  'aggs': {
    'author': {
      'terms': {
        'field': 'main_entry_personal_name.personal_name'
      }
    }
  },
  'post_filters': {
    'author': terms_filter(
      'main_entry_personal_name.personal_name'
    )
  }
}
}
			

Facets

now run on your terminal


  $ invenio run -h 0.0.0.0
  

Now open on your browser

http://192.168.50.10/search

Sort options

Sort options

Open invenio.cfg

~/.virtualenv/var/instance/invenio.cfg

		  $ cdvirtualenv var/instance/
		  $ vim invenio.cfg
		  

Sort options

add the following code


				  RECORDS_REST_SORT_OPTIONS = {
				    'records': {
				      'title': {
				        'fields': ['title_statement.title'],
				        'title': 'Record title',
				        'order': 1,
				      }
				    }
				  }
		  

in

~/.virtualenv/var/instance/invenio.cfg

Sort options

now run on your terminal


$ invenio run -h 0.0.0.0

Now open on your browser

http://192.168.50.10/search

Detail view

Detail view

open invenio.cfg

~/.virtualenv/var/instance/invenio.cfg

$ cdvirtualenv var/instance/
$ vim invenio.cfg

Detail view

add the following code


RECORDS_UI_ENDPOINTS = {
  "recid": {
      "pid_type": "recid",
      "route": "/records/",
      "template": "invenio_beauty/detail.html"
  },
}

in

~/.virtualenv/var/instance/invenio.cfg

Detail view

now run on your terminal


$ invenio run -h 0.0.0.0

Now open on your browser

http://192.168.50.10/records/1

Search results template

Search results template

open invenio.cfg

~/.virtualenv/var/instance/invenio.cfg

$ cdvirtualenv var/instance/
$ vim invenio.cfg

Search results template

add the following code


SEARCH_UI_JSTEMPLATE_RESULTS = 'templates/invenio_beauty/results.html'

in

~/.virtualenv/var/instance/invenio.cfg

Search results template

now run on your terminal


$ invenio run -h 0.0.0.0

Now open on your browser

http://192.168.50.10/search

Change homepage

Change homepage

open invenio.cfg

~/.virtualenv/var/instance/invenio.cfg

$ cdvirtualenv var/instance/
$ vim invenio.cfg

Change homepage

add the following code


THEME_FRONTPAGE_TEMPLATE = 'invenio_beauty/home.html'

in

~/.virtualenv/var/instance/invenio.cfg

Change homepage

now run on your terminal


$ invenio run -h 0.0.0.0

Now open on your browser

http://192.168.50.10/

All together


$ cd /vagrant/iugw2017/2-customization
$ cat final.cfg >> ~/.virtualenvs/invenio/var/instance/invenio.cfg

paste to the following file

~/.virtualenv/var/instance/invenio.cfg