Skip to content

Commit

Permalink
DMPonline4 - RAILS 4.0 (#4)
Browse files Browse the repository at this point in the history
Merging the initial DMPOnline4 codebase into Roadmap

DMPonline4, this code was designed and implemented by the Digital
Curation Centre (DCC)
DMPonline runs in Ruby 2.1 and Rails 4.0, there is a mysql database.
  • Loading branch information
Marta Ribeiro authored and briri committed Jun 3, 2016
1 parent a231b8e commit dbeb039
Show file tree
Hide file tree
Showing 648 changed files with 71,008 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Ignore bundler config
/.bundle

# Ignore all logfiles, tempfiles, public assets,
/log/*.log
/tmp
public/assets/*

# Ignore gemfile.lock
Gemfile.lock

# Ignore db schema.rb
#db/schema.rb

# Ignore database configuration and token secrets
config/database.yml
config/secrets.yml

# Ignore some of the initializers
config/initializers/recaptcha.rb
config/initializers/devise.rb
config/initializers/contact_us.rb

# Ignore enviroments settings
config/environments/development.rb
config/environments/production.rb
config/environments/test.rb



95 changes: 95 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
source 'https://rubygems.org'
#
# RAILS
#
gem 'rails', '4.0.0'

# additional gems for rails 4
gem 'turbolinks'
gem 'railties', '= 4.0.0'
# add these gems to help with the transition:
gem 'protected_attributes'
gem 'rails-observers'
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'

gem 'uglifier', '>= 1.3.0'

# Gems used only for assets and not required in production environments by default.
#group :assets do
# gem 'coffee-rails'
#end
# Use SCSS for stylesheets
gem 'sass-rails'
#gem 'sass'


# Use SCSS for stylesheets
gem 'less-rails'
gem 'twitter-bootstrap-rails', '2.2.8'
gem 'therubyracer', '0.11.4', platforms: :ruby

gem 'libv8'

# To use debugger
gem 'ledermann-rails-settings'
gem 'jbuilder'
#to notify admin of errors
gem 'exception_notification'

#to allow cloning of objects
gem 'amoeba'

group :development do
gem 'web-console', '~>2.0'
gem "better_errors"
gem "binding_of_caller"
end

#
# USERS
#
# devise for user authentication
gem 'devise'
gem 'devise_invitable'
gem 'omniauth'
gem 'omniauth-shibboleth'
#rolify for roles
gem 'rolify'
# Gems for repository integration
gem 'email_validator'
gem 'validate_url'

#
# DATABASE/SERVER
#
gem 'mysql2', '~> 0.3.10'
# Use unicorn as the app server
# gem 'unicorn'
#cancan for usergroups
gem 'cancancan'

#
# VIEWS
#
gem 'jquery-rails'
gem 'tinymce-rails'
gem 'friendly_id', '~> 5.0.1'
gem 'contact_us'
gem 'recaptcha'
gem 'turbolinks'
#implementation of forms
gem 'activeadmin', github: 'activeadmin'

#
# EXPORTING PLANS
#
gem 'thin'
gem 'wicked_pdf'
gem 'htmltoword'
gem 'feedjira'
# WORD DOC EXPORTING
gem 'caracal'
gem 'caracal-rails'


43 changes: 43 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
= DMPonline v4

DMPonline is the DCC's data management planning tool, available at https://dmponline.dcc.ac.uk

Development of the DMPonline by the Digital Curation Centre has been funded by JISC. JISC inspires UK colleges and universities in the innovative use of digital technologies, helping to maintain the UK's position as a global leader in education. www.jisc.ac.uk

This is just the application code, the accompanying question data available at https://dmponline.dcc.ac.uk is not included.

The tool has four main functions
1. To help create and maintain different versions of Data Management Plans;
2. To provide useful guidance on data management issues and how to meet research funders' requirements;
3. To export attractive and useful plans in a variety of formats;
4. To allow collaborative work when creating Data Management Plans.

== Documentation & Support

* You can contact us by email, [email protected], but we can only provide limited support for your installation

== Bugs & Feature Requests

* Bug Reports & Feature Requests: https://github.com/DigitalCurationCentre/DMPonline_v4/issues

== Prerequisites

DMPonline is a Ruby on Rails application and you will need to have Ruby 2.0.0p247 or greater installed on your server and a MySQL server v5.0 or greater.

Further details on how to install Ruby on Rails applications are available from the Ruby on Rails site, http://rubyonrails.org

You may also find the following resources handy:

* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/


== Copyright

Copyright (c) 2013 Digital Curation Centre, University of Edinburgh.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses.
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

DMPonline4::Application.load_tasks

RDoc::Task.new :rdoc do |rdoc|
rdoc.main = "README.rdoc"

rdoc.rdoc_files.include("README.rdoc", "doc/*.rdoc", "app/**/*.rb", "lib/*.rb", "config/**/*.rb")
#change above to fit needs

rdoc.title = "DMPonline4 Documentation"
rdoc.options << "--all"
end
39 changes: 39 additions & 0 deletions app/admin/dashboard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# [+Project:+] DMPonline
# [+Description:+]
#
# [+Copyright:+] Digital Curation Centre


ActiveAdmin.register_page "Dashboard" do

menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }

content title: proc{ I18n.t("active_admin.dashboard") } do
#div class: "blank_slate_container", id: "dashboard_default_message" do
# span class: "blank_slate" do
# span I18n.t("active_admin.dashboard_welcome.welcome")
# small I18n.t("active_admin.dashboard_welcome.call_to_action")
# end
#end

# Here is an example of a simple dashboard with columns and panels.
#
# columns do
# column do
# panel "Recent Posts" do
# ul do
# Post.recent(5).map do |post|
# li link_to(post.title, admin_post_path(post))
# end
# end
# end
# end

# column do
# panel "Info" do
# para "Welcome to ActiveAdmin."
# end
# end
# end
end # content
end
125 changes: 125 additions & 0 deletions app/admin/dmptemplate.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# [+Project:+] DMPonline
# [+Description:+]
#
# [+Created:+] 03/09/2014
# [+Copyright:+] Digital Curation Centre

ActiveAdmin.register Dmptemplate do
permit_params :title, :description, :organisation_id, :published, :is_default

menu :priority => 11, :label => proc{ I18n.t('admin.template')}, :parent => "Templates management"

# FIXME: The below member_actions only work on :export settings.
member_action :settings do
@template = resource
@settings = resource.settings(:export)
end

member_action :update_settings, method: :put do
new_settings = params[:settings][:export]

settings = resource.settings(:export).tap do |s|
s.formatting, s.max_pages = if params[:commit] != 'Reset'
[
new_settings[:formatting].try(:deep_symbolize_keys),
new_settings[:max_pages].try(:to_i)
]
else
[ nil, nil ]
end
end

if settings.save
redirect_to(action: :show, flash: { notice: 'Settings updated successfully' })
else
settings.formatting = nil
@template = resource
@settings = settings
render(action: :settings)
end
end

action_item only: %i( show edit ) do
link_to(I18n.t('helpers.settings.title'), settings_admin_dmptemplate_path(resource.id))
end

index do
column :title do |dmptemp|
link_to dmptemp.title, [:admin, dmptemp]
end
column :description do |descr|
if !descr.description.nil? then
descr.description.html_safe
end
end
column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title|
if !org_title.organisation.nil? then
link_to org_title.organisation.name, [:admin, org_title.organisation]
else
'-'
end
end
column :published
column :is_default

actions defaults: true do |template|
link_to(I18n.t('helpers.settings.title'), settings_admin_dmptemplate_path(template.id))
end
end


# show Template details
show do
attributes_table do
row :title
row :description do |descr|
if !descr.description.nil? then
descr.description.html_safe
end
end
row I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title|
if !org_title.organisation.nil? then
link_to org_title.organisation.name, [:admin, org_title.organisation]
else
'-'
end
end
row :published
row :is_default
row :created_at
row :updated_at
end
end

#phases sidebar
sidebar I18n.t('admin.phases'), :only => :show, :if => proc { dmptemplate.phases.count >= 1} do
table_for dmptemplate.phases.order("number asc") do |temp_phases|
column :number
column :title do |row|
link_to row.title, [:admin, row]
end
end
end

#form
form do |f|
f.inputs "Details" do
f.input :title
f.input :description
f.input :organisation_id, :label => I18n.t('admin.org_title'),
:as => :select,
:collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]}
f.input :published
f.input :is_default
end
f.actions
end

controller do
def permitted_params
params.permit!
end
end

end

Loading

0 comments on commit dbeb039

Please sign in to comment.