Configuring your own BEFdata instance

manxingxing edited this page Oct 19, 2013 · 18 revisions

Your first login

At this point the database should be set up and its schema loaded. An initial user and a howto datataset can be created by running rake db:seed. You can now login as user admin with the password change_me. As it indicates the first step now should be to change your password in your Profile.

Application name

Application name you specified here will be displayed on the browser title bar.

First, you need a file configuration.yml under the config directory. If it doesn't already exist, create it by making a copy of configuration.yml.hist.

cp config/configuration.yml.dist  config/configuration.yml

Open the file with your text editor and change the title field to what you'd like to name your application.

site:
  # Specify the title of your site which will appear at the browser title bar.
  # uncomment subtitle if you need a subtitle
  # the resulting pattern would be "title | subtitle" for the home page
  # and "title | page_title" for the other pages.
  title: Biodiversity
  # subtitle:

you could uncomment the line of subtitle if you need a subtitle.

Here is an example:

  title:  FunDivEUROPE
  subtitle:  Functional significance of forest biodiversity in Europe

Layout and Apperance

At the moment, we provide limited support for customizing the look. To use a different layout other than the default, you need to set the layout field in the file config/configuration.yml. for example:

site:
  #set layout to use one different than standard befdata
  layout: 'fundiv'
  ...

In the following sections , we will asume your layout is named as my_layout, replace <my_layout> with your real layout name in the commands below.

You will need to create a folder with the same name with your layout under app/views/pages/, and create four files within that folder. If you are in the application root, you could run these commands in your terminal:

mkdir app/views/pages/<my_layout>
touch app/views/pages/<my_layout>/_footer.html.haml
touch app/views/pages/<my_layout>/_head.html.haml
touch app/views/pages/<my_layout>/_home.html.haml
touch app/views/pages/<my_layout>/_imprint.html.haml

These files should all be written in Haml, you can find a tutorial for it here.

Favicon

Within the file app/views/pages/<my_layout>/_head.html.haml, you can set the favicon for your site.

-# Your own favicon from an external server 
-# %link{"rel" => "icon", "href" => "http://www.fundiveurope.eu/favicon.ico", "type" => "image/x-icon"}
-# If you load a favicon locally from the public folder
%link{"rel" => "icon", "href" => "/favicon.ico", "type" => "image/x-icon"}

The content in this file will be inserted into the HEAD of every HTML page. You can also include your javascript or CSS files here, but it's not recommended. Please see section Stylesheet & JavaScript files

Logo

At the moment, you can only replace the logo via CSS rules. the logo is wrapped in a div element named with an ID: logo, you should defined propertyies such as background-image on it.

for example:

#header div#logo {
  background: image-url("http://www.fundiveurope.eu/wp-content/themes/fundiveurope/images/bg_header.jpg") top no-repeat;
  height: 148px;
}

See section Stylesheet & JavaScript files to know how to include your own stylesheet files.

Footer

Your own footer section is filled with content from app/views/pages/$PROJECT/_footer.html.haml. Here is an example.

-# the links to help_path and imprint_path are at the moment only accessible from this place, 
-# so it is a good idea to keep at least the imprint link somewhere in the footer as it contains the legal stuff
%ul#foot-menu
  %li= link_to 'Help', help_path
  %li= link_to 'Imprint', imprint_path

-# Mentioning important friends
%ul#page-associates
  - img_heigt = '50px'
  %li= link_to image_tag('logo_dfg.png', :height => img_heigt), "http://www.dfg.de" 
  ...

Home page

The content of your home page is stored in app/views/pages/$PROJECT/_home.html.haml. Here is an example:

%h2 Welcome to our data portal
%p
  This is the data portal of our project, you can learn more at this place:
  = link_to "www.bef-china.de", "http://www.bef-china.de" 
%p
  Another paragraph where we describe why this website is around

Imprint page

This page is designed to declear who is responsible for your website. The corresponding file is app/views/pages/$PROJECT/_imprint.html.haml.

for example:

-# User id's on your portal, to link to persons profile
- responsible_person_id = 3

%h2
  Imprint
%p
  Responsible for the contents of this website is
  -# link to persons profile
  = link_to "Some Name", {:controller => :users, :action => :show, :id => responsible_person_id}

  -# Good idea to encode email-addresses so it's not so easy for spambots to collect them
  = mail_to("some.name@uni-leipzig.de", nil, :encode => :javascript)

  ...

Note that a paragraph of technical/legal remarks will be automatically appended to this page, in order to acknowledge some third-party gems, libraries or icons used in this portal.

Stylesheet & JavaScript files

It's very likely that you want to include your own stylesheet or javascript files, to add your own logo and to customize the appearance.

You should put your stylesheets into folder lib/assets/stylesheets. you can find there a file named site.css which is a manifest file that specifies which stylesheet files to be included. By default, all stylesheet files in this folder and its sub-folders will be included.

Your stylesheet files are included at the last, so your CSS rules will override the default BEF rules.

Similarly, you should put your javascript files into lib/assets/javascripts folder which contains another manifest file site.js.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.