diff --git a/.gitignore b/.gitignore index 74254e5..67282e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,41 +1,41 @@ - -# Ignore bundler config -/.bundle - -# Ignore all logfiles, tempfiles, public assets, -/log/*.log -/tmp -public/assets/* -public/apidocs/* - -# Ignore gemfile.lock -Gemfile.lock - -# Ignore db schema.rb -# db/schema.rb - -# Ignore database configuration and token secrets -config/database.yml -config/secrets.yml - -# Ignore some of the initializers -config/initializers/recaptcha.rb -config/initializers/devise.rb -config/initializers/contact_us.rb - -# Ignore enviroments settings -config/environments/development.rb -config/environments/production.rb -config/environments/test.rb - -config/initializers/contact_us.rb - -# ignore IDE files -.idea/* - -# ignore yard doc files -.yardoc/* - -# ignore yard generated documents -/doc/* + +# Ignore bundler config +/.bundle + +# Ignore all logfiles, tempfiles, public assets, +/log/*.log +/tmp +public/assets/* +public/apidocs/* + +# Ignore gemfile.lock +Gemfile.lock + +# Ignore db schema.rb +# db/schema.rb + +# Ignore database configuration and token secrets +config/database.yml +config/secrets.yml + +# Ignore some of the initializers +config/initializers/recaptcha.rb +config/initializers/devise.rb +config/initializers/contact_us.rb + +# Ignore enviroments settings +config/environments/development.rb +config/environments/production.rb +config/environments/test.rb + +config/initializers/contact_us.rb + +# ignore IDE files +.idea/* + +# ignore yard doc files +.yardoc/* + +# ignore yard generated documents +/doc/* !/doc/README_FOR_APP \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index ff8c728..104c6cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,15 @@ -language: ruby -rvm: - - 2.1.10 - -services: - - mysql - -before_script: - - cp config/database_example.yml config/database.yml - - cp config/secrets_example.yml config/secrets.yml - - mysql -e 'create database IF NOT EXISTS roadmap_test;' -uroot - -script: - - bundle exec rake db:test:prepare - - bundle exec rake +language: ruby +rvm: + - 2.1.10 + +services: + - mysql + +before_script: + - cp config/database_example.yml config/database.yml + - cp config/secrets_example.yml config/secrets.yml + - mysql -e 'create database IF NOT EXISTS roadmap_test;' -uroot + +script: + - bundle exec rake db:test:prepare + - bundle exec rake 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/Rakefile b/Rakefile index 0d74091..757e6a8 100755 --- a/Rakefile +++ b/Rakefile @@ -1,21 +1,21 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require 'rake/testtask' -require File.expand_path('../config/application', __FILE__) - -DMPonline4::Application.load_tasks - -# TODO: destroy rdoc rake task once finished with new documentation - -RDoc::Task.new :rdoc do |rdoc| - rdoc.main = "README.rdoc" - - rdoc.rdoc_files.include("README.rdoc", "doc/*.rdoc", "app/**/*.rb", "lib/*.rb", "config/**/*.rb") - #change above to fit needs - - rdoc.title = "DMPonline4 Documentation" - rdoc.options << "--all" -end - -task default: :test +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. +require 'rake/testtask' +require File.expand_path('../config/application', __FILE__) + +DMPonline4::Application.load_tasks + +# TODO: destroy rdoc rake task once finished with new documentation + +RDoc::Task.new :rdoc do |rdoc| + rdoc.main = "README.rdoc" + + rdoc.rdoc_files.include("README.rdoc", "doc/*.rdoc", "app/**/*.rb", "lib/*.rb", "config/**/*.rb") + #change above to fit needs + + rdoc.title = "DMPonline4 Documentation" + rdoc.options << "--all" +end + +task default: :test diff --git a/app/admin/dashboard.rb b/app/admin/dashboard.rb index 30e55c2..8b1c9bb 100644 --- a/app/admin/dashboard.rb +++ b/app/admin/dashboard.rb @@ -1,39 +1,39 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Copyright:+] Digital Curation Centre - - -ActiveAdmin.register_page "Dashboard" do - - menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") } - - content title: proc{ I18n.t("active_admin.dashboard") } do - #div class: "blank_slate_container", id: "dashboard_default_message" do - # span class: "blank_slate" do - # span I18n.t("active_admin.dashboard_welcome.welcome") - # small I18n.t("active_admin.dashboard_welcome.call_to_action") - # end - #end - - # Here is an example of a simple dashboard with columns and panels. - # - # columns do - # column do - # panel "Recent Posts" do - # ul do - # Post.recent(5).map do |post| - # li link_to(post.title, admin_post_path(post)) - # end - # end - # end - # end - - # column do - # panel "Info" do - # para "Welcome to ActiveAdmin." - # end - # end - # end - end # content +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Copyright:+] Digital Curation Centre + + +ActiveAdmin.register_page "Dashboard" do + + menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") } + + content title: proc{ I18n.t("active_admin.dashboard") } do + #div class: "blank_slate_container", id: "dashboard_default_message" do + # span class: "blank_slate" do + # span I18n.t("active_admin.dashboard_welcome.welcome") + # small I18n.t("active_admin.dashboard_welcome.call_to_action") + # end + #end + + # Here is an example of a simple dashboard with columns and panels. + # + # columns do + # column do + # panel "Recent Posts" do + # ul do + # Post.recent(5).map do |post| + # li link_to(post.title, admin_post_path(post)) + # end + # end + # end + # end + + # column do + # panel "Info" do + # para "Welcome to ActiveAdmin." + # end + # end + # end + end # content end \ No newline at end of file diff --git a/app/admin/guidance.rb b/app/admin/guidance.rb index 753fd07..53c8049 100644 --- a/app/admin/guidance.rb +++ b/app/admin/guidance.rb @@ -1,81 +1,81 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Guidance do - permit_params :text, :guidance_group_id, :question_id - - menu :priority => 13, :label => proc{ I18n.t('admin.guidance')}, :parent => "Guidance list" - - index do - column (:text) { |guidance| raw(guidance.text) } - column I18n.t('admin.theme') do |t| - (t.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - - column I18n.t('admin.question'), :sortable => :question_id do |que| - if !que.nil? then - que.question - else - '-' - end - end - - column I18n.t('admin.guidance_group') do |guidance| - (guidance.guidance_groups.map{|t_q| link_to t_q.name, [:admin, t_q]}).join(', ').html_safe - end - actions - end - - #show details of a question - show do - attributes_table do - row (:text) { |guidance| raw(guidance.text) } - - row I18n.t('admin.theme') do - (guidance.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - row I18n.t('admin.question'), :question_id do |question| - question.question - end - row I18n.t('admin.guidance_group') do |guidance| - (guidance.guidance_groups.map{|t_q| link_to t_q.name, [:admin, t_q]}).join(', ').html_safe - end - - row :created_at - row :updated_at - end - end - - #form - form do |f| - f.inputs "Details" do - f.input :text - f.input :question_id, :as => :select, - :collection => Question.order('text').map{|que|[que.text, que.id]} - f.input :guidance_group_ids, :label => I18n.t('admin.guidance_group'), - :as => :select, - :collection => GuidanceGroup.order('name').map{|gui|[gui.name, gui.id]} - - end - f.inputs "Themes" do - f.input :theme_ids, :label => I18n.t('admin.selected_themes'), - :as => :select, - :include_blank => I18n.t('admin.all_themes'), - :multiple => true, - :collection => Theme.order('title').map{|the| [the.title, the.id]}, - :hint => I18n.t('admin.choose_themes') - end - - f.actions - end - - controller do - def permitted_params - params.permit! - end - end - -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Guidance do + permit_params :text, :guidance_group_id, :question_id + + menu :priority => 13, :label => proc{ I18n.t('admin.guidance')}, :parent => "Guidance list" + + index do + column (:text) { |guidance| raw(guidance.text) } + column I18n.t('admin.theme') do |t| + (t.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe + end + + column I18n.t('admin.question'), :sortable => :question_id do |que| + if !que.nil? then + que.question + else + '-' + end + end + + column I18n.t('admin.guidance_group') do |guidance| + (guidance.guidance_groups.map{|t_q| link_to t_q.name, [:admin, t_q]}).join(', ').html_safe + end + actions + end + + #show details of a question + show do + attributes_table do + row (:text) { |guidance| raw(guidance.text) } + + row I18n.t('admin.theme') do + (guidance.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe + end + row I18n.t('admin.question'), :question_id do |question| + question.question + end + row I18n.t('admin.guidance_group') do |guidance| + (guidance.guidance_groups.map{|t_q| link_to t_q.name, [:admin, t_q]}).join(', ').html_safe + end + + row :created_at + row :updated_at + end + end + + #form + form do |f| + f.inputs "Details" do + f.input :text + f.input :question_id, :as => :select, + :collection => Question.order('text').map{|que|[que.text, que.id]} + f.input :guidance_group_ids, :label => I18n.t('admin.guidance_group'), + :as => :select, + :collection => GuidanceGroup.order('name').map{|gui|[gui.name, gui.id]} + + end + f.inputs "Themes" do + f.input :theme_ids, :label => I18n.t('admin.selected_themes'), + :as => :select, + :include_blank => I18n.t('admin.all_themes'), + :multiple => true, + :collection => Theme.order('title').map{|the| [the.title, the.id]}, + :hint => I18n.t('admin.choose_themes') + end + + f.actions + end + + controller do + def permitted_params + params.permit! + end + end + +end diff --git a/app/admin/guidance_group.rb b/app/admin/guidance_group.rb index 5a54831..639792d 100644 --- a/app/admin/guidance_group.rb +++ b/app/admin/guidance_group.rb @@ -1,80 +1,80 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register GuidanceGroup do - permit_params :organisation_id, :name, :published, :optional_subset - - menu :priority => 2, :label => proc{I18n.t('admin.guidance_group')}, :parent => "Guidance list" - - index do - column I18n.t('admin.name'), :sortable => :name do |ggn| - link_to ggn.name, [:admin, ggn] - end - column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - column I18n.t('admin.template') do |t| - (t.dmptemplates.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - - actions - end - - #show details of guidance group - show do - attributes_table do - row :name - row :organisation_id do |org_title| - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - row I18n.t('admin.template') do - (guidance_group.dmptemplates.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - row :created_at - row :updated_at - end - end - - #guidance list - sidebar I18n.t('admin.guidance'), :only => :show, :if => proc { guidance_group.guidances.count >= 1} do - table_for guidance_group.guidances.order("text asc") do |guis| - column :text do |gtext| - link_to gtext.text.html_safe, [:admin, gtext] - end - column I18n.t('admin.theme') do |themelist| - (themelist.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - end - end - - #form - form do |f| - f.inputs "Details" do - f.input :name - f.input :organisation_id, :label => I18n.t('admin.org_title'), - :as => :select, - :collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :published - f.input :optional_subset - end - - f.inputs "Templates" do - f.input :dmptemplate_ids, :label => I18n.t('admin.selected_templates'), - :as => :select, - :include_blank => I18n.t('admin.all_templates'), - :multiple => true, - :collection => Dmptemplate.order('title').map{|the| [the.title, the.id]}, - :hint => I18n.t('admin.choose_templates') - end - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register GuidanceGroup do + permit_params :organisation_id, :name, :published, :optional_subset + + menu :priority => 2, :label => proc{I18n.t('admin.guidance_group')}, :parent => "Guidance list" + + index do + column I18n.t('admin.name'), :sortable => :name do |ggn| + link_to ggn.name, [:admin, ggn] + end + column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| + link_to org_title.organisation.name, [:admin, org_title.organisation] + end + column I18n.t('admin.template') do |t| + (t.dmptemplates.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe + end + + actions + end + + #show details of guidance group + show do + attributes_table do + row :name + row :organisation_id do |org_title| + link_to org_title.organisation.name, [:admin, org_title.organisation] + end + row I18n.t('admin.template') do + (guidance_group.dmptemplates.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe + end + row :created_at + row :updated_at + end + end + + #guidance list + sidebar I18n.t('admin.guidance'), :only => :show, :if => proc { guidance_group.guidances.count >= 1} do + table_for guidance_group.guidances.order("text asc") do |guis| + column :text do |gtext| + link_to gtext.text.html_safe, [:admin, gtext] + end + column I18n.t('admin.theme') do |themelist| + (themelist.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe + end + end + end + + #form + form do |f| + f.inputs "Details" do + f.input :name + f.input :organisation_id, :label => I18n.t('admin.org_title'), + :as => :select, + :collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]} + f.input :published + f.input :optional_subset + end + + f.inputs "Templates" do + f.input :dmptemplate_ids, :label => I18n.t('admin.selected_templates'), + :as => :select, + :include_blank => I18n.t('admin.all_templates'), + :multiple => true, + :collection => Dmptemplate.order('title').map{|the| [the.title, the.id]}, + :hint => I18n.t('admin.choose_templates') + end + f.actions + end + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/option.rb b/app/admin/option.rb index c7553e8..5cc1fbb 100644 --- a/app/admin/option.rb +++ b/app/admin/option.rb @@ -1,79 +1,79 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Option do - permit_params :question_id, :text, :number, :is_default - menu :priority => 6, :label => proc{I18n.t('admin.multi_options')}, :parent => "Templates management" - - index do - column :text - column I18n.t('admin.questions'), :sortable => :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.text, [:admin, ques.question] - end - end - column I18n.t('admin.sections'), :sortable => :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.section.title, [:admin, ques.question.section] - end - end - column I18n.t('admin.template'), :sortable => :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.section.version.phase.dmptemplate.title, [:admin, ques.question.section.version.phase.dmptemplate] - end - end - - actions - end - - #show details of a section - show do - attributes_table do - row :text - row :number - row I18n.t('admin.questions'), :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.text, [:admin, ques.question] - end - end - row I18n.t('admin.sections'), :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.section.title, [:admin, ques.question.section] - end - end - row I18n.t('admin.template'), :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.section.version.phase.dmptemplate.title, [:admin, ques.question.section.version.phase.dmptemplate] - end - end - row :is_default - row :created_at - row :updated_at - end - end - - - #form - form do |f| - f.inputs "Details" do - f.input :text - f.input :number - f.input :question, - :as => :select, - :collection => Question.order('text').map{ |sec| ["#{truncate(sec.section.version.phase.dmptemplate.title, :lengh => 20)} - #{truncate(sec.section.title, :lengh => 50)} - #{truncate(sec.text, :lengh => 20)}", sec.id] } - f.input :is_default - end - - f.actions - end - - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Option do + permit_params :question_id, :text, :number, :is_default + menu :priority => 6, :label => proc{I18n.t('admin.multi_options')}, :parent => "Templates management" + + index do + column :text + column I18n.t('admin.questions'), :sortable => :question_id do |ques| + if !ques.question_id.nil? then + link_to ques.question.text, [:admin, ques.question] + end + end + column I18n.t('admin.sections'), :sortable => :question_id do |ques| + if !ques.question_id.nil? then + link_to ques.question.section.title, [:admin, ques.question.section] + end + end + column I18n.t('admin.template'), :sortable => :question_id do |ques| + if !ques.question_id.nil? then + link_to ques.question.section.version.phase.dmptemplate.title, [:admin, ques.question.section.version.phase.dmptemplate] + end + end + + actions + end + + #show details of a section + show do + attributes_table do + row :text + row :number + row I18n.t('admin.questions'), :question_id do |ques| + if !ques.question_id.nil? then + link_to ques.question.text, [:admin, ques.question] + end + end + row I18n.t('admin.sections'), :question_id do |ques| + if !ques.question_id.nil? then + link_to ques.question.section.title, [:admin, ques.question.section] + end + end + row I18n.t('admin.template'), :question_id do |ques| + if !ques.question_id.nil? then + link_to ques.question.section.version.phase.dmptemplate.title, [:admin, ques.question.section.version.phase.dmptemplate] + end + end + row :is_default + row :created_at + row :updated_at + end + end + + + #form + form do |f| + f.inputs "Details" do + f.input :text + f.input :number + f.input :question, + :as => :select, + :collection => Question.order('text').map{ |sec| ["#{truncate(sec.section.version.phase.dmptemplate.title, :lengh => 20)} - #{truncate(sec.section.title, :lengh => 50)} - #{truncate(sec.text, :lengh => 20)}", sec.id] } + f.input :is_default + end + + f.actions + end + + + controller do + def permitted_params + params.permit! + end + end +end 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/organisation.rb b/app/admin/organisation.rb index 2c88380..15eeb31 100644 --- a/app/admin/organisation.rb +++ b/app/admin/organisation.rb @@ -1,125 +1,125 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Organisation do - permit_params :abbreviation, :banner_file_id, :description, :domain, :logo_file_id, :name, :stylesheet_file_id, :target_url, :organisation_type_id, :wayfless_entity, :parent_id - - menu :priority => 14, :label => proc{I18n.t('admin.org')}, :parent => "Organisations management" - - index do - column I18n.t('admin.org_title'), :sortable => :name do |ggn| - link_to ggn.name, [:admin, ggn] - end - column I18n.t('admin.abbrev'), :sortable => :abbreviation do |ggn| - if !ggn.abbreviation.nil? - link_to ggn.abbreviation, [:admin, ggn] - else - '-' - end - end - column I18n.t('admin.org_type'), :sortable => :organisation_type_id do |org_type| - if !org_type.organisation_type_id.nil? then - link_to org_type.organisation_type.name, [:admin, org_type] - end - end - - actions - end - - - #show details of an organisation - show do - resource.check_api_credentials - attributes_table do - row I18n.t('admin.org_title'), :sortable => :name do |gn| - if !gn.name.nil? then - link_to gn.name, [:admin, gn] - end - end - row I18n.t('admin.abbrev'), :abbreviation do |ggn| - if !ggn.abbreviation.nil? - link_to ggn.abbreviation, [:admin, ggn] - else - '-' - end - end - row :sort_name - row I18n.t('admin.org_type'), :organisation_type_id do |org_type| - if !org_type.organisation_type_id.nil? then - link_to org_type.organisation_type.name, [:admin, org_type] - end - end - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row :banner_text do |banner| - if !banner.banner_text.nil? then - banner.banner_text.html_safe - end - end - # row :target_url - row :logo_file_name - row :domain - row :wayfless_entity - row I18n.t('admin.token_permission_type') do - (organisation.token_permission_types.map{|tpt| link_to tpt.token_type, [:admin, tpt]}).join(', ').html_safe - end - # row I18n.t('admin.org_parent'), :parent_id do |org_parent| - # if !org_parent.parent_id.nil? then - # parent_org = Organisation.find(org_parent.parent_id) - # link_to parent_org.name, [:admin, parent_org] - # end - # end - # row :stylesheet_file_id - row :created_at - row :updated_at - end - end - - #templates sidebar - sidebar I18n.t('admin.templates'), :only => :show, :if => proc { organisation.dmptemplates.count >= 1} do - table_for organisation.dmptemplates.order("title asc") do |temp| - column :title do |dmptemp| - link_to dmptemp.title, [:admin, dmptemp] - end - column :published - end - end - - #form - form do |f| - f.inputs "Details" do - f.input :name - f.input :abbreviation - f.input :sort_name - f.input :description - f.input :organisation_type_id, :label => I18n.t('admin.org_type'), :as => :select, :collection => OrganisationType.order('name').map{|orgt|[orgt.name, orgt.id]} - # f.input :target_url - f.input :banner_text - f.input :logo_file_name - f.input :domain - f.input :wayfless_entity - f.input :token_permission_types, label: I18n.t('admin.token_permission_type'), - as: :select, multiple: true, include_blank: I18n.t('helpers.none'), - collection: TokenPermissionType.order(:token_type).map{|token| [token.token_type, token.id]}, - hint: I18n.t('admin.choose_api_permissions') - # f.input :parent_id, :label => I18n.t('admin.org_parent'), :as => :select, :collection => Organisation.find(:all, :order => 'name ASC').map{|orgp|[orgp.name, orgp.id]} - # f.input :stylesheet_file_id - end - f.actions - end - - - controller do - def permitted_params - params.permit! - end - end - - -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Organisation do + permit_params :abbreviation, :banner_file_id, :description, :domain, :logo_file_id, :name, :stylesheet_file_id, :target_url, :organisation_type_id, :wayfless_entity, :parent_id + + menu :priority => 14, :label => proc{I18n.t('admin.org')}, :parent => "Organisations management" + + index do + column I18n.t('admin.org_title'), :sortable => :name do |ggn| + link_to ggn.name, [:admin, ggn] + end + column I18n.t('admin.abbrev'), :sortable => :abbreviation do |ggn| + if !ggn.abbreviation.nil? + link_to ggn.abbreviation, [:admin, ggn] + else + '-' + end + end + column I18n.t('admin.org_type'), :sortable => :organisation_type_id do |org_type| + if !org_type.organisation_type_id.nil? then + link_to org_type.organisation_type.name, [:admin, org_type] + end + end + + actions + end + + + #show details of an organisation + show do + resource.check_api_credentials + attributes_table do + row I18n.t('admin.org_title'), :sortable => :name do |gn| + if !gn.name.nil? then + link_to gn.name, [:admin, gn] + end + end + row I18n.t('admin.abbrev'), :abbreviation do |ggn| + if !ggn.abbreviation.nil? + link_to ggn.abbreviation, [:admin, ggn] + else + '-' + end + end + row :sort_name + row I18n.t('admin.org_type'), :organisation_type_id do |org_type| + if !org_type.organisation_type_id.nil? then + link_to org_type.organisation_type.name, [:admin, org_type] + end + end + row :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + row :banner_text do |banner| + if !banner.banner_text.nil? then + banner.banner_text.html_safe + end + end + # row :target_url + row :logo_file_name + row :domain + row :wayfless_entity + row I18n.t('admin.token_permission_type') do + (organisation.token_permission_types.map{|tpt| link_to tpt.token_type, [:admin, tpt]}).join(', ').html_safe + end + # row I18n.t('admin.org_parent'), :parent_id do |org_parent| + # if !org_parent.parent_id.nil? then + # parent_org = Organisation.find(org_parent.parent_id) + # link_to parent_org.name, [:admin, parent_org] + # end + # end + # row :stylesheet_file_id + row :created_at + row :updated_at + end + end + + #templates sidebar + sidebar I18n.t('admin.templates'), :only => :show, :if => proc { organisation.dmptemplates.count >= 1} do + table_for organisation.dmptemplates.order("title asc") do |temp| + column :title do |dmptemp| + link_to dmptemp.title, [:admin, dmptemp] + end + column :published + end + end + + #form + form do |f| + f.inputs "Details" do + f.input :name + f.input :abbreviation + f.input :sort_name + f.input :description + f.input :organisation_type_id, :label => I18n.t('admin.org_type'), :as => :select, :collection => OrganisationType.order('name').map{|orgt|[orgt.name, orgt.id]} + # f.input :target_url + f.input :banner_text + f.input :logo_file_name + f.input :domain + f.input :wayfless_entity + f.input :token_permission_types, label: I18n.t('admin.token_permission_type'), + as: :select, multiple: true, include_blank: I18n.t('helpers.none'), + collection: TokenPermissionType.order(:token_type).map{|token| [token.token_type, token.id]}, + hint: I18n.t('admin.choose_api_permissions') + # f.input :parent_id, :label => I18n.t('admin.org_parent'), :as => :select, :collection => Organisation.find(:all, :order => 'name ASC').map{|orgp|[orgp.name, orgp.id]} + # f.input :stylesheet_file_id + end + f.actions + end + + + controller do + def permitted_params + params.permit! + end + end + + +end diff --git a/app/admin/organisation_type.rb b/app/admin/organisation_type.rb index 2c9c4de..74b0813 100644 --- a/app/admin/organisation_type.rb +++ b/app/admin/organisation_type.rb @@ -1,55 +1,55 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register OrganisationType do - permit_params :organisation_id, :name - - menu :priority => 4, :label => proc{I18n.t('admin.org_type')}, :parent => "Organisations management" - - index do - column I18n.t('admin.title'), :sortable => :name do |ggn| - link_to ggn.name, [:admin, ggn] - end - column I18n.t('admin.desc'), :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - - actions - end - - - #show organisation type details - show do - attributes_table do - row :name - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row :created_at - row :updated_at - end - end - - #organisations sidebar - sidebar I18n.t('admin.orgs'), :only => :show, :if => proc { organisation_type.organisations.count >= 1} do - table_for organisation_type.organisations.order("name") do |org_list| - column I18n.t('admin.org_title'), :sortable => :name do |ggn| - link_to ggn.name, [:admin, ggn] - end - end - end - - controller do - def permitted_params - params.permit! - end - end - -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register OrganisationType do + permit_params :organisation_id, :name + + menu :priority => 4, :label => proc{I18n.t('admin.org_type')}, :parent => "Organisations management" + + index do + column I18n.t('admin.title'), :sortable => :name do |ggn| + link_to ggn.name, [:admin, ggn] + end + column I18n.t('admin.desc'), :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + + actions + end + + + #show organisation type details + show do + attributes_table do + row :name + row :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + row :created_at + row :updated_at + end + end + + #organisations sidebar + sidebar I18n.t('admin.orgs'), :only => :show, :if => proc { organisation_type.organisations.count >= 1} do + table_for organisation_type.organisations.order("name") do |org_list| + column I18n.t('admin.org_title'), :sortable => :name do |ggn| + link_to ggn.name, [:admin, ggn] + end + end + end + + controller do + def permitted_params + params.permit! + end + end + +end diff --git a/app/admin/phase.rb b/app/admin/phase.rb index 0da6ca1..59ec07a 100644 --- a/app/admin/phase.rb +++ b/app/admin/phase.rb @@ -1,83 +1,83 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Phase do - permit_params :description, :number, :title, :dmptemplate_id - - menu :priority => 10, :label => proc{I18n.t('admin.phase')}, :parent => "Templates management" - - index do - column :title, :sortable => :title do |ph| - if !ph.title.nil? then - link_to ph.title, [:admin, ph] - end - end - column :number - column I18n.t('admin.template'), :sortable => :dmptemplate_id do |temp_title| - if !temp_title.nil? then - if !temp_title.dmptemplate.nil? then - link_to temp_title.dmptemplate.title, [:admin, temp_title.dmptemplate] - else - "-" - end - end - end - - actions - end - - #show details of a phase - show do - attributes_table do - row :title - row :number - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row I18n.t('admin.template'), :sortable => :dmptemplate_id do |temp_title| - link_to temp_title.dmptemplate.title, [:admin, temp_title.dmptemplate] - end - row :created_at - row :updated_at - end - - end - - #versions sidebar - sidebar I18n.t('admin.version'), :only => :show, :if => proc { phase.versions.count >= 1} do - table_for phase.versions.order("number asc") do |temp_phases| - column :number - column :title do |row| - link_to row.title, [:admin, row] - end - column :published - end - end - - - #form - form do |f| - f.inputs "Details" do - f.input :title - f.input :number - f.input :description - f.input :dmptemplate_id, :label => I18n.t('admin.template'), - :as => :select, - :collection => Dmptemplate.order('title').map{|temp|[temp.title, temp.id]} - - end - f.actions - end - - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Phase do + permit_params :description, :number, :title, :dmptemplate_id + + menu :priority => 10, :label => proc{I18n.t('admin.phase')}, :parent => "Templates management" + + index do + column :title, :sortable => :title do |ph| + if !ph.title.nil? then + link_to ph.title, [:admin, ph] + end + end + column :number + column I18n.t('admin.template'), :sortable => :dmptemplate_id do |temp_title| + if !temp_title.nil? then + if !temp_title.dmptemplate.nil? then + link_to temp_title.dmptemplate.title, [:admin, temp_title.dmptemplate] + else + "-" + end + end + end + + actions + end + + #show details of a phase + show do + attributes_table do + row :title + row :number + row :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + row I18n.t('admin.template'), :sortable => :dmptemplate_id do |temp_title| + link_to temp_title.dmptemplate.title, [:admin, temp_title.dmptemplate] + end + row :created_at + row :updated_at + end + + end + + #versions sidebar + sidebar I18n.t('admin.version'), :only => :show, :if => proc { phase.versions.count >= 1} do + table_for phase.versions.order("number asc") do |temp_phases| + column :number + column :title do |row| + link_to row.title, [:admin, row] + end + column :published + end + end + + + #form + form do |f| + f.inputs "Details" do + f.input :title + f.input :number + f.input :description + f.input :dmptemplate_id, :label => I18n.t('admin.template'), + :as => :select, + :collection => Dmptemplate.order('title').map{|temp|[temp.title, temp.id]} + + end + f.actions + end + + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/project.rb b/app/admin/project.rb index b410c71..816911d 100644 --- a/app/admin/project.rb +++ b/app/admin/project.rb @@ -1,39 +1,39 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Project do - permit_params :dmptemplate_id, :title, :organisation_id, :unit_id, :guidance_group_ids, :project_group_ids, :funder_id, :institution_id, :grant_number,:identifier, :description, :principal_investigator, :principal_investigator_identifier, :data_contact - - menu :priority => 25, :label => proc{I18n.t('admin.plans')} - - - index do - column :title - column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - if !org_title.organisation.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - else - '-' - end - end - column I18n.t('admin.template_title'), :sortable => :dmptemplate_id do |dmptemp| - if !dmptemp.dmptemplate.nil? then - link_to dmptemp.dmptemplate.title, [:admin, dmptemp.dmptemplate] - else - '-' - end - end - - actions - end - - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Project do + permit_params :dmptemplate_id, :title, :organisation_id, :unit_id, :guidance_group_ids, :project_group_ids, :funder_id, :institution_id, :grant_number,:identifier, :description, :principal_investigator, :principal_investigator_identifier, :data_contact + + menu :priority => 25, :label => proc{I18n.t('admin.plans')} + + + index do + column :title + column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| + if !org_title.organisation.nil? then + link_to org_title.organisation.name, [:admin, org_title.organisation] + else + '-' + end + end + column I18n.t('admin.template_title'), :sortable => :dmptemplate_id do |dmptemp| + if !dmptemp.dmptemplate.nil? then + link_to dmptemp.dmptemplate.title, [:admin, dmptemp.dmptemplate] + else + '-' + end + end + + actions + end + + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/project_group.rb b/app/admin/project_group.rb index 2ec7a0c..62f63d0 100644 --- a/app/admin/project_group.rb +++ b/app/admin/project_group.rb @@ -1,9 +1,9 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register ProjectGroup do - menu false -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register ProjectGroup do + menu false +end diff --git a/app/admin/question.rb b/app/admin/question.rb index f301e60..f15df75 100644 --- a/app/admin/question.rb +++ b/app/admin/question.rb @@ -1,131 +1,131 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Question do - permit_params :default_value, :dependency_id, :dependency_text, :guidance, :number, :parent_id, :suggested_answer, :text, :question_type, :section_id - - menu :priority => 7, :label => proc{I18n.t('admin.question')}, :parent => "Templates management" - - index do - column I18n.t('admin.question'), :sortable => :text do |descr| - if !descr.text.nil? then - descr.text.html_safe - end - end - column I18n.t('admin.section_title'), :sortable => :section_id do |dmptemplate| - if !dmptemplate.section_id.nil? then - link_to dmptemplate.section.title, [:admin, dmptemplate.section] - end - end - column :number, :sortable => :number do |question_n| - if !question_n.number.nil? then - question_n.number - end - end - column I18n.t('admin.template_title'), :sortable => true do |dmptemplate| - if !dmptemplate.section_id.nil? then - if !dmptemplate.section.version.phase.dmptemplate.nil? then - link_to dmptemplate.section.version.phase.dmptemplate.title, [:admin, dmptemplate.section.version.phase.dmptemplate] - else - "-" - end - end - end - actions - end - - - #show details of a question - show do - attributes_table do - row :text do |descr| - if !descr.text.nil? then - descr.text.html_safe - end - end - row :section_id do |question| - link_to question.section.title, [:admin, question.section] - end - row :number - row :default_value - row I18n.t('admin.question_format') do |format| - link_to format.question_format.title, [:admin, format.question_format] - end - #row :guidance do |qguidance| - # if !qguidance.guidance.nil? then - # qguidance.guidance.html_safe - # end - #end - #row :parent_id do |qparent| - # if !qparent.parent_id.nil? then - # parent_q = Question.where('id = ?', qparent.parent_id) - # link_to parent_q.text, [:admin, parent_q] - # end - #end - #row :dependency_id do |qdepend| - # if !qdepend.dependency_id.nil? then - # qdep = Question.where('id = ?', qparent.dependency_id) - # link_to qdep.text, [:admin, qdep] - # end - #end - #row :dependency_text do |dep_text| - # if !dep_text.dependency_text.nil? then - # dep_text.dependency_text.html_safe - # end - #end - row I18n.t('admin.themes') do - (question.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - row :created_at - row :updated_at - - end - end - - - #form - form do |f| - f.inputs "Details" do - f.input :text - f.input :number - f.input :section, - :as => :select, - :collection => Section.order('title').map{ |sec| ["#{sec.version.phase.dmptemplate.title} - #{sec.title}", sec.id] } - f.input :default_value - # f.input :guidance - # f.input :parent_id, :label => "Parent", - # :as => :select, - # :collection => Question.find(:all, :order => 'text ASC').map{|que|[que.text, que.id]} - #f.input :dependency_id, :label => "Dependency question", - # :as => :select, - # :collection => Question.find(:all, :order => 'text ASC').map{|que|[que.text, que.id]} - # f.input :dependency_text - - end - f.inputs "Question Format" do - f.input :question_format_id, :label => I18n.t('admin.select_question_format'), - :as => :select, - :collection => QuestionFormat.order('title').map{|format| [format.title, format.id]} - end - f.inputs "Themes" do - f.input :theme_ids, :label => I18n.t('admin.selected_themes'), - :as => :select, - :multiple => true, - :include_blank => I18n.t('helpers.none'), - :collection => Theme.order('title').map{|the| [the.title, the.id]} , - :hint => I18n.t('admin.choose_themes') - - end - f.actions - end - - controller do - def permitted_params - params.permit! - end - end - -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Question do + permit_params :default_value, :dependency_id, :dependency_text, :guidance, :number, :parent_id, :suggested_answer, :text, :question_type, :section_id + + menu :priority => 7, :label => proc{I18n.t('admin.question')}, :parent => "Templates management" + + index do + column I18n.t('admin.question'), :sortable => :text do |descr| + if !descr.text.nil? then + descr.text.html_safe + end + end + column I18n.t('admin.section_title'), :sortable => :section_id do |dmptemplate| + if !dmptemplate.section_id.nil? then + link_to dmptemplate.section.title, [:admin, dmptemplate.section] + end + end + column :number, :sortable => :number do |question_n| + if !question_n.number.nil? then + question_n.number + end + end + column I18n.t('admin.template_title'), :sortable => true do |dmptemplate| + if !dmptemplate.section_id.nil? then + if !dmptemplate.section.version.phase.dmptemplate.nil? then + link_to dmptemplate.section.version.phase.dmptemplate.title, [:admin, dmptemplate.section.version.phase.dmptemplate] + else + "-" + end + end + end + actions + end + + + #show details of a question + show do + attributes_table do + row :text do |descr| + if !descr.text.nil? then + descr.text.html_safe + end + end + row :section_id do |question| + link_to question.section.title, [:admin, question.section] + end + row :number + row :default_value + row I18n.t('admin.question_format') do |format| + link_to format.question_format.title, [:admin, format.question_format] + end + #row :guidance do |qguidance| + # if !qguidance.guidance.nil? then + # qguidance.guidance.html_safe + # end + #end + #row :parent_id do |qparent| + # if !qparent.parent_id.nil? then + # parent_q = Question.where('id = ?', qparent.parent_id) + # link_to parent_q.text, [:admin, parent_q] + # end + #end + #row :dependency_id do |qdepend| + # if !qdepend.dependency_id.nil? then + # qdep = Question.where('id = ?', qparent.dependency_id) + # link_to qdep.text, [:admin, qdep] + # end + #end + #row :dependency_text do |dep_text| + # if !dep_text.dependency_text.nil? then + # dep_text.dependency_text.html_safe + # end + #end + row I18n.t('admin.themes') do + (question.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe + end + row :created_at + row :updated_at + + end + end + + + #form + form do |f| + f.inputs "Details" do + f.input :text + f.input :number + f.input :section, + :as => :select, + :collection => Section.order('title').map{ |sec| ["#{sec.version.phase.dmptemplate.title} - #{sec.title}", sec.id] } + f.input :default_value + # f.input :guidance + # f.input :parent_id, :label => "Parent", + # :as => :select, + # :collection => Question.find(:all, :order => 'text ASC').map{|que|[que.text, que.id]} + #f.input :dependency_id, :label => "Dependency question", + # :as => :select, + # :collection => Question.find(:all, :order => 'text ASC').map{|que|[que.text, que.id]} + # f.input :dependency_text + + end + f.inputs "Question Format" do + f.input :question_format_id, :label => I18n.t('admin.select_question_format'), + :as => :select, + :collection => QuestionFormat.order('title').map{|format| [format.title, format.id]} + end + f.inputs "Themes" do + f.input :theme_ids, :label => I18n.t('admin.selected_themes'), + :as => :select, + :multiple => true, + :include_blank => I18n.t('helpers.none'), + :collection => Theme.order('title').map{|the| [the.title, the.id]} , + :hint => I18n.t('admin.choose_themes') + + end + f.actions + end + + controller do + def permitted_params + params.permit! + end + end + +end diff --git a/app/admin/question_format.rb b/app/admin/question_format.rb index 14bb8eb..b73592c 100644 --- a/app/admin/question_format.rb +++ b/app/admin/question_format.rb @@ -1,39 +1,39 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register QuestionFormat do - permit_params :description, :title - - menu :priority => 5, :label => proc{I18n.t('admin.question_format')}, :parent => "Templates management" - - index do - column I18n.t('admin.question_format'), :sortable => :title do |n| - link_to n.title, [:admin, n] - end - - actions - end - - # show Template details - show do - attributes_table do - row :title - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row :created_at - row :updated_at - end - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register QuestionFormat do + permit_params :description, :title + + menu :priority => 5, :label => proc{I18n.t('admin.question_format')}, :parent => "Templates management" + + index do + column I18n.t('admin.question_format'), :sortable => :title do |n| + link_to n.title, [:admin, n] + end + + actions + end + + # show Template details + show do + attributes_table do + row :title + row :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + row :created_at + row :updated_at + end + end + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/role.rb b/app/admin/role.rb index 824eb47..076a3d7 100644 --- a/app/admin/role.rb +++ b/app/admin/role.rb @@ -1,62 +1,62 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Role do - permit_params :name, :role_in_plans - - menu :priority => 5, :label => proc{I18n.t('admin.role')}, :parent => "User management" - - index do - column I18n.t('admin.title'), :sortable => :name do |role_name| - link_to role_name.name, [:admin, role_name] - end - - actions - end - - - show do - attributes_table do - row :name - row :role_in_plans - row :created_at - row :updated_at - end - - table_for( (Role.find(params[:id]).users)) do - column (:email){|user| link_to user.email, [:admin, user]} - column (:firstname){|user| user.firstname} - column (:surname){|user| user.surname} - column (:last_sign_in_at){|user| user.last_sign_in_at} - column (I18n.t('admin.org_title')){|user| - if !user.organisation.nil? then - if user.other_organisation.nil? || user.other_organisation == "" then - link_to user.organisation.name, [:admin, user.organisation] - else - I18n.t('helpers.org_type.org_name') + ' - ' + user.other_organisation - - end - end - } - end - - end - - form do |f| - f.inputs "Details" do - f.input :name - f.input :role_in_plans - end - - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Role do + permit_params :name, :role_in_plans + + menu :priority => 5, :label => proc{I18n.t('admin.role')}, :parent => "User management" + + index do + column I18n.t('admin.title'), :sortable => :name do |role_name| + link_to role_name.name, [:admin, role_name] + end + + actions + end + + + show do + attributes_table do + row :name + row :role_in_plans + row :created_at + row :updated_at + end + + table_for( (Role.find(params[:id]).users)) do + column (:email){|user| link_to user.email, [:admin, user]} + column (:firstname){|user| user.firstname} + column (:surname){|user| user.surname} + column (:last_sign_in_at){|user| user.last_sign_in_at} + column (I18n.t('admin.org_title')){|user| + if !user.organisation.nil? then + if user.other_organisation.nil? || user.other_organisation == "" then + link_to user.organisation.name, [:admin, user.organisation] + else + I18n.t('helpers.org_type.org_name') + ' - ' + user.other_organisation + + end + end + } + end + + end + + form do |f| + f.inputs "Details" do + f.input :name + f.input :role_in_plans + end + + f.actions + end + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/section.rb b/app/admin/section.rb index 9252bf8..5cff27b 100644 --- a/app/admin/section.rb +++ b/app/admin/section.rb @@ -1,93 +1,93 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Section do - permit_params :organisation_id, :description, :number, :title, :version_id - - menu :priority => 8, :label => proc{I18n.t('admin.section')}, :parent => "Templates management" - - filter :title - filter :organisation - filter :version - filter :created_at - filter :updated_at - - - index do - column :title , :sortable => :title do |section| - if !section.title.nil? then - link_to section.title, [:admin, section] - end - end - column I18n.t('admin.version'), :sortable => :version_id do |version_title| - if !version_title.version_id.nil? then - link_to version_title.version.title, [:admin, version_title.version] - end - end - column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - if !org_title.organisation_id.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - end - - actions - end - - #show details of a section - show do - attributes_table do - row :title - row :number - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row I18n.t('admin.version'), :sortable => :version_id do |version_title| - if !version_title.version_id.nil? then - link_to version_title.version.title, [:admin, version_title.version] - end - end - row I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - if !org_title.organisation_id.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - end - row :created_at - row :updated_at - end - - end - - - #questions sidebar(:default_value, :dependency_id, :dependency_text, :guidance, :number, :parent_id, :suggested_answer, :text, :question_type, :section_id) - sidebar proc{I18n.t("admin.questions")}, :only => :show, :if => proc { (Question.where("section_id = ?", params[:id])).count >= 1} do - table_for( Question.where("section_id = ?", params[:id] ).order("number")) do - column (:number){|question| question.number} - column (I18n.t("admin.question")){|question| link_to question.text, [:admin, question]} - end - - end - - #form - form do |f| - f.inputs "Details" do - f.input :title - f.input :number - f.input :version, :collection => Version.all.map{ |ver| [ver.title, ver.id] } - f.input :organisation, :as => :select, :collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :description - end - - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Section do + permit_params :organisation_id, :description, :number, :title, :version_id + + menu :priority => 8, :label => proc{I18n.t('admin.section')}, :parent => "Templates management" + + filter :title + filter :organisation + filter :version + filter :created_at + filter :updated_at + + + index do + column :title , :sortable => :title do |section| + if !section.title.nil? then + link_to section.title, [:admin, section] + end + end + column I18n.t('admin.version'), :sortable => :version_id do |version_title| + if !version_title.version_id.nil? then + link_to version_title.version.title, [:admin, version_title.version] + end + end + column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| + if !org_title.organisation_id.nil? then + link_to org_title.organisation.name, [:admin, org_title.organisation] + end + end + + actions + end + + #show details of a section + show do + attributes_table do + row :title + row :number + row :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + row I18n.t('admin.version'), :sortable => :version_id do |version_title| + if !version_title.version_id.nil? then + link_to version_title.version.title, [:admin, version_title.version] + end + end + row I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| + if !org_title.organisation_id.nil? then + link_to org_title.organisation.name, [:admin, org_title.organisation] + end + end + row :created_at + row :updated_at + end + + end + + + #questions sidebar(:default_value, :dependency_id, :dependency_text, :guidance, :number, :parent_id, :suggested_answer, :text, :question_type, :section_id) + sidebar proc{I18n.t("admin.questions")}, :only => :show, :if => proc { (Question.where("section_id = ?", params[:id])).count >= 1} do + table_for( Question.where("section_id = ?", params[:id] ).order("number")) do + column (:number){|question| question.number} + column (I18n.t("admin.question")){|question| link_to question.text, [:admin, question]} + end + + end + + #form + form do |f| + f.inputs "Details" do + f.input :title + f.input :number + f.input :version, :collection => Version.all.map{ |ver| [ver.title, ver.id] } + f.input :organisation, :as => :select, :collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]} + f.input :description + end + + f.actions + end + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/suggested_answer.rb b/app/admin/suggested_answer.rb index 555044b..93421cc 100644 --- a/app/admin/suggested_answer.rb +++ b/app/admin/suggested_answer.rb @@ -1,33 +1,33 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register SuggestedAnswer do - permit_params :question_id, :organisation_id - - menu :priority => 4, :label => proc{I18n.t('admin.sug_answer')}, :parent => "Templates management" - - - #form - form do |f| - f.inputs "Details" do - f.input :question_id, :label => I18n.t('admin.question'), - :as => :select, - :collection => Question.order('text').map{|ques|[ques.text, ques.id]} - f.input :organisation_id, :label => I18n.t('admin.org_title'), - :as => :select, - :collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :text - f.input :is_example - end - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register SuggestedAnswer do + permit_params :question_id, :organisation_id + + menu :priority => 4, :label => proc{I18n.t('admin.sug_answer')}, :parent => "Templates management" + + + #form + form do |f| + f.inputs "Details" do + f.input :question_id, :label => I18n.t('admin.question'), + :as => :select, + :collection => Question.order('text').map{|ques|[ques.text, ques.id]} + f.input :organisation_id, :label => I18n.t('admin.org_title'), + :as => :select, + :collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]} + f.input :text + f.input :is_example + end + f.actions + end + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/theme.rb b/app/admin/theme.rb index 5122921..0b1ea5b 100644 --- a/app/admin/theme.rb +++ b/app/admin/theme.rb @@ -1,77 +1,77 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Theme do - permit_params :description, :title, :locale - - menu :priority => 12, :label => "Themes" - - index do - column :title , :sortable => :title do |theme| - link_to theme.title, [:admin, theme] - end - column :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - - actions - end - - #show details of a theme - show do - attributes_table do - row :title - row :description - row :created_at - row :updated_at - end - - table_for( (Theme.find(params[:id]).questions).order('number')) do - column (:number){|question| question.number} - column (I18n.t("admin.question")){|question| link_to question.text, [:admin, question]} - column (I18n.t("admin.template")){|question| - if !question.section.nil? then - if !question.section.version.nil? then - if !question.section.version.phase.nil? then - if !question.section.version.phase.dmptemplate.nil? then - link_to question.section.version.phase.dmptemplate.title, [:admin, question.section.version.phase.dmptemplate] - else - I18n.t('admin.no_template') - end - else - I18n.t('admin.no_phase') - end - else - I18n.t('admin.no_version') - end - else - I18n.t('admin.no_section') - end - } - end - end - - - - #form - form do |f| - f.inputs "Details" do - f.input :title - f.input :description - end - f.actions - end - - - controller do - def permitted_params - params.permit! - end - end - -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Theme do + permit_params :description, :title, :locale + + menu :priority => 12, :label => "Themes" + + index do + column :title , :sortable => :title do |theme| + link_to theme.title, [:admin, theme] + end + column :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + + actions + end + + #show details of a theme + show do + attributes_table do + row :title + row :description + row :created_at + row :updated_at + end + + table_for( (Theme.find(params[:id]).questions).order('number')) do + column (:number){|question| question.number} + column (I18n.t("admin.question")){|question| link_to question.text, [:admin, question]} + column (I18n.t("admin.template")){|question| + if !question.section.nil? then + if !question.section.version.nil? then + if !question.section.version.phase.nil? then + if !question.section.version.phase.dmptemplate.nil? then + link_to question.section.version.phase.dmptemplate.title, [:admin, question.section.version.phase.dmptemplate] + else + I18n.t('admin.no_template') + end + else + I18n.t('admin.no_phase') + end + else + I18n.t('admin.no_version') + end + else + I18n.t('admin.no_section') + end + } + end + end + + + + #form + form do |f| + f.inputs "Details" do + f.input :title + f.input :description + end + f.actions + 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/admin/user.rb b/app/admin/user.rb index 450472f..18aca07 100644 --- a/app/admin/user.rb +++ b/app/admin/user.rb @@ -1,127 +1,127 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register User do - permit_params :api_token, :password_confirmation, :encrypted_password, :remember_me, :id, :email, :firstname, :orcid_id, :shibboleth_id, :user_status_id, :surname, :user_type_id, :organisation_id, :skip_invitation, :other_organisation, :accept_terms, :role_ids - - menu :priority => 15, :label => proc{ I18n.t('admin.user')}, :parent => "User management" - - filter :firstname - filter :surname - filter :email - filter :organisations - filter :other_organisation - filter :created_at - filter :updated_at - - - - index do - - column I18n.t('admin.user_name'), :sortable => :email do |user_email| - link_to user_email.email, [:admin, user_email] - end - column I18n.t('admin.firstname'), :sortable => :firstname do |use_first| - link_to use_first.firstname, [:admin, use_first] - end - column I18n.t('admin.surname'), :sortable => :surname do |user| - link_to user.surname, [:admin, user] - end - column I18n.t('admin.last_logged_in'), :last_sign_in_at - column I18n.t('admin.org_title'), :sortable => 'organisations.name' do |org_title| - if !org_title.organisation.nil? then - if org_title.other_organisation.nil? || org_title.other_organisation == "" then - link_to org_title.organisation.name, [:admin, org_title.organisation] - else - I18n.t('helpers.org_type.org_name') + ' - ' + org_title.other_organisation - - end - end - end - - actions - end - - show do - attributes_table do - row :firstname - row :surname - row :email - row :orcid_id - row I18n.t('admin.org_title'), :organisation_id do |org_title| - if !org_title.organisation_id.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - end - row :other_organisation - # row I18n.t('admin.user_status'), :user_status_id do |us| - # if !us.user_status.nil? then - # link_to us.user_status.name, [:admin, us.user_status] - # end - # end - # row I18n.t('admin.user_type'), :user_type_id do |ut| - # if !ut.user_type.nil? then - # link_to ut.user_type.name, [:admin, ut.user_type] - # else - # '-' - # end - # end - row I18n.t('admin.user_role') do - (user.roles.map{|ro| link_to ro.name, [:admin, ro]}).join(', ').html_safe - end - # row :shibboleth_id - row :last_sign_in_at - row :sign_in_count - row :api_token - - end - end - - - form do |f| - f.inputs "Details" do - f.input :firstname - f.input :surname - f.input :email - f.input :orcid_id - f.input :api_token - # f.input :shibboleth_id - f.input :organisation_id ,:label => I18n.t('admin.org_title'), - :as => :select, - :collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :other_organisation - # f.input :user_status_id, :label => I18n.t('admin.user_status'), - # :as => :select, - # :collection => UserStatus.find(:all, :order => 'name ASC').map{|us|[us.name, us.id]} - # f.input :user_type_id, :label => I18n.t('admin.user_type'), - # :as => :select, - # :collection => UserType.find(:all, :order => 'name ASC').map{|ut|[ut.name, ut.id]} - f.input :role_ids, :label => I18n.t('admin.user_role'), - :as => :select, - :multiple => true, - :include_blank => I18n.t('helpers.none'), - :collection => Role.order('name').map{|ro| [ro.name, ro.id]} - - f.input :api_token - end - - f.actions - end - - - - controller do - def scoped_collection - resource_class.includes(:organisations) # prevents N+1 queries to your database - end - - def permitted_params - params.permit! - end - - end - -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register User do + permit_params :api_token, :password_confirmation, :encrypted_password, :remember_me, :id, :email, :firstname, :orcid_id, :shibboleth_id, :user_status_id, :surname, :user_type_id, :organisation_id, :skip_invitation, :other_organisation, :accept_terms, :role_ids + + menu :priority => 15, :label => proc{ I18n.t('admin.user')}, :parent => "User management" + + filter :firstname + filter :surname + filter :email + filter :organisations + filter :other_organisation + filter :created_at + filter :updated_at + + + + index do + + column I18n.t('admin.user_name'), :sortable => :email do |user_email| + link_to user_email.email, [:admin, user_email] + end + column I18n.t('admin.firstname'), :sortable => :firstname do |use_first| + link_to use_first.firstname, [:admin, use_first] + end + column I18n.t('admin.surname'), :sortable => :surname do |user| + link_to user.surname, [:admin, user] + end + column I18n.t('admin.last_logged_in'), :last_sign_in_at + column I18n.t('admin.org_title'), :sortable => 'organisations.name' do |org_title| + if !org_title.organisation.nil? then + if org_title.other_organisation.nil? || org_title.other_organisation == "" then + link_to org_title.organisation.name, [:admin, org_title.organisation] + else + I18n.t('helpers.org_type.org_name') + ' - ' + org_title.other_organisation + + end + end + end + + actions + end + + show do + attributes_table do + row :firstname + row :surname + row :email + row :orcid_id + row I18n.t('admin.org_title'), :organisation_id do |org_title| + if !org_title.organisation_id.nil? then + link_to org_title.organisation.name, [:admin, org_title.organisation] + end + end + row :other_organisation + # row I18n.t('admin.user_status'), :user_status_id do |us| + # if !us.user_status.nil? then + # link_to us.user_status.name, [:admin, us.user_status] + # end + # end + # row I18n.t('admin.user_type'), :user_type_id do |ut| + # if !ut.user_type.nil? then + # link_to ut.user_type.name, [:admin, ut.user_type] + # else + # '-' + # end + # end + row I18n.t('admin.user_role') do + (user.roles.map{|ro| link_to ro.name, [:admin, ro]}).join(', ').html_safe + end + # row :shibboleth_id + row :last_sign_in_at + row :sign_in_count + row :api_token + + end + end + + + form do |f| + f.inputs "Details" do + f.input :firstname + f.input :surname + f.input :email + f.input :orcid_id + f.input :api_token + # f.input :shibboleth_id + f.input :organisation_id ,:label => I18n.t('admin.org_title'), + :as => :select, + :collection => Organisation.order('name').map{|orgp|[orgp.name, orgp.id]} + f.input :other_organisation + # f.input :user_status_id, :label => I18n.t('admin.user_status'), + # :as => :select, + # :collection => UserStatus.find(:all, :order => 'name ASC').map{|us|[us.name, us.id]} + # f.input :user_type_id, :label => I18n.t('admin.user_type'), + # :as => :select, + # :collection => UserType.find(:all, :order => 'name ASC').map{|ut|[ut.name, ut.id]} + f.input :role_ids, :label => I18n.t('admin.user_role'), + :as => :select, + :multiple => true, + :include_blank => I18n.t('helpers.none'), + :collection => Role.order('name').map{|ro| [ro.name, ro.id]} + + f.input :api_token + end + + f.actions + end + + + + controller do + def scoped_collection + resource_class.includes(:organisations) # prevents N+1 queries to your database + end + + def permitted_params + params.permit! + end + + end + +end diff --git a/app/admin/user_org_role.rb b/app/admin/user_org_role.rb index 9164eda..f6830d1 100644 --- a/app/admin/user_org_role.rb +++ b/app/admin/user_org_role.rb @@ -1,54 +1,54 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register UserOrgRole do - permit_params :user_id, :organisation_id, :user_role_type_id - - menu false - #:priority => 5, :label => proc{I18n.t('admin.user_org_role')}, :parent => "User management" - - index do - column I18n.t('admin.user'), :sortable => :user_id do |user_n| - if !user_n.user.nil? then - link_to user_n.user.firstname, [:admin, user_n.user] - end - end - column I18n.t('admin.org'), :sortable => :organisation_id do |org| - if !org.organisation.nil? then - link_to org.organisation.name, [:admin, org.organisation] - end - end - column I18n.t('admin.user_role_type'), :sortable => :user_role_type_id do |role| - if !role.user_role_type.nil? then - link_to role.user_role_type.name, [:admin, role.user_role_type] - end - end - - actions - end - - show do - attributes_table do - row I18n.t('admin.user'), :user_id do |user_n| - link_to user_n.user.firstname, [:admin, user_n.user] - end - row I18n.t('admin.org'), :organisation_id do |org| - link_to org.organisation.name, [:admin, org.organisation] - end - row I18n.t('admin.user_role_type'), :user_role_type_id do |role| - link_to role.user_role_type.name, [:admin, role.user_role_type] - end - row :created_at - row :updated_at - end - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register UserOrgRole do + permit_params :user_id, :organisation_id, :user_role_type_id + + menu false + #:priority => 5, :label => proc{I18n.t('admin.user_org_role')}, :parent => "User management" + + index do + column I18n.t('admin.user'), :sortable => :user_id do |user_n| + if !user_n.user.nil? then + link_to user_n.user.firstname, [:admin, user_n.user] + end + end + column I18n.t('admin.org'), :sortable => :organisation_id do |org| + if !org.organisation.nil? then + link_to org.organisation.name, [:admin, org.organisation] + end + end + column I18n.t('admin.user_role_type'), :sortable => :user_role_type_id do |role| + if !role.user_role_type.nil? then + link_to role.user_role_type.name, [:admin, role.user_role_type] + end + end + + actions + end + + show do + attributes_table do + row I18n.t('admin.user'), :user_id do |user_n| + link_to user_n.user.firstname, [:admin, user_n.user] + end + row I18n.t('admin.org'), :organisation_id do |org| + link_to org.organisation.name, [:admin, org.organisation] + end + row I18n.t('admin.user_role_type'), :user_role_type_id do |role| + link_to role.user_role_type.name, [:admin, role.user_role_type] + end + row :created_at + row :updated_at + end + end + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/user_role_type.rb b/app/admin/user_role_type.rb index 4e02387..9bf0e53 100644 --- a/app/admin/user_role_type.rb +++ b/app/admin/user_role_type.rb @@ -1,30 +1,30 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register UserRoleType do - permit_params :description, :name - menu false - #:priority => 5, :label => proc{I18n.t('admin.user_role_type')}, :parent => "User management" - - index do - column I18n.t('admin.title'), :sortable => :name do |user_n| - link_to user_n.name, [:admin, user_n] - end - column I18n.t('admin.desc'),:description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - - actions - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register UserRoleType do + permit_params :description, :name + menu false + #:priority => 5, :label => proc{I18n.t('admin.user_role_type')}, :parent => "User management" + + index do + column I18n.t('admin.title'), :sortable => :name do |user_n| + link_to user_n.name, [:admin, user_n] + end + column I18n.t('admin.desc'),:description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + + actions + end + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/user_status.rb b/app/admin/user_status.rb index 5cfeb45..d50bf3e 100644 --- a/app/admin/user_status.rb +++ b/app/admin/user_status.rb @@ -1,31 +1,31 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register UserStatus do - permit_params :description, :name - - menu false - #:priority => 5, :label => proc{I18n.t('admin.user_status')}, :parent => "User management" - - index do - column I18n.t('admin.title'), :sortable => :name do |user_n| - link_to user_n.name, [:admin, user_n] - end - column I18n.t('admin.desc'),:description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - - actions - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register UserStatus do + permit_params :description, :name + + menu false + #:priority => 5, :label => proc{I18n.t('admin.user_status')}, :parent => "User management" + + index do + column I18n.t('admin.title'), :sortable => :name do |user_n| + link_to user_n.name, [:admin, user_n] + end + column I18n.t('admin.desc'),:description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + + actions + end + + controller do + def permitted_params + params.permit! + end + end +end diff --git a/app/admin/user_type.rb b/app/admin/user_type.rb index 9074f5e..df26a74 100644 --- a/app/admin/user_type.rb +++ b/app/admin/user_type.rb @@ -1,42 +1,42 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register UserType do - permit_params :description, :name - - menu false - #:priority => 5, :label => proc{I18n.t('admin.user_type')}, :parent => "User management" - - index do - column I18n.t('admin.user_type'), :sortable => :name do |user_n| - link_to user_n.name, [:admin, user_n] - end - - actions - end - - # show Template details - show do - attributes_table do - row :name - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row :created_at - row :updated_at - end - end - - controller do - def permitted_params - params.permit! - end - end - - -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register UserType do + permit_params :description, :name + + menu false + #:priority => 5, :label => proc{I18n.t('admin.user_type')}, :parent => "User management" + + index do + column I18n.t('admin.user_type'), :sortable => :name do |user_n| + link_to user_n.name, [:admin, user_n] + end + + actions + end + + # show Template details + show do + attributes_table do + row :name + row :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + row :created_at + row :updated_at + end + end + + controller do + def permitted_params + params.permit! + end + end + + +end diff --git a/app/admin/version.rb b/app/admin/version.rb index 2b6a1fd..1df7893 100644 --- a/app/admin/version.rb +++ b/app/admin/version.rb @@ -1,86 +1,86 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Version do - permit_params :description, :number, :published, :title, :phase_id - - menu :priority => 9, :label => proc{I18n.t('admin.version')}, :parent => "Templates management" - - index do - column I18n.t('admin.title'), :sortable => :title do |version_used| - if !version_used.title.nil? then - link_to version_used.title, [:admin, version_used] - end - end - column I18n.t('admin.version_numb'), :number - column :published - column I18n.t('admin.phase'), :sortable => :phase_id do |phase_title| - if !phase_title.phase_id.nil? then - link_to phase_title.phase.title, [:admin, phase_title.phase] - else - '-' - end - end - - actions - end - - #show details of a version - show do - attributes_table do - row :title - row :number - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row I18n.t('admin.phase'), :sortable => :phase_id do |phase_title| - if !phase_title.phase_id.nil? then - link_to phase_title.phase.title, [:admin, phase_title.phase] - end - end - row :published - row :created_at - row :updated_at - end - - end - - #sections sidebar (:organisation_id, :description, :number, :title, :version_id) - sidebar I18n.t('admin.sections'), :only => :show, :if => proc { version.sections.count >= 1} do - table_for version.sections.order("number") do |temp_phases| - column :number - column :title do |row| - link_to row.title, [:admin, row] - end - column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - - end - end - - #form - form do |f| - f.inputs "Details" do - f.input :title - f.input :number - f.input :description - f.input :phase, :label => I18n.t('admin.phase_title'), - :as => :select, - :collection => Phase.order('title').map{|ph|[ph.title, ph.id]} - f.input :published - end - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end +# [+Project:+] DMPonline +# [+Description:+] +# +# [+Created:+] 03/09/2014 +# [+Copyright:+] Digital Curation Centre + +ActiveAdmin.register Version do + permit_params :description, :number, :published, :title, :phase_id + + menu :priority => 9, :label => proc{I18n.t('admin.version')}, :parent => "Templates management" + + index do + column I18n.t('admin.title'), :sortable => :title do |version_used| + if !version_used.title.nil? then + link_to version_used.title, [:admin, version_used] + end + end + column I18n.t('admin.version_numb'), :number + column :published + column I18n.t('admin.phase'), :sortable => :phase_id do |phase_title| + if !phase_title.phase_id.nil? then + link_to phase_title.phase.title, [:admin, phase_title.phase] + else + '-' + end + end + + actions + end + + #show details of a version + show do + attributes_table do + row :title + row :number + row :description do |descr| + if !descr.description.nil? then + descr.description.html_safe + end + end + row I18n.t('admin.phase'), :sortable => :phase_id do |phase_title| + if !phase_title.phase_id.nil? then + link_to phase_title.phase.title, [:admin, phase_title.phase] + end + end + row :published + row :created_at + row :updated_at + end + + end + + #sections sidebar (:organisation_id, :description, :number, :title, :version_id) + sidebar I18n.t('admin.sections'), :only => :show, :if => proc { version.sections.count >= 1} do + table_for version.sections.order("number") do |temp_phases| + column :number + column :title do |row| + link_to row.title, [:admin, row] + end + column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| + link_to org_title.organisation.name, [:admin, org_title.organisation] + end + + end + end + + #form + form do |f| + f.inputs "Details" do + f.input :title + f.input :number + f.input :description + f.input :phase, :label => I18n.t('admin.phase_title'), + :as => :select, + :collection => Phase.order('title').map{|ph|[ph.title, ph.id]} + f.input :published + end + f.actions + 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/admin.js b/app/assets/javascripts/admin.js index 0b5dcdd..bf2b1d9 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -1,473 +1,473 @@ -//= require tinymce -/* -**Project: DMPonline v4 -**Description: This file include all javascript regarding admin interface -**Copyright: Digital Curation Centre -*/ - - -$( document ).ready(function() { - - if($('.in').length > 0) { - if ($('.in .current_question').length > 0) { - $(document.body).animate({ - 'scrollTop': $('.in .current_question').offset().top - }, 1000); - } - else { - $(document.body).animate({ - 'scrollTop': $('.in').offset().top - }, 1000); - } - } - - //set the tinymce popover help text - $(".template_desc_popover, .phase_desc_popover, .version_desc_popover, .section_desc_popover, .question_format_popover," + - " .default_answer_popover, .suggested_answer_popover, .question_guidance_popover, .question_themes_popover," + - " .question_options_popover, .guidance_group_title_popover, .guidance_group_template_popover," + - " .guidance_group_subset_popover, .guidance_text_popover, .guidance_apply_to_popover, .guidance_by_themes_popover," + - " .guidance_by_question_popover, .guidance_group_select_popover, .org_abbr_popover").on('click', function(e) { - e.preventDefault(); - }).popover(); - - //show or hide divs based on what the user selects from the question format. New question - $('.ques_format').on("change", function(e) { - var s_id = $(this).prev(".section_id").val(); - - var selected_format = $('#new-select-format-'+ s_id).val(); - - //text area - if (selected_format == 1){ - $("#new-options-"+ s_id).hide(); - $("#new-default-text-field-"+ s_id).hide(); - $("#new-default-text-area-"+ s_id).show(); - $("#new-default-value-field-"+ s_id).show(); - } - //text field - else if (selected_format == 2){ - $("#new-options-"+ s_id).hide(); - $("#new-default-text-field-"+ s_id).show(); - $("#new-default-value-field-"+ s_id).show(); - $("#new-default-text-area-"+ s_id).hide(); - } - //checkbox,radio button, dropdown, multi select - else if (selected_format == 3 ||selected_format == 4 || selected_format == 5 || selected_format == 6){ - $("#new-options-"+ s_id).show(); - $("#new-default-text-field-"+ s_id).hide(); - $("#new-default-text-area-"+ s_id).hide(); - $("#new-default-value-field-"+ s_id).hide(); - } - delete selected_format; - }).trigger('change'); - - - //show or hide divs based on what the user selects from the question format - $('.ques_format').on("change", function(e) { - var q_id = $(this).find('.quest_id').val(); - - var selected_format = $('#'+ q_id +'-select-format').val(); - //text area - if (selected_format == 1){ - $("#options-"+ q_id).hide(); - $("#default-text-field-"+ q_id).hide(); - $("#default-text-area-"+ q_id).show(); - $("#default-value-field-"+ q_id).show(); - } - //text field - else if (selected_format == 2){ - $("#options-"+ q_id).hide(); - $("#default-text-field-"+ q_id).show(); - $("#default-value-field-"+ q_id).show(); - $("#default-text-area-"+ q_id).hide(); - } - //checkbox,radio button, dropdown, multi select - else if (selected_format == 3 ||selected_format == 4 || selected_format == 5 || selected_format == 6){ - $("#options-"+ q_id).show(); - $("#default-text-field-"+ q_id).hide(); - $("#default-text-area-"+ q_id).hide(); - $("#default-value-field-"+ q_id).hide(); - } - delete selected_format; - delete q_id; - }).trigger('change'); - - - //Code to show/hide divs on new guidance (by themes or by question) - $('#g_options').on("change", function (){ - var g_t_q = $(this).val(); - - e_g_q_f = $("#edit_guid_ques_flag").val(); - - if (g_t_q == 1){ - $(".guindace_by_question").hide(); - $(".guindance_by_theme").show(); - } - else if (g_t_q == 2){ - $(".guindace_by_question").show(); - $(".guindance_by_theme").hide(); - //check if editing - if( e_g_q_f != 2){ - $('#phases_select').hide(); - $('#versions_select').hide(); - $('#sections_select').hide(); - $('#questions_select').hide(); - - } - } - - }).trigger('change'); - - - //filter from template to question 5 dropdowns - $('#templates_select').change(function() { - $.ajax({ - type: 'GET', - url: "update_phases", - dataType: 'script', - data: { - dmptemplate_id : $('#templates_select').val() - } - }); - $('#phases_select').show(); - $('#versions_select').hide(); - $('#sections_select').hide(); - $('#questions_select').hide(); - - }); - $('#phases_select').change(function() { - $.ajax({ - type: 'GET', - url: "update_versions", - dataType: 'script', - data: { - phase_id : $('#phases_select').val() - } - }); - $('#phases_select').show(); - $('#versions_select').show(); - $('#sections_select').hide(); - $('#questions_select').hide(); - }); - $('#versions_select').change(function() { - $.ajax({ - type: 'GET', - url: "update_sections", - dataType: 'script', - data: { - version_id : $('#versions_select').val() - } - }); - $('#phases_select').show(); - $('#versions_select').show(); - $('#sections_select').show(); - $('#questions_select').hide(); - }); - $('#sections_select').change(function() { - $.ajax({ - type: 'GET', - url: "update_questions", - dataType: 'script', - data: { - section_id : $('#sections_select').val() - } - }); - $('#phases_select').show(); - $('#versions_select').show(); - $('#sections_select').show(); - $('#questions_select').show(); - }); - - - //action for show or hide template editing display - $('#edit_template_button').click(function(e){ - e.preventDefault(); - - $('#edit_template_div').show(); - $('#show_template_div').hide(); - }); - - - //action for show or hide phase display - $('#edit_phase_button').click(function(e){ - e.preventDefault(); - $('#edit_phase_div').show(); - $('#show_phase_div').hide(); - }); - - //action to hide the alert to edit a version - $("#edit-version-confirmed").click(function (e){ - e.preventDefault(); - $("#version_edit_alert").modal("hide"); - }); - - //action to clone/add a version - $("#clone-version-confirmed").click(function (){ - $("#new_project").submit(); - }); - - //action for show question editing display - $('.edit_question_button').click(function(e){ - var q_id = $(this).prev(".question_id").val(); - $('#edit_question_div_'+ q_id).show(); - $('#show_question_div_'+ q_id).hide(); - e.preventDefault(); - }); - - - $(".cancel_edit_question").click(function(e){ - var q_id = $(this).prev(".question_id").val(); - $('#edit_question_div_'+ q_id).hide(); - $('#show_question_div_'+ q_id).show(); - e.preventDefault(); - }); - - //action for adding a new question - $('.add_question_button').click(function(e){ - var s_id = $(this).prev(".section_id").val(); - $('#add_question_block_div_'+ s_id).show(); - $('#add_question_button_div_'+ s_id).hide(); - e.preventDefault(); - - }); - - //if question text area is empty send alert - $('.new_question_save_button').click(function(e){ - var s_id = $(this).prev(".section_id").val(); - if ($('#new_question_text_'+ s_id).val() == ''){ - alert(I18n.t("js.question_text_empty")); - return false; - } - }); - - //action for cancelling a new question - $('.cancel_add_new_question').click(function(e){ - var s_id_new = $(this).prev(".section_id_new").val(); - $('#add_question_block_div_'+ s_id_new).hide(); - $('#add_question_button_div_'+ s_id_new).show(); - e.preventDefault(); - }); - - //action for adding a new section - $('#add_section_button').click(function(e){ - $('#add_section_block_div').show(); - $('#add_section_button_div').hide(); - e.preventDefault(); - }); - - - //action for cancelling a new section - $('#cancel_add_section').click(function(e){ - $('#add_section_block_div').hide(); - $('#add_section_button_div').show(); - e.preventDefault(); - }); - - //SUGGESTED ANSWERS - //action for adding a new suggested answer - $('.add_suggested_answer_button').click(function(e){ - var q_id = $(this).prev(".question_id").val(); - - $('#add_suggested_answer_block_'+ q_id).show(); - $('#add_suggested_answer_button_'+ q_id).hide(); - e.preventDefault(); - }); - - //cancelling edit of a suggested answer - $(".cancel_edit_suggested_answer").click(function(e){ - var q_id = $(this).prev(".question_id").val(); - $('#edit_suggested_answer_div_'+ q_id).hide(); - $('#show_suggested_answer_div_'+ q_id).show(); - e.preventDefault(); - }); - - //edit a suggested answer - $('.edit_form_for_suggested_answer').click(function(e){ - var q_id = $(this).prev(".question_id").val(); - $('#edit_suggested_answer_div_'+ q_id).show(); - $('#show_suggested_answer_div_'+ q_id).hide(); - e.preventDefault(); - }); - - //GUIDANCE - //action for adding a new guidance next to the question - $('.add_guidance_button').click(function(e){ - var q_id = $(this).prev(".question_id").val(); - $('#add_guidance_block_'+ q_id).show(); - $('#add_guidance_button_'+ q_id).hide(); - e.preventDefault(); - }); - - //cancelling edit of guidance next to the question - $(".cancel_guidance_answer").click(function(e){ - var q_id = $(this).prev(".question_id").val(); - $('#edit_guidance_div_'+ q_id).hide(); - $('#show_guidance_div_'+ q_id).show(); - e.preventDefault(); - }); - - //edit guidance next to the question - $('.edit_form_for_guidance').click(function(e){ - var q_id = $(this).prev(".question_id").val(); - $('#edit_guidance_div_'+ q_id).show(); - $('#show_guidance_div_'+ q_id).hide(); - e.preventDefault(); - }); - - - //Add new guidance Alerts - $("#return_to_new_guidance").click(function(){ - $('#new_guidance_alert_dialog').modal("hide"); - }); - - - $('#new_guidance_submit').click( function(e){ - // $('#new_guidance_alert_dialog').on("hide", function(){ - - var alert_message = []; - //verify if text area is not nil - var editorContent = tinyMCE.get('guidance-text').getContent(); - if (editorContent == ''){ - alert_message.push(I18n.t("js.add_guidance_text")); - } - //verify dropdown with questions has a selected option if guidance for a question being used - if ($('#g_options').val() == '2') { - if ($('#questions_select').val() == '' || isNaN($('#questions_select').val())){ - alert_message.push(I18n.t("js.select_question")); - } - } - - //verify dropdown with questions has a selected option if guidance for a question being used - if ($('#g_options').val() == '1' ){ - if($('#guidance_theme_ids').val() == undefined || $('#guidance_theme_ids').val() == ''){ - alert_message.push(I18n.t("js.select_at_least_one_theme")); - } - } - //verify if guidance group is selected - if ( ($('#guidance_guidance_group_ids').val() == '') || $('#guidance_guidance_group_ids').val() == undefined ) { - alert_message.push(I18n.t("js.select_guidance_group")); - } - if(alert_message.length == 0){ - //clear dropdowns before submission - $('#new_guidance_alert_dialog').modal("hide"); - - if ($('#g_options').val() == '2'){ - $('#guidance_theme_ids').val(null); - } - if($('#g_options').val() == '1'){ - $('#questions_select').val(null); - } - $('#new_guidance_form').submit(); - return false; - - } - else if (alert_message.length != 0){ - var message = ''; - $('#new_guidance_alert_dialog').on("show", function(){ - - $("#missing_fields_new_guidance").empty(); - $.each(alert_message, function(key, value){ - message += "
  • "+value+"
  • "; - }); - $("#missing_fields_new_guidance").append(message); - }); - delete message; - } - delete alert_message; - e.preventDefault(); - }); - - //edit guidance alerts - $("#return_to_edit_guidance").click(function(){ - $('#edit_guidance_alert_dialog').modal("hide"); - }); - - - $('#edit_guidance_submit').click( function(e){ - // $('#new_guidance_alert_dialog').on("hide", function(){ - - var alert_message = []; - //verify if text area is not nil - var editorContent = tinyMCE.get('guidance-text').getContent(); - if (editorContent == ''){ - alert_message.push(I18n.t("js.add_guidance_text")); - } - //verify dropdown with questions has a selected option if guidance for a question being used - if ($('#g_options').val() == '2') { - if ($('#questions_select').val() == '' || isNaN($('#questions_select').val())){ - alert_message.push(I18n.t("js.select_question")); - } - } - //verify dropdown with questions has a selected option if guidance for a question being used - if ($('#g_options').val() == '1' ){ - if($('#guidance_theme_ids').val() == undefined || $('#guidance_theme_ids').val() == ''){ - alert_message.push(I18n.t("js.select_at_least_one_theme")); - } - } - //verify if guidance group is selected - if ( ($('#guidance_guidance_group_ids').val() == '') || $('#guidance_guidance_group_ids').val() == undefined ) { - alert_message.push(I18n.t("js.select_guidance_group")); - } - - if(alert_message.length == 0){ - //clear dropdowns before submission - $('#edit_guidance_alert_dialog').modal("hide"); - - if ($('#g_options').val() == '2'){ $('#guidance_theme_ids').val(null);} - if($('#g_options').val() == '1'){$('#questions_select').val(null);} - $('#edit_guidance_form').submit(); - return false; - } - else if (alert_message.length != 0){ - var message = ''; - $('#edit_guidance_alert_dialog').on("show", function(){ - - $("#missing_fields_edit_guidance").empty(); - $.each(alert_message, function(key, value){ - message += "
  • "+value+"
  • "; - }); - $("#missing_fields_edit_guidance").append(message); - }); - delete message; - } - delete alert_message; - e.preventDefault(); - }); - - - //Validate banner_text area for less than 165 character - $("form#edit_org_details").submit(function(){ - if (getStats('org_banner_text').chars > 165) { - alert(I18n.t("js.enter_up_to") + " " + getStats('org_banner_text').chars + ". " + I18n.t("js.if_using_url_try")); - return false; - } - }); - - - - - }); - - -//remove option when question format is base on a choice -function remove_object(link){ - $(link).prev("input[type=hidden]").val("1"); - $(link).closest(".options_content").hide(); - -} -function add_object(link, association, content) { - var new_id = new Date().getTime(); - var regexp = new RegExp("new_" + association, "g"); - - if (association == 'options') { - $(link).parent().children('.options_table').children('.options_tbody').children('.new_option_before').before(content.replace(regexp, new_id)); - } -} - -// Returns text statistics for the specified editor by id -function getStats(id) { - var body = tinymce.get(id).getBody(), text = tinymce.trim(body.innerText || body.textContent); - - return { - chars: text.length - }; +//= require tinymce +/* +**Project: DMPonline v4 +**Description: This file include all javascript regarding admin interface +**Copyright: Digital Curation Centre +*/ + + +$( document ).ready(function() { + + if($('.in').length > 0) { + if ($('.in .current_question').length > 0) { + $(document.body).animate({ + 'scrollTop': $('.in .current_question').offset().top + }, 1000); + } + else { + $(document.body).animate({ + 'scrollTop': $('.in').offset().top + }, 1000); + } + } + + //set the tinymce popover help text + $(".template_desc_popover, .phase_desc_popover, .version_desc_popover, .section_desc_popover, .question_format_popover," + + " .default_answer_popover, .suggested_answer_popover, .question_guidance_popover, .question_themes_popover," + + " .question_options_popover, .guidance_group_title_popover, .guidance_group_template_popover," + + " .guidance_group_subset_popover, .guidance_text_popover, .guidance_apply_to_popover, .guidance_by_themes_popover," + + " .guidance_by_question_popover, .guidance_group_select_popover, .org_abbr_popover").on('click', function(e) { + e.preventDefault(); + }).popover(); + + //show or hide divs based on what the user selects from the question format. New question + $('.ques_format').on("change", function(e) { + var s_id = $(this).prev(".section_id").val(); + + var selected_format = $('#new-select-format-'+ s_id).val(); + + //text area + if (selected_format == 1){ + $("#new-options-"+ s_id).hide(); + $("#new-default-text-field-"+ s_id).hide(); + $("#new-default-text-area-"+ s_id).show(); + $("#new-default-value-field-"+ s_id).show(); + } + //text field + else if (selected_format == 2){ + $("#new-options-"+ s_id).hide(); + $("#new-default-text-field-"+ s_id).show(); + $("#new-default-value-field-"+ s_id).show(); + $("#new-default-text-area-"+ s_id).hide(); + } + //checkbox,radio button, dropdown, multi select + else if (selected_format == 3 ||selected_format == 4 || selected_format == 5 || selected_format == 6){ + $("#new-options-"+ s_id).show(); + $("#new-default-text-field-"+ s_id).hide(); + $("#new-default-text-area-"+ s_id).hide(); + $("#new-default-value-field-"+ s_id).hide(); + } + delete selected_format; + }).trigger('change'); + + + //show or hide divs based on what the user selects from the question format + $('.ques_format').on("change", function(e) { + var q_id = $(this).find('.quest_id').val(); + + var selected_format = $('#'+ q_id +'-select-format').val(); + //text area + if (selected_format == 1){ + $("#options-"+ q_id).hide(); + $("#default-text-field-"+ q_id).hide(); + $("#default-text-area-"+ q_id).show(); + $("#default-value-field-"+ q_id).show(); + } + //text field + else if (selected_format == 2){ + $("#options-"+ q_id).hide(); + $("#default-text-field-"+ q_id).show(); + $("#default-value-field-"+ q_id).show(); + $("#default-text-area-"+ q_id).hide(); + } + //checkbox,radio button, dropdown, multi select + else if (selected_format == 3 ||selected_format == 4 || selected_format == 5 || selected_format == 6){ + $("#options-"+ q_id).show(); + $("#default-text-field-"+ q_id).hide(); + $("#default-text-area-"+ q_id).hide(); + $("#default-value-field-"+ q_id).hide(); + } + delete selected_format; + delete q_id; + }).trigger('change'); + + + //Code to show/hide divs on new guidance (by themes or by question) + $('#g_options').on("change", function (){ + var g_t_q = $(this).val(); + + e_g_q_f = $("#edit_guid_ques_flag").val(); + + if (g_t_q == 1){ + $(".guindace_by_question").hide(); + $(".guindance_by_theme").show(); + } + else if (g_t_q == 2){ + $(".guindace_by_question").show(); + $(".guindance_by_theme").hide(); + //check if editing + if( e_g_q_f != 2){ + $('#phases_select').hide(); + $('#versions_select').hide(); + $('#sections_select').hide(); + $('#questions_select').hide(); + + } + } + + }).trigger('change'); + + + //filter from template to question 5 dropdowns + $('#templates_select').change(function() { + $.ajax({ + type: 'GET', + url: "update_phases", + dataType: 'script', + data: { + dmptemplate_id : $('#templates_select').val() + } + }); + $('#phases_select').show(); + $('#versions_select').hide(); + $('#sections_select').hide(); + $('#questions_select').hide(); + + }); + $('#phases_select').change(function() { + $.ajax({ + type: 'GET', + url: "update_versions", + dataType: 'script', + data: { + phase_id : $('#phases_select').val() + } + }); + $('#phases_select').show(); + $('#versions_select').show(); + $('#sections_select').hide(); + $('#questions_select').hide(); + }); + $('#versions_select').change(function() { + $.ajax({ + type: 'GET', + url: "update_sections", + dataType: 'script', + data: { + version_id : $('#versions_select').val() + } + }); + $('#phases_select').show(); + $('#versions_select').show(); + $('#sections_select').show(); + $('#questions_select').hide(); + }); + $('#sections_select').change(function() { + $.ajax({ + type: 'GET', + url: "update_questions", + dataType: 'script', + data: { + section_id : $('#sections_select').val() + } + }); + $('#phases_select').show(); + $('#versions_select').show(); + $('#sections_select').show(); + $('#questions_select').show(); + }); + + + //action for show or hide template editing display + $('#edit_template_button').click(function(e){ + e.preventDefault(); + + $('#edit_template_div').show(); + $('#show_template_div').hide(); + }); + + + //action for show or hide phase display + $('#edit_phase_button').click(function(e){ + e.preventDefault(); + $('#edit_phase_div').show(); + $('#show_phase_div').hide(); + }); + + //action to hide the alert to edit a version + $("#edit-version-confirmed").click(function (e){ + e.preventDefault(); + $("#version_edit_alert").modal("hide"); + }); + + //action to clone/add a version + $("#clone-version-confirmed").click(function (){ + $("#new_project").submit(); + }); + + //action for show question editing display + $('.edit_question_button').click(function(e){ + var q_id = $(this).prev(".question_id").val(); + $('#edit_question_div_'+ q_id).show(); + $('#show_question_div_'+ q_id).hide(); + e.preventDefault(); + }); + + + $(".cancel_edit_question").click(function(e){ + var q_id = $(this).prev(".question_id").val(); + $('#edit_question_div_'+ q_id).hide(); + $('#show_question_div_'+ q_id).show(); + e.preventDefault(); + }); + + //action for adding a new question + $('.add_question_button').click(function(e){ + var s_id = $(this).prev(".section_id").val(); + $('#add_question_block_div_'+ s_id).show(); + $('#add_question_button_div_'+ s_id).hide(); + e.preventDefault(); + + }); + + //if question text area is empty send alert + $('.new_question_save_button').click(function(e){ + var s_id = $(this).prev(".section_id").val(); + if ($('#new_question_text_'+ s_id).val() == ''){ + alert(I18n.t("js.question_text_empty")); + return false; + } + }); + + //action for cancelling a new question + $('.cancel_add_new_question').click(function(e){ + var s_id_new = $(this).prev(".section_id_new").val(); + $('#add_question_block_div_'+ s_id_new).hide(); + $('#add_question_button_div_'+ s_id_new).show(); + e.preventDefault(); + }); + + //action for adding a new section + $('#add_section_button').click(function(e){ + $('#add_section_block_div').show(); + $('#add_section_button_div').hide(); + e.preventDefault(); + }); + + + //action for cancelling a new section + $('#cancel_add_section').click(function(e){ + $('#add_section_block_div').hide(); + $('#add_section_button_div').show(); + e.preventDefault(); + }); + + //SUGGESTED ANSWERS + //action for adding a new suggested answer + $('.add_suggested_answer_button').click(function(e){ + var q_id = $(this).prev(".question_id").val(); + + $('#add_suggested_answer_block_'+ q_id).show(); + $('#add_suggested_answer_button_'+ q_id).hide(); + e.preventDefault(); + }); + + //cancelling edit of a suggested answer + $(".cancel_edit_suggested_answer").click(function(e){ + var q_id = $(this).prev(".question_id").val(); + $('#edit_suggested_answer_div_'+ q_id).hide(); + $('#show_suggested_answer_div_'+ q_id).show(); + e.preventDefault(); + }); + + //edit a suggested answer + $('.edit_form_for_suggested_answer').click(function(e){ + var q_id = $(this).prev(".question_id").val(); + $('#edit_suggested_answer_div_'+ q_id).show(); + $('#show_suggested_answer_div_'+ q_id).hide(); + e.preventDefault(); + }); + + //GUIDANCE + //action for adding a new guidance next to the question + $('.add_guidance_button').click(function(e){ + var q_id = $(this).prev(".question_id").val(); + $('#add_guidance_block_'+ q_id).show(); + $('#add_guidance_button_'+ q_id).hide(); + e.preventDefault(); + }); + + //cancelling edit of guidance next to the question + $(".cancel_guidance_answer").click(function(e){ + var q_id = $(this).prev(".question_id").val(); + $('#edit_guidance_div_'+ q_id).hide(); + $('#show_guidance_div_'+ q_id).show(); + e.preventDefault(); + }); + + //edit guidance next to the question + $('.edit_form_for_guidance').click(function(e){ + var q_id = $(this).prev(".question_id").val(); + $('#edit_guidance_div_'+ q_id).show(); + $('#show_guidance_div_'+ q_id).hide(); + e.preventDefault(); + }); + + + //Add new guidance Alerts + $("#return_to_new_guidance").click(function(){ + $('#new_guidance_alert_dialog').modal("hide"); + }); + + + $('#new_guidance_submit').click( function(e){ + // $('#new_guidance_alert_dialog').on("hide", function(){ + + var alert_message = []; + //verify if text area is not nil + var editorContent = tinyMCE.get('guidance-text').getContent(); + if (editorContent == ''){ + alert_message.push(I18n.t("js.add_guidance_text")); + } + //verify dropdown with questions has a selected option if guidance for a question being used + if ($('#g_options').val() == '2') { + if ($('#questions_select').val() == '' || isNaN($('#questions_select').val())){ + alert_message.push(I18n.t("js.select_question")); + } + } + + //verify dropdown with questions has a selected option if guidance for a question being used + if ($('#g_options').val() == '1' ){ + if($('#guidance_theme_ids').val() == undefined || $('#guidance_theme_ids').val() == ''){ + alert_message.push(I18n.t("js.select_at_least_one_theme")); + } + } + //verify if guidance group is selected + if ( ($('#guidance_guidance_group_ids').val() == '') || $('#guidance_guidance_group_ids').val() == undefined ) { + alert_message.push(I18n.t("js.select_guidance_group")); + } + if(alert_message.length == 0){ + //clear dropdowns before submission + $('#new_guidance_alert_dialog').modal("hide"); + + if ($('#g_options').val() == '2'){ + $('#guidance_theme_ids').val(null); + } + if($('#g_options').val() == '1'){ + $('#questions_select').val(null); + } + $('#new_guidance_form').submit(); + return false; + + } + else if (alert_message.length != 0){ + var message = ''; + $('#new_guidance_alert_dialog').on("show", function(){ + + $("#missing_fields_new_guidance").empty(); + $.each(alert_message, function(key, value){ + message += "
  • "+value+"
  • "; + }); + $("#missing_fields_new_guidance").append(message); + }); + delete message; + } + delete alert_message; + e.preventDefault(); + }); + + //edit guidance alerts + $("#return_to_edit_guidance").click(function(){ + $('#edit_guidance_alert_dialog').modal("hide"); + }); + + + $('#edit_guidance_submit').click( function(e){ + // $('#new_guidance_alert_dialog').on("hide", function(){ + + var alert_message = []; + //verify if text area is not nil + var editorContent = tinyMCE.get('guidance-text').getContent(); + if (editorContent == ''){ + alert_message.push(I18n.t("js.add_guidance_text")); + } + //verify dropdown with questions has a selected option if guidance for a question being used + if ($('#g_options').val() == '2') { + if ($('#questions_select').val() == '' || isNaN($('#questions_select').val())){ + alert_message.push(I18n.t("js.select_question")); + } + } + //verify dropdown with questions has a selected option if guidance for a question being used + if ($('#g_options').val() == '1' ){ + if($('#guidance_theme_ids').val() == undefined || $('#guidance_theme_ids').val() == ''){ + alert_message.push(I18n.t("js.select_at_least_one_theme")); + } + } + //verify if guidance group is selected + if ( ($('#guidance_guidance_group_ids').val() == '') || $('#guidance_guidance_group_ids').val() == undefined ) { + alert_message.push(I18n.t("js.select_guidance_group")); + } + + if(alert_message.length == 0){ + //clear dropdowns before submission + $('#edit_guidance_alert_dialog').modal("hide"); + + if ($('#g_options').val() == '2'){ $('#guidance_theme_ids').val(null);} + if($('#g_options').val() == '1'){$('#questions_select').val(null);} + $('#edit_guidance_form').submit(); + return false; + } + else if (alert_message.length != 0){ + var message = ''; + $('#edit_guidance_alert_dialog').on("show", function(){ + + $("#missing_fields_edit_guidance").empty(); + $.each(alert_message, function(key, value){ + message += "
  • "+value+"
  • "; + }); + $("#missing_fields_edit_guidance").append(message); + }); + delete message; + } + delete alert_message; + e.preventDefault(); + }); + + + //Validate banner_text area for less than 165 character + $("form#edit_org_details").submit(function(){ + if (getStats('org_banner_text').chars > 165) { + alert(I18n.t("js.enter_up_to") + " " + getStats('org_banner_text').chars + ". " + I18n.t("js.if_using_url_try")); + return false; + } + }); + + + + + }); + + +//remove option when question format is base on a choice +function remove_object(link){ + $(link).prev("input[type=hidden]").val("1"); + $(link).closest(".options_content").hide(); + +} +function add_object(link, association, content) { + var new_id = new Date().getTime(); + var regexp = new RegExp("new_" + association, "g"); + + if (association == 'options') { + $(link).parent().children('.options_table').children('.options_tbody').children('.new_option_before').before(content.replace(regexp, new_id)); + } +} + +// Returns text statistics for the specified editor by id +function getStats(id) { + var body = tinymce.get(id).getBody(), text = tinymce.trim(body.innerText || body.textContent); + + return { + chars: text.length + }; } \ No newline at end of file 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(' +======= +

    <%= t("helpers.edit_profile") %>

    + +<%= raw t("helpers.user_details_text_html") %> + +
    + <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:method => :put}) do |f| %> + <%= hidden_field_tag :unlink_flag, "false", :id => "unlink_flag" %> + +
    + +

    <%= raw t("helpers.user_details_paragraph_html") %>

    + + + + + + + + + + + + + + + + + + + <% other_organisations = Array.new %> + <% Organisation.where("parent_id IS ? AND is_other = ?", nil, 1).each do |org| %> + <% other_organisations << org.id %> + <% end %> + "> + + + + + + + + + + + + <% unless @user.api_token.nil? %> + + + + + + + + + <% end %> +
    <%= (t("helpers.email") + " *") %><%= f.email_field :email, :as => :email %>
    <%= t("helpers.first_name") %><%= f.text_field :firstname, :as => :string, + :id => "first_time_login_firstname", + :autofocus => true, + :class => "text_field has-tooltip", + "data-toggle" => "tooltip", + "data-trigger" => "focus", + "title" => t("helpers.first_name_help_text") %>
    <%= t("helpers.last_name") %><%= f.text_field :surname, + :as => :string, :id => "first_time_login_surname", + :class => "text_field has-tooltip", + "data-toggle" => "tooltip", + "data-trigger" => "focus", + "title" => t("helpers.surname_help_text") %>
    <%= t("helpers.org_type.organisation") %><%= collection_select(:user, + :organisation_id, Organisation.where("parent_id IS NULL").order("name"), + :id, :name, {include_blank: t("helpers.org_type.organisation")}, + {:class => "typeahead org_sign_up"}) %>
    <%= t('helpers.user_details_language') %><%= collection_select(:user, + :language_id, Language.all.order("name"), + :id, :name, {:selected => Language.where(default_language: true).first.id}, + {:class => "typeahead org_sign_up"}) %>
    <%= t("helpers.orcid_id") %><%= f.text_field :orcid_id, + :as => :string, + :autocomplete => "off", + :class => "text_field has-tooltip", "data-toggle" => "tooltip", "data-html" => "true", "title" => t("helpers.orcid_html") %>
    <%= t("helpers.api_token") %><%= @user.api_token %>
    <%= t("helpers.api_info") %><%= link_to(t("helpers.api_use"), controller: "token_permission_types", action: "index") %>
    +
    +

    + <% if Rails.application.config.shibboleth_enabled %> + <% if resource.shibboleth_id.nil? || resource.shibboleth_id.length == 0 then %> + <%= link_to t("helpers.shibboleth_to_link_text"), user_omniauth_shibboleth_path, :class => "a-orange" %> + <% else %> + <%= t("helpers.shibboleth_linked_text") %> + + <%= t("helpers.shibboleth_unlink_label") %> + + <% end %> + <% end %> +

    +
    +
    +
    +

    + <%= raw t("helpers.edit_password_info") %> +

    + + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +
    <%= t('custom_devise.waiting_for_confirmation') %><%= resource.unconfirmed_email %>
    + <% end %> + + + + + + + + + + + + +
    <%= t("helpers.current_password") %> + <%= f.password_field :current_password, :as => :password %> +
    <%= t("helpers.new_password") %><%= f.password_field :password, :as => :password, :autocomplete => "off" %> +
    <%= t("helpers.password_conf") %><%= f.password_field :password_confirmation, :as => :password, :autocomplete => "off" %>
    +
    + <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> + <%= link_to t("helpers.submit.cancel"), :back, :class => "btn btn-primary" %> +
    + <% end %> + + +
    +
    + + + + +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6 diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 0c3ca00..5406165 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,13 +1,13 @@ -

    <%= t('helpers.sign_up') %>

    -<% unless session[:shibboleth_data].nil? %> -

    - <%= raw t('helpers.sign_up_shibboleth_alert_text_html')%> -

    - <% cookies[:show_shib_link] = { value: 'show_shib_link', expires: 3.hours.from_now } %> -<% end %> - -
    -
    - - <%= render :partial => 'shared/register_form', locals: {extended: true} %> +

    <%= t('helpers.sign_up') %>

    +<% unless session[:shibboleth_data].nil? %> +

    + <%= raw t('helpers.sign_up_shibboleth_alert_text_html')%> +

    + <% cookies[:show_shib_link] = { value: 'show_shib_link', expires: 3.hours.from_now } %> +<% end %> + +
    +
    + + <%= render :partial => 'shared/register_form', locals: {extended: true} %>
    \ No newline at end of file diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 2f0d3bb..95c5cf1 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,33 +1,33 @@ -

    <%= t("helpers.sign_in") %>

    -
    - - <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> -
    - - - - - - - - - - - - - -
    <%= t("helpers.email") %><%= f.email_field :email, :autofocus => true %>
    <%= t("helpers.password") %><%= f.password_field :password %>
    <% if devise_mapping.rememberable? -%> -
    - <%= f.check_box :remember_me %> - <%= f.label :remember_me %> -
    - <% end -%> -
    -
    - <%= f.submit t("helpers.sign_in"), :class => "btn btn-primary" %> -
    -
    - <% end %> - - <%= render "devise/shared/links" %> -
    +

    <%= t("helpers.sign_in") %>

    +
    + + <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> +
    + + + + + + + + + + + + + +
    <%= t("helpers.email") %><%= f.email_field :email, :autofocus => true %>
    <%= t("helpers.password") %><%= f.password_field :password %>
    <% if devise_mapping.rememberable? -%> +
    + <%= f.check_box :remember_me %> + <%= f.label :remember_me %> +
    + <% end -%> +
    +
    + <%= f.submit t("helpers.sign_in"), :class => "btn btn-primary" %> +
    +
    + <% end %> + + <%= render "devise/shared/links" %> +
    diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb index 9de3361..44a1965 100644 --- a/app/views/devise/shared/_links.erb +++ b/app/views/devise/shared/_links.erb @@ -1,17 +1,17 @@ -<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to t('helpers.forgot_password'), new_password_path(resource_name), :class => "a-orange"%>
    -<% end -%> - -<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> - <%= link_to t('helpers.no_pass_instructions'), new_confirmation_path(resource_name), :class => "a-orange"%>
    -<% end -%> - -<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> - <%= link_to t('helpers.no_unlock_instructions'), new_unlock_path(resource_name), :class => "a-orange" %>
    -<% end -%> - -<%#- if devise_mapping.omniauthable? %> - <%#- resource_class.omniauth_providers.each do |provider| %> - <%#= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
    - <%# end -%> +<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to t('helpers.forgot_password'), new_password_path(resource_name), :class => "a-orange"%>
    +<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to t('helpers.no_pass_instructions'), new_confirmation_path(resource_name), :class => "a-orange"%>
    +<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to t('helpers.no_unlock_instructions'), new_unlock_path(resource_name), :class => "a-orange" %>
    +<% end -%> + +<%#- if devise_mapping.omniauthable? %> + <%#- resource_class.omniauth_providers.each do |provider| %> + <%#= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
    + <%# end -%> <%# end -%> \ No newline at end of file diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb index b632e4f..40792b2 100644 --- a/app/views/devise/unlocks/new.html.erb +++ b/app/views/devise/unlocks/new.html.erb @@ -1,12 +1,12 @@ -

    <%= t('custom_devise.resend_unlock') %>

    - -<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> - <%= devise_error_messages! %> - -
    <%= f.label :email %>
    - <%= f.email_field :email, :autofocus => true %>
    - -
    <%= f.submit "Resend unlock instructions" %>
    -<% end %> - -<%= render "devise/shared/links" %> +

    <%= t('custom_devise.resend_unlock') %>

    + +<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + +
    <%= f.label :email %>
    + <%= f.email_field :email, :autofocus => true %>
    + +
    <%= f.submit "Resend unlock instructions" %>
    +<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/dmptemplates/_add_guidance.html.erb b/app/views/dmptemplates/_add_guidance.html.erb index de49775..e7322b0 100644 --- a/app/views/dmptemplates/_add_guidance.html.erb +++ b/app/views/dmptemplates/_add_guidance.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD
    <%= form_for :guidance, :url => {:action => "admin_create"}, :html => {:id => "new_guidance_form"} do |f| %> @@ -90,4 +91,98 @@ +======= + +
    + <%= form_for :guidance, :url => {:action => "admin_createguidance"}, :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 => t('helpers.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%> +
    + + + + + \ No newline at end of file diff --git a/app/views/dmptemplates/_add_question.html.erb b/app/views/dmptemplates/_add_question.html.erb index 578a8aa..98c15ed 100644 --- a/app/views/dmptemplates/_add_question.html.erb +++ b/app/views/dmptemplates/_add_question.html.erb @@ -1,181 +1,181 @@ - - -<% @new_question = Question.new %> -<% @new_question.number = section.questions.count + 1 %> - - -<%= form_for @new_question, :url => {:action => "admin_createquestion"}, :html => {:id => "new_question_#{section.id}"} do |f| %> -<%= f.hidden_field :section_id, :value => section.id %> -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    <%= t("org_admin.questions.question_number_label")%><%= f.number_field :number, :in => 1..50, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.questions.number_help_text") %> - -
    -
    <%= t("org_admin.questions.question_text_label")%><%= f.text_area :text, :rows => "5", :id => "new_question_text_#{section.id}" %> -
    -
    <%= t("org_admin.questions.answer_format_label")%><%= f.hidden_field :section_id, :value => section.id, :class => "section_id" %> -
    -
    - <%= f.select :question_format_id, - options_from_collection_for_select(QuestionFormat.all.order("title"), :id, :title, QuestionFormat.find_by_title(t("helpers.text_area")).id), - {}, :id => "new-select-format-#{section.id}"%> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "question_format_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_format_help_text_html"))%> -
    - -
    -
    - - -
    - - -
    - - -
    - -
    -
    -
    -
    <%= t("org_admin.questions.suggested_or_example_answer_label")%>
    - <% suggested_answer = @new_question.suggested_answers.build %> - <%= f.fields_for :suggested_answers, suggested_answer do |s|%> - <%= s.hidden_field :organisation_id, :value => current_user.organisation.id %> -
      -
    • <%= s.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
    • -
    • <%= s.text_area :text, :rows => 5 %>
    • -
    - <%end%> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "suggested_answer_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.suggested_answer_help_text_html"))%> -
    -
    -
    - -
    <%= t("org_admin.questions.guidance_label")%>
    - <%= text_area_tag("new-question-guidance", "", class: "tinymce") %> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "question_guidance_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_guidance_help_text_html"))%> -
    -
    -
    -
    <%= t("org_admin.questions.themes_label")%>
    - <%= f.collection_select(:theme_ids, - Theme.all.order("title"), - :id, :title, {:prompt => false, :include_blank => t('helpers.none')}, {:multiple => true})%> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "question_themes_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_themes_help_text_html"))%> -
    - - -
    -
    - - -
    - <%= hidden_field_tag :section_id, section.id, :class => "section_id" %> - <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary new_question_save_button" %> - <%= hidden_field_tag :section_id, section.id, :class => "section_id_new" %> - <%= link_to t("helpers.submit.cancel"), '#', :class => "btn cancel cancel_add_new_question" %> -
    -
    - -<%end%> - - - + + +<% @new_question = Question.new %> +<% @new_question.number = section.questions.count + 1 %> + + +<%= form_for @new_question, :url => {:action => "admin_createquestion"}, :html => {:id => "new_question_#{section.id}"} do |f| %> +<%= f.hidden_field :section_id, :value => section.id %> +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    <%= t("org_admin.questions.question_number_label")%><%= f.number_field :number, :in => 1..50, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.questions.number_help_text") %> + +
    +
    <%= t("org_admin.questions.question_text_label")%><%= f.text_area :text, :rows => "5", :id => "new_question_text_#{section.id}" %> +
    +
    <%= t("org_admin.questions.answer_format_label")%><%= f.hidden_field :section_id, :value => section.id, :class => "section_id" %> +
    +
    + <%= f.select :question_format_id, + options_from_collection_for_select(QuestionFormat.all.order("title"), :id, :title, QuestionFormat.find_by_title(t("helpers.text_area")).id), + {}, :id => "new-select-format-#{section.id}"%> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "question_format_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_format_help_text_html"))%> +
    + +
    +
    + + +
    + + +
    + + +
    + +
    +
    +
    +
    <%= t("org_admin.questions.suggested_or_example_answer_label")%>
    + <% suggested_answer = @new_question.suggested_answers.build %> + <%= f.fields_for :suggested_answers, suggested_answer do |s|%> + <%= s.hidden_field :organisation_id, :value => current_user.organisation.id %> +
      +
    • <%= s.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
    • +
    • <%= s.text_area :text, :rows => 5 %>
    • +
    + <%end%> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "suggested_answer_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.suggested_answer_help_text_html"))%> +
    +
    +
    + +
    <%= t("org_admin.questions.guidance_label")%>
    + <%= text_area_tag("new-question-guidance", "", class: "tinymce") %> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "question_guidance_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_guidance_help_text_html"))%> +
    +
    +
    +
    <%= t("org_admin.questions.themes_label")%>
    + <%= f.collection_select(:theme_ids, + Theme.all.order("title"), + :id, :title, {:prompt => false, :include_blank => t('helpers.none')}, {:multiple => true})%> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "question_themes_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_themes_help_text_html"))%> +
    + + +
    +
    + + +
    + <%= hidden_field_tag :section_id, section.id, :class => "section_id" %> + <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary new_question_save_button" %> + <%= hidden_field_tag :section_id, section.id, :class => "section_id_new" %> + <%= link_to t("helpers.submit.cancel"), '#', :class => "btn cancel cancel_add_new_question" %> +
    +
    + +<%end%> + + + diff --git a/app/views/dmptemplates/_add_section.html.erb b/app/views/dmptemplates/_add_section.html.erb index e5facd8..b445c85 100644 --- a/app/views/dmptemplates/_add_section.html.erb +++ b/app/views/dmptemplates/_add_section.html.erb @@ -1,54 +1,54 @@ - - -<% @new_section = Section.new %> -<% @new_section.number = version.sections.count + 1 %> - - -<%= form_for @new_section, :url => {:action => "admin_createsection"} do |f| %> - <%= f.hidden_field :version_id, :value => version.id %> - <%= f.hidden_field :organisation_id, :value => current_user.organisation.id %> - -
    -
    -
    -
    - - <%= f.text_field :title, :as => :string, :class => "text_field", :placeholder => t("org_admin.templates.section_title_placeholder")%> -
    - - -
    - -
    -
    -
    - - - - - - - - - -
    <%= t("org_admin.templates.phase_order_label") %> - <%= f.number_field :number, :in => 1..15, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.section_number_help_text") %>
    <%= t("org_admin.templates.desc_label") %> -
    - <%= text_area_tag("section-desc", "" , class: "tinymce") %> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "section_desc_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.templates.section_desc_help_text_html"))%> -
    -
    - -
    - <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.cancel"), "#", :id => "", :class => "btn cancel" %> -
    -
    -
    -
    -
    -<%end%> - - + + +<% @new_section = Section.new %> +<% @new_section.number = version.sections.count + 1 %> + + +<%= form_for @new_section, :url => {:action => "admin_createsection"} do |f| %> + <%= f.hidden_field :version_id, :value => version.id %> + <%= f.hidden_field :organisation_id, :value => current_user.organisation.id %> + +
    +
    +
    +
    + + <%= f.text_field :title, :as => :string, :class => "text_field", :placeholder => t("org_admin.templates.section_title_placeholder")%> +
    + + +
    + +
    +
    +
    + + + + + + + + + +
    <%= t("org_admin.templates.phase_order_label") %> + <%= f.number_field :number, :in => 1..15, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.templates.section_number_help_text") %>
    <%= t("org_admin.templates.desc_label") %> +
    + <%= text_area_tag("section-desc", "" , class: "tinymce") %> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "section_desc_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.templates.section_desc_help_text_html"))%> +
    +
    + +
    + <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> + <%= link_to t("helpers.submit.cancel"), "#", :id => "", :class => "btn cancel" %> +
    +
    +
    +
    +
    +<%end%> + + diff --git a/app/views/dmptemplates/_add_suggested_answer.html.erb b/app/views/dmptemplates/_add_suggested_answer.html.erb index ec9d98b..03e11b7 100644 --- a/app/views/dmptemplates/_add_suggested_answer.html.erb +++ b/app/views/dmptemplates/_add_suggested_answer.html.erb @@ -1,25 +1,25 @@ - -<%= form_for :suggested_answer, :url => {:action => "admin_createsuggestedanswer"} do |f| %> - <%= f.hidden_field :organisation_id, :value => current_user.organisation.id %> - <%= f.hidden_field :question_id, :value => question.id %> - - - - - - -
    <%= t("org_admin.questions.suggested_or_example_answer_label")%> -
      -
    • <%= f.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
    • -
    • <%= f.text_area :text, :rows => 5 %> -
    • -
    -
    -
    - - -
    - <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.cancel"), "#", :id => "cancel_suugested_answer", :class => "btn cancel" %> -
    -<%end%> + +<%= form_for :suggested_answer, :url => {:action => "admin_createsuggestedanswer"} do |f| %> + <%= f.hidden_field :organisation_id, :value => current_user.organisation.id %> + <%= f.hidden_field :question_id, :value => question.id %> + + + + + + +
    <%= t("org_admin.questions.suggested_or_example_answer_label")%> +
      +
    • <%= f.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
    • +
    • <%= f.text_area :text, :rows => 5 %> +
    • +
    +
    +
    + + +
    + <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> + <%= link_to t("helpers.submit.cancel"), "#", :id => "cancel_suugested_answer", :class => "btn cancel" %> +
    +<%end%> diff --git a/app/views/dmptemplates/_admin_nav_tabs.html.erb b/app/views/dmptemplates/_admin_nav_tabs.html.erb index 6974892..db29ff9 100644 --- a/app/views/dmptemplates/_admin_nav_tabs.html.erb +++ b/app/views/dmptemplates/_admin_nav_tabs.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD +======= + + + +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6 diff --git a/app/views/dmptemplates/_edit_guidance.html.erb b/app/views/dmptemplates/_edit_guidance.html.erb index 839e8e0..8debbca 100644 --- a/app/views/dmptemplates/_edit_guidance.html.erb +++ b/app/views/dmptemplates/_edit_guidance.html.erb @@ -1,26 +1,26 @@ - -<%= form_for(suggested_answer, :url => admin_updatesuggestedanswer_dmptemplate_path(suggested_answer), :html => { :method => :put}) do |f| %> - <%= f.hidden_field :organisation_id, :value => current_user.organisation.id %> - - - - - - -
    <%= t("org_admin.questions.suggested_or_example_answer_label")%> -
      -
    • <%= f.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
    • -
    • <%= f.text_area :text, :rows => 5 %>
    • -
    -
    -
    - - -
    - <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.delete"), admin_destroysuggestedanswer_dmptemplate_path(:suggested_answer => suggested_answer.id), - :confirm => t("org_admin.questions.delete_suggested_answer_message", :question_text => question.text ), :method => :delete, :class => "btn btn-primary"%> - <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> - <%= link_to t("helpers.submit.cancel"), "#", :class => "btn cancel cancel_edit_suggested_answer" %> -
    -<%end%> + +<%= form_for(suggested_answer, :url => admin_updatesuggestedanswer_dmptemplate_path(suggested_answer), :html => { :method => :put}) do |f| %> + <%= f.hidden_field :organisation_id, :value => current_user.organisation.id %> + + + + + + +
    <%= t("org_admin.questions.suggested_or_example_answer_label")%> +
      +
    • <%= f.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
    • +
    • <%= f.text_area :text, :rows => 5 %>
    • +
    +
    +
    + + +
    + <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> + <%= link_to t("helpers.submit.delete"), admin_destroysuggestedanswer_dmptemplate_path(:suggested_answer => suggested_answer.id), + :confirm => t("org_admin.questions.delete_suggested_answer_message", :question_text => question.text ), :method => :delete, :class => "btn btn-primary"%> + <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> + <%= link_to t("helpers.submit.cancel"), "#", :class => "btn cancel cancel_edit_suggested_answer" %> +
    +<%end%> diff --git a/app/views/dmptemplates/_edit_phase.html.erb b/app/views/dmptemplates/_edit_phase.html.erb index 3d1ac1d..1536a48 100644 --- a/app/views/dmptemplates/_edit_phase.html.erb +++ b/app/views/dmptemplates/_edit_phase.html.erb @@ -1,45 +1,45 @@ - - -<%= form_for(phase, :url => admin_updatephase_dmptemplate_path(phase), :html => { :method => :put}) do |f| %> - -

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

    -
    - <%= raw t('org_admin.templates.phase_details_text_html')%> -
    -
    -
    - - - - - - - - - - - - - - -
    <%= 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 => 0..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", phase.description, 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_phase_dmptemplate_path(phase), :class => 'btn cancel' %> -
    - + + +<%= form_for(phase, :url => admin_updatephase_dmptemplate_path(phase), :html => { :method => :put}) do |f| %> + +

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

    +
    + <%= raw t('org_admin.templates.phase_details_text_html')%> +
    +
    +
    + + + + + + + + + + + + + + +
    <%= 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 => 0..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", phase.description, 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_phase_dmptemplate_path(phase), :class => 'btn cancel' %> +
    + <%end%> \ No newline at end of file diff --git a/app/views/dmptemplates/_edit_question.html.erb b/app/views/dmptemplates/_edit_question.html.erb index 7ce3ef3..e26abba 100644 --- a/app/views/dmptemplates/_edit_question.html.erb +++ b/app/views/dmptemplates/_edit_question.html.erb @@ -1,174 +1,174 @@ - - -<%= form_for(question, :url => admin_updatequestion_dmptemplate_path(question), :html => { :method => :put}) do |f| %> -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    <%= t("org_admin.questions.question_number_label")%><%= f.number_field :number, :in => 1..50, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.questions.number_help_text") %> -
    -
    <%= t("org_admin.questions.question_text_label")%><%= f.text_area :text, :rows => "5" %> -
    -
    <%= t("org_admin.questions.answer_format_label")%>
    -
    - <%= f.hidden_field :id,{ :class => "quest_id" } %> - <%= f.select :question_format_id, - options_from_collection_for_select(QuestionFormat.all.order("title"), :id, :title, question.question_format_id), - {}, :id => "#{question.id}-select-format"%> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "question_format_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_format_help_text_html"))%> -
    - -
    - - - -
    - - -
    - - -
    - -
    -
    -
    -
    <%= t("org_admin.questions.suggested_or_example_answer_label")%>
    - <% suggested_answer = question.suggested_answers.find_by_organisation_id(current_user.organisation.id) %> - <% if suggested_answer.nil? then %> - <% suggested_answer = question.suggested_answers.build %> - <%end%> - <%= f.fields_for :suggested_answers, suggested_answer do |s|%> - <%= s.hidden_field :organisation_id, :value => current_user.organisation.id %> -
      -
    • <%= s.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
    • -
    • <%= s.text_area :text, :rows => 5 %> -
    • -
    - <%end%> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "suggested_answer_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.suggested_answer_help_text_html"))%> -
    -
    -
    -
    <%= t("org_admin.questions.guidance_label")%>
    - <%= text_area_tag("question-guidance-#{question.id}", question.guidance , class: "tinymce") %> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "question_guidance_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_guidance_help_text_html"))%> -
    -
    -
    -
    <%= t("org_admin.questions.themes_label")%>
    - <%= f.collection_select(:theme_ids, - Theme.all.order("title"), - :id, :title, {:prompt => false, :include_blank => "None"}, {:multiple => true})%> -
    -
    - <%= link_to( image_tag("help_button.png"), "#", :class => "question_themes_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_themes_help_text_html"))%> -
    -
    -
    - -
    - <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> - <% if !question.section.version.published? then%> - <%= link_to t("helpers.submit.delete"), admin_destroyquestion_dmptemplate_path(:question_id => question.id), - :confirm => t("org_admin.questions.delete_message", :question_text => question.text ), :method => :delete, :class => "btn btn-primary"%> - <%end%> - <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> - <%= link_to t("helpers.submit.cancel"), "#", :class => "btn cancel cancel_edit_question" %> -
    -
    - - - -<%= render :partial => "guidance_display", locals: {question: question}%> -<%end%> + + +<%= form_for(question, :url => admin_updatequestion_dmptemplate_path(question), :html => { :method => :put}) do |f| %> +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    <%= t("org_admin.questions.question_number_label")%><%= f.number_field :number, :in => 1..50, :class => "number_field has-tooltip", "data-toggle" => "tooltip", "title" => t("org_admin.questions.number_help_text") %> +
    +
    <%= t("org_admin.questions.question_text_label")%><%= f.text_area :text, :rows => "5" %> +
    +
    <%= t("org_admin.questions.answer_format_label")%>
    +
    + <%= f.hidden_field :id,{ :class => "quest_id" } %> + <%= f.select :question_format_id, + options_from_collection_for_select(QuestionFormat.all.order("title"), :id, :title, question.question_format_id), + {}, :id => "#{question.id}-select-format"%> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "question_format_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_format_help_text_html"))%> +
    + +
    + + + +
    + + +
    + + +
    + +
    +
    +
    +
    <%= t("org_admin.questions.suggested_or_example_answer_label")%>
    + <% suggested_answer = question.suggested_answers.find_by_organisation_id(current_user.organisation.id) %> + <% if suggested_answer.nil? then %> + <% suggested_answer = question.suggested_answers.build %> + <%end%> + <%= f.fields_for :suggested_answers, suggested_answer do |s|%> + <%= s.hidden_field :organisation_id, :value => current_user.organisation.id %> +
      +
    • <%= s.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
    • +
    • <%= s.text_area :text, :rows => 5 %> +
    • +
    + <%end%> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "suggested_answer_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.suggested_answer_help_text_html"))%> +
    +
    +
    +
    <%= t("org_admin.questions.guidance_label")%>
    + <%= text_area_tag("question-guidance-#{question.id}", question.guidance , class: "tinymce") %> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "question_guidance_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_guidance_help_text_html"))%> +
    +
    +
    +
    <%= t("org_admin.questions.themes_label")%>
    + <%= f.collection_select(:theme_ids, + Theme.all.order("title"), + :id, :title, {:prompt => false, :include_blank => "None"}, {:multiple => true})%> +
    +
    + <%= link_to( image_tag("help_button.png"), "#", :class => "question_themes_popover", :rel => "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_themes_help_text_html"))%> +
    +
    +
    + +
    + <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> + <% if !question.section.version.published? then%> + <%= link_to t("helpers.submit.delete"), admin_destroyquestion_dmptemplate_path(:question_id => question.id), + :confirm => t("org_admin.questions.delete_message", :question_text => question.text ), :method => :delete, :class => "btn btn-primary"%> + <%end%> + <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> + <%= link_to t("helpers.submit.cancel"), "#", :class => "btn cancel cancel_edit_question" %> +
    +
    + + + +<%= render :partial => "guidance_display", locals: {question: question}%> +<%end%> diff --git a/app/views/dmptemplates/_edit_section.html.erb b/app/views/dmptemplates/_edit_section.html.erb index d13c164..2fa3108 100644 --- a/app/views/dmptemplates/_edit_section.html.erb +++ b/app/views/dmptemplates/_edit_section.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD + + +<%= form_for(section, :url => admin_updatesection_dmptemplate_path(section, :phase => phase, :edit => edit), :html => { :method => :put}) do |s| %> + <%if @open && @section_id == section.id then%> + <% toggle = 'accordion-body section-collapse in collapse'%> + <%else%> + <% toggle = 'accordion-body collapse section-collapse' %> + <%end%> + + <%if @new_sec then%> + <% toggle = 'accordion-body section-collapse in collapse'%> + <%end%> + +
    +
    +
    +
    + <%= s.text_field :title, :as => :string, :class => 'text_field', :placeholder => t('org_admin.templates.section_title_placeholder') %> + +
    +
    + +
    + + +
    +
    + + + + + + + + + +
    <%= t('org_admin.templates.phase_order_label') %><%= s.number_field :number, :in => 1..15, :class => "number_field has-tooltip", 'data-toggle' => "tooltip", 'title' => t('org_admin.templates.section_number_help_text') %>
    <%= t('org_admin.templates.desc_label') %> +
    + <%= text_area_tag("section-desc-#{section.id}", section.description , class: "tinymce") %> +
    +
    + <%= link_to( image_tag('help_button.png'), '#', :class => 'section_desc_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.templates.section_desc_help_text_html'))%> +
    +
    + +
    + <%= s.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> + <% if !section.version.published? || phase.dmptemplate.org_type == t("helpers.org_type.funder") then%> + <%= link_to t("helpers.submit.delete"), admin_destroysection_dmptemplate_path(:section_id => section.id), + :confirm => t("org_admin.templates.section_delete_message", :section_title => section.title ), :method => :delete, :class => "btn btn-primary"%> + <%end%> + <%= link_to t('helpers.submit.cancel'), :back, :class => 'btn cancel' %> +
    + <%end%> +
    + <% @questions = section.questions.order("number")%> + <%if @questions.count > 0 %> + <% question_left = @questions.count %> + <% @questions.each do |question| %> +
    +
    "> + + <%= render :partial => 'show_question', locals: {question: question} %> +
    + + +
    + + <%if question_left.to_i > 1 then %> +
    + <%else%> +
    + <%end%> + <% question_left = question_left - 1 %> + + <%end%> + <%end%> + + + <% if !section.version.published? || phase.dmptemplate.org_type == t("helpers.org_type.funder") then%> + + <%if @questions.count != 0 %> +
    + <%end%> + + + + +
    +
    + <%= hidden_field_tag :section_id, section.id, :class => "section_id" %> + <%= link_to t("org_admin.add_question_label"), '#', :class => "btn btn-primary add_question_button" %> +
    +
    + <%end%> + +
    +
    +
    +
    +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6 diff --git a/app/views/dmptemplates/_edit_suggested_answer.html.erb b/app/views/dmptemplates/_edit_suggested_answer.html.erb index e81eabc..2f78934 100644 --- a/app/views/dmptemplates/_edit_suggested_answer.html.erb +++ b/app/views/dmptemplates/_edit_suggested_answer.html.erb @@ -1,26 +1,26 @@ - -<%= form_for(suggested_answer, :url => admin_updatesuggestedanswer_dmptemplate_path(suggested_answer), :html => { :method => :put}) do |f| %> - <%= f.hidden_field :organisation_id, :value => current_user.organisation.id %> - - - - - - -
    <%= t('org_admin.questions.suggested_or_example_answer_label')%> -
      -
    • <%= f.select :is_example, {t('org_admin.questions.example_answer_label') => true, t('org_admin.questions.suggested_answer_label') => false} %>
    • -
    • <%= f.text_area :text, :rows => 5 %>
    • -
    -
    -
    - - -
    - <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> - <%= link_to t("helpers.submit.delete"), admin_destroysuggestedanswer_dmptemplate_path(:suggested_answer => suggested_answer.id), - :confirm => t("org_admin.questions.delete_suggested_answer_message", :question_text => question.text ), :method => :delete, :class => "btn btn-primary"%> - <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> - <%= link_to t('helpers.submit.cancel'), '#', :class => 'btn cancel cancel_edit_suggested_answer' %> -
    -<%end%> + +<%= form_for(suggested_answer, :url => admin_updatesuggestedanswer_dmptemplate_path(suggested_answer), :html => { :method => :put}) do |f| %> + <%= f.hidden_field :organisation_id, :value => current_user.organisation.id %> + + + + + + +
    <%= t('org_admin.questions.suggested_or_example_answer_label')%> +
      +
    • <%= f.select :is_example, {t('org_admin.questions.example_answer_label') => true, t('org_admin.questions.suggested_answer_label') => false} %>
    • +
    • <%= f.text_area :text, :rows => 5 %>
    • +
    +
    +
    + + +
    + <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> + <%= link_to t("helpers.submit.delete"), admin_destroysuggestedanswer_dmptemplate_path(:suggested_answer => suggested_answer.id), + :confirm => t("org_admin.questions.delete_suggested_answer_message", :question_text => question.text ), :method => :delete, :class => "btn btn-primary"%> + <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> + <%= link_to t('helpers.submit.cancel'), '#', :class => 'btn cancel cancel_edit_suggested_answer' %> +
    +<%end%> diff --git a/app/views/dmptemplates/_edit_template.html.erb b/app/views/dmptemplates/_edit_template.html.erb index 1a8d6f8..dbea10a 100644 --- a/app/views/dmptemplates/_edit_template.html.erb +++ b/app/views/dmptemplates/_edit_template.html.erb @@ -1,52 +1,52 @@ - - -<%= form_for(dmptemplate, :url => admin_update_dmptemplate_path(dmptemplate), :html => { :method => :put}) 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", dmptemplate.description, class: "tinymce") %> -
    -
    - <%= link_to( image_tag('help_button.png'), '#', :class => 'template_desc_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.templates.desc_help_text_html'))%> -
    -
    <%= t('org_admin.templates.published_label') %><%if dmptemplate.published? || dmptemplate.has_published_versions? then%> - <%= f.check_box :published, :as => :check_boxes %> - <%else%> - <%= t('org_admin.templates.cannot_publish')%> - <%end%> -
    <%= t('org_admin.templates.created') %> - <%= l dmptemplate.created_at.to_date, :formats => :short %> -
    <%= t('org_admin.templates.last_updated') %> - <%= l dmptemplate.updated_at.to_date, :formats => :short %> -
    - - -
    - <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> - <%= link_to t('helpers.submit.cancel'), admin_template_dmptemplate_path(dmptemplate), :class => 'btn cancel' %> -
    - -
    - + + +<%= form_for(dmptemplate, :url => admin_update_dmptemplate_path(dmptemplate), :html => { :method => :put}) 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", dmptemplate.description, class: "tinymce") %> +
    +
    + <%= link_to( image_tag('help_button.png'), '#', :class => 'template_desc_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.templates.desc_help_text_html'))%> +
    +
    <%= t('org_admin.templates.published_label') %><%if dmptemplate.published? || dmptemplate.has_published_versions? then%> + <%= f.check_box :published, :as => :check_boxes %> + <%else%> + <%= t('org_admin.templates.cannot_publish')%> + <%end%> +
    <%= t('org_admin.templates.created') %> + <%= l dmptemplate.created_at.to_date, :formats => :short %> +
    <%= t('org_admin.templates.last_updated') %> + <%= l dmptemplate.updated_at.to_date, :formats => :short %> +
    + + +
    + <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> + <%= link_to t('helpers.submit.cancel'), admin_template_dmptemplate_path(dmptemplate), :class => 'btn cancel' %> +
    + +
    + <%end%> \ No newline at end of file diff --git a/app/views/dmptemplates/_edit_version.html.erb b/app/views/dmptemplates/_edit_version.html.erb index 7e52bdf..416fdb7 100644 --- a/app/views/dmptemplates/_edit_version.html.erb +++ b/app/views/dmptemplates/_edit_version.html.erb @@ -1,47 +1,47 @@ - - - -<%= form_for(version, :url => admin_updateversion_dmptemplate_path(version, :edit => edit, :phase => phase), :html => { :method => :put}) do |f| %> - -

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

    -
    - -
    - - - - - - - - - - - - - - - -
    <%= 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.desc_label') %>
    - <%= text_area_tag("version-desc", version.description, class: "tinymce") %> -
    -
    - <%= link_to( image_tag('help_button.png'), '#', :class => 'version_desc_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.versions.desc_help_text_html'))%> -
    -
    <%= t('org_admin.templates.published_label') %><%= f.check_box :published, :as => :check_boxes %>
    - -
    - -
    - <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> - <%= link_to t('helpers.submit.cancel'), admin_phase_dmptemplate_path(phase), :class => 'btn cancel' %> -
    -
    - -<%end%> - - + + + +<%= form_for(version, :url => admin_updateversion_dmptemplate_path(version, :edit => edit, :phase => phase), :html => { :method => :put}) do |f| %> + +

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

    +
    + +
    + + + + + + + + + + + + + + + +
    <%= 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.desc_label') %>
    + <%= text_area_tag("version-desc", version.description, class: "tinymce") %> +
    +
    + <%= link_to( image_tag('help_button.png'), '#', :class => 'version_desc_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.versions.desc_help_text_html'))%> +
    +
    <%= t('org_admin.templates.published_label') %><%= f.check_box :published, :as => :check_boxes %>
    + +
    + +
    + <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> + <%= link_to t('helpers.submit.cancel'), admin_phase_dmptemplate_path(phase), :class => 'btn cancel' %> +
    +
    + +<%end%> + + \ No newline at end of file diff --git a/app/views/dmptemplates/_guidance_display.html.erb b/app/views/dmptemplates/_guidance_display.html.erb index 888f801..8438b71 100644 --- a/app/views/dmptemplates/_guidance_display.html.erb +++ b/app/views/dmptemplates/_guidance_display.html.erb @@ -1,47 +1,47 @@ - - -
    -
    - <% if !question.guidance.nil? && question.guidance != "" then %> - - <% end %> - - <% question.guidance_for_question(question, current_user.organisation).each_pair do |title,guidance| %> -
    - -
    -
    <%= raw guidance.text %>
    -
    -
    - <% end %> -
    - -
    -
    - <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> - <%= link_to t("org_admin.questions.quidance_button"), "# ", :class => "btn btn-primary add_guidance_button"%> -
    -
    - - - + + +
    +
    + <% if !question.guidance.nil? && question.guidance != "" then %> + + <% end %> + + <% question.guidance_for_question(question, current_user.organisation).each_pair do |title,guidance| %> +
    + +
    +
    <%= raw guidance.text %>
    +
    +
    + <% end %> +
    + +
    +
    + <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> + <%= link_to t("org_admin.questions.quidance_button"), "# ", :class => "btn btn-primary add_guidance_button"%> +
    +
    + + +
    \ No newline at end of file diff --git a/app/views/dmptemplates/_option_fields.html.erb b/app/views/dmptemplates/_option_fields.html.erb index ac69280..21f3e80 100644 --- a/app/views/dmptemplates/_option_fields.html.erb +++ b/app/views/dmptemplates/_option_fields.html.erb @@ -1,7 +1,7 @@ - - - <%= f.number_field :number,:in => 1..20, :class => "number_field option"%> - <%= f.text_field :text, :as => :string, :class => "small_text_field" %> - <%= f.check_box :is_default %> - <%= f.hidden_field :_destroy %><%= t('org_admin.remove_option_label') %> - + + + <%= f.number_field :number,:in => 1..20, :class => "number_field option"%> + <%= f.text_field :text, :as => :string, :class => "small_text_field" %> + <%= f.check_box :is_default %> + <%= f.hidden_field :_destroy %><%= t('org_admin.remove_option_label') %> + diff --git a/app/views/dmptemplates/_preview_question.html.erb b/app/views/dmptemplates/_preview_question.html.erb index f055bfa..79d6459 100644 --- a/app/views/dmptemplates/_preview_question.html.erb +++ b/app/views/dmptemplates/_preview_question.html.erb @@ -1,124 +1,124 @@ - - -
    - - - <% q_format = question.question_format%> -
    -
    - - <% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") then%> - <% options = question.options.order("number") %> - - - <% if q_format.title == t("helpers.checkbox") then %> - <%if !options.nil? then %> -
    - -
      - <% options.each do |op|%> -
    1. - <%end%> -
    -
    - <%end%> - - <% elsif q_format.title == t("helpers.multi_select_box") then %> - <%if !options.nil? then %> - - - <%end%> - - <% elsif q_format.title == t("helpers.radio_buttons") then%> - <%if !options.nil? then %> -
    - -
      - <% options.each do |op|%> -
    1. - <%end%> -
    -
    - <%end%> - - <% elsif q_format.title == t("helpers.dropdown") then%> - <%if !options.nil? then %> - - - <%end%> - <% end %> - - - <% suggested_answer = question.suggested_answers.find_by_organisation_id(current_user.organisation_id) %> - <% if !suggested_answer.nil? && suggested_answer.text != "" then %> -
    - - <% 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 %> -

    -
    -
    - <% end %> - -
    - - <% else %> - - - <% suggested_answer = question.suggested_answers.find_by_organisation_id(current_user.organisation_id) %> - <% if !suggested_answer.nil? && suggested_answer.text != "" then %> -
    - - <% 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 %> -

    -
    -
    - <% end %> - - <% end %> - - - - - <% if q_format.title == t("helpers.text_field") then %> - - - <%elsif q_format.title == t("helpers.text_area") then%> - - <%end%> -
    - - <%= link_to t("helpers.save"), "#", :class => "btn btn-primary", :onclick => "event.preventDefault();" %> - - <%= t("helpers.notanswered") %> - -
    -
    -
    - - - -<%= render :partial => "guidance_display", locals: {question: question}%> + + +
    + + + <% q_format = question.question_format%> +
    +
    + + <% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") then%> + <% options = question.options.order("number") %> + + + <% if q_format.title == t("helpers.checkbox") then %> + <%if !options.nil? then %> +
    + +
      + <% options.each do |op|%> +
    1. + <%end%> +
    +
    + <%end%> + + <% elsif q_format.title == t("helpers.multi_select_box") then %> + <%if !options.nil? then %> + + + <%end%> + + <% elsif q_format.title == t("helpers.radio_buttons") then%> + <%if !options.nil? then %> +
    + +
      + <% options.each do |op|%> +
    1. + <%end%> +
    +
    + <%end%> + + <% elsif q_format.title == t("helpers.dropdown") then%> + <%if !options.nil? then %> + + + <%end%> + <% end %> + + + <% suggested_answer = question.suggested_answers.find_by_organisation_id(current_user.organisation_id) %> + <% if !suggested_answer.nil? && suggested_answer.text != "" then %> +
    + + <% 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 %> +

    +
    +
    + <% end %> + +
    + + <% else %> + + + <% suggested_answer = question.suggested_answers.find_by_organisation_id(current_user.organisation_id) %> + <% if !suggested_answer.nil? && suggested_answer.text != "" then %> +
    + + <% 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 %> +

    +
    +
    + <% end %> + + <% end %> + + + + + <% if q_format.title == t("helpers.text_field") then %> + + + <%elsif q_format.title == t("helpers.text_area") then%> + + <%end%> +
    + + <%= link_to t("helpers.save"), "#", :class => "btn btn-primary", :onclick => "event.preventDefault();" %> + + <%= t("helpers.notanswered") %> + +
    +
    +
    + + + +<%= render :partial => "guidance_display", locals: {question: question}%> diff --git a/app/views/dmptemplates/_show_phase.html.erb b/app/views/dmptemplates/_show_phase.html.erb index d415e99..18c8860 100644 --- a/app/views/dmptemplates/_show_phase.html.erb +++ b/app/views/dmptemplates/_show_phase.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD

    @@ -34,4 +35,43 @@ <%= raw @phase.description %> -
    \ No newline at end of file +
    +======= + + +

    + <%= t('org_admin.templates.phase_details_label')%> + + + <% if @phase.dmptemplate.org_type != t("helpers.org_type.funder") || current_user.org_type == t("helpers.org_type.funder") then %> +
    + <%= link_to t("org_admin.templates.edit_phase_details_label"), '#', :class => "btn btn-primary", :id => "edit_phase_button"%> +
    + <%end%> +

    + +<%if @phase.dmptemplate.org_type != t("helpers.org_type.funder") then%> +
    + <%= raw t('org_admin.templates.phase_details_text_html')%> +
    +<%end%> + +
    +
    + + + + + + + + + + + + + + +
    <%= t('org_admin.templates.title_label') %><%= @phase.title %>
    <%= t('org_admin.templates.phase_order_label') %><%= @phase.number %>
    <%= t('org_admin.templates.desc_label') %><%= raw @phase.description %>
    +
    +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6 diff --git a/app/views/dmptemplates/_show_phases_sections.html.erb b/app/views/dmptemplates/_show_phases_sections.html.erb index cafef12..209a035 100644 --- a/app/views/dmptemplates/_show_phases_sections.html.erb +++ b/app/views/dmptemplates/_show_phases_sections.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD
    @@ -69,4 +70,77 @@ <%end%> +======= + + +
    + +
    +

    <%= raw phase.description %>

    +
    + +<% if phase.versions.any? then %> + + <% version = phase.versions.where("published = ?", true).first %> + <% if version.nil? then%> + <% version = phase.versions.order("updated_at DESC").first %> + <%end%> + + +
    + + + <%if phase.has_sections == true then %> + <%= link_to t("helpers.preview"), admin_previewphase_dmptemplate_path(version), :class => 'btn btn-primary'%> + <%end%> + <% if phase.latest_published_version == nil then%> + <%= link_to t("helpers.submit.delete"), admin_destroyphase_dmptemplate_path(:phase_id => phase.id), + :confirm => t("org_admin.templates.phase_delete_message", :phase_title => phase.title ), :method => :delete, :class => "btn btn-primary"%> + <%end%> + <%if phase.dmptemplate.org_type == t("helpers.org_type.funder") && current_user.org_type != t("helpers.org_type.funder") then%> + <% b_label = t('org_admin.templates.view_phase_label')%> + <%else %> + <% b_label = t('org_admin.templates.edit_phase_label')%> + <%end%> + <%= link_to b_label, admin_phase_dmptemplate_path(phase), :class => "btn btn-primary" %> + +
    + <% if version.sections.any? then %> + + + + + + + + + <% version.sections.order("number ASC").each do |section| %> + <%if (section.organisation_id == phase.dmptemplate.organisation_id ) || ( section.organisation_id == current_user.organisation_id) then%> + + + + + <%end%> + <%end%> + +
    <%= t('helpers.sections_label')%><%= t('helpers.questions_label')%>
    +

    <%= section.title %>

    +
    + <% if section.questions.any? %> + <% questions = section.questions.order("number ASC") %> +
      + <% questions.each do |ques|%> +
    • + - <%= ques.text %> +
    • + <%end%> +
    + <%end%> +
    + + <%end%> + +<%end%> + +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6
    \ No newline at end of file diff --git a/app/views/dmptemplates/_show_question.html.erb b/app/views/dmptemplates/_show_question.html.erb index 53d3f06..a809d2d 100644 --- a/app/views/dmptemplates/_show_question.html.erb +++ b/app/views/dmptemplates/_show_question.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD <%= render :partial => 'guidance_display', locals: {question: question}%> +======= + + +
    + + + + + + + + + + + + + + <%if q_format.title == t("helpers.text_field") || q_format.title == t("helpers.text_area") then %> + <%if !question.default_value.nil? then %> + + + + + <%end%> + <% end %> + + + + + + + + <% if (question.section.version.phase.dmptemplate.org_type != t("helpers.org_type.funder") && question.section.organisation_id == current_user.organisation_id ) then%> + <% suggested_answer = question.get_suggested_answer(current_user.organisation.id) %> + <% if !suggested_answer.nil? && suggested_answer.text != "" then %> + + + + + <%end%> + <%end%> + + <%if !question.guidance.nil? then %> + + + + + <%end%> + + <% themes_q = question.themes %> + <%if !themes_q.nil? then%> + + + + + <%end%> +
    <%= t('org_admin.questions.question_number_label')%><%= question.number%>
    <%= t('org_admin.questions.question_text_label')%><%= raw question.text %> +
    +
    + <% q_format = question.question_format %> + <% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") then%> +
      + <% if question.options.is_a? Option then %> +
    • - <%= question.options.text %>
    • + <% else %> + <% if !question.options.to_a.nil? then %> + <% question.options.to_a.sort_by{|op| op['number']}.each do |o| %> +
    • - <%= o.text %>
    • + <%end%> + <% end %> + <% end %> +
    + <% end %> +
    +
    <%= t('org_admin.questions.default_value_label')%><%= raw question.default_value %>
    <%= t('org_admin.questions.answer_format_label')%><%= q_format.title %> +
    + <% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") then%> + <% if question.option_comment_display == true then%> + <%= t("org_admin.questions.option_comment_display")%> + <%else%> + <%= t("org_admin.questions.option_comment_hide")%> + <%end%> + <%end%> +
    +
    + <% 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 %>
    <%= t('org_admin.questions.guidance_label')%><%= raw question.guidance %>
    <%= t('org_admin.questions.themes_label')%><% i = 1%> + <% themes_q.each do |t|%> + <%= t.title %> + <% if themes_q.count > i then%> + , + <% i +=1 %> + <% end %> + <%end%> +
    +
    + + <% if (question.section.version.phase.dmptemplate.org_type == t("helpers.org_type.funder") && question.section.organisation_id != current_user.organisation_id ) then%> + <% suggested_answer = question.get_suggested_answer(current_user.organisation.id) %> + <% if !suggested_answer.nil? && suggested_answer.text != "" then %> +
    + <%= render :partial => 'show_suggested_answer', locals: {suggested_answer: suggested_answer, question: question} %> +
    + + + <%end%> + + + + + + <%end%> + +
    + + <%if (@edit == 'true'&& question.section.organisation_id == current_user.organisation_id) || (question.section.version.phase.dmptemplate.org_type == t("helpers.org_type.funder") && question.section.organisation_id == current_user.organisation_id && current_user.org_type != t("helpers.org_type.funder")) then%> +
    + <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> + <%= link_to t("org_admin.questions.question_edit_button"), '# ', :class => "btn btn-primary edit_question_button"%> + <% if !question.section.version.published? then%> + <%= link_to t("org_admin.questions.question_delete_button"), admin_destroyquestion_dmptemplate_path(:question_id => question.id), + :confirm => t("org_admin.questions.delete_message", :question_text => question.text ), :method => :delete, :class => "btn btn-primary"%> + <%end%> +
    + <%elsif (@edit == 'false' && question.section.organisation_id != current_user.organisation_id )|| (question.section.version.phase.dmptemplate.org_type == t("helpers.org_type.funder") && question.section.organisation_id != current_user.organisation_id ) then%> + <% suggested_answer = question.get_suggested_answer(current_user.organisation.id) %> + <% if suggested_answer.nil? then %> +
    +
    + <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> + <%= link_to t("org_admin.questions.suggested_or_example_answer_button"), '# ', :class => "btn btn-primary add_suggested_answer_button"%> +
    +
    + <%end%> + <%end%> +
    +
    + + + +<%= render :partial => 'guidance_display', locals: {question: question}%> +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6 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 7507735..2c23a85 100644 --- a/app/views/dmptemplates/_show_template.html.erb +++ b/app/views/dmptemplates/_show_template.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD <% if @dmptemplate.org_type != constant("organisation_types.funder") || current_user.org_type == constant("organisation_types.funder") then %> @@ -41,4 +42,49 @@ <%= l dmptemplate.updated_at.to_date, :formats => :short %> +======= + + +<% if @dmptemplate.org_type != t("helpers.org_type.funder") || current_user.org_type == t("helpers.org_type.funder") then %> +

    +
    + <%= link_to t("org_admin.templates.edit_details"), '# ', :class => "btn btn-primary", :id => "edit_template_button"%> +
    +

    +<%end%> +
    + + + + + + + + + + + + + + + + + + + + + + +
    <%= t('org_admin.templates.title_label') %><%= dmptemplate.title %>
    <%= t('org_admin.templates.desc_label') %><% if !dmptemplate.description.nil? && dmptemplate.description != "" then %> + <%= raw dmptemplate.description %> + <%else%> + - + <%end%> +
    <%= t('org_admin.templates.published_label') %><%if dmptemplate.published || dmptemplate.has_published_versions? then%> + <%= dmptemplate.published %> + <%else%> + <%= t('org_admin.templates.cannot_publish')%> + <%end%> +
    <%= t('org_admin.templates.created') %><%= l dmptemplate.created_at.to_date, :formats => :short %>
    <%= t('org_admin.templates.last_updated') %><%= l dmptemplate.updated_at.to_date, :formats => :short %>
    +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6
    \ 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 f80d245..3228a3d 100644 --- a/app/views/dmptemplates/admin_index.html.erb +++ b/app/views/dmptemplates/admin_index.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD <%= stylesheet_link_tag "admin" %>

    @@ -150,4 +151,159 @@ <%end%> -<%end%> \ No newline at end of file +<%end%> +======= +<%= stylesheet_link_tag "admin" %> + +

    + <%= t('org_admin.templates_label') %> +

    +
    +

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

    + +
    + <%= raw t('org_admin.templates.create_own_template_text_html')%> +
    +
    + +
    + <%= link_to t("org_admin.templates.create_template"), + admin_new_dmptemplate_path, + :class => 'btn btn-primary' %> +
    +
    +
    + + +<% if @dmptemplates_own.count > 0 then %> + + + + + + + + + + + + <% @dmptemplates_own.each do |org_template| %> + + + + + + + + + <%end%> + +
    <%= t('org_admin.templates.title_label') %><%= t('org_admin.templates.desc_label') %><%= t('org_admin.templates.published_label') %><%= t('org_admin.templates.last_updated') %><%= t('org_admin.templates.actions') %>
    + <%= org_template.title%> + + <%= raw org_template.description.truncate(90, omission: t('helpers.truncate_continued')) %> + + <%= org_template.published %> + + <% last_temp_updated = org_template.updated_at %> + <% org_template.phases.each do |phase|%> + <% if phase.versions.any? then%> + <% phase.versions.each do |version| %> + <% if org_template.updated_at.to_date < version.updated_at.to_date then %> + <% last_temp_updated = version.updated_at %> + <%end%> + <%end%> + <%end%> + <%end%> + <%= l last_temp_updated.to_date, :formats => :short %> + + <%if current_user.is_org_admin? then%> + <% b_label = t('helpers.submit.edit')%> + <%else%> + <% b_label = t('helpers.view')%> + <%end%> + <%= link_to b_label, admin_template_dmptemplate_path(org_template), :class => "dmp_table_link"%> +
    + +<%end%> + +
    +
    + + +<% if current_user.org_type != t("helpers.org_type.funder") then %> +

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

    + + + <% if @dmptemplates_funders.count > 0 then %> + + + + + + + + + + + + + + <% @dmptemplates_funders.each do |org_template| %> + <% if org_template.published? ||org_template.has_customisations?(current_user.organisation_id, org_template) then %> + + + + + + + + <%end%> + <%end%> + +
    <%= t('org_admin.templates.title_label') %><%= t('org_admin.templates.desc_label') %><%= t('org_admin.templates.published_label') %><%= t('org_admin.templates.last_updated') %><%= t('org_admin.templates.actions') %>
    + <%= org_template.title%> + + <%= raw org_template.description.truncate(90, omission: t('helpers.truncate_continued')) %> + + <%if org_template.published? then %> + <%= org_template.published%> + <%else%> + <%= t("helpers.false_lowercase")%> + <%end%> + + <% last_updated = org_template.updated_at %> + <% org_template.phases.each do |phase|%> + <% if phase.versions.any? then%> + <% phase.versions.each do |version| %> + <% if org_template.updated_at.to_date < version.updated_at.to_date then %> + <% last_updated = version.updated_at %> + <%end%> + <%end%> + <%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.has_customisations?(current_user.organisation_id, org_template) then%> + <% b_label = t("org_admin.templates.edit_customisation")%> + <%else%> + <% b_label = t("org_admin.templates.customise")%> + <%end%> + <%else%> + <% b_label = t("helpers.submit.edit")%> + <%end%> + <%else%> + <% b_label = t("helpers.view")%> + <%end%> + <%= link_to b_label, admin_template_dmptemplate_path(org_template), :class => "dmp_table_link"%> +
    + <%end%> +<%end%> +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6 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 f6bfa2d..76f8953 100644 --- a/app/views/dmptemplates/admin_phase.html.erb +++ b/app/views/dmptemplates/admin_phase.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD <%- model_class = Phase -%> <%= stylesheet_link_tag "admin" %> <% javascript 'admin.js' %> @@ -78,4 +79,86 @@ <%end%> +======= +<%- model_class = Phase -%> +<%= stylesheet_link_tag "admin" %> +<% javascript 'admin.js' %> + +

    + <%= @phase.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: @phase.dmptemplate, active: @phase.id} %> + + +
    +
    + + +
    +
    + + +
    + <%= 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 %> + + + + <%= render :partial => "versions_table", locals: {phase: @phase}%> + <%end%> + + + <% if @edit == "false" || (@phase.dmptemplate.org_type == t("helpers.org_type.funder") && current_user.org_type != t("helpers.org_type.funder")) then%> + <%= render :partial => 'show_version', locals: {version: @version}%> + <%elsif @edit == "true" || current_user.org_type == t("helpers.org_type.funder") then %> + <%= render :partial => 'edit_version', locals: {version: @version, edit: @edit, phase: @phase} %> + <%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%> + <%= 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 %> + +
    +
    + + + + <% if !@version.published? || (@phase.dmptemplate.org_type == t("helpers.org_type.funder") && current_user.org_type != t("helpers.org_type.funder"))then %> + + + + + +
    +
    + <%= link_to t('org_admin.add_section_label'),'#', :id => 'add_section_button', :class =>'btn btn-primary' %> +
    +
    + <%end%> + + +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6 <%= tinymce :content_css => asset_path('application.css') %> \ No newline at end of file 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 2820939..3fe01b9 100644 --- a/app/views/dmptemplates/admin_template.html.erb +++ b/app/views/dmptemplates/admin_template.html.erb @@ -1,3 +1,4 @@ +<<<<<<< HEAD <%= stylesheet_link_tag "admin" %> <% javascript 'admin.js' %> @@ -58,4 +59,67 @@ <%end%>
    -<%= tinymce :content_css => asset_path('application.css') %> \ No newline at end of file +<%= tinymce :content_css => asset_path('application.css') %> +======= +<%= 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: "show_template"} %> + + +
    +
    + <% if @dmptemplate.org_type != t("helpers.org_type.funder") || current_user.org_type == t("helpers.org_type.funder") then %> + + <%end%> +
    + <%= render :partial => "show_template", locals: {dmptemplate: @dmptemplate}%> +
    +
    + + <% if !@dmptemplate.phases.nil? then %> + <% if @dmptemplate.phases.count == 1 then %> + <% @dmptemplate.phases.each do |phase| %> + + <%= render :partial => 'show_phases_sections', locals: {phase: phase}%> + <%end%> + <%else%> + <% @dmptemplate.phases.order(:number).each do |phase| %> +
    +
    + +
    +
    + + <%= render :partial => 'show_phases_sections', locals: {phase: phase}%> +
    +
    +
    +
    + <%end%> + <%end%> + <%end%> +
    + +<%= tinymce :content_css => asset_path('application.css') %> +>>>>>>> 5081913e85a4cd405917545a8559aaaba67db1c6 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%> -
    -
    - - - -