diff --git a/.gitignore b/.gitignore index 59dd548..960fdd4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ + # Ignore rbenv files .ruby-version diff --git a/Gemfile b/Gemfile index 41541aa..6d1c709 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,11 @@ source 'https://rubygems.org' + +ruby '>= 2.2.2' + # # RAILS # -gem 'rails', '4.2.0' +gem 'rails', '4.2.7' # additional gems for rails 4 gem 'railties' diff --git a/Gemfile.lock b/Gemfile.lock index b4c911a..b0f7bd4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/activeadmin/activeadmin.git - revision: 3941e1550c4d5d8a6df51057d0517f1a51b609e4 + revision: cc178ad0ebe1b74729eeaa59d5c7ad9b82ed7837 specs: activeadmin (1.0.0.pre4) arbre (~> 1.0, >= 1.0.2) @@ -12,7 +12,7 @@ jquery-rails jquery-ui-rails kaminari (~> 0.15) - rails (>= 3.2, < 5.1) + railties (>= 3.2, < 5.1) ransack (~> 1.3) sass-rails sprockets (< 4.1) @@ -20,40 +20,40 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.0) - actionpack (= 4.2.0) - actionview (= 4.2.0) - activejob (= 4.2.0) + actionmailer (4.2.7) + actionpack (= 4.2.7) + actionview (= 4.2.7) + activejob (= 4.2.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.0) - actionview (= 4.2.0) - activesupport (= 4.2.0) - rack (~> 1.6.0) + actionpack (4.2.7) + actionview (= 4.2.7) + activesupport (= 4.2.7) + rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) + rails-html-sanitizer (~> 1.0, >= 1.0.2) actionpack-action_caching (1.1.1) actionpack (>= 4.0.0, < 5.0) actionpack-page_caching (1.0.2) actionpack (>= 4.0.0, < 5) - actionview (4.2.0) - activesupport (= 4.2.0) + actionview (4.2.7) + activesupport (= 4.2.7) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - activejob (4.2.0) - activesupport (= 4.2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.7) + activesupport (= 4.2.7) globalid (>= 0.3.0) - activemodel (4.2.0) - activesupport (= 4.2.0) + activemodel (4.2.7) + activesupport (= 4.2.7) builder (~> 3.1) - activerecord (4.2.0) - activemodel (= 4.2.0) - activesupport (= 4.2.0) + activerecord (4.2.7) + activemodel (= 4.2.7) + activesupport (= 4.2.7) arel (~> 6.0) - activesupport (4.2.0) + activesupport (4.2.7) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -227,16 +227,16 @@ rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.0) - actionmailer (= 4.2.0) - actionpack (= 4.2.0) - actionview (= 4.2.0) - activejob (= 4.2.0) - activemodel (= 4.2.0) - activerecord (= 4.2.0) - activesupport (= 4.2.0) + rails (4.2.7) + actionmailer (= 4.2.7) + actionpack (= 4.2.7) + actionview (= 4.2.7) + activejob (= 4.2.7) + activemodel (= 4.2.7) + activerecord (= 4.2.7) + activesupport (= 4.2.7) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.0) + railties (= 4.2.7) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -248,9 +248,9 @@ loofah (~> 2.0) rails-observers (0.1.2) activemodel (~> 4.0) - railties (4.2.0) - actionpack (= 4.2.0) - activesupport (= 4.2.0) + railties (4.2.7) + actionpack (= 4.2.7) + activesupport (= 4.2.7) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (11.2.2) @@ -284,9 +284,9 @@ actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - swagger-docs (0.2.8) - activesupport (>= 3, < 5) - rails (>= 3, < 5) + swagger-docs (0.2.9) + activesupport (>= 3) + rails (>= 3) therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref @@ -361,7 +361,7 @@ omniauth-shibboleth protected_attributes rack-test - rails (= 4.2.0) + rails (= 4.2.7) rails-observers railties recaptcha @@ -381,5 +381,8 @@ wicked_pdf yard +RUBY VERSION + ruby 2.2.2p95 + BUNDLED WITH 1.12.5 diff --git a/LICENSE.md b/LICENSE.md index ba4db2c..abce7d2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,18 +1,18 @@ -The MIT License (MIT) - -Copyright (c) 2016 University of Edinburgh, University of Glasgow & The Regents of the University of California - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -associated documentation files (the "Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or -substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2016 University of Edinburgh, University of Glasgow & The Regents of the University of California + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 67fcb25..13ddc72 100644 --- a/README.md +++ b/README.md @@ -1,103 +1,103 @@ -## DMP Roadmap - -DMP Roadmap is a Data Management Planning tool. It allows users to create data management plans for the projects using funder specific templates and institutional guidance. Once a plan has been completed it can be downloaded and inserted into your grant proposals. - -Management and development of the DMP Roadmap is jointly provided by the Digital Curation Centre (DCC), http://www.dcc.ac.uk/, and the University of California Curation Center (UC3), http://www.cdlib.org/services/uc3/ - -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. - -#### Current Release -v.0.1.0 -[![Build Status](https://travis-ci.org/DMPRoadmap/roadmap.svg)](https://travis-ci.org/DMPRoadmap/roadmap) - -#### Summary - -#### Pre-requisites -Roadmap is a Ruby on Rails application and you will need to have: -1. Ruby >= 2.0.0p247 -2. Rails >= 4.0 -3. MySql >= 5.0 - -Further details on how to install Ruby on Rails applications are available from the Ruby on Rails site: http://rubyonrails.org - -Further details on how to install MySQL and create your first user and database. Be sure to follow the instructions for your particular environment. -* Install: http://dev.mysql.com/downloads/mysql/ -* -* Create a user: http://dev.mysql.com/doc/refman/5.7/en/create-user.html -* Create the database: http://dev.mysql.com/doc/refman/5.7/en/creating-database.html - -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/ - -#### Installation -* Create your mysql db. Select UTF-8 Unicode (utf8mb4) encoding. -* Fork the repository and then clone it onto your server - -> > git clone https://github.com/[your organization]/roadmap.git - -> > cd roadmap - -* Make copies of the yaml configuration files and update the values for your installation - -> > cp config/database_example.yml config/database.yml -> > cp config/secrets_example.yml config/secrets.yml - -* Create an environment variable for your instance's secret (as defined in config/secrets.yml). You should use the following command to generate secrets for each of your environments, storing the production one in the environment variable: - -> > rake secret - -* Run bundler and perform the DB migrations - -> > gem install bundler (if bundler is not yet installed) - -> > bundle install - -> > rake db:migrate - -> > rake db:seed - -* Setup the devise authentication gem - -> > rails generate devise:install (Is this really necessary?) - -* Start the application - -> > rails server - -* Verify that the site is running properly by going to http://localhost:3000 -* Login as the default administrator: 'super_admin@example.com' - 'password1' - -#### Troubleshooting -##### Installation - OSX: - -``` -An error occurred while installing libv8 (3.11.8.17), and Bundler cannot continue. - -Make sure that `gem install libv8 -v '3.11.8.17'` succeeds before bundling. -``` - -If you are installing on a system that already has v8 installed then you may need to install the libv8 gem manually using your system's current v8 engine. If you're using homebrew to manage your packages you should run 'brew update' and 'brew upgrade' to make sure you have the latest packages - -> > gem uninstall -a libv8 - -> > gem install libv8 -v '<>' -- --with-system-v8 - -> > bundle install - -#### Support -Issues should be reported here on Github https://github.com/DMPRoadmap/roadmap/issues -Please be advised though that we can only provide limited support for your local installations. - -#### Become a contributor -Fork this repository and make your modifications in a new branch. Then create a pull request to our 'development' branch. We will reject any pull request made against the 'master' branch. Once your pull request has been submitted the team will review your request and accept it if appropriate. - -Join the email listserv at roadmap-l (at) listserv.ucop (dot) edu. - -#### License -The DMP Roadmap project uses to the MIT License. +## DMP Roadmap + +DMP Roadmap is a Data Management Planning tool. It allows users to create data management plans for the projects using funder specific templates and institutional guidance. Once a plan has been completed it can be downloaded and inserted into your grant proposals. + +Management and development of the DMP Roadmap is jointly provided by the Digital Curation Centre (DCC), http://www.dcc.ac.uk/, and the University of California Curation Center (UC3), http://www.cdlib.org/services/uc3/ + +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. + +#### Current Release +v.0.1.0 +[![Build Status](https://travis-ci.org/DMPRoadmap/roadmap.svg)](https://travis-ci.org/DMPRoadmap/roadmap) + +#### Summary + +#### Pre-requisites +Roadmap is a Ruby on Rails application and you will need to have: +1. Ruby >= 2.0.0p247 +2. Rails >= 4.0 +3. MySql >= 5.0 + +Further details on how to install Ruby on Rails applications are available from the Ruby on Rails site: http://rubyonrails.org + +Further details on how to install MySQL and create your first user and database. Be sure to follow the instructions for your particular environment. +* Install: http://dev.mysql.com/downloads/mysql/ +* +* Create a user: http://dev.mysql.com/doc/refman/5.7/en/create-user.html +* Create the database: http://dev.mysql.com/doc/refman/5.7/en/creating-database.html + +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/ + +#### Installation +* Create your mysql db. Select UTF-8 Unicode (utf8mb4) encoding. +* Fork the repository and then clone it onto your server + +> > git clone https://github.com/[your organization]/roadmap.git + +> > cd roadmap + +* Make copies of the yaml configuration files and update the values for your installation + +> > cp config/database_example.yml config/database.yml +> > cp config/secrets_example.yml config/secrets.yml + +* Create an environment variable for your instance's secret (as defined in config/secrets.yml). You should use the following command to generate secrets for each of your environments, storing the production one in the environment variable: + +> > rake secret + +* Run bundler and perform the DB migrations + +> > gem install bundler (if bundler is not yet installed) + +> > bundle install + +> > rake db:migrate + +> > rake db:seed + +* Setup the devise authentication gem + +> > rails generate devise:install (Is this really necessary?) + +* Start the application + +> > rails server + +* Verify that the site is running properly by going to http://localhost:3000 +* Login as the default administrator: 'super_admin@example.com' - 'password1' + +#### Troubleshooting +##### Installation - OSX: + +``` +An error occurred while installing libv8 (3.11.8.17), and Bundler cannot continue. + +Make sure that `gem install libv8 -v '3.11.8.17'` succeeds before bundling. +``` + +If you are installing on a system that already has v8 installed then you may need to install the libv8 gem manually using your system's current v8 engine. If you're using homebrew to manage your packages you should run 'brew update' and 'brew upgrade' to make sure you have the latest packages + +> > gem uninstall -a libv8 + +> > gem install libv8 -v '<>' -- --with-system-v8 + +> > bundle install + +#### Support +Issues should be reported here on Github https://github.com/DMPRoadmap/roadmap/issues +Please be advised though that we can only provide limited support for your local installations. + +#### Become a contributor +Fork this repository and make your modifications in a new branch. Then create a pull request to our 'development' branch. We will reject any pull request made against the 'master' branch. Once your pull request has been submitted the team will review your request and accept it if appropriate. + +Join the email listserv at roadmap-l (at) listserv.ucop (dot) edu. + +#### License +The DMP Roadmap project uses to the MIT License. diff --git a/README.rdoc b/README.rdoc index 9a680a0..8f67343 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,36 +1,36 @@ -= DMPRoadmap - -Roadmap is a data management planning tool, available at https://github.com/DMPRoadmap/roadmap - -Development of the Roadmap is provided by the Digital Curation Centre and the University of California Curation Center. - -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, roadmap-l@listserv.ucop.edu, but we can only provide limited support for your installation - -== Bugs & Feature Requests - -* Bug Reports & Feature Requests: https://github.com/DMPRoadmap/roadmap/issues -* Please prefix your request with either: 'Bug:' or 'Feature:' - -== Prerequisites - -Roadmap 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 - -The Roadmap project uses an MIT License. The full text of the license can be found at: https://github.com/DMPRoadmap/roadmap/blob/master/LICENSE.md += DMPRoadmap + +Roadmap is a data management planning tool, available at https://github.com/DMPRoadmap/roadmap + +Development of the Roadmap is provided by the Digital Curation Centre and the University of California Curation Center. + +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, roadmap-l@listserv.ucop.edu, but we can only provide limited support for your installation + +== Bugs & Feature Requests + +* Bug Reports & Feature Requests: https://github.com/DMPRoadmap/roadmap/issues +* Please prefix your request with either: 'Bug:' or 'Feature:' + +== Prerequisites + +Roadmap 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 + +The Roadmap project uses an MIT License. The full text of the license can be found at: https://github.com/DMPRoadmap/roadmap/blob/master/LICENSE.md diff --git a/app/admin/language.rb b/app/admin/language.rb new file mode 100644 index 0000000..777478c --- /dev/null +++ b/app/admin/language.rb @@ -0,0 +1,45 @@ +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 12/08/2016 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Language do + permit_params :language_id, :name, :abbreviation, :default_language + + menu :priority => 10, :label => proc { I18n.t('admin.language') } + + index do + column I18n.t('admin.language_name'), :sortable => :name do |lang| + link_to lang.name, [:admin, lang] + end + column I18n.t('admin.language_abbreviation'), :sortable => :abbreviation do |lang| + link_to lang.abbreviation, [:admin, lang] + end + column I18n.t('admin.language_is_default'), :sortable => :default_language do |lang| + if lang[:default_language] + 'Yes' + else + 'No' + end + end + + actions + end + + show do + attributes_table do + row :name + row :abbreviation + row :default_language + row :description + end + end + + controller do + def permitted_params + params.permit! + end + end + +end \ No newline at end of file diff --git a/app/admin/org_token_permission.rb b/app/admin/org_token_permission.rb index e335d7f..4075d5cf 100644 --- a/app/admin/org_token_permission.rb +++ b/app/admin/org_token_permission.rb @@ -1,31 +1,31 @@ -ActiveAdmin.register OrgTokenPermission do - permit_params :organisation_id, :token_permission_type_id - - menu priority: 40, label: proc{ I18n.t('admin.org_token_permission')}, parent: "Api" - - index do - column I18n.t('admin.org') do |n| - link_to n.organisation, [:admin,n] - end - column I18n.t('admin.token_permission') do |n| - link_to n.token_permission_type, [:admin,n] - end - - actions - end - - show do - attributes_table do - row :organisation_id - row :token_permission_type_id - end - end - - controller do - def permitted_params - params.permit! - end - end - - -end +ActiveAdmin.register OrgTokenPermission do + permit_params :organisation_id, :token_permission_type_id + + menu priority: 40, label: proc{ I18n.t('admin.org_token_permission')}, parent: "Api" + + index do + column I18n.t('admin.org') do |n| + link_to n.organisation, [:admin,n] + end + column I18n.t('admin.token_permission') do |n| + link_to n.token_permission_type, [:admin,n] + end + + actions + end + + show do + attributes_table do + row :organisation_id + row :token_permission_type_id + end + end + + controller do + def permitted_params + params.permit! + end + end + + +end diff --git a/app/admin/token_permission_type.rb b/app/admin/token_permission_type.rb index de4aa2d..cd6e05c 100644 --- a/app/admin/token_permission_type.rb +++ b/app/admin/token_permission_type.rb @@ -1,33 +1,33 @@ -ActiveAdmin.register TokenPermissionType do - permit_params :token_type, :text_desription - - menu priority: 40, label: proc{ I18n.t('admin.token_permission_type')}, parent: "Api" - - # TODO: Find better fix for the undefined method xxx_id_eq - remove_filter :org_token_permissions - - index do - column I18n.t('admin.token_permission_type'), sortable: :token_type do |n| - link_to n.token_type, [:admin, n] - end - column I18n.t('admin.permission_description') do |n| - link_to n.text_desription, [:admin, n] - end - - actions - end - - show do - attributes_table do - row :token_type - row :text_desription - end - end - - controller do - def permitted_params - params.permit! - end - end - -end +ActiveAdmin.register TokenPermissionType do + permit_params :token_type, :text_desription + + menu priority: 40, label: proc{ I18n.t('admin.token_permission_type')}, parent: "Api" + + # TODO: Find better fix for the undefined method xxx_id_eq + remove_filter :org_token_permissions + + index do + column I18n.t('admin.token_permission_type'), sortable: :token_type do |n| + link_to n.token_type, [:admin, n] + end + column I18n.t('admin.permission_description') do |n| + link_to n.text_desription, [:admin, n] + end + + actions + end + + show do + attributes_table do + row :token_type + row :text_desription + end + end + + controller do + def permitted_params + params.permit! + end + end + +end diff --git a/app/assets/javascripts/active_admin.js b/app/assets/javascripts/active_admin.js index 3752dce..1f42d86 100644 --- a/app/assets/javascripts/active_admin.js +++ b/app/assets/javascripts/active_admin.js @@ -1 +1 @@ -#= require active_admin/base +#= require active_admin/base diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0a76459..68c3667 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,197 +1,197 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD -// GO AFTER THE REQUIRES BELOW. -// -//= require jquery -//= require jquery_ujs -//= require twitter/bootstrap -//= require v1.js -//= require select2.min.js -//= require jquery.placeholder.js -//= require tinymce-jquery -//= require i18n -//= require i18n/translations - - -$( document ).ready(function() { - - $(function(){ - $('.dropdown-toggle').dropdown() - }); - - $('.accordion-body').on('show', function() { - var plus = $(this).parent().children(".accordion-heading").children(".accordion-toggle").children(".icon-plus").removeClass("icon-plus").addClass("icon-minus"); - }).on('hide', function(){ - var minus = $(this).parent().children(".accordion-heading").children(".accordion-toggle").children(".icon-minus").removeClass("icon-minus").addClass("icon-plus"); - }); - - //accordion home page - $('.accordion-home').on('show', function() { - var plus = $(this).parent().find(".plus-laranja").removeClass("plus-laranja").addClass("minus-laranja"); - }).on('hide', function(){ - var minus = $(this).parent().find(".minus-laranja").removeClass("minus-laranja").addClass("plus-laranja"); - }); - - //accordion project details page when project has more than 1 plan - $('.accordion-project').on('show', function() { - var plus = $(this).parent().find(".plus-laranja").removeClass("plus-laranja").addClass("minus-laranja"); - }).on('hide', function(){ - var minus = $(this).parent().find(".minus-laranja").removeClass("minus-laranja").addClass("plus-laranja"); - }); - - //$('#3-or-4-splash').modal(); - - $('.typeahead').select2({ - width: "element", - allowClear: true - }); - - $(".help").popover(); - - $('.has-tooltip').tooltip({ - placement: "right", - trigger: "focus" - }); - - $(".show-edit-toggle").click(function (e) { - e.preventDefault(); - - $(".edit-project").toggle(); - $(".view-project").toggle(); - }); - - $(".toggle-existing-user-access").change(function(){ - $(this).closest("form").submit(); - }); - - $("#user_email.text_field.reg-input").blur(function () { - if (validateEmail($(this).val())) { - $(this).parent().children("div").hide(); - } - else { - $(this).parent().children("div").show(); - } - }); - - $("#user_password.text_field.reg-input").blur(function () { - if ($(this).val().length >= 8) { - $(this).parent().children("div").hide(); - } - else { - $(this).parent().children("div").show(); - } - }); - - $("#user_password_confirmation.text_field.reg-input").blur(function () { - if ($(this).val() == $("#user_password.text_field.reg-input").val()) { - $(this).parent().children("div").hide(); - } - else { - $(this).parent().children("div").show(); - } - }); - - $('#user_organisation_id').on("change", function(e) { - e.preventDefault(); - var selected_org = $(this).select2("val"); - var other_orgs = $("#other-organisation-name").attr("data-orgs").split(","); - var index = $.inArray(selected_org, other_orgs); - if (index > -1) { - $("#other-organisation-name").show(); - $("#user_other_organisation").focus(); - } - else { - $("#other-organisation-name").hide(); - } - }); - - $("#other-org-link > a").click(function(e){ - e.preventDefault(); - var other_org = $("#other-organisation-name").attr("data-orgs").split(","); - $("#user_organisation_id").select2("val", other_org); - $("#other-org-link").hide(); - $("#user_organisation_id").change(); - }); - - //alert dialog for unlink Shibbileth account - $("#unlink-institutional-credentials-dialog").on("show", function(){ - $('.select2-choice').hide(); - }); - - $("#unlink-shibboleth-cancelled").click(function (){ - $("#unlink-institutional-credentials-dialog").modal("hide"); - $('.select2-choice').show(); - }); - - $("#unlink-shibboleth-confirmed").click(function (){ - $("#unlink_flag").val('true'); - $("#edit_user").submit(); - - }); - - //Question Options - // ------------------------------------------------------------------------------------ - $(".options_table").on("click", ".remove-option", function(e){ - e.preventDefault(); - - // Mark the option for removal - $($(this).siblings()[0]).val(true); - - // Hide the entire table row and the associated hidden field for the item - $(this).parent().parent().addClass('hidden'); - }); - - $(".add-option").click(function(e){ - e.preventDefault(); - - var tbl = $(this).parent().find("table.options_table > tbody.options_tbody"), - last = tbl.find("tr:last"), - clone = last.clone(); - nbr = parseInt(last.find(".number_field").val()); - - // Update the input field names and ids - clone.find("input").each(function(index){ - $(this).prop("id", $(this).prop("id").replace(/_\d+_/g, "_" + nbr + "_")); - $(this).prop("name", $(this).prop("name").replace(/\[\d+\]/g, "[" + nbr + "]")); - }); - - // Remove the hidden class and make sure the new row is not marked for removal - clone.removeClass('hidden'); - clone.find("[id$=" + nbr + "__destroy]").val(false); - - // Default the other values - clone.find("[id$=" + nbr + "_number]").val("" + (nbr + 1)); - clone.find("[id$=" + nbr + "_text]").val(""); - clone.find("[id$=" + nbr + "_is_default]").prop("checked", false); - - last.after(clone); - }); - - /*$('#continue-to-new').click(function(e){ - var destination = $(this).attr("href"); - var n = destination.lastIndexOf('='); - destination = decodeURIComponent(destination.substring(n + 1)); - $.post('splash_logs', {destination: destination} ); - $("#3-or-4-splash").modal('hide'); - return false; - });*/ - -}); - -function validateEmail(sEmail) { - var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/; - if (filter.test(sEmail)) { - return true; - } - else { - return false; - } -} +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require jquery +//= require jquery_ujs +//= require twitter/bootstrap +//= require v1.js +//= require select2.min.js +//= require jquery.placeholder.js +//= require tinymce-jquery +//= require i18n +//= require i18n/translations + + +$( document ).ready(function() { + + $(function(){ + $('.dropdown-toggle').dropdown() + }); + + $('.accordion-body').on('show', function() { + var plus = $(this).parent().children(".accordion-heading").children(".accordion-toggle").children(".icon-plus").removeClass("icon-plus").addClass("icon-minus"); + }).on('hide', function(){ + var minus = $(this).parent().children(".accordion-heading").children(".accordion-toggle").children(".icon-minus").removeClass("icon-minus").addClass("icon-plus"); + }); + + //accordion home page + $('.accordion-home').on('show', function() { + var plus = $(this).parent().find(".plus-laranja").removeClass("plus-laranja").addClass("minus-laranja"); + }).on('hide', function(){ + var minus = $(this).parent().find(".minus-laranja").removeClass("minus-laranja").addClass("plus-laranja"); + }); + + //accordion project details page when project has more than 1 plan + $('.accordion-project').on('show', function() { + var plus = $(this).parent().find(".plus-laranja").removeClass("plus-laranja").addClass("minus-laranja"); + }).on('hide', function(){ + var minus = $(this).parent().find(".minus-laranja").removeClass("minus-laranja").addClass("plus-laranja"); + }); + + //$('#3-or-4-splash').modal(); + + $('.typeahead').select2({ + width: "element", + allowClear: true + }); + + $(".help").popover(); + + $('.has-tooltip').tooltip({ + placement: "right", + trigger: "focus" + }); + + $(".show-edit-toggle").click(function (e) { + e.preventDefault(); + + $(".edit-project").toggle(); + $(".view-project").toggle(); + }); + + $(".toggle-existing-user-access").change(function(){ + $(this).closest("form").submit(); + }); + + $("#user_email.text_field.reg-input").blur(function () { + if (validateEmail($(this).val())) { + $(this).parent().children("div").hide(); + } + else { + $(this).parent().children("div").show(); + } + }); + + $("#user_password.text_field.reg-input").blur(function () { + if ($(this).val().length >= 8) { + $(this).parent().children("div").hide(); + } + else { + $(this).parent().children("div").show(); + } + }); + + $("#user_password_confirmation.text_field.reg-input").blur(function () { + if ($(this).val() == $("#user_password.text_field.reg-input").val()) { + $(this).parent().children("div").hide(); + } + else { + $(this).parent().children("div").show(); + } + }); + + $('#user_organisation_id').on("change", function(e) { + e.preventDefault(); + var selected_org = $(this).select2("val"); + var other_orgs = $("#other-organisation-name").attr("data-orgs").split(","); + var index = $.inArray(selected_org, other_orgs); + if (index > -1) { + $("#other-organisation-name").show(); + $("#user_other_organisation").focus(); + } + else { + $("#other-organisation-name").hide(); + } + }); + + $("#other-org-link > a").click(function(e){ + e.preventDefault(); + var other_org = $("#other-organisation-name").attr("data-orgs").split(","); + $("#user_organisation_id").select2("val", other_org); + $("#other-org-link").hide(); + $("#user_organisation_id").change(); + }); + + //alert dialog for unlink Shibbileth account + $("#unlink-institutional-credentials-dialog").on("show", function(){ + $('.select2-choice').hide(); + }); + + $("#unlink-shibboleth-cancelled").click(function (){ + $("#unlink-institutional-credentials-dialog").modal("hide"); + $('.select2-choice').show(); + }); + + $("#unlink-shibboleth-confirmed").click(function (){ + $("#unlink_flag").val('true'); + $("#edit_user").submit(); + + }); + + //Question Options + // ------------------------------------------------------------------------------------ + $(".options_table").on("click", ".remove-option", function(e){ + e.preventDefault(); + + // Mark the option for removal + $($(this).siblings()[0]).val(true); + + // Hide the entire table row and the associated hidden field for the item + $(this).parent().parent().addClass('hidden'); + }); + + $(".add-option").click(function(e){ + e.preventDefault(); + + var tbl = $(this).parent().find("table.options_table > tbody.options_tbody"), + last = tbl.find("tr:last"), + clone = last.clone(); + nbr = parseInt(last.find(".number_field").val()); + + // Update the input field names and ids + clone.find("input").each(function(index){ + $(this).prop("id", $(this).prop("id").replace(/_\d+_/g, "_" + nbr + "_")); + $(this).prop("name", $(this).prop("name").replace(/\[\d+\]/g, "[" + nbr + "]")); + }); + + // Remove the hidden class and make sure the new row is not marked for removal + clone.removeClass('hidden'); + clone.find("[id$=" + nbr + "__destroy]").val(false); + + // Default the other values + clone.find("[id$=" + nbr + "_number]").val("" + (nbr + 1)); + clone.find("[id$=" + nbr + "_text]").val(""); + clone.find("[id$=" + nbr + "_is_default]").prop("checked", false); + + last.after(clone); + }); + + /*$('#continue-to-new').click(function(e){ + var destination = $(this).attr("href"); + var n = destination.lastIndexOf('='); + destination = decodeURIComponent(destination.substring(n + 1)); + $.post('splash_logs', {destination: destination} ); + $("#3-or-4-splash").modal('hide'); + return false; + });*/ + +}); + +function validateEmail(sEmail) { + var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/; + if (filter.test(sEmail)) { + return true; + } + else { + return false; + } +} diff --git a/app/assets/javascripts/bootstrap.min.js b/app/assets/javascripts/bootstrap.min.js index f9cbdae..dce516e 100644 --- a/app/assets/javascripts/bootstrap.min.js +++ b/app/assets/javascripts/bootstrap.min.js @@ -1,6 +1,6 @@ -/*! -* Bootstrap.js by @fat & @mdo -* Copyright 2012 Twitter, Inc. -* http://www.apache.org/licenses/LICENSE-2.0.txt -*/ +/*! +* Bootstrap.js by @fat & @mdo +* Copyright 2012 Twitter, Inc. +* http://www.apache.org/licenses/LICENSE-2.0.txt +*/ !function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),r=this;if(t>this.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){r.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u](),f=e.Event("slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children()[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},i.data(),n.data()),o;i.carousel(s),(o=n.attr("data-slide-to"))&&i.data("carousel").pause().to(o).cycle(),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning||this.$element.hasClass("in"))return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning||!this.$element.hasClass("in"))return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=e.extend({},e.fn.collapse.defaults,r.data(),typeof n=="object"&&n);i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})}(window.jQuery),!function(e){"use strict";function r(){e(".dropdown-backdrop").remove(),e(t).each(function(){i(e(this)).removeClass("open")})}function i(t){var n=t.attr("data-target"),r;n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),r=n&&e(n);if(!r||!r.length)r=t.parent();return r}var t="[data-toggle=dropdown]",n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||("ontouchstart"in document.documentElement&&e(' - + <%= render :partial => 'guidance_display', locals: {question: question}%> diff --git a/app/views/dmptemplates/_show_section.html.erb b/app/views/dmptemplates/_show_section.html.erb index 7041cc0..1dbf719 100644 --- a/app/views/dmptemplates/_show_section.html.erb +++ b/app/views/dmptemplates/_show_section.html.erb @@ -1,43 +1,43 @@ - -<%if @open && @section_id == section.id then%> - <% toggle = 'accordion-body section-collapse in collapse'%> -<%else%> - <% toggle = 'accordion-body collapse section-collapse' %> -<%end%> -
- -
-
- <%= raw section.description %> -
-
- <% section.questions.order("number").each do |question| %> - <% last_question_id = section.questions.order("number DESC").first.id %> - -
- - <%= render :partial => 'show_question', locals: {question: question}%> -
- - <% if last_question_id == question.id then %> -
- <% else %> -
- <% end %> - - <%end%> -
-
-
+ +<%if @open && @section_id == section.id then%> + <% toggle = 'accordion-body section-collapse in collapse'%> +<%else%> + <% toggle = 'accordion-body collapse section-collapse' %> +<%end%> +
+ +
+
+ <%= raw section.description %> +
+
+ <% section.questions.order("number").each do |question| %> + <% last_question_id = section.questions.order("number DESC").first.id %> + +
+ + <%= render :partial => 'show_question', locals: {question: question}%> +
+ + <% if last_question_id == question.id then %> +
+ <% else %> +
+ <% end %> + + <%end%> +
+
+
diff --git a/app/views/dmptemplates/_show_suggested_answer.html.erb b/app/views/dmptemplates/_show_suggested_answer.html.erb index c20fff6..888dd45 100644 --- a/app/views/dmptemplates/_show_suggested_answer.html.erb +++ b/app/views/dmptemplates/_show_suggested_answer.html.erb @@ -1,19 +1,19 @@ - - - - - - -
- <% if suggested_answer.is_example? then %> - <%= t('org_admin.questions.example_answer_label')%> - <%else%> - <%= t('org_admin.questions.suggested_answer_label')%> - <%end%> - <%= raw suggested_answer.text %>
-
- -
- <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> - <%= link_to t("org_admin.questions.edit_suggested_answer_button"), '# ', :class => "btn btn-primary edit_form_for_suggested_answer"%> -
+ + + + + + +
+ <% if suggested_answer.is_example? then %> + <%= t('org_admin.questions.example_answer_label')%> + <%else%> + <%= t('org_admin.questions.suggested_answer_label')%> + <%end%> + <%= raw suggested_answer.text %>
+
+ +
+ <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> + <%= link_to t("org_admin.questions.edit_suggested_answer_button"), '# ', :class => "btn btn-primary edit_form_for_suggested_answer"%> +
diff --git a/app/views/dmptemplates/_show_template.html.erb b/app/views/dmptemplates/_show_template.html.erb index a904ebb..7cfec9d 100644 --- a/app/views/dmptemplates/_show_template.html.erb +++ b/app/views/dmptemplates/_show_template.html.erb @@ -1,6 +1,6 @@ -<% if @dmptemplate.org_type != t("helpers.org_type.funder") || current_user.org_type == t("helpers.org_type.funder") then %> +<% if @dmptemplate.org_type != constant("organisation_types.funder") || current_user.org_type == constant("organisation_types.funder") then %>

<%= link_to t("org_admin.templates.edit_details"), '# ', :class => "btn btn-primary", :id => "edit_template_button"%> @@ -41,4 +41,3 @@ <%= l dmptemplate.updated_at.to_date, :formats => :short %> -
\ No newline at end of file diff --git a/app/views/dmptemplates/_show_version.html.erb b/app/views/dmptemplates/_show_version.html.erb index 0214afe..3e1456e 100644 --- a/app/views/dmptemplates/_show_version.html.erb +++ b/app/views/dmptemplates/_show_version.html.erb @@ -1,42 +1,42 @@ - - - -

- <%= t('org_admin.templates.version_details_label')%> -

-
- - - - - - - <% if version.description != "" then%> - - - - - <%end%> - - - - - - - - - - - - -
<%= t('org_admin.templates.title_label') %><%= version.title %>
<%= t('org_admin.templates.desc_label') %><%= raw version.description %>
<%= t('org_admin.templates.published_label') %><%= version.published %>
<%= t('org_admin.templates.created') %> - <%= l version.created_at.to_date, :formats => :short %> -
<%= t('org_admin.templates.last_updated') %> - <%= l version.updated_at.to_date, :formats => :short %> -
-
- - - - - + + + +

+ <%= t('org_admin.templates.version_details_label')%> +

+
+ + + + + + + <% if version.description != "" then%> + + + + + <%end%> + + + + + + + + + + + + +
<%= t('org_admin.templates.title_label') %><%= version.title %>
<%= t('org_admin.templates.desc_label') %><%= raw version.description %>
<%= t('org_admin.templates.published_label') %><%= version.published %>
<%= t('org_admin.templates.created') %> + <%= l version.created_at.to_date, :formats => :short %> +
<%= t('org_admin.templates.last_updated') %> + <%= l version.updated_at.to_date, :formats => :short %> +
+
+ + + + + diff --git a/app/views/dmptemplates/_versions_table.html.erb b/app/views/dmptemplates/_versions_table.html.erb index 3e38730..259fb5f 100644 --- a/app/views/dmptemplates/_versions_table.html.erb +++ b/app/views/dmptemplates/_versions_table.html.erb @@ -1,72 +1,72 @@ -<%if !phase.versions.nil? then %> -
-

<%= t('org_admin.templates.versions_label')%>

-

- <%= t('org_admin.versions.versions_text_html')%> -

- - - - - - - - - - - - - <% phase.versions.each do |v|%> - - - - - - - - - - - - - <%end%> - -
<%= t('org_admin.templates.title_label')%><%= t('org_admin.templates.published_label')%><%= t('org_admin.templates.created')%><%= t('org_admin.templates.last_updated') %><%= t('org_admin.templates.actions') %>
- <%= v.title %> - - <%= v.published %> - - <%= l v.created_at.to_date, :formats => :short %> - - <%= l v.updated_at.to_date, :formats => :short %> - - <%= link_to t("helpers.view"), admin_phase_dmptemplate_path( :version_id => v.id, :id => phase.id , :edit => 'false'), :class => "dmp_table_link"%> - <% if v.published? then%> - - <%= t('org_admin.versions.edit_label')%> - - <%= link_to t("helpers.preview"), admin_previewphase_dmptemplate_path(v), :class => "dmp_table_link" %> - <%else%> - <%= link_to t("org_admin.versions.edit_label"), admin_phase_dmptemplate_path(phase, :version_id => v.id, :edit => 'true'), :class => "dmp_table_link" %> - <%= link_to t("helpers.preview"), admin_previewphase_dmptemplate_path(v), :class => "dmp_table_link" %> - <%#= link_to t("helpers.submit.delete"), admin_destroyversion_dmptemplate_path(:version_id => v.id, :phase => phase , :edit => 'false'), - :confirm => t("org_admin.versions.delete_message", :version_title => v.title ), :method => :delete, :class => "dmp_table_link"%> - <%end%> -
-
- - - -<%end%> +<%if !phase.versions.nil? then %> +
+

<%= t('org_admin.templates.versions_label')%>

+

+ <%= t('org_admin.versions.versions_text_html')%> +

+ + + + + + + + + + + + + <% phase.versions.each do |v|%> + + + + + + + + + + + + + <%end%> + +
<%= t('org_admin.templates.title_label')%><%= t('org_admin.templates.published_label')%><%= t('org_admin.templates.created')%><%= t('org_admin.templates.last_updated') %><%= t('org_admin.templates.actions') %>
+ <%= v.title %> + + <%= v.published %> + + <%= l v.created_at.to_date, :formats => :short %> + + <%= l v.updated_at.to_date, :formats => :short %> + + <%= link_to t("helpers.view"), admin_phase_dmptemplate_path( :version_id => v.id, :id => phase.id , :edit => 'false'), :class => "dmp_table_link"%> + <% if v.published? then%> + + <%= t('org_admin.versions.edit_label')%> + + <%= link_to t("helpers.preview"), admin_previewphase_dmptemplate_path(v), :class => "dmp_table_link" %> + <%else%> + <%= link_to t("org_admin.versions.edit_label"), admin_phase_dmptemplate_path(phase, :version_id => v.id, :edit => 'true'), :class => "dmp_table_link" %> + <%= link_to t("helpers.preview"), admin_previewphase_dmptemplate_path(v), :class => "dmp_table_link" %> + <%#= link_to t("helpers.submit.delete"), admin_destroyversion_dmptemplate_path(:version_id => v.id, :phase => phase , :edit => 'false'), + :confirm => t("org_admin.versions.delete_message", :version_title => v.title ), :method => :delete, :class => "dmp_table_link"%> + <%end%> +
+
+ + + +<%end%> diff --git a/app/views/dmptemplates/admin_addphase.html.erb b/app/views/dmptemplates/admin_addphase.html.erb index d8109eb..6e8a336 100644 --- a/app/views/dmptemplates/admin_addphase.html.erb +++ b/app/views/dmptemplates/admin_addphase.html.erb @@ -1,75 +1,75 @@ -<%- model_class = Phase -%> -<%= stylesheet_link_tag "admin" %> -<% javascript "admin.js" %> - -

- <%= @dmptemplate.title %> - -
- <%= link_to t("org_admin.templates.view_all_templates"), - admin_index_dmptemplate_path, - :class => "btn btn-primary" %> -
-

- -
- - -<%= render :partial => "admin_nav_tabs", locals: {dmptemplate: @dmptemplate, active: "add_plan"} %> - - -
-
- - -
-
- - - <%= form_for :phase, :url => { :action => "admin_createphase"} do |f| %> -

- <%= t("org_admin.templates.phase_details_label")%> -

- <%= raw t("org_admin.templates.phase_new_text_html")%> -
-
- <%= f.hidden_field :dmptemplate_id, :value => @dmptemplate.id%> - - - - - - - - - - - - - -
<%= t("org_admin.templates.title_label") %><%= f.text_field :title, - :as => :string, - :class => "text_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.phase_title_help_text") %>
<%= t("org_admin.templates.phase_order_label") %><%= f.number_field :number, :in => 1..5, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.phase_number_help_text") %>
<%= t("org_admin.templates.desc_label") %> -
- <%= text_area_tag("phase-desc","" , class: "tinymce") %> -
-
- <%= link_to( image_tag("help_button.png"), "#", :class => "phase_desc_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.templates.phase_desc_help_text_html"))%> -
-
-
-
- - -
- <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.cancel"), admin_dmptemplate_path(@dmptemplate), :class => "btn cancel" %> -
- - <%end%> -
-
-
-
- +<%- model_class = Phase -%> +<%= stylesheet_link_tag "admin" %> +<% javascript "admin.js" %> + +

+ <%= @dmptemplate.title %> + +
+ <%= link_to t("org_admin.templates.view_all_templates"), + admin_index_dmptemplate_path, + :class => "btn btn-primary" %> +
+

+ +
+ + +<%= render :partial => "admin_nav_tabs", locals: {dmptemplate: @dmptemplate, active: "add_plan"} %> + + +
+
+ + +
+
+ + + <%= form_for :phase, :url => { :action => "admin_createphase"} do |f| %> +

+ <%= t("org_admin.templates.phase_details_label")%> +

+ <%= raw t("org_admin.templates.phase_new_text_html")%> +
+
+ <%= f.hidden_field :dmptemplate_id, :value => @dmptemplate.id%> + + + + + + + + + + + + + +
<%= t("org_admin.templates.title_label") %><%= f.text_field :title, + :as => :string, + :class => "text_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.phase_title_help_text") %>
<%= t("org_admin.templates.phase_order_label") %><%= f.number_field :number, :in => 1..5, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.phase_number_help_text") %>
<%= t("org_admin.templates.desc_label") %> +
+ <%= text_area_tag("phase-desc","" , class: "tinymce") %> +
+
+ <%= link_to( image_tag("help_button.png"), "#", :class => "phase_desc_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.templates.phase_desc_help_text_html"))%> +
+
+
+
+ + +
+ <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> + <%= link_to t("helpers.submit.cancel"), admin_dmptemplate_path(@dmptemplate), :class => "btn cancel" %> +
+ + <%end%> +
+
+
+
+ <%= tinymce :content_css => asset_path("application.css") %> \ No newline at end of file diff --git a/app/views/dmptemplates/admin_index.html.erb b/app/views/dmptemplates/admin_index.html.erb index 5440687..64a2097 100644 --- a/app/views/dmptemplates/admin_index.html.erb +++ b/app/views/dmptemplates/admin_index.html.erb @@ -5,7 +5,7 @@

- <%= t('org_admin.templates.own_temp') %> + <%= t('org_admin.templates.own_temp') %>

@@ -34,8 +34,8 @@ - <% @dmptemplates_own.each do |org_template| %> - + <% @dmptemplates_own.each do |org_template| %> + <%= org_template.title%> @@ -64,28 +64,28 @@ <% b_label = t('helpers.submit.edit')%> <%else%> <% b_label = t('helpers.view')%> - <%end%> + <%end%> <%= link_to b_label, admin_template_dmptemplate_path(org_template), :class => "dmp_table_link"%> - <%end%> + <%end%> - -<%end%> + +<%end%>
-<% if current_user.org_type != t("helpers.org_type.funder") then %> +<% if current_user.org_type != constant("organisation_types.funder") then %>

<%= t("org_admin.templates.funders_temp") %> -

+ <% if @dmptemplates_funders.count > 0 then %> - + @@ -97,8 +97,8 @@ - - <% @dmptemplates_funders.each do |org_template| %> + + <% @dmptemplates_funders.each do |org_template| %> <% if org_template.published? ||org_template.has_customisations?(current_user.organisation_id, org_template) then %> <%end%> - <%end%> + <%end%>
@@ -126,28 +126,28 @@ <%end%> <%end%> <%= l last_updated.to_date, :formats => :short %> - + <%if current_user.is_org_admin? then%> - <% if org_template.org_type == t("helpers.org_type.funder") then %> + <% if org_template.org_type == constant("organisation_types.funder") then %> <%if org_template.has_customisations?(current_user.organisation_id, org_template) then%> <% b_label = t("org_admin.templates.edit_customisation")%> - <%else%> + <%else%> <% b_label = t("org_admin.templates.customise")%> - <%end%> + <%end%> <%else%> <% b_label = t("helpers.submit.edit")%> - <%end%> + <%end%> <%else%> <% b_label = t("helpers.view")%> - <%end%> + <%end%> <%= link_to b_label, admin_template_dmptemplate_path(org_template), :class => "dmp_table_link"%>
<%end%> -<%end%> \ No newline at end of file +<%end%> diff --git a/app/views/dmptemplates/admin_new.html.erb b/app/views/dmptemplates/admin_new.html.erb index 07b75a7..798f855 100644 --- a/app/views/dmptemplates/admin_new.html.erb +++ b/app/views/dmptemplates/admin_new.html.erb @@ -1,48 +1,48 @@ -<%= stylesheet_link_tag "admin" %> -<% javascript "admin.js" %> - -

- <%= t("org_admin.templates.new_label") %> - -
- <%= link_to t("org_admin.templates.view_all_templates"), - admin_index_dmptemplate_path, - :class => "btn btn-primary" %> -
-

- -
-
- -
- <%= raw t("org_admin.templates.create_new_template_text_html")%> -
- <%= form_for :dmptemplate, :url => {:action => "admin_create"} do |f| %> - - - - - - - - - - -
<%= t("org_admin.templates.title_label") %><%= f.text_field :title, :as => :string, - :class => "text_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.title_help_text") %>
<%= t("org_admin.templates.desc_label") %>
- <%= text_area_tag("template-desc", "", class: "tinymce") %> -
-
- <%= link_to( image_tag("help_button.png"), "#", :class => "template_desc_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.template_desc_help_text_html"))%> -
-
- -
- <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.cancel"), admin_index_dmptemplate_path, :class => "btn cancel" %> -
-
- <%end%> -
-
+<%= stylesheet_link_tag "admin" %> +<% javascript "admin.js" %> + +

+ <%= t("org_admin.templates.new_label") %> + +
+ <%= link_to t("org_admin.templates.view_all_templates"), + admin_index_dmptemplate_path, + :class => "btn btn-primary" %> +
+

+ +
+
+ +
+ <%= raw t("org_admin.templates.create_new_template_text_html")%> +
+ <%= form_for :dmptemplate, :url => {:action => "admin_create"} do |f| %> + + + + + + + + + + +
<%= t("org_admin.templates.title_label") %><%= f.text_field :title, :as => :string, + :class => "text_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.title_help_text") %>
<%= t("org_admin.templates.desc_label") %>
+ <%= text_area_tag("template-desc", "", class: "tinymce") %> +
+
+ <%= link_to( image_tag("help_button.png"), "#", :class => "template_desc_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.template_desc_help_text_html"))%> +
+
+ +
+ <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> + <%= link_to t("helpers.submit.cancel"), admin_index_dmptemplate_path, :class => "btn cancel" %> +
+
+ <%end%> +
+
<%= tinymce :content_css => asset_path("application.css") %> \ No newline at end of file diff --git a/app/views/dmptemplates/admin_phase.html.erb b/app/views/dmptemplates/admin_phase.html.erb index 0621f7e..18ee0a2 100644 --- a/app/views/dmptemplates/admin_phase.html.erb +++ b/app/views/dmptemplates/admin_phase.html.erb @@ -9,7 +9,7 @@ <%= link_to t("org_admin.templates.view_all_templates"), admin_index_dmptemplate_path, :class => 'btn btn-primary' %> -
+
@@ -20,62 +20,61 @@
- +
- +
<%= render :partial => "show_phase", locals: {phase: @phase}%>
- <% if @phase.dmptemplate.org_type != t("helpers.org_type.funder") || current_user.org_type == t("helpers.org_type.funder") then %> + <% if @phase.dmptemplate.org_type != constant("organisation_types.funder") || current_user.org_type == constant("organisation_types.funder") then %> - + <%= render :partial => "versions_table", locals: {phase: @phase}%> - <%end%> - + <%end%> + - <% if @edit == "false" || (@phase.dmptemplate.org_type == t("helpers.org_type.funder") && current_user.org_type != t("helpers.org_type.funder")) then%> + <% if @edit == "false" || (@phase.dmptemplate.org_type == constant("organisation_types.funder") && current_user.org_type != constant("organisation_types.funder")) then%> <%= render :partial => 'show_version', locals: {version: @version}%> - <%elsif @edit == "true" || current_user.org_type == t("helpers.org_type.funder") then %> + <%elsif @edit == "true" || current_user.org_type == constant("organisation_types.funder") then %> <%= render :partial => 'edit_version', locals: {version: @version, edit: @edit, phase: @phase} %> - <%end%> + <%end%>
- + <% @sections.order("number ASC").each do |section| %> - <%if (@edit == "true" && section.organisation_id == current_user.organisation_id) || - (@phase.dmptemplate.org_type == t("helpers.org_type.funder") && section.organisation_id == current_user.organisation_id && current_user.org_type != t("helpers.org_type.funder"))then%> + <%if (@edit == "true" && section.organisation_id == current_user.organisation_id) || + (@phase.dmptemplate.org_type == constant("organisation_types.funder") && section.organisation_id == current_user.organisation_id && current_user.org_type != constant("organisation_types.funder"))then%> <%= render :partial => 'edit_section', locals: {section: section, edit: @edit, phase: @phase, version: @version} %> <%elsif (section.organisation_id == @phase.dmptemplate.organisation_id ) || ( section.organisation_id == current_user.organisation_id) then%> <%= render :partial => 'show_section', locals: {section: section}%> - <%end%> + <%end%> <% end %> - -
+ +
- - + + - <% if !@version.published? || (@phase.dmptemplate.org_type == t("helpers.org_type.funder") && current_user.org_type != t("helpers.org_type.funder"))then %> - + <% if !@version.published? || (@phase.dmptemplate.org_type == constant("organisation_types.funder") && current_user.org_type != constant("organisation_types.funder"))then %> + - +
- <%= link_to t('org_admin.add_section_label'),'#', :id => 'add_section_button', :class =>'btn btn-primary' %> + <%= link_to t('org_admin.add_section_label'),'#', :id => 'add_section_button', :class =>'btn btn-primary' %>
-
- <%end%> - - -<%= tinymce :content_css => asset_path('application.css') %> \ No newline at end of file + + <%end%> + + diff --git a/app/views/dmptemplates/admin_previewphase.html.erb b/app/views/dmptemplates/admin_previewphase.html.erb index 3cf5b64..12c2507 100644 --- a/app/views/dmptemplates/admin_previewphase.html.erb +++ b/app/views/dmptemplates/admin_previewphase.html.erb @@ -1,64 +1,64 @@ -<%- model_class = Phase -%> -<%= stylesheet_link_tag "admin" %> - -

- <%= @version.phase.dmptemplate.title %> - -
- <%= link_to t("org_admin.templates.back_to_edit_phase_label"), - admin_phase_dmptemplate_path(:id => @version.phase_id, :version_id => @version.id, :edit => "true"), - :class => 'btn btn-primary' %> - <%= link_to t("org_admin.templates.view_all_templates"), - admin_index_dmptemplate_path, - :class => 'btn btn-primary' %> -
-

- -
- - -<%= render :partial => "admin_nav_tabs", locals: {dmptemplate: @version.phase.dmptemplate, active: @version.phase_id} %> - - -
-
- <% sections = @version.sections %> - <% sections.order(:number).each do |section| %> - <%if (section.organisation_id == @version.phase.dmptemplate.organisation_id ) || ( section.organisation_id == current_user.organisation_id) then%> - -
- -
-
- <%= raw section.description %> -
-
- <% section.questions.order("number").each do |question| %> - <% last_question_id = section.questions.order("number DESC").first.id%> - - - <%= render :partial => 'preview_question', locals: {question: question}%> - - <% if last_question_id == question.id then %> -
- <% else %> -
- <% end %> - - <%end%> -
-
-
- <%end%> - <%end%> -
+<%- model_class = Phase -%> +<%= stylesheet_link_tag "admin" %> + +

+ <%= @version.phase.dmptemplate.title %> + +
+ <%= link_to t("org_admin.templates.back_to_edit_phase_label"), + admin_phase_dmptemplate_path(:id => @version.phase_id, :version_id => @version.id, :edit => "true"), + :class => 'btn btn-primary' %> + <%= link_to t("org_admin.templates.view_all_templates"), + admin_index_dmptemplate_path, + :class => 'btn btn-primary' %> +
+

+ +
+ + +<%= render :partial => "admin_nav_tabs", locals: {dmptemplate: @version.phase.dmptemplate, active: @version.phase_id} %> + + +
+
+ <% sections = @version.sections %> + <% sections.order(:number).each do |section| %> + <%if (section.organisation_id == @version.phase.dmptemplate.organisation_id ) || ( section.organisation_id == current_user.organisation_id) then%> + +
+ +
+
+ <%= raw section.description %> +
+
+ <% section.questions.order("number").each do |question| %> + <% last_question_id = section.questions.order("number DESC").first.id%> + + + <%= render :partial => 'preview_question', locals: {question: question}%> + + <% if last_question_id == question.id then %> +
+ <% else %> +
+ <% end %> + + <%end%> +
+
+
+ <%end%> + <%end%> +
\ No newline at end of file diff --git a/app/views/dmptemplates/admin_template.html.erb b/app/views/dmptemplates/admin_template.html.erb index 2d36206..642fb15 100644 --- a/app/views/dmptemplates/admin_template.html.erb +++ b/app/views/dmptemplates/admin_template.html.erb @@ -8,7 +8,7 @@ <%= link_to t("org_admin.templates.view_all_templates"), admin_index_dmptemplate_path, :class => 'btn btn-primary' %> -
+
@@ -19,14 +19,14 @@
- <% if @dmptemplate.org_type != t("helpers.org_type.funder") || current_user.org_type == t("helpers.org_type.funder") then %> + <% if @dmptemplate.org_type != constant("organisation_types.funder") || current_user.org_type == constant("organisation_types.funder") then %> - <%end%> +
+ <%end%>
<%= render :partial => "show_template", locals: {dmptemplate: @dmptemplate}%> -
+
<% if !@dmptemplate.phases.nil? then %> @@ -35,7 +35,7 @@ <%= render :partial => 'show_phases_sections', locals: {phase: phase}%> <%end%> - <%else%> + <%else%> <% @dmptemplate.phases.order(:number).each do |phase| %>
@@ -52,10 +52,10 @@
- - <%end%> - <%end%> - <%end%> - + + <%end%> + <%end%> + <%end%> + -<%= tinymce :content_css => asset_path('application.css') %> \ No newline at end of file +<%= tinymce :content_css => asset_path('application.css') %> diff --git a/app/views/guidance_groups/admin_edit.html.erb b/app/views/guidance_groups/admin_edit.html.erb index 88303f2..2ea27f8 100644 --- a/app/views/guidance_groups/admin_edit.html.erb +++ b/app/views/guidance_groups/admin_edit.html.erb @@ -1,97 +1,97 @@ -<%= stylesheet_link_tag "admin" %> -<% javascript 'admin.js' %> - -

- <%= t('org_admin.guidance.guidance_group_label') %> - -
- <%= link_to t("org_admin.guidance.view_all_guidance"), - admin_index_guidance_path, - :class => 'btn btn-primary' %> -
-

- -
- -
- -
- <%= form_for(@guidance_group, :url => admin_update_guidance_group_path(@guidance_group), :html => {:method => :put}) do |f| %> - - - - - - - - - - - - <% if @guidance_group.published == true then %> - - - - - <% end %> - - - - - - -
<%= t('org_admin.guidance_group.name_label') %> -
- <%= f.text_field :name, - :as => :string, - :class => 'text_field' %> - -
-
- <%= link_to(image_tag('help_button.png'), '#', :class => 'guidance_group_title_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.title_help_text_html')) %> -
-
<%= t('org_admin.guidance.template') %> -
- <% if @guidance_group.dmptemplate_ids == [] then %> - <% default_select = "" %> - <% else %> - <% default_select = @guidance_group.dmptemplate_ids %> - <% end %> - <%= f.select :dmptemplate_ids, options_for_select( - [['All templates', ""]].concat(Dmptemplate.funders_and_own_templates(current_user.organisation_id).collect { |g| [g.title, g.id] }), :selected => default_select), {}, - {:prompt => false, :multiple => true} %> -
-
- <%= link_to(image_tag('help_button.png'), '#', :class => 'guidance_group_template_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.template_help_text_html')) %> -
- -
<%= t('org_admin.templates.published_label') %> -
- <%= f.check_box :published %> -
-
- -
-
<%= t('org_admin.guidance_group.subset') %> -
- <%= f.check_box :optional_subset %> <%= t('org_admin.guidance_group.subset_eg') %> -
-
- <%= link_to(image_tag('help_button.png'), '#', :class => 'guidance_group_subset_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.subset_option_help_text')) %> -
-
- - - -
- <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> - <% if @guidance_group.published == false then %> - <%= f.submit t('helpers.submit.publish'), :name => "save_publish", :class => "btn btn-primary" %> - <% end %> - <%= link_to t('helpers.submit.cancel'), :back, :class => 'btn cancel' %> -
- -
- <% end %> -
-
+<%= stylesheet_link_tag "admin" %> +<% javascript 'admin.js' %> + +

+ <%= t('org_admin.guidance.guidance_group_label') %> + +
+ <%= link_to t("org_admin.guidance.view_all_guidance"), + admin_index_guidance_path, + :class => 'btn btn-primary' %> +
+

+ +
+ +
+ +
+ <%= form_for(@guidance_group, :url => admin_update_guidance_group_path(@guidance_group), :html => {:method => :put}) do |f| %> + + + + + + + + + + + + <% if @guidance_group.published == true then %> + + + + + <% end %> + + + + + + +
<%= t('org_admin.guidance_group.name_label') %> +
+ <%= f.text_field :name, + :as => :string, + :class => 'text_field' %> + +
+
+ <%= link_to(image_tag('help_button.png'), '#', :class => 'guidance_group_title_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.title_help_text_html')) %> +
+
<%= t('org_admin.guidance.template') %> +
+ <% if @guidance_group.dmptemplate_ids == [] then %> + <% default_select = "" %> + <% else %> + <% default_select = @guidance_group.dmptemplate_ids %> + <% end %> + <%= f.select :dmptemplate_ids, options_for_select( + [['All templates', ""]].concat(Dmptemplate.funders_and_own_templates(current_user.organisation_id).collect { |g| [g.title, g.id] }), :selected => default_select), {}, + {:prompt => false, :multiple => true} %> +
+
+ <%= link_to(image_tag('help_button.png'), '#', :class => 'guidance_group_template_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.template_help_text_html')) %> +
+ +
<%= t('org_admin.templates.published_label') %> +
+ <%= f.check_box :published %> +
+
+ +
+
<%= t('org_admin.guidance_group.subset') %> +
+ <%= f.check_box :optional_subset %> <%= t('org_admin.guidance_group.subset_eg') %> +
+
+ <%= link_to(image_tag('help_button.png'), '#', :class => 'guidance_group_subset_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.subset_option_help_text')) %> +
+
+ + + +
+ <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> + <% if @guidance_group.published == false then %> + <%= f.submit t('helpers.submit.publish'), :name => "save_publish", :class => "btn btn-primary" %> + <% end %> + <%= link_to t('helpers.submit.cancel'), :back, :class => 'btn cancel' %> +
+ +
+ <% end %> +
+
diff --git a/app/views/guidance_groups/admin_new.html.erb b/app/views/guidance_groups/admin_new.html.erb index 20b3a04..4bd3367 100644 --- a/app/views/guidance_groups/admin_new.html.erb +++ b/app/views/guidance_groups/admin_new.html.erb @@ -1,71 +1,71 @@ -<%= stylesheet_link_tag "admin" %> -<% javascript 'admin.js' %> - -

- <%= t("org_admin.guidance.guidance_group_label") %> - -
- <%= link_to t("org_admin.guidance.view_all_guidance"), - admin_index_guidance_path, - :class => "btn btn-primary" %> -
-

- -
- -
- -
- <%= form_for :guidance_group, :url => {:action => "admin_create"} do |f| %> - - - - - - - - - - - - - - - -
<%= t('org_admin.guidance_group.name_label') %>
- <%= f.text_field :name, - :as => :string, - :class => "text_field" %> -
-
- <%= link_to( image_tag("help_button.png"), "#", :class => 'guidance_group_title_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t("org_admin.guidance_group.title_help_text_html"))%> -
- -
<%= t("org_admin.guidance.template") %>
- <%= f.select :dmptemplate_ids, options_for_select( - [['All templates', ""]].concat( Dmptemplate.funders_and_own_templates(current_user.organisation_id).collect{ |g| [g.title, g.id] })),{} , - {:prompt => false , :multiple => true}%> -
-
- <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_group_template_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.template_help_text_html'))%> -
-
<%= t('org_admin.guidance_group.subset') %>
- <%= f.check_box :optional_subset %> <%= t('org_admin.guidance_group.subset_eg') %> -
-
- <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_group_subset_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.subset_option_help_text'))%> -
- -
- - - -
- <%= f.submit t("helpers.submit.save"), :name => "draft", :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.cancel"), :back, :class => "btn cancel btn-secondary" %> -
- -
- <%end%> -
-
+<%= stylesheet_link_tag "admin" %> +<% javascript 'admin.js' %> + +

+ <%= t("org_admin.guidance.guidance_group_label") %> + +
+ <%= link_to t("org_admin.guidance.view_all_guidance"), + admin_index_guidance_path, + :class => "btn btn-primary" %> +
+

+ +
+ +
+ +
+ <%= form_for :guidance_group, :url => {:action => "admin_create"} do |f| %> + + + + + + + + + + + + + + + +
<%= t('org_admin.guidance_group.name_label') %>
+ <%= f.text_field :name, + :as => :string, + :class => "text_field" %> +
+
+ <%= link_to( image_tag("help_button.png"), "#", :class => 'guidance_group_title_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t("org_admin.guidance_group.title_help_text_html"))%> +
+ +
<%= t("org_admin.guidance.template") %>
+ <%= f.select :dmptemplate_ids, options_for_select( + [['All templates', ""]].concat( Dmptemplate.funders_and_own_templates(current_user.organisation_id).collect{ |g| [g.title, g.id] })),{} , + {:prompt => false , :multiple => true}%> +
+
+ <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_group_template_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.template_help_text_html'))%> +
+
<%= t('org_admin.guidance_group.subset') %>
+ <%= f.check_box :optional_subset %> <%= t('org_admin.guidance_group.subset_eg') %> +
+
+ <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_group_subset_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance_group.subset_option_help_text'))%> +
+ +
+ + + +
+ <%= f.submit t("helpers.submit.save"), :name => "draft", :class => "btn btn-primary" %> + <%= link_to t("helpers.submit.cancel"), :back, :class => "btn cancel btn-secondary" %> +
+ +
+ <%end%> +
+
diff --git a/app/views/guidance_groups/admin_show.html.erb b/app/views/guidance_groups/admin_show.html.erb index fe641ab..a5998ec 100644 --- a/app/views/guidance_groups/admin_show.html.erb +++ b/app/views/guidance_groups/admin_show.html.erb @@ -1,92 +1,92 @@ -<%= stylesheet_link_tag "admin" %> - -

- <%= t("org_admin.guidance.guidance_group_label") %> - - -
- <%= link_to t("org_admin.guidance.view_all_guidance"), - admin_index_guidance_path, - :class => "btn btn-primary" %> -
-

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<%= t("org_admin.guidance_group.name_label") %><%= raw @guidance_group.name %>
- <% if @guidance_group.dmptemplates.count == 1 then %> - <%= t("org_admin.guidance.template") %> - <% else %> - <%= t("org_admin.guidance.templates") %> - <% end %> - - <% i = 1 %> - <% if @guidance_group.dmptemplates.count == 0 then %> - <% list = Dmptemplate.funders_and_own_templates(current_user.organisation_id) %> - <% list.each do |tem| %> - <%= tem.title %> - <% if list.count > i then %> - , - <% i +=1 %> - <% end %> - <% end %> - <% else %> - <% @guidance_group.dmptemplates.each do |tem| %> - <%= tem.title %> - <% if @guidance_group.dmptemplates.count > i then %> - , - <% i +=1 %> - <% end %> - <% end %> - <% end %> -
<%= t('org_admin.templates.published_label') %> - <% if @guidance_group.published.nil? || @guidance_group.published == false then %> - <%= t("helpers.no_label") %> - <% else %> - <%= t("helpers.yes_label") %> - <% end %> -
<%= t("org_admin.guidance_group.subset") %> - <% if @guidance_group.optional_subset.nil? || @guidance_group.optional_subset == false then %> - <%= t('helpers.no_label') %> - <% else %> - <%= t('helpers.yes_label') %> - <% end %> -
<%= t("org_admin.guidance.created") %><%= l @guidance_group.created_at.to_date, :formats => :short %>
<%= t("org_admin.guidance.last_updated") %><%= l @guidance_group.updated_at.to_date, :formats => :short %>
-
- <%= link_to t("helpers.submit.edit"), admin_edit_guidance_group_path(@guidance_group.id), :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.back"), :back, :class => "btn cancel" %> -
-
-
+<%= stylesheet_link_tag "admin" %> + +

+ <%= t("org_admin.guidance.guidance_group_label") %> + + +
+ <%= link_to t("org_admin.guidance.view_all_guidance"), + admin_index_guidance_path, + :class => "btn btn-primary" %> +
+

+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<%= t("org_admin.guidance_group.name_label") %><%= raw @guidance_group.name %>
+ <% if @guidance_group.dmptemplates.count == 1 then %> + <%= t("org_admin.guidance.template") %> + <% else %> + <%= t("org_admin.guidance.templates") %> + <% end %> + + <% i = 1 %> + <% if @guidance_group.dmptemplates.count == 0 then %> + <% list = Dmptemplate.funders_and_own_templates(current_user.organisation_id) %> + <% list.each do |tem| %> + <%= tem.title %> + <% if list.count > i then %> + , + <% i +=1 %> + <% end %> + <% end %> + <% else %> + <% @guidance_group.dmptemplates.each do |tem| %> + <%= tem.title %> + <% if @guidance_group.dmptemplates.count > i then %> + , + <% i +=1 %> + <% end %> + <% end %> + <% end %> +
<%= t('org_admin.templates.published_label') %> + <% if @guidance_group.published.nil? || @guidance_group.published == false then %> + <%= t("helpers.no_label") %> + <% else %> + <%= t("helpers.yes_label") %> + <% end %> +
<%= t("org_admin.guidance_group.subset") %> + <% if @guidance_group.optional_subset.nil? || @guidance_group.optional_subset == false then %> + <%= t('helpers.no_label') %> + <% else %> + <%= t('helpers.yes_label') %> + <% end %> +
<%= t("org_admin.guidance.created") %><%= l @guidance_group.created_at.to_date, :formats => :short %>
<%= t("org_admin.guidance.last_updated") %><%= l @guidance_group.updated_at.to_date, :formats => :short %>
+
+ <%= link_to t("helpers.submit.edit"), admin_edit_guidance_group_path(@guidance_group.id), :class => "btn btn-primary" %> + <%= link_to t("helpers.submit.back"), :back, :class => "btn cancel" %> +
+
+
\ No newline at end of file diff --git a/app/views/guidances/admin_edit.html.erb b/app/views/guidances/admin_edit.html.erb index 0f2e0c8..e6a47f9 100644 --- a/app/views/guidances/admin_edit.html.erb +++ b/app/views/guidances/admin_edit.html.erb @@ -1,157 +1,157 @@ -<%= stylesheet_link_tag "admin" %> -<% javascript 'admin.js' %> - -

- <%= t('org_admin.guidance_label') %> - -
- <%= link_to t("org_admin.guidance.add_guidance"), - admin_new_guidance_path, - :class => 'btn btn-primary' %> - <%= link_to t("org_admin.guidance.view_all_guidance"), - admin_index_guidance_path, - :class => 'btn btn-primary' %> -
-

- -
- -
- -
- <%= form_for(@guidance, :url => admin_update_guidance_path(@guidance), :html => { :method => :put , :id => 'edit_guidance_form'}) do |f| %> - - - - - - - - - - - - - - - - - - - - -
<%= t('org_admin.guidance.text_label') %>
- <%= text_area_tag("guidance-text", @guidance.text, class: "tinymce") %> -
-
- <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_text_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.text_help_text_html'))%> -
-
-
<%= t('org_admin.guidance.by_theme_or_by_question') %>
- <% if !@guidance.question_id.nil? then %> - <% select_op = 2 %> - <% else%> - <% select_op = 1%> - <%end%> - <%= hidden_field 'select_op' , :value => select_op, :id => 'edit_guid_ques_flag' %> - - <%= select_tag "g_options", options_for_select({t('org_admin.guidance.by_themes_label') => 1, - t('org_admin.guidance.by_question_label') => 2}, select_op) %> -
-
- <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_apply_to_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.apply_to_help_text_html'))%> -
-
- - - - -
<%= t('org_admin.guidance.published') %>
- <%= f.check_box :published , :as => :check_boxes%> -
-
- -
-
<%= t('org_admin.guidance.guidance_group_label') %>
- <%= f.collection_select(:guidance_group_ids, - GuidanceGroup.where("organisation_id = ?", current_user.organisation_id).order('name ASC'), - :id, :name, {:prompt => false, :include_blank => 'None'}, {:multiple => false})%> -
-
- <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_group_select_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.guidance_group_select_help_text_html'))%> -
-
- -
- - - -
- <%= t('helpers.submit.save')%> - <%= link_to t('helpers.submit.cancel'), :back, :class => 'btn cancel' %> -
- -
- <%= tinymce :content_css => asset_path('application.css') %> - <%end%> -
-
- - - - +<%= stylesheet_link_tag "admin" %> +<% javascript 'admin.js' %> + +

+ <%= t('org_admin.guidance_label') %> + +
+ <%= link_to t("org_admin.guidance.add_guidance"), + admin_new_guidance_path, + :class => 'btn btn-primary' %> + <%= link_to t("org_admin.guidance.view_all_guidance"), + admin_index_guidance_path, + :class => 'btn btn-primary' %> +
+

+ +
+ +
+ +
+ <%= form_for(@guidance, :url => admin_update_guidance_path(@guidance), :html => { :method => :put , :id => 'edit_guidance_form'}) do |f| %> + + + + + + + + + + + + + + + + + + + + +
<%= t('org_admin.guidance.text_label') %>
+ <%= text_area_tag("guidance-text", @guidance.text, class: "tinymce") %> +
+
+ <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_text_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.text_help_text_html'))%> +
+
+
<%= t('org_admin.guidance.by_theme_or_by_question') %>
+ <% if !@guidance.question_id.nil? then %> + <% select_op = 2 %> + <% else%> + <% select_op = 1%> + <%end%> + <%= hidden_field 'select_op' , :value => select_op, :id => 'edit_guid_ques_flag' %> + + <%= select_tag "g_options", options_for_select({t('org_admin.guidance.by_themes_label') => 1, + t('org_admin.guidance.by_question_label') => 2}, select_op) %> +
+
+ <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_apply_to_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.apply_to_help_text_html'))%> +
+
+ + + + +
<%= t('org_admin.guidance.published') %>
+ <%= f.check_box :published , :as => :check_boxes%> +
+
+ +
+
<%= t('org_admin.guidance.guidance_group_label') %>
+ <%= f.collection_select(:guidance_group_ids, + GuidanceGroup.where("organisation_id = ?", current_user.organisation_id).order('name ASC'), + :id, :name, {:prompt => false, :include_blank => 'None'}, {:multiple => false})%> +
+
+ <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_group_select_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.guidance_group_select_help_text_html'))%> +
+
+ +
+ + + +
+ <%= t('helpers.submit.save')%> + <%= link_to t('helpers.submit.cancel'), :back, :class => 'btn cancel' %> +
+ +
+ <%= tinymce :content_css => asset_path('application.css') %> + <%end%> +
+
+ + + + diff --git a/app/views/guidances/admin_index.html.erb b/app/views/guidances/admin_index.html.erb index 596b023..f808526 100644 --- a/app/views/guidances/admin_index.html.erb +++ b/app/views/guidances/admin_index.html.erb @@ -1,174 +1,174 @@ -<%= stylesheet_link_tag "admin" %> -<% javascript "admin.js" %> - - -

- <%= t("org_admin.guidance_group.guidance_group_list") %> -

- -
- <%= raw t("org_admin.guidance_group.guidance_group_text_html")%> -
-
-
- <%= link_to t("org_admin.guidance_group.add_guidance_group"), admin_new_guidance_group_path(), :class => "btn btn-primary" %> -
-
- - -<% if @guidance_groups.count > 0 then%> - - - - - - - - - - - - - <% !@guidance_groups.each do |guidance_gr| %> - - - <% guidance_group_temp = guidance_gr.dmptemplate_ids %> - <% if guidance_group_temp != [] then %> - - <%else%> - - <%end%> - - - - - - - - <%end%> - -
<%= t("org_admin.guidance_group.name_label") %><%= t("org_admin.guidance.template") %><%= t("org_admin.guidance.published") %><%= t("org_admin.guidance_group.subset") %><%= t("org_admin.guidance.last_updated") %><%= t("org_admin.guidance.actions") %>
- <%= guidance_gr.name %> - - <% i = 1 %> - <% guidance_group_temp.each do |t| %> - <% temp = Dmptemplate.find(t) %> - <%= temp.title %> - - <% if guidance_group_temp.count > i then%> - , - <% i +=1 %> - <% end %> - <%end%> - - <%= t("org_admin.guidance_group.all_temp")%> - - <%if guidance_gr.published.nil? || guidance_gr.published == false then%> - <%= t("helpers.no_label")%> - <%else%> - <%= t("helpers.yes_label")%> - <%end%> - - <%if guidance_gr.optional_subset.nil? || guidance_gr.optional_subset == false then%> - <%= t("helpers.no_label")%> - <%else%> - <%= t("helpers.yes_label")%> - <%end%> - - <%= l guidance_gr.updated_at.to_date, :formats => :short %> - - <%= link_to t("helpers.view"), admin_show_guidance_group_path(guidance_gr), :class => "dmp_table_link"%>
- <%= link_to t("helpers.submit.edit"), admin_edit_guidance_group_path(guidance_gr), :class => "dmp_table_link"%>
- <%= link_to t("helpers.submit.delete"), admin_destroy_guidance_group_path(guidance_gr), - :confirm => t("org_admin.guidance_group.delete_message", :guidance_group_name => guidance_gr.name ), :method => :delete, :class => "dmp_table_link"%> -
-<%end%> - -
-
- -

- <%= t("org_admin.guidance.guidance_list") %> -

- -
- <%= raw t("org_admin.guidance.guidance_text_html")%> -
-
- -
- <%= link_to t("org_admin.guidance.add_guidance"), - admin_new_guidance_path(), - :class => "btn btn-primary" %> -
-
- -
- - -<% if @guidances.count > 0 then%> - - - - - - - - - - - - - <% @guidances.each do |guidance| %> - <% if guidance.in_group_belonging_to?(current_user.organisation_id) then %> - - - <% if guidance.themes != [] then %> - - <%else%> - - <%end%> - <% if !guidance.question_id.nil? then %> - - <%else%> - - <%end%> - <% if guidance.guidance_groups != [] then %> - - <%else%> - - <%end%> - - - - <%end%> - <%end%> - -
<%= t("org_admin.guidance.text_label") %><%= t("org_admin.guidance.themes_label") %><%= t("org_admin.guidance.question_label") %><%= t("org_admin.guidance.guidance_group_label") %><%= t("org_admin.guidance.last_updated") %><%= t("org_admin.guidance.actions") %>
- <%= guidance.text.html_safe%> - - <% guidance.themes.each do |th| %> - <%= th.title %> - <%end%> - - - - - <%= raw guidance.question.text.truncate(70, omission: t('helpers.truncate_continued')) %> - - - - - <% guidance.guidance_groups.each do |p|%> - <%= p.name %> - <%end%> - - - - - <%= l guidance.updated_at.to_date, :formats => :short %> - - <%= link_to t("helpers.view"), admin_show_guidance_path(guidance), :class => "dmp_table_link"%>
- <%= link_to t("helpers.submit.edit"), admin_edit_guidance_path(guidance), :class => "dmp_table_link"%>
- <%= link_to t("helpers.submit.delete"), admin_destroy_guidance_path(guidance), - :confirm => t("org_admin.guidance.delete_message_html", :guidance_summary => truncate(sanitize(guidance.text,:tags => %w(br a)), :length => 20 , :omission => t('helpers.truncate_continued')) ), :method => :delete, :class => "dmp_table_link"%> -
-<%end%> - +<%= stylesheet_link_tag "admin" %> +<% javascript "admin.js" %> + + +

+ <%= t("org_admin.guidance_group.guidance_group_list") %> +

+ +
+ <%= raw t("org_admin.guidance_group.guidance_group_text_html")%> +
+
+
+ <%= link_to t("org_admin.guidance_group.add_guidance_group"), admin_new_guidance_group_path(), :class => "btn btn-primary" %> +
+
+ + +<% if @guidance_groups.count > 0 then%> + + + + + + + + + + + + + <% !@guidance_groups.each do |guidance_gr| %> + + + <% guidance_group_temp = guidance_gr.dmptemplate_ids %> + <% if guidance_group_temp != [] then %> + + <%else%> + + <%end%> + + + + + + + + <%end%> + +
<%= t("org_admin.guidance_group.name_label") %><%= t("org_admin.guidance.template") %><%= t("org_admin.guidance.published") %><%= t("org_admin.guidance_group.subset") %><%= t("org_admin.guidance.last_updated") %><%= t("org_admin.guidance.actions") %>
+ <%= guidance_gr.name %> + + <% i = 1 %> + <% guidance_group_temp.each do |t| %> + <% temp = Dmptemplate.find(t) %> + <%= temp.title %> + + <% if guidance_group_temp.count > i then%> + , + <% i +=1 %> + <% end %> + <%end%> + + <%= t("org_admin.guidance_group.all_temp")%> + + <%if guidance_gr.published.nil? || guidance_gr.published == false then%> + <%= t("helpers.no_label")%> + <%else%> + <%= t("helpers.yes_label")%> + <%end%> + + <%if guidance_gr.optional_subset.nil? || guidance_gr.optional_subset == false then%> + <%= t("helpers.no_label")%> + <%else%> + <%= t("helpers.yes_label")%> + <%end%> + + <%= l guidance_gr.updated_at.to_date, :formats => :short %> + + <%= link_to t("helpers.view"), admin_show_guidance_group_path(guidance_gr), :class => "dmp_table_link"%>
+ <%= link_to t("helpers.submit.edit"), admin_edit_guidance_group_path(guidance_gr), :class => "dmp_table_link"%>
+ <%= link_to t("helpers.submit.delete"), admin_destroy_guidance_group_path(guidance_gr), + :confirm => t("org_admin.guidance_group.delete_message", :guidance_group_name => guidance_gr.name ), :method => :delete, :class => "dmp_table_link"%> +
+<%end%> + +
+
+ +

+ <%= t("org_admin.guidance.guidance_list") %> +

+ +
+ <%= raw t("org_admin.guidance.guidance_text_html")%> +
+
+ +
+ <%= link_to t("org_admin.guidance.add_guidance"), + admin_new_guidance_path(), + :class => "btn btn-primary" %> +
+
+ +
+ + +<% if @guidances.count > 0 then%> + + + + + + + + + + + + + <% @guidances.each do |guidance| %> + <% if guidance.in_group_belonging_to?(current_user.organisation_id) then %> + + + <% if guidance.themes != [] then %> + + <%else%> + + <%end%> + <% if !guidance.question_id.nil? then %> + + <%else%> + + <%end%> + <% if guidance.guidance_groups != [] then %> + + <%else%> + + <%end%> + + + + <%end%> + <%end%> + +
<%= t("org_admin.guidance.text_label") %><%= t("org_admin.guidance.themes_label") %><%= t("org_admin.guidance.question_label") %><%= t("org_admin.guidance.guidance_group_label") %><%= t("org_admin.guidance.last_updated") %><%= t("org_admin.guidance.actions") %>
+ <%= guidance.text.html_safe%> + + <% guidance.themes.each do |th| %> + <%= th.title %> + <%end%> + + - + + <%= raw guidance.question.text.truncate(70, omission: t('helpers.truncate_continued')) %> + + - + + <% guidance.guidance_groups.each do |p|%> + <%= p.name %> + <%end%> + + - + + <%= l guidance.updated_at.to_date, :formats => :short %> + + <%= link_to t("helpers.view"), admin_show_guidance_path(guidance), :class => "dmp_table_link"%>
+ <%= link_to t("helpers.submit.edit"), admin_edit_guidance_path(guidance), :class => "dmp_table_link"%>
+ <%= link_to t("helpers.submit.delete"), admin_destroy_guidance_path(guidance), + :confirm => t("org_admin.guidance.delete_message_html", :guidance_summary => truncate(sanitize(guidance.text,:tags => %w(br a)), :length => 20 , :omission => t('helpers.truncate_continued')) ), :method => :delete, :class => "dmp_table_link"%> +
+<%end%> + diff --git a/app/views/guidances/admin_new.html.erb b/app/views/guidances/admin_new.html.erb index 94d90fe..9676554 100644 --- a/app/views/guidances/admin_new.html.erb +++ b/app/views/guidances/admin_new.html.erb @@ -1,127 +1,127 @@ -<%= stylesheet_link_tag "admin" %> -<% javascript 'admin.js' %> - -

- <%= t('org_admin.guidance.new_label') %> - -
- <%= link_to t("org_admin.guidance.view_all_guidance"), - admin_index_guidance_path, - :class => 'btn btn-primary' %> -
-

- -
-
- -
- <%= form_for :guidance, :url => {:action => 'admin_create'}, :html => {:id => 'new_guidance_form'} do |f| %> - - - - - - - - - - - - - - - - - -
<%= t('org_admin.guidance.text_label') %>
- <%= text_area_tag("guidance-text", "", class: "tinymce") %> -
-
- <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_text_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.text_help_text_html'))%> -
-
-
<%= t('org_admin.guidance.by_theme_or_by_question') %>
- <%= select_tag "g_options", options_for_select([[t('org_admin.guidance.by_themes_label'), 1], - [t('org_admin.guidance.by_question_label'), 2]]) %> -
-
- <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_apply_to_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.apply_to_help_text_html'))%> -
-
- - - -
<%= t('org_admin.guidance.published') %>
- <%= f.check_box :published , :as => :check_boxes%> -
-
- -
-
<%= t('org_admin.guidance.guidance_group_label') %>
- <%= f.collection_select(:guidance_group_ids, - GuidanceGroup.where("organisation_id = ?", current_user.organisation_id).order('name ASC'), - :id, :name, {:prompt => false, :include_blank => 'None'}, {:multiple => false})%> -
-
- <%= link_to( image_tag('help_button.png'), '#', :class => 'guidance_group_select_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.guidance.guidance_group_select_help_text_html'))%> -
-
- -
- - - -
- <%= t("helpers.submit.save")%> - - <%= link_to t('helpers.submit.cancel'), :back, :class => 'btn cancel' %> -
- -
- <%= tinymce :content_css => asset_path('application.css') %> - <%end%> -
-
- - - -