diff --git a/.travis.yml b/.travis.yml index d126eee..5c2dc30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +<<<<<<< HEAD language: ruby rvm: - 2.2.2 @@ -13,3 +14,20 @@ 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 +>>>>>>> bea115faeb6f8344ca4e7e582a78f78dcc091c2c diff --git a/Gemfile b/Gemfile index 02c57ef..e36a90c 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ ruby '>= 2.2.2' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # RAILS gem 'rails', '4.2.7' gem 'railties' @@ -10,35 +10,35 @@ # GEMS ADDED TO HELP HANDLE RAILS MIGRATION FROM 3.x to 4.2 # THESE GEMS HELP SUPPORT DEPRACATED FUNCTIONALITY AND WILL LOSE SUPPORT IN FUTURE VERSIONS # WE SHOULD CONSIDER BRINGING THE CODE UP TO DATE INSTEAD -gem 'protected_attributes' # Provides attr_accessor functions -gem 'responders', '~> 2.0' # Allows use of respond_with and respond_to in controllers +gem 'protected_attributes' # Provides attr_accessor functions +gem 'responders', '~> 2.0' # Allows use of respond_with and respond_to in controllers -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # DATABASE/SERVER gem 'mysql2', '~> 0.3.18' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # JS <-> RUBY BRIDGE gem 'libv8' gem 'therubyracer', '>=0.11.4', platforms: :ruby -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # JSON DSL - USED BY API gem 'jbuilder' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # CLONE ACTIVERECORD MODELS AND ASSOCIATIONS gem 'amoeba' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # SLUGS/PERMALINKS gem 'friendly_id' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # SUPER ADMIN SECTION gem 'activeadmin', github: 'activeadmin' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # USERS # devise for user authentication gem 'devise' @@ -48,47 +48,47 @@ #rolify for roles gem 'rolify' # Gems for repository integration -gem 'cancancan' +gem 'pundit' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # SETTINGS FOR TEMPLATES AND PLANS (FONTS, COLUMN LAYOUTS, ETC) gem 'ledermann-rails-settings' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # VIEWS gem 'sass-rails' -gem 'less-rails' # WE SHOULD PROBABLY USE SASS OR LESS NOT BOTH +gem 'less-rails' # WE SHOULD PROBABLY USE SASS OR LESS NOT BOTH gem 'jquery-rails' gem 'twitter-bootstrap-rails', '2.2.8' -gem 'tinymce-rails' # WYSIWYG EDITOR -gem 'contact_us', '>= 1.2.0' # COULD BE EASILY REPLACED WITH OUR OWN CODE +gem 'tinymce-rails' # WYSIWYG EDITOR +gem 'contact_us', '>= 1.2.0' # COULD BE EASILY REPLACED WITH OUR OWN CODE gem 'recaptcha' -gem 'dragonfly' # LOGO UPLOAD +gem 'dragonfly' # LOGO UPLOAD -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # EXPORTING gem 'thin' gem 'wicked_pdf' gem 'htmltoword' gem 'feedjira' -gem 'caracal' # WORD DOC EXPORTING +gem 'caracal' # WORD DOC EXPORTING gem 'caracal-rails' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # INTERNATIONALIZATION -gem "i18n-js", ">= 3.0.0.rc11" #damodar added TODO: explain +gem "i18n-js", ">= 3.0.0.rc11" #damodar added TODO: explain -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # API gem 'swagger-docs' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # CODE DOCUMENTATION gem 'yard' gem 'redcarpet' -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # ENVIRONMENT SPECIFIC DEPENDENCIES group :development, :test do @@ -111,8 +111,9 @@ gem 'uglifier' # JS minifier end -# --------------------------------------------------------------------------------------------- +# ------------------------------------------------ # GEMS THAT ARE NO LONGER IN USE +# # gem 'rails-observers' # UNUSED OBSERVERS FOR ACTIVERECORD ... PHASED OUT IN RAILS 5.0 # gem 'actionpack-page_caching' # UNUSED BUT LOOKS PROMISING FOR STATIC PAGES # gem 'actionpack-action_caching' # UNUSED BUT LOOKS PROMISING FOR FAIRLY STATIC PAGES BEHIND AUTH diff --git a/Gemfile.lock b/Gemfile.lock index 39a0c98..31724f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,10 @@ GIT remote: git://github.com/activeadmin/activeadmin.git +<<<<<<< HEAD revision: cc178ad0ebe1b74729eeaa59d5c7ad9b82ed7837 +======= + revision: 0a5a15b88bffbe5efad7ff2a072ec4fe6eb09511 +>>>>>>> master specs: activeadmin (1.0.0.pre4) arbre (~> 1.0, >= 1.0.2) @@ -74,8 +78,12 @@ thor (~> 0.19) builder (3.2.2) byebug (9.0.5) +<<<<<<< HEAD cancancan (1.15.0) capybara (2.8.0) +======= + capybara (2.8.1) +>>>>>>> master addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -144,7 +152,7 @@ nokogiri rubyzip (>= 1.0) i18n (0.7.0) - i18n-js (3.0.0.rc13) + i18n-js (3.0.0.rc14) i18n (~> 0.6, >= 0.6.6) inherited_resources (1.6.0) actionpack (>= 3.2, < 5) @@ -154,7 +162,7 @@ jbuilder (2.6.0) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) - jquery-rails (4.1.1) + jquery-rails (4.2.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -219,6 +227,8 @@ activerecord (>= 3.0) protected_attributes (1.1.3) activemodel (>= 4.0.1, < 5.0) + pundit (1.1.0) + activesupport (>= 3.0.0) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -273,7 +283,7 @@ sprockets (3.7.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.1.1) + sprockets-rails (3.2.0) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) @@ -290,7 +300,7 @@ thor (0.19.1) thread_safe (0.3.5) tilt (2.0.5) - tinymce-rails (4.4.1) + tinymce-rails (4.4.2) railties (>= 3.1.1) twitter-bootstrap-rails (2.2.8) actionpack (>= 3.1) @@ -299,7 +309,7 @@ railties (>= 3.1) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.1) + uglifier (3.0.2) execjs (>= 0.3.0, < 3) warden (1.2.6) rack (>= 1.0) @@ -308,7 +318,7 @@ binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) - wicked_pdf (1.0.6) + wicked_pdf (1.1.0) xpath (2.0.0) nokogiri (~> 1.3) yard (0.9.5) @@ -322,7 +332,6 @@ better_errors binding_of_caller byebug - cancancan caracal caracal-rails contact_us (>= 1.2.0) @@ -344,6 +353,7 @@ omniauth omniauth-shibboleth protected_attributes + pundit rack-test rails (= 4.2.7) railties diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index c0aac55..45e9f4e 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -129,9 +129,10 @@ } }); $('#phases_select').show(); - $('#versions_select').hide(); - $('#sections_select').hide(); - $('#questions_select').hide(); + //$('#versions_select').hide(); + //$('#sections_select').hide(); + //$('#questions_select').hide(); + return false; }); $('#phases_select').change(function() { @@ -143,10 +144,11 @@ phase_id : $('#phases_select').val() } }); - $('#phases_select').show(); + //$('#phases_select').show(); $('#versions_select').show(); - $('#sections_select').hide(); - $('#questions_select').hide(); + //$('#sections_select').hide(); + //$('#questions_select').hide(); + return false; }); $('#versions_select').change(function() { $.ajax({ @@ -157,10 +159,11 @@ version_id : $('#versions_select').val() } }); - $('#phases_select').show(); - $('#versions_select').show(); + //$('#phases_select').show(); + //$('#versions_select').show(); $('#sections_select').show(); - $('#questions_select').hide(); + //$('#questions_select').show(); + return false; }); $('#sections_select').change(function() { $.ajax({ @@ -171,9 +174,9 @@ section_id : $('#sections_select').val() } }); - $('#phases_select').show(); - $('#versions_select').show(); - $('#sections_select').show(); + //$('#phases_select').show(); + //$('#versions_select').show(); + //$('#sections_select').show(); $('#questions_select').show(); }); diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index 08617ed..f630d8c 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -459,6 +459,11 @@ margin-left:0px; } +ul.bullet { + list-style-type: disc; + margin-left: 20px; +} + hr.orange_break_line{ clear: both; margin-top: 40px; @@ -1900,4 +1905,4 @@ tr.new_option_before { display: none; -} \ No newline at end of file +} diff --git a/app/controllers/api/v0/base_controller.rb b/app/controllers/api/v0/base_controller.rb index 4d76e83..7e939fd 100644 --- a/app/controllers/api/v0/base_controller.rb +++ b/app/controllers/api/v0/base_controller.rb @@ -107,7 +107,7 @@ @token = token @user = User.find_by(api_token: token) # if no user found, return false, otherwise true - !@user.nil? + !@user.nil? && @user.can_use_api? else false end diff --git a/app/controllers/api/v0/statistics_controller.rb b/app/controllers/api/v0/statistics_controller.rb index 0709a06..ec21140 100644 --- a/app/controllers/api/v0/statistics_controller.rb +++ b/app/controllers/api/v0/statistics_controller.rb @@ -92,7 +92,7 @@ # takes in an array of active_reccords and restricts the range of dates # to those specified in the params # - # @params objects [Array] any active_reccord reccords which + # @param objects [Array] any active_reccord reccords which # have the "created_at" field specified # @return [Array] filtered list of objects def restrict_date_range( objects ) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ecca66a..5eb574e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,14 +2,17 @@ protect_from_forgery with: :exception include GlobalHelpers + include Pundit helper_method GlobalHelpers.instance_methods # Override build_footer method in ActiveAdmin::Views::Pages require 'active_admin_views_pages_base.rb' - rescue_from CanCan::AccessDenied do |exception| - redirect_to root_url, :alert => exception.message + rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized + + def user_not_authorized + render(file: File.join(Rails.root, 'public/403.html'), status: 403, layout: false) end before_filter :set_locale @@ -25,6 +28,7 @@ elsif user_signed_in? and !current_user[:language_id].nil? I18n.locale = Language.find_by_id(current_user[:language_id]).abbreviation # if user has set preferred language use it + elsif user_signed_in? and current_user.organisation.present? and !current_user.organisation[:language_id].nil? I18n.locale = Language.find_by_id(current_user.organisation[:language_id]).abbreviation # use user's organization language, keep in mine the "OTHER ORG" edge case which should use default language @@ -67,7 +71,8 @@ end def authenticate_admin! - redirect_to root_path unless user_signed_in? && current_user.is_admin? + # currently if admin has any super-admin task, they can view the super-admin + redirect_to root_path unless user_signed_in? && (current_user.can_add_orgs? || current_user.can_change_org? || current_user.can_super_admin?) end def get_plan_list_columns diff --git a/app/controllers/dmptemplates_controller.rb b/app/controllers/dmptemplates_controller.rb index f80d93f..817e961 100644 --- a/app/controllers/dmptemplates_controller.rb +++ b/app/controllers/dmptemplates_controller.rb @@ -7,34 +7,25 @@ # GET /dmptemplates # GET /dmptemplates.json def admin_index - if user_signed_in? && current_user.is_org_admin? then - #institutional templates - @dmptemplates_own = Dmptemplate.own_institutional_templates(current_user.organisation_id) - - #funders templates - @dmptemplates_funders = Dmptemplate.funders_templates - - respond_to do |format| - format.html # index.html.erb - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + authorize Dmptemplate + #institutional templates + @dmptemplates_own = Dmptemplate.own_institutional_templates(current_user.organisation_id) + #funders templates + @dmptemplates_funders = Dmptemplate.funders_templates + respond_to do |format| + format.html # index.html.erb + end end # GET /dmptemplates/1 # GET /dmptemplates/1.json def admin_template - if user_signed_in? && current_user.is_org_admin? then - @dmptemplate = Dmptemplate.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render json: @dmptemplate } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @dmptemplate = Dmptemplate.find(params[:id]) + authorize @dmptemplate + respond_to do |format| + format.html # show.html.erb + format.json { render json: @dmptemplate } + end end @@ -42,60 +33,48 @@ # PUT /dmptemplates/1 # PUT /dmptemplates/1.json def admin_update - if user_signed_in? && current_user.is_org_admin? then - @dmptemplate = Dmptemplate.find(params[:id]) - @dmptemplate.description = params["template-desc"] - - respond_to do |format| - if @dmptemplate.update_attributes(params[:dmptemplate]) - format.html { redirect_to admin_template_dmptemplate_path(params[:dmptemplate]), notice: I18n.t('org_admin.templates.updated_message') } - format.json { head :no_content } - else - format.html { render action: "edit" } - format.json { render json: @dmptemplate.errors, status: :unprocessable_entity } - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @dmptemplate = Dmptemplate.find(params[:id]) + authorize @dmptemplate + @dmptemplate.description = params["template-desc"] + respond_to do |format| + if @dmptemplate.update_attributes(params[:dmptemplate]) + format.html { redirect_to admin_template_dmptemplate_path(params[:dmptemplate]), notice: I18n.t('org_admin.templates.updated_message') } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @dmptemplate.errors, status: :unprocessable_entity } + end + end end - # GET /dmptemplates/new + # GET /dmptemplates/new # GET /dmptemplates/new.json def admin_new - if user_signed_in? && current_user.is_org_admin? then - @dmptemplate = Dmptemplate.new - - respond_to do |format| - format.html # new.html.erb - format.json { render json: @dmptemplate } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @dmptemplate = Dmptemplate.new + authorize @dmptemplate + respond_to do |format| + format.html # new.html.erb + format.json { render json: @dmptemplate } + end end # POST /dmptemplates # POST /dmptemplates.json def admin_create - if user_signed_in? && current_user.is_org_admin? then - @dmptemplate = Dmptemplate.new(params[:dmptemplate]) - @dmptemplate.organisation_id = current_user.organisation.id - @dmptemplate.description = params['template-desc'] - - respond_to do |format| - if @dmptemplate.save - format.html { redirect_to admin_template_dmptemplate_path(@dmptemplate), notice: I18n.t('org_admin.templates.created_message') } - format.json { render json: @dmptemplate, status: :created, location: @dmptemplate } - else - format.html { render action: "admin_new" } - format.json { render json: @dmptemplate.errors, status: :unprocessable_entity } - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @dmptemplate = Dmptemplate.new(params[:dmptemplate]) + @dmptemplate.organisation_id = current_user.organisation.id + @dmptemplate.description = params['template-desc'] + authorize @dmptemplate + respond_to do |format| + if @dmptemplate.save + format.html { redirect_to admin_template_dmptemplate_path(@dmptemplate), notice: I18n.t('org_admin.templates.created_message') } + format.json { render json: @dmptemplate, status: :created, location: @dmptemplate } + else + format.html { render action: "admin_new" } + format.json { render json: @dmptemplate.errors, status: :unprocessable_entity } + end + end end @@ -103,17 +82,13 @@ # DELETE /dmptemplates/1 # DELETE /dmptemplates/1.json def admin_destroy - if user_signed_in? && current_user.is_org_admin? then - @dmptemplate = Dmptemplate.find(params[:id]) - @dmptemplate.destroy - - respond_to do |format| - format.html { redirect_to admin_index_dmptemplate_path } - format.json { head :no_content } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @dmptemplate = Dmptemplate.find(params[:id]) + authorize @dmptemplate + @dmptemplate.destroy + respond_to do |format| + format.html { redirect_to admin_index_dmptemplate_path } + format.json { head :no_content } + end end @@ -122,449 +97,397 @@ #show and edit a phase of the template def admin_phase - if user_signed_in? && current_user.is_org_admin? then - - @phase = Phase.find(params[:id]) - - if !params.has_key?(:version_id) then - @edit = 'false' - #check for the most recent published version, if none is available then return the most recent one - versions = @phase.versions.where('published = ?', true).order('updated_at DESC') - if versions.any?() then - @version = versions.first - else - @version = @phase.versions.order('updated_at DESC').first - end - # When the version_id is passed as an argument + @phase = Phase.find(params[:id]) + authorize @phase.dmptemplate + if !params.has_key?(:version_id) then + @edit = 'false' + #check for the most recent published version, if none is available then return the most recent one + versions = @phase.versions.where('published = ?', true).order('updated_at DESC') + if versions.any?() then + @version = versions.first else - @edit = params[:edit] - @version = Version.find(params[:version_id]) + @version = @phase.versions.order('updated_at DESC').first end - - #verify if there are any sections if not create one - @sections = @version.sections - if !@sections.any?() || @sections.count == 0 then - @section = @version.sections.build - @section.title = '' - @section.version_id = params[:version_id] - @section.number = 1 - @section.organisation_id = current_user.organisation.id - @section.published = true - @section.save - @new_sec = true - end - - #verify if section_id has been passed, if so then open that section - if params.has_key?(:section_id) then - @open = true - @section_id = params[:section_id].to_i - end - - if params.has_key?(:question_id) then - @question_id = params[:question_id].to_i - end - - respond_to do |format| - format.html - end + # When the version_id is passed as an argument + else + @edit = params[:edit] + @version = Version.find(params[:version_id]) + end + #verify if there are any sections if not create one + @sections = @version.sections + if !@sections.any?() || @sections.count == 0 then + @section = @version.sections.build + @section.title = '' + @section.version_id = params[:version_id] + @section.number = 1 + @section.organisation_id = current_user.organisation.id + @section.published = true + @section.save + @new_sec = true + end + #verify if section_id has been passed, if so then open that section + if params.has_key?(:section_id) then + @open = true + @section_id = params[:section_id].to_i + end + if params.has_key?(:question_id) then + @question_id = params[:question_id].to_i + end + respond_to do |format| + format.html end end - + + #preview a phase def admin_previewphase - if user_signed_in? && current_user.is_org_admin? then - - @version = Version.find(params[:id]) - - - respond_to do |format| - format.html - end - end + @version = Version.find(params[:id]) + authorize @version.phase.dmptemplate + respond_to do |format| + format.html + end end #add a new phase to a template def admin_addphase - if user_signed_in? && current_user.is_org_admin? then - @dmptemplate = Dmptemplate.find(params[:id]) - @phase = Phase.new - if @dmptemplate.phases.count == 0 then - @phase.number = '1' - else - @phase.number = @dmptemplate.phases.count + 1 - end - - respond_to do |format| - format.html - end + @dmptemplate = Dmptemplate.find(params[:id]) + @phase = Phase.new + authorize @dmptemplate + if @dmptemplate.phases.count == 0 then + @phase.number = '1' + else + @phase.number = @dmptemplate.phases.count + 1 end + respond_to do |format| + format.html + end end + #create a phase def admin_createphase - if user_signed_in? && current_user.is_org_admin? then @phase = Phase.new(params[:phase]) - @phase.description = params["phase-desc"] - @version = @phase.versions.build - @version.title = "#{@phase.title} v.1" - @version.phase_id = @phase.id - @version.number = 1 - @version.published = false - - respond_to do |format| - if @phase.save - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @phase.errors, status: :unprocessable_entity } - end - end + authorize @phase.dmptemplate + @phase.description = params["phase-desc"] + @version = @phase.versions.build + @version.title = "#{@phase.title} v.1" + @version.phase_id = @phase.id + @version.number = 1 + @version.published = false + respond_to do |format| + if @phase.save + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @phase.errors, status: :unprocessable_entity } + end end end #update a phase of a template def admin_updatephase - if user_signed_in? && current_user.is_org_admin? then - @phase = Phase.find(params[:id]) + @phase = Phase.find(params[:id]) + authorize @phase.dmptemplate @phase.description = params["phase-desc"] - - respond_to do |format| - if @phase.update_attributes(params[:phase]) - format.html { redirect_to admin_phase_dmptemplate_path(@phase), notice: I18n.t('org_admin.templates.updated_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @phase.errors, status: :unprocessable_entity } - end - end - end + respond_to do |format| + if @phase.update_attributes(params[:phase]) + format.html { redirect_to admin_phase_dmptemplate_path(@phase), notice: I18n.t('org_admin.templates.updated_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @phase.errors, status: :unprocessable_entity } + end + end end #delete a version, sections and questions def admin_destroyphase - if user_signed_in? && current_user.is_org_admin? then - @phase = Phase.find(params[:phase_id]) - @dmptemplate = @phase.dmptemplate - @phase.destroy - - respond_to do |format| - format.html { redirect_to admin_template_dmptemplate_path(@dmptemplate), notice: I18n.t('org_admin.templates.destroyed_message') } - format.json { head :no_content } - end - end + @phase = Phase.find(params[:phase_id]) + authorize @phase.dmptemplate + @dmptemplate = @phase.dmptemplate + @phase.destroy + respond_to do |format| + format.html { redirect_to admin_template_dmptemplate_path(@dmptemplate), notice: I18n.t('org_admin.templates.destroyed_message') } + format.json { head :no_content } + end end # VERSIONS #update a version of a template def admin_updateversion - if user_signed_in? && current_user.is_org_admin? then - @version = Version.find(params[:id]) - @version.description = params["version-desc"] - @phase = @version.phase + @version = Version.find(params[:id]) + authorize @version.phase.dmptemplate + @version.description = params["version-desc"] + @phase = @version.phase + if @version.published && !@phase.dmptemplate.published then + @phase.dmptemplate.published = true + end + if @version.published == true then + @all_versions = @phase.versions.where('published = ?', true) + @all_versions.each do |v| + if v.id != @version.id && v.published == true then + v.published = false + v.save + end + end + end + respond_to do |format| + if @version.update_attributes(params[:version]) + format.html { redirect_to admin_phase_dmptemplate_path(@phase, :version_id => @version.id, :edit => 'false'), notice: I18n.t('org_admin.templates.updated_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @version.errors, status: :unprocessable_entity } + end + end + end - if @version.published && !@phase.dmptemplate.published then - @phase.dmptemplate.published = true - end - - if @version.published == true then - @all_versions = @phase.versions.where('published = ?', true) - @all_versions.each do |v| - if v.id != @version.id && v.published == true then - v.published = false - v.save - end - end - end - - respond_to do |format| - if @version.update_attributes(params[:version]) - format.html { redirect_to admin_phase_dmptemplate_path(@phase, :version_id => @version.id, :edit => 'false'), notice: I18n.t('org_admin.templates.updated_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @version.errors, status: :unprocessable_entity } - end - end - end - end - - #clone a version of a template - def admin_cloneversion - if user_signed_in? && current_user.is_org_admin? then - @old_version = Version.find(params[:version_id]) - @version = @old_version.amoeba_dup - @phase = @version.phase - - respond_to do |format| - - if @version.save - format.html { redirect_to admin_phase_dmptemplate_path(@phase, :version_id => @version.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @version.errors, status: :unprocessable_entity } - end - end - end - end + #clone a version of a template + def admin_cloneversion + @old_version = Version.find(params[:version_id]) + authorize @version.phase.dmptemplate + @version = @old_version.amoeba_dup + @phase = @version.phase + respond_to do |format| + if @version.save + format.html { redirect_to admin_phase_dmptemplate_path(@phase, :version_id => @version.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @version.errors, status: :unprocessable_entity } + end + end + end #delete a version, sections and questions def admin_destroyversion - if user_signed_in? && current_user.is_org_admin? then - @version = Version.find(params[:version_id]) - @phase = @version.phase - @version.destroy - - respond_to do |format| - format.html { redirect_to admin_phase_dmptemplate_path(@phase), notice: I18n.t('org_admin.templates.destroyed_message') } - format.json { head :no_content } - end - end + @version = Version.find(params[:version_id]) + authorize @version.phase.dmptemplate + @phase = @version.phase + @version.destroy + respond_to do |format| + format.html { redirect_to admin_phase_dmptemplate_path(@phase), notice: I18n.t('org_admin.templates.destroyed_message') } + format.json { head :no_content } + end end + # SECTIONS #create a section def admin_createsection - if user_signed_in? && current_user.is_org_admin? then - @section = Section.new(params[:section]) - @section.description = params["section-desc"] - - respond_to do |format| - if @section.save - format.html { redirect_to admin_phase_dmptemplate_path(:id => @section.version.phase_id, :version_id => @section.version_id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @section.errors, status: :unprocessable_entity } - end - end + @section = Section.new(params[:section]) + authorize @section.version.phase.dmptemplate + @section.description = params["section-desc"] + respond_to do |format| + if @section.save + format.html { redirect_to admin_phase_dmptemplate_path(:id => @section.version.phase_id, :version_id => @section.version_id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @section.errors, status: :unprocessable_entity } + end end end #update a section of a template def admin_updatesection - if user_signed_in? && current_user.is_org_admin? then - @section = Section.find(params[:id]) - @section.description = params["section-desc-#{params[:id]}"] - @version = @section.version - @phase = @version.phase - - respond_to do |format| - if @section.update_attributes(params[:section]) - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id , :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @section.errors, status: :unprocessable_entity } - end - end - end + @section = Section.find(params[:id]) + authorize @section.version.phase.dmptemplate + @section.description = params["section-desc-#{params[:id]}"] + @version = @section.version + @phase = @version.phase + respond_to do |format| + if @section.update_attributes(params[:section]) + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id , :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @section.errors, status: :unprocessable_entity } + end + end end #delete a section and questions def admin_destroysection - if user_signed_in? && current_user.is_org_admin? then - @section = Section.find(params[:section_id]) - @version = @section.version - @phase = @version.phase - @section.destroy - - respond_to do |format| - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :edit => 'true' ), notice: I18n.t('org_admin.templates.destroyed_message') } - format.json { head :no_content } - end - end - end + @section = Section.find(params[:section_id]) + authorize @section.version.phase.dmptemplate + @version = @section.version + @phase = @version.phase + @section.destroy + respond_to do |format| + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :edit => 'true' ), notice: I18n.t('org_admin.templates.destroyed_message') } + format.json { head :no_content } + end + end # QUESTIONS #create a question def admin_createquestion - if user_signed_in? && current_user.is_org_admin? then @question = Question.new(params[:question]) - @question.guidance = params["new-question-guidance"] - @question.default_value = params["new-question-default-value"] - - respond_to do |format| - if @question.save - format.html { redirect_to admin_phase_dmptemplate_path(:id => @question.section.version.phase_id, :version_id => @question.section.version_id, :section_id => @question.section_id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @question.errors, status: :unprocessable_entity } - end - end + authorize @question.section.version.phase.dmptemplate + @question.guidance = params["new-question-guidance"] + @question.default_value = params["new-question-default-value"] + respond_to do |format| + if @question.save + format.html { redirect_to admin_phase_dmptemplate_path(:id => @question.section.version.phase_id, :version_id => @question.section.version_id, :section_id => @question.section_id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @question.errors, status: :unprocessable_entity } + end end - end + end #update a question of a template def admin_updatequestion - if user_signed_in? && current_user.is_org_admin? then - @question = Question.find(params[:id]) - @question.guidance = params["question-guidance-#{params[:id]}"] - @question.default_value = params["question-default-value-#{params[:id]}"] - @section = @question.section - @version = @section.version - @phase = @version.phase - - respond_to do |format| - - -puts "PARAMS: #{params[:question]}" - - if @question.update_attributes(params[:question]) - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @question.errors, status: :unprocessable_entity } - end - end - end - end + @question = Question.find(params[:id]) + authorize @question.section.version.phase.dmptemplate + @question.guidance = params["question-guidance-#{params[:id]}"] + @question.default_value = params["question-default-value-#{params[:id]}"] + @section = @question.section + @version = @section.version + @phase = @version.phase + respond_to do |format| + if @question.update_attributes(params[:question]) + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @question.errors, status: :unprocessable_entity } + end + end + end #delete a version, sections and questions def admin_destroyquestion - if user_signed_in? && current_user.is_org_admin? then - @question = Question.find(params[:question_id]) - @section = @question.section - @version = @section.version - @phase = @version.phase - @question.destroy - - respond_to do |format| - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') } - format.json { head :no_content } - end - end + @question = Question.find(params[:question_id]) + authorize @question.section.version.phase.dmptemplate + @section = @question.section + @version = @section.version + @phase = @version.phase + @question.destroy + respond_to do |format| + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') } + format.json { head :no_content } + end end #SUGGESTED ANSWERS #create suggested answers def admin_createsuggestedanswer - if user_signed_in? && current_user.is_org_admin? then - @suggested_answer = SuggestedAnswer.new(params[:suggested_answer]) + @suggested_answer = SuggestedAnswer.new(params[:suggested_answer]) + authorize @suggested_answer.question.section.version.phase.dmptemplate + respond_to do |format| + if @suggested_answer.save + format.html { redirect_to admin_phase_dmptemplate_path(:id => @suggested_answer.question.section.version.phase_id, :version_id => @suggested_answer.question.section.version_id, :section_id => @suggested_answer.question.section_id, :question_id => @suggested_answer.question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @suggested_answer.errors, status: :unprocessable_entity } + end + end + end - respond_to do |format| - if @suggested_answer.save - format.html { redirect_to admin_phase_dmptemplate_path(:id => @suggested_answer.question.section.version.phase_id, :version_id => @suggested_answer.question.section.version_id, :section_id => @suggested_answer.question.section_id, :question_id => @suggested_answer.question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @suggested_answer.errors, status: :unprocessable_entity } - end - end - end - end #update a suggested answer of a template def admin_updatesuggestedanswer - if user_signed_in? && current_user.is_org_admin? then - @suggested_answer = SuggestedAnswer.find(params[:id]) - @question = @suggested_answer.question - @section = @question.section - @version = @section.version - @phase = @version.phase + @suggested_answer = SuggestedAnswer.find(params[:id]) + authorize @suggested_answer.question.section.version.phase.dmptemplate + @question = @suggested_answer.question + @section = @question.section + @version = @section.version + @phase = @version.phase - respond_to do |format| - if @suggested_answer.update_attributes(params[:suggested_answer]) - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @suggested_answer.errors, status: :unprocessable_entity } - end - end - end - end + respond_to do |format| + if @suggested_answer.update_attributes(params[:suggested_answer]) + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @suggested_answer.errors, status: :unprocessable_entity } + end + end + end #delete a suggested answer def admin_destroysuggestedanswer - if user_signed_in? && current_user.is_org_admin? then - @suggested_answer = SuggestedAnswer.find(params[:suggested_answer]) - @question = @suggested_answer.question - @section = @question.section - @version = @section.version - @phase = @version.phase - @suggested_answer.destroy - - respond_to do |format| - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') } - format.json { head :no_content } - end - end - end + @suggested_answer = SuggestedAnswer.find(params[:suggested_answer]) + authorize @suggested_answer.question.section.version.phase.dmptemplate + @question = @suggested_answer.question + @section = @question.section + @version = @section.version + @phase = @version.phase + @suggested_answer.destroy + respond_to do |format| + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') } + format.json { head :no_content } + end + end # GUIDANCES #create a guidance def admin_createguidance - if user_signed_in? && current_user.is_org_admin? then - @question = Question.find(params[:question][:id]) - @guidance = Guidance.new(params[:guidance]) - @guidance.question_id = @question.id - #@question.guidance = params["new-question-guidance"] - #@question.default_value = params["new-question-default-value"] - - - respond_to do |format| - if @guidance.save - format.html { redirect_to admin_phase_dmptemplate_path(:id => @question.section.version.phase_id, :version_id => @question.section.version_id, :section_id => @question.section_id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @guidance.errors, status: :unprocessable_entity } - end - end + @question = Question.find(params[:question][:id]) + authorize @question.section.version.phase.dmptemplate + @guidance = Guidance.new(params[:guidance]) + @guidance.question_id = @question.id + #@question.guidance = params["new-question-guidance"] + #@question.default_value = params["new-question-default-value"] + respond_to do |format| + if @guidance.save + format.html { redirect_to admin_phase_dmptemplate_path(:id => @question.section.version.phase_id, :version_id => @question.section.version_id, :section_id => @question.section_id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @guidance.errors, status: :unprocessable_entity } + end end - end + end #update a guidance of a template def admin_updateguidance - if user_signed_in? && current_user.is_org_admin? then - @question = Question.find(params[:id]) - @question.guidance = params["question-guidance-#{params[:id]}"] - @question.default_value = params["question-default-value-#{params[:id]}"] - @section = @question.section - @version = @section.version - @phase = @version.phase - - respond_to do |format| - if @question.update_attributes(params[:question]) - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } - format.json { head :no_content } - else - format.html { render action: "admin_phase" } - format.json { render json: @question.errors, status: :unprocessable_entity } - end - end - end - end + @question = Question.find(params[:id]) + authorize @question.section.version.phase.dmptemplate + @question.guidance = params["question-guidance-#{params[:id]}"] + @question.default_value = params["question-default-value-#{params[:id]}"] + @section = @question.section + @version = @section.version + @phase = @version.phase + respond_to do |format| + if @question.update_attributes(params[:question]) + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') } + format.json { head :no_content } + else + format.html { render action: "admin_phase" } + format.json { render json: @question.errors, status: :unprocessable_entity } + end + end + end #delete a version, sections and guidance def admin_destroyguidance - if user_signed_in? && current_user.is_org_admin? then - @question = Question.find(params[:question_id]) - @section = @question.section - @version = @section.version - @phase = @version.phase - @question.destroy - - respond_to do |format| - format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') } - format.json { head :no_content } - end - end - end + @question = Question.find(params[:question_id]) + authorize @question.section.version.phase.dmptemplate + @section = @question.section + @version = @section.version + @phase = @version.phase + @question.destroy + respond_to do |format| + format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') } + format.json { head :no_content } + end + end -end +end \ No newline at end of file diff --git a/app/controllers/guidance_groups_controller.rb b/app/controllers/guidance_groups_controller.rb index 9a1dcfd..4c0c900 100644 --- a/app/controllers/guidance_groups_controller.rb +++ b/app/controllers/guidance_groups_controller.rb @@ -1,126 +1,105 @@ class GuidanceGroupsController < ApplicationController - - + + # GET /guidance_groups/1 # GET /guidance_groups/1.json def admin_show - if user_signed_in? && current_user.is_org_admin? then - @guidance_group = GuidanceGroup.find(params[:id]) - - respond_to do |format| - format.html - format.json { render json: @guidance_group } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @guidance_group = GuidanceGroup.find(params[:id]) + authorize @guidance_group + respond_to do |format| + format.html + format.json { render json: @guidance_group } + end end - + # GET add new guidance groups def admin_new - if user_signed_in? && current_user.is_org_admin? then - @guidance_group = GuidanceGroup.new - - respond_to do |format| - format.html # new.html.erb - format.json { render json: @guidance } - end - end - end - + @guidance_group = GuidanceGroup.new + authorize @guidance_group + respond_to do |format| + format.html # new.html.erb + format.json { render json: @guidance } + end + end + + # POST /guidance_groups # POST /guidance_groups.json def admin_create - if user_signed_in? && current_user.is_org_admin? then - @guidance_group = GuidanceGroup.new(params[:guidance_group]) - @guidance_group.organisation_id = current_user.organisation_id - if params[:save_publish] - @guidance_group.published = true - end - - respond_to do |format| - if @guidance_group.save - format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.created_message') } - format.json { render json: @guidance_group, status: :created, location: @guidance_group } - else - format.html { render action: "new" } - format.json { render json: @guidance_group.errors, status: :unprocessable_entity } - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @guidance_group = GuidanceGroup.new(params[:guidance_group]) + authorize @guidance_group + @guidance_group.organisation_id = current_user.organisation_id + if params[:save_publish] + @guidance_group.published = true + end + + respond_to do |format| + if @guidance_group.save + format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.created_message') } + format.json { render json: @guidance_group, status: :created, location: @guidance_group } + else + format.html { render action: "new" } + format.json { render json: @guidance_group.errors, status: :unprocessable_entity } + end + end end - + + # GET /guidance_groups/1/edit def admin_edit - if user_signed_in? && current_user.is_org_admin? then @guidance_group = GuidanceGroup.find(params[:id]) - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + authorize @guidance_group end + # PUT /guidance_groups/1 # PUT /guidance_groups/1.json def admin_update - if user_signed_in? && current_user.is_org_admin? then - @guidance_group = GuidanceGroup.find(params[:id]) - @guidance_group.organisation_id = current_user.organisation_id - - respond_to do |format| - if @guidance_group.update_attributes(params[:guidance_group]) - format.html { redirect_to admin_index_guidance_path(params[:guidance_group]), notice: I18n.t('org_admin.guidance_group.updated_message') } - format.json { head :no_content } - else - format.html { render action: "edit" } - format.json { render json: @guidance_group.errors, status: :unprocessable_entity } - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @guidance_group = GuidanceGroup.find(params[:id]) + authorize @guidance_group + @guidance_group.organisation_id = current_user.organisation_id + respond_to do |format| + if @guidance_group.update_attributes(params[:guidance_group]) + format.html { redirect_to admin_index_guidance_path(params[:guidance_group]), notice: I18n.t('org_admin.guidance_group.updated_message') } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @guidance_group.errors, status: :unprocessable_entity } + end + end end - + + # PUT /guidance_groups/1 def admin_update_publish - if user_signed_in? && current_user.is_org_admin? then - @guidance_group = GuidanceGroup.find(params[:id]) - @guidance_group.organisation_id = current_user.organisation_id - @guidance_group.published = true + @guidance_group = GuidanceGroup.find(params[:id]) + authorize @guidance_group + @guidance_group.organisation_id = current_user.organisation_id + @guidance_group.published = true - respond_to do |format| - if @guidance_group.update_attributes(params[:guidance_group]) - format.html { redirect_to admin_index_guidance_path(params[:guidance_group]), notice: I18n.t('org_admin.guidance_group.updated_message') } - format.json { head :no_content } - else - format.html { render action: "edit" } - format.json { render json: @guidance_group.errors, status: :unprocessable_entity } - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + respond_to do |format| + if @guidance_group.update_attributes(params[:guidance_group]) + format.html { redirect_to admin_index_guidance_path(params[:guidance_group]), notice: I18n.t('org_admin.guidance_group.updated_message') } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @guidance_group.errors, status: :unprocessable_entity } + end + end end # DELETE /guidance_groups/1 # DELETE /guidance_groups/1.json def admin_destroy - if user_signed_in? && current_user.is_org_admin? then - @guidance_group = GuidanceGroup.find(params[:id]) - @guidance_group.destroy - - respond_to do |format| - format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.destroyed_message') } - format.json { head :no_content } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end - + @guidance_group = GuidanceGroup.find(params[:id]) + authorize @guidance_group + @guidance_group.destroy + respond_to do |format| + format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.destroyed_message') } + format.json { head :no_content } + end end - - + end \ No newline at end of file diff --git a/app/controllers/guidances_controller.rb b/app/controllers/guidances_controller.rb index 1c8d2d1..abb2c1e 100644 --- a/app/controllers/guidances_controller.rb +++ b/app/controllers/guidances_controller.rb @@ -1,228 +1,197 @@ -class GuidancesController < ApplicationController - - # GET /guidances - # GET /guidances.json - def admin_index - if user_signed_in? && current_user.is_org_admin? then - @guidances = Guidance.by_organisation(current_user.organisation_id) - @guidance_groups = GuidanceGroup.where('organisation_id = ?', current_user.organisation_id ) - - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @guidances } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end - end - - # GET /guidances/1 - # GET /guidances/1.json - def admin_show - if user_signed_in? && current_user.is_org_admin? then - @guidance = Guidance.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render json: @guidance } - end - end - end - - def admin_new - if user_signed_in? && current_user.is_org_admin? then - @guidance = Guidance.new - @dmptemplates = Dmptemplate.funders_and_own_templates(current_user.organisation_id) - @phases = nil - @dmptemplates.each do |template| - if @phases.nil? then - @phases = template.phases.all.order('number') - else - @phases = @phases + template.phases.all.order('number') - end - end - @versions = nil - @phases.each do |phase| - if @versions.nil? then - @versions = phase.versions.all.order('title') - else - @versions = @versions + phase.versions.all.order('title') - end - end - @sections = nil - @versions.each do |version| - if @sections.nil? then - @sections = version.sections.all.order('number') - else - @sections = @sections + version.sections.all.order('number') - end - end - @questions = nil - @sections.each do |section| - if @questions.nil? then - @questions = section.questions.all.order('number') - else - @questions = @questions + section.questions.all.order('number') - end - end - respond_to do |format| - format.html - end - end - end - - #setup variables for use in the dynamic updating - def update_phases - # updates phases, versions, sections and questions based on template selected - dmptemplate = Dmptemplate.find(params[:dmptemplate_id]) - # map to title and id for use in our options_for_select - @phases = dmptemplate.phases.map{|a| [a.title, a.id]}.insert(0, I18n.t('helpers.select_phase')) - @versions = dmptemplate.versions.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_version')) - @sections = dmptemplate.sections.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_section')) - @questions = dmptemplate.questions.map{|s| [s.text, s.id]}.insert(0, I18n.t('helpers.select_question')) - - end - - def update_versions - # updates versions, sections and questions based on phase selected - phase = Phase.find(params[:phase_id]) - # map to name and id for use in our options_for_select - @versions = phase.versions.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_version')) - @sections = phase.sections.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_section')) - @questions = phase.questions.map{|s| [s.text, s.id]}.insert(0, I18n.t('helpers.select_question')) - end - - def update_sections - # updates sections and questions based on version selected - version = Version.find(params[:version_id]) - # map to name and id for use in our options_for_select - @sections = version.sections.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_section')) - @questions = version.questions.map{|s| [s.text, s.id]}.insert(0, I18n.t('helpers.select_question')) - end - - def update_questions - # updates songs based on artist selected - section = Section.find(params[:section_id]) - @questions = section.questions.map{|s| [s.text, s.id]}.insert(0, I18n.t('helpers.select_question')) - end - - - # GET /guidances/1/edit - def admin_edit - if user_signed_in? && current_user.is_org_admin? then - @guidance = Guidance.find(params[:id]) - @dmptemplates = Dmptemplate.funders_and_own_templates(current_user.organisation_id) - @phases = nil - @dmptemplates.each do |template| - if @phases.nil? then - @phases = template.phases.all.order('number') - else - @phases = @phases + template.phases.all.order('number') - end - end - @versions = nil - @phases.each do |phase| - if @versions.nil? then - @versions = phase.versions.all.order('title') - else - @versions = @versions + phase.versions.all.order('title') - end - end - @sections = nil - @versions.each do |version| - if @sections.nil? then - @sections = version.sections.all.order('number') - else - @sections = @sections + version.sections.all.order('number') - end - end - @questions = nil - @sections.each do |section| - if @questions.nil? then - @questions = section.questions.all.order('number') - else - @questions = @questions + section.questions.all.order('number') - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end - end - - # POST /guidances - # POST /guidances.json - def admin_create - if user_signed_in? && current_user.is_org_admin? then - @guidance = Guidance.new(params[:guidance]) - @guidance.text = params["guidance-text"] - @guidance.question_id = params["question_id"] - if @guidance.published == true then - @gg = GuidanceGroup.find(@guidance.guidance_group_ids).first - - if @gg.published == false || @gg.published.nil? then - @gg.published = true - @gg.save - end - - end - - respond_to do |format| - if @guidance.save - format.html { redirect_to admin_show_guidance_path(@guidance), notice: I18n.t('org_admin.guidance.created_message') } - format.json { render json: @guidance, status: :created, location: @guidance } - else - format.html { render action: "new" } - format.json { render json: @guidance.errors, status: :unprocessable_entity } - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end - end - - # PUT /guidances/1 - # PUT /guidances/1.json - def admin_update - if user_signed_in? && current_user.is_org_admin? then - @guidance = Guidance.find(params[:id]) - - @guidance.text = params["guidance-text"] - - @guidance.question_id = params["question_id"] - - respond_to do |format| - if @guidance.update_attributes(params[:guidance]) - format.html { redirect_to admin_show_guidance_path(params[:guidance]), notice: I18n.t('org_admin.guidance.updated_message') } - format.json { head :no_content } - else - format.html { render action: "edit" } - format.json { render json: @guidance.errors, status: :unprocessable_entity } - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end - end - - - # DELETE /guidances/1 - # DELETE /guidances/1.json - def admin_destroy - if user_signed_in? && current_user.is_org_admin? then - @guidance = Guidance.find(params[:id]) - @guidance.destroy - - respond_to do |format| - format.html { redirect_to admin_index_guidance_path } - format.json { head :no_content } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end - - end - - - -end +class GuidancesController < ApplicationController + # GET /guidances + # GET /guidances.json + def admin_index + authorize Guidance + @guidances = policy_scope(Guidance) + @guidance_groups = GuidanceGroup.where('organisation_id = ?', current_user.organisation_id ) + respond_to do |format| + format.html # index.html.erb + format.json { render json: @guidances } + end + end + + # GET /guidances/1 + # GET /guidances/1.json + def admin_show + @guidance = Guidance.find(params[:id]) + authorize @guidance + respond_to do |format| + format.html # show.html.erb + format.json { render json: @guidance } + end + end + + def admin_new + @guidance = Guidance.new + authorize @guidance + @dmptemplates = Dmptemplate.funders_and_own_templates(current_user.organisation_id) + @phases = nil + @dmptemplates.each do |template| + if @phases.nil? then + @phases = template.phases.all.order('number') + else + @phases = @phases + template.phases.all.order('number') + end + end + @versions = nil + @phases.each do |phase| + if @versions.nil? then + @versions = phase.versions.all.order('title') + else + @versions = @versions + phase.versions.all.order('title') + end + end + @sections = nil + @versions.each do |version| + if @sections.nil? then + @sections = version.sections.all.order('number') + else + @sections = @sections + version.sections.all.order('number') + end + end + @questions = nil + @sections.each do |section| + if @questions.nil? then + @questions = section.questions.all.order('number') + else + @questions = @questions + section.questions.all.order('number') + end + end + respond_to do |format| + format.html + end + end + + #setup variables for use in the dynamic updating + def update_phases + # updates phases, versions, sections and questions based on template selected + dmptemplate = Dmptemplate.find(params[:dmptemplate_id]) + # map to title and id for use in our options_for_select + @phases = dmptemplate.phases.map{|a| [a.title, a.id]}.insert(0, I18n.t('helpers.select_phase')) + @versions = dmptemplate.versions.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_version')) + @sections = dmptemplate.sections.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_section')) + @questions = dmptemplate.questions.map{|s| [s.text, s.id]}.insert(0, I18n.t('helpers.select_question')) + + end + + def update_versions + # updates versions, sections and questions based on phase selected + phase = Phase.find(params[:phase_id]) + # map to name and id for use in our options_for_select + @versions = phase.versions.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_version')) + @sections = phase.sections.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_section')) + @questions = phase.questions.map{|s| [s.text, s.id]}.insert(0, I18n.t('helpers.select_question')) + end + + def update_sections + # updates sections and questions based on version selected + version = Version.find(params[:version_id]) + # map to name and id for use in our options_for_select + @sections = version.sections.map{|s| [s.title, s.id]}.insert(0, I18n.t('helpers.select_section')) + @questions = version.questions.map{|s| [s.text, s.id]}.insert(0, I18n.t('helpers.select_question')) + end + + def update_questions + # updates songs based on artist selected + section = Section.find(params[:section_id]) + @questions = section.questions.map{|s| [s.text, s.id]}.insert(0, I18n.t('helpers.select_question')) + end + + + # GET /guidances/1/edit + def admin_edit + @guidance = Guidance.find(params[:id]) + authorize @guidance + @dmptemplates = Dmptemplate.funders_and_own_templates(current_user.organisation_id) + @phases = nil + @dmptemplates.each do |template| + if @phases.nil? then + @phases = template.phases.all.order('number') + else + @phases = @phases + template.phases.all.order('number') + end + end + @versions = nil + @phases.each do |phase| + if @versions.nil? then + @versions = phase.versions.all.order('title') + else + @versions = @versions + phase.versions.all.order('title') + end + end + @sections = nil + @versions.each do |version| + if @sections.nil? then + @sections = version.sections.all.order('number') + else + @sections = @sections + version.sections.all.order('number') + end + end + @questions = nil + @sections.each do |section| + if @questions.nil? then + @questions = section.questions.all.order('number') + else + @questions = @questions + section.questions.all.order('number') + end + end + end + + # POST /guidances + # POST /guidances.json + def admin_create + @guidance = Guidance.new(params[:guidance]) + authorize @guidance + @guidance.text = params["guidance-text"] + @guidance.question_id = params["question_id"] + if @guidance.published == true then + @gg = GuidanceGroup.find(@guidance.guidance_group_ids).first + if @gg.published == false || @gg.published.nil? then + @gg.published = true + @gg.save + end + end + respond_to do |format| + if @guidance.save + format.html { redirect_to admin_show_guidance_path(@guidance), notice: I18n.t('org_admin.guidance.created_message') } + format.json { render json: @guidance, status: :created, location: @guidance } + else + format.html { render action: "new" } + format.json { render json: @guidance.errors, status: :unprocessable_entity } + end + end + end + + # PUT /guidances/1 + # PUT /guidances/1.json + def admin_update + @guidance = Guidance.find(params[:id]) + authorize @guidance + @guidance.text = params["guidance-text"] + @guidance.question_id = params["question_id"] + respond_to do |format| + if @guidance.update_attributes(params[:guidance]) + format.html { redirect_to admin_show_guidance_path(params[:guidance]), notice: I18n.t('org_admin.guidance.updated_message') } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @guidance.errors, status: :unprocessable_entity } + end + end + end + + + # DELETE /guidances/1 + # DELETE /guidances/1.json + def admin_destroy + @guidance = Guidance.find(params[:id]) + authorize @guidance + @guidance.destroy + respond_to do |format| + format.html { redirect_to admin_index_guidance_path } + format.json { head :no_content } + end + end + +end diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index a9ee7a4..16ea960 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -37,57 +37,42 @@ end end - + # GET /organisations/1 # GET /organisations/1.json def admin_show - if user_signed_in? && current_user.is_org_admin? then - @organisation = Organisation.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render json: @organisation } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end - + @organisation = Organisation.find(params[:id]) + authorize @organisation + respond_to do |format| + format.html # show.html.erb + format.json { render json: @organisation } + end end - + # GET /organisations/1/edit def admin_edit - if user_signed_in? && current_user.is_org_admin? then - @organisation = Organisation.find(params[:id]) - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @organisation = authorize Organisation.find(params[:id]) end - - + + # PUT /organisations/1 # PUT /organisations/1.json def admin_update - if user_signed_in? && current_user.is_org_admin? then - @organisation = Organisation.find(params[:id]) - @organisation.banner_text = params["org_banner_text"] - @organisation.logo = params[:organisation][:logo] if params[:organisation][:logo] - assign_params = params[:organisation].dup - assign_params.delete(:logo) - - respond_to do |format| - if @organisation.update_attributes(assign_params) - format.html { redirect_to admin_show_organisation_path(params[:id]), notice: I18n.t("admin.org_updated_message") } - format.json { head :no_content } - else - flash[:alert] = @organisation.errors.full_messages.join("
").html_safe if @organisation.errors.any? - - format.html { render action: "admin_edit" } - format.json { render json: @organisation.errors, status: :unprocessable_entity } - end - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + @organisation = authorize Organisation.find(params[:id]) + @organisation.banner_text = params["org_banner_text"] + @organisation.logo = params[:organisation][:logo] if params[:organisation][:logo] + assign_params = params[:organisation].dup + assign_params.delete(:logo) + + respond_to do |format| + if @organisation.update_attributes(assign_params) + format.html { redirect_to admin_show_organisation_path(params[:id]), notice: I18n.t("admin.org_updated_message") } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @organisation.errors, status: :unprocessable_entity } + end + end end # DELETE /organisations/1 @@ -101,13 +86,13 @@ format.json { head :no_content } end end - + def parent @organisation = Organisation.find(params[:id]) parent_org = @organisation.find_by {|o| o.parent_id } return parent_org end - + def children @organisation = Organisation.find(params[:id]) #if user_signed_in? then @@ -122,7 +107,7 @@ # render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) # end end - + def templates @organisation = Organisation.find(params[:id]) #if user_signed_in? then diff --git a/app/controllers/token_permission_types_controller.rb b/app/controllers/token_permission_types_controller.rb index bdb6b58..5d5c3fc 100644 --- a/app/controllers/token_permission_types_controller.rb +++ b/app/controllers/token_permission_types_controller.rb @@ -1,15 +1,9 @@ -class TokenPermissionTypesController < ApplicationController - - - def index - if user_signed_in? && current_user.organisation.token_permission_types.count > 0 - @user = current_user - respond_to do |format| - format.html - end - else - render(file: File.join(Rails.root, 'public/403.html'),status: 403, layout: false) - end - end - +class TokenPermissionTypesController < ApplicationController + def index + authorize TokenPermissionType + @user = current_user + respond_to do |format| + format.html + end + end end \ No newline at end of file diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5647a32..530bf0f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -73,46 +73,48 @@ end def admin_index - if user_signed_in? && current_user.is_org_admin? then - respond_to do |format| - format.html # index.html.erb - format.json { render json: @organisation_users } - end - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) - end + authorize User + @users = current_user.organisation.users.includes(:roles, :project_groups) + respond_to do |format| + format.html # index.html.erb + format.json { render json: @organisation_users } + end end - def admin_api_update - if user_signed_in? && current_user.is_org_admin? then - #iterate through all org users - user_ids = params[:api_user_ids].blank? ? [] : params[:api_user_ids].map(&:to_i) - admin_user_ids = params[:org_admin_ids].blank? ? [] : params[:org_admin_ids].map(&:to_i) - current_user.organisation.users.each do |user| - # if user_id in passed params - if user_ids.include? user.id - # run generate_or_keep - user.keep_or_generate_token! - # if not in passed params - else - # remove the token - user.remove_token! - end - # ORG_ADMINS - if admin_user_ids.include?( user.id) && !user.is_org_admin? - # add admin privleges - # MAGIC_STRING - user.roles << Role.find_by(name: constant("user_role_types.organisational_admin")) - # if user_id not in passed, but user is an admin - elsif !admin_user_ids.include?(user.id) && user.is_org_admin? - # strip admin privleges - user.roles.delete(Role.find_by(name: constant("user_role_types.organisational_admin"))) - end + def admin_grant_permissions + @user = User.includes(:roles).find(params[:id]) + authorize @user + user_roles = current_user.roles + @roles = user_roles & Role.where(name: [constant("user_role_types.change_org_details"),constant("user_role_types.use_api"), constant("user_role_types.modify_guidance"), constant("user_role_types.modify_templates"), constant("user_role_types.grant_permissions")]) + end + + def admin_update_permissions + @user = User.includes(:roles).find(params[:id]) + authorize @user + roles_ids = params[:role_ids].blank? ? [] : params[:role_ids].map(&:to_i) + roles = Role.where( id: roles_ids) + current_user.roles.each do |role| + if @user.roles.include? role + if ! roles.include? role + @user.roles.delete(role) + if role.name == constant("user_role_types.use_api") + @user.remove_token! end - #redirect_to admin_index - else - render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) end + else + if roles.include? role + @user.roles << role + if role.name == constant("user_role_types.use_api") + @user.keep_or_generate_token! + end + end + end end + @user.save! + respond_to do |format| + format.html { redirect_to({controller: 'users', action: 'admin_index'}, {notice: I18n.t('helpers.success')})} + format.json { head :no_content } + end + end end diff --git a/app/models/exported_plan.rb b/app/models/exported_plan.rb index 6d21897..68fe5bf 100644 --- a/app/models/exported_plan.rb +++ b/app/models/exported_plan.rb @@ -84,7 +84,7 @@ answer = self.plan.answer(question.id) options_string = answer.options.collect {|o| o.text}.join('; ') - csv << [section.title, question.text, sanitize_text(answer.text), options_string, answer.try(:user).try(:name), answer.created_at] + csv << [section.title, sanitize_text(question.text), sanitize_text(answer.text), options_string, answer.try(:user).try(:name), answer.created_at] end end end @@ -97,7 +97,8 @@ output += "\n#{section.title}\n" self.questions_for_section(section).each do |question| - output += "\n#{question.text}\n" + qtext = sanitize_text( question.text.gsub(/
  • /, ' * ') ) + output += "\n#{qtext}\n" answer = self.plan.answer(question.id, false) if answer.nil? || answer.text.nil? then diff --git a/app/models/guidance_group.rb b/app/models/guidance_group.rb index 201818c..c5d5c24 100644 --- a/app/models/guidance_group.rb +++ b/app/models/guidance_group.rb @@ -40,7 +40,7 @@ ## # Returns the list of all guidance groups not coming from the given organisations # - # @params excluded_orgs [Array] a list of organisations to exclude in the result + # @param excluded_orgs [Array] a list of organisations to exclude in the result # @return [Array] a list of guidance groups def self.guidance_groups_excluding(excluded_orgs) excluded_org_ids = Array.new diff --git a/app/models/organisation.rb b/app/models/organisation.rb index caccda5..4db9796 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -15,8 +15,6 @@ has_many :suggested_answers has_and_belongs_to_many :token_permission_types, join_table: "org_token_permissions" - has_many :user_org_roles - belongs_to :parent, :class_name => 'Organisation' has_one :language @@ -31,7 +29,7 @@ :organisation_type_id, :wayfless_entity, :parent_id, :sort_name, :token_permission_type_ids, :language_id, :contact_email - validates :contact_email, email: true + validates :contact_email, email: true, allow_nil: true # allow validations for logo upload dragonfly_accessor :logo do @@ -42,10 +40,6 @@ validates_property :format, of: :logo, in: ['jpeg', 'png', 'gif','jpg','bmp'] validates_size_of :logo, maximum: 500.kilobytes - def to_s - name - end - ## # returns the name of the organisation # @@ -69,7 +63,7 @@ ## # finds all organisations who have a parent of the passed organisation type # - # @params [String] the name of an organisation type + # @param [String] the name of an organisation type # @return [Array] def self.orgs_with_parent_of_type(org_type) parents = OrganisationType.find_by_name(org_type).organisations @@ -118,7 +112,7 @@ ## # returns a list of all sections of a given version from this organisation and it's parents # - # @params version_id [Integer] version number of the section + # @param version_id [Integer] version number of the section # @return [Array
    ] list of sections def all_sections(version_id) if parent.nil? @@ -159,7 +153,7 @@ ## # takes in the id of, and returns an OptionWarning # - # @params option_id [number] the id of the desired warning + # @param option_id [number] the id of the desired warning # @return [OptionWarning] the specified warning def warning(option_id) warning = option_warnings.find_by_option_id(option_id) diff --git a/app/models/plan.rb b/app/models/plan.rb index 5946db3..8bf12aa 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -104,7 +104,7 @@ ## # returns the guidances associated with the project's organisation, for a specified question # - # @params question [Question] the question to find guidance for + # @param question [Question] the question to find guidance for # @return [Array] the list of guidances which pretain to the specified question def guidance_for_question(question) guidances = {} @@ -435,7 +435,7 @@ # returns an array of hashes. Each hash contains the question's id, the answer_id, # the answer_text, the answer_timestamp, and the answer_options # - # @params section_id [Integer] the section to find answers of + # @param section_id [Integer] the section to find answers of # @return [Array nil,String,Integer,DateTime}] def section_answers(section_id) section = Section.find(section_id) @@ -477,7 +477,7 @@ # NOTE: This is only an estimate, rounded up to the nearest 5%; it is intended # for guidance when editing plan data, not to be 100% accurate. # - # @params used_height [Integer] an estimate of the height used so far + # @param used_height [Integer] an estimate of the height used so far # @return [Integer] the estimate of space used of an A4 portrain def estimate_space_used(used_height) @formatting ||= self.settings(:export).formatting @@ -501,9 +501,9 @@ # Allows for hinting different font sizes (offset from base via font_size_inc) # and vertical margins (i.e. for heading text) # - # @params text [String] the text to estimate size of - # @params font_size_inc [Integer] the size of the font of the text, defaults to 0 - # @params vertical_margin [Integer] the top margin above the text, defaults to 0 + # @param text [String] the text to estimate size of + # @param font_size_inc [Integer] the size of the font of the text, defaults to 0 + # @param vertical_margin [Integer] the top margin above the text, defaults to 0 def height_of_text(text, font_size_inc = 0, vertical_margin = 0) @formatting ||= self.settings(:export).formatting @margin_width ||= @formatting[:margin][:left].to_i + @formatting[:margin][:right].to_i diff --git a/app/models/project.rb b/app/models/project.rb index 4c14724..f205429 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -106,7 +106,7 @@ ## # sets a new institution_id if there is no current organisation # - # @params new_institution_id [Integer] the id for the new institution + # @param new_institution_id [Integer] the id for the new institution # @return [Integer, Bool] false if an organisation exists, or the id of the set org if a new organisation is set def institution_id=(new_institution_id) if organisation.nil? then @@ -130,7 +130,7 @@ # defines a new organisation_id for the project # but is confusingly labled unit_id # - # @params new_unit_id [Integer] + # @param new_unit_id [Integer] # @return [Integer, Boolean] the new organisation ID or false if no unit_id was passed def unit_id=(new_unit_id) unless new_unit_id.nil? ||new_unit_id == "" @@ -252,7 +252,7 @@ # whether or not the specified user_id created this project # should be renamed to created_by? # - # @params user_id [Integer] the user to check the priveleges of + # @param user_id [Integer] the user to check the priveleges of # @return [Boolean] true if the user created the project def created_by(user_id) user = project_groups.find_by_user_id(user_id) diff --git a/app/models/question.rb b/app/models/question.rb index 4cce243..aed95fb 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -30,6 +30,14 @@ "#{text}" end + def select_text + cleantext = text.gsub(/<[^<]+>/, '') + if cleantext.length > 120 + cleantext = cleantext.slice(0,120) + end + cleantext + end + amoeba do include_association :options include_association :suggested_answers diff --git a/app/models/role.rb b/app/models/role.rb index c568dac..dbe0a80 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -1,9 +1,8 @@ -class Role < ActiveRecord::Base - has_and_belongs_to_many :users, :join_table => :users_roles - - belongs_to :resource, :polymorphic => true - - scopify - attr_accessible :name, :role_in_plans, :resource_id, :resource_type, :as => [:default, :admin] - -end +class Role < ActiveRecord::Base + has_and_belongs_to_many :users, :join_table => :users_roles + + belongs_to :resource, :polymorphic => true + + attr_accessible :name, :role_in_plans, :resource_id, :resource_type, :as => [:default, :admin] + +end diff --git a/app/models/user.rb b/app/models/user.rb index e9ea489..351e7be 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,6 @@ class User < ActiveRecord::Base include GlobalHelpers - rolify # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable @@ -30,7 +29,7 @@ conditions = t[:title].matches(q) columns = %i( - grant_number identifier description principal_investigator data_contact + grant_number identifier description principal_investigator data_contact ) columns = ['grant_number', 'identifier', 'description', 'principal_investigator', 'data_contact'] @@ -40,8 +39,7 @@ end end - # Commented out due to warning in Rails 4. This line is redundant due to use of the rolify gem - #has_and_belongs_to_many :roles, :join_table => :users_roles + has_and_belongs_to_many :roles, :join_table => :users_roles has_many :plan_sections @@ -80,33 +78,34 @@ # @param new_organisation_id [Integer] the id for an organisation # @return [String] the empty string as a causality of setting api_token def organisation_id=(new_organisation_id) + # DEPRICATED STRUCTURE ONLY USED HERE + if !self.user_org_roles.pluck(:organisation_id).include?(new_organisation_id.to_i) then + # if the user has more than one role + if self.user_org_roles.count != 1 then + new_user_org_role = UserOrgRole.new + new_user_org_role.organisation_id = new_organisation_id + new_user_org_role.user_role_type = UserRoleType.find_by(name: constant("user_role_types.user")); + self.user_org_roles << new_user_org_role + # if the user has roles other than one(0/2/3?) + else + # set role to first role + user_org_role = self.user_org_roles.first + # change org_id to new org_id + user_org_role.organisation_id = new_organisation_id + # save modified role + user_org_role.save # if the user is not part of the new organisation if !self.user_org_roles.pluck(:organisation_id).include?(new_organisation_id.to_i) then - # if the user has more than one role - if self.user_org_roles.count != 1 then - new_user_org_role = UserOrgRole.new - new_user_org_role.organisation_id = new_organisation_id - new_user_org_role.user_role_type = UserRoleType.find_by(name: constant("user_role_types.user")); - self.user_org_roles << new_user_org_role - # - # if the user has roles other than one(0/2/3?) - else - # set role to first role - user_org_role = self.user_org_roles.first - # change org_id to new org_id - user_org_role.organisation_id = new_organisation_id - # save modified role - user_org_role.save - # if user has an "org_admin" role - org_admin_role = roles.find_by(name: constant("user_role_types.org_admin")) - unless org_admin_role.nil? then - # delete it - roles.delete(org_admin_role) - end + unless self.can_change_org? + # rip all permissions from user + self.roles.delete_all + self.save! end end - # rip api_token from user - self.remove_token! + end + end + # rip api_token from user + self.remove_token! end ## @@ -149,30 +148,105 @@ ## # sets a new organisation for the user # - # @params new_organisation [Organisation] the new organisation for the user + # @param new_organisation [Organisation] the new organisation for the user def organisation=(new_organisation) organisation_id = organisation.id end ## - # checks if the user is an admin + # checks if the user is a super admin + # if the user has any privelege which requires them to see the super admin page + # then they are a super admin # # @return [Boolean] true if the user is an admin - def is_admin? - admin = roles.find_by( name: constant("user_role_types.super_admin")) - return !admin.nil? + def can_super_admin? + return self.can_add_orgs? || self.can_grant_api_to_orgs? || can_change_org? end ## # checks if the user is an organisation admin + # if the user has any privlege which requires them to see the org-admin pages + # then they are an org admin # # @return [Boolean] true if the user is an organisation admin - def is_org_admin? - org_admin = roles.find_by(name: constant("user_role_types.organisational_admin")) - return !org_admin.nil? + def can_org_admin? + return self.can_grant_permissions? || self.can_modify_guidance? || self.can_modify_templates? || self.can_modify_org_details? end ## + # checks if the user can add new organisations + # + # @return [Boolean] true if the user can add new organisations + def can_add_orgs? + roles.include? Role.find_by(name: constant("user_role_types.add_organisations")) + end + + ## + # checks if the user can change their organisation affiliations + # + # @return [Boolean] true if the user can change their organisation affiliations + def can_change_org? + roles.include? Role.find_by(name: constant("user_role_types.change_org_affiliation")) + end + + ## + # checks if the user can grant their permissions to others + # + # @return [Boolean] true if the user can grant their permissions to others + def can_grant_permissions? + roles.include? Role.find_by(name: constant("user_role_types.grant_permissions")) + end + + ## + # checks if the user can modify organisation templates + # + # @return [Boolean] true if the user can modify organisation templates + def can_modify_templates? + roles.include? Role.find_by(name: constant("user_role_types.modify_templates")) + end + + ## + # checks if the user can modify organisation guidance + # + # @return [Boolean] true if the user can modify organistion guidance + def can_modify_guidance? + roles.include? Role.find_by(name: constant("user_role_types.modify_guidance")) + end + + ## + # checks if the user can use the api + # + # @return [Boolean] true if the user can use the api + def can_use_api? + roles.include? Role.find_by(name: constant("user_role_types.use_api")) + end + + ## + # checks if the user can modify their org's details + # + # @return [Boolean] true if the user can modify the org's details + def can_modify_org_details? + roles.include? Role.find_by(name: constant("user_role_types.change_org_details")) + end + + ## + # checks if the user can grant the api to organisations + # + # @return [Boolean] true if the user can grant api permissions to organisations + def can_grant_api_to_orgs? + roles.include? Role.find_by(name: constant('user_role_types.grant_api_to_orgs')) + end + + + ## + # checks if the user can grant the api to organisations + # + # @return [Boolean] true if the user can grant api permissions to organisations + def can_grant_api_to_orgs? + roles.include? Role.find_by(name: constant('user_role_types.grant_api_to_orgs')) + end + + ## # checks what type the user's organisation is # # @return [String] the organisation type @@ -185,13 +259,13 @@ # removes the api_token from the user # modifies the user model def remove_token! - unless api_token.empty? + unless api_token.blank? self.api_token = "" self.save! end end - # + ## # generates a new token for the user unless the user already has a token. # modifies the user's model. def keep_or_generate_token! @@ -206,4 +280,48 @@ end end + ## + # updates the user permissions to the new system. + # the old system only had admin and org-admin roles, which loosely map to the + # new permissions system. + def self.update_user_permissions + admin = Role.find_by(name: 'admin') + org_admin = Role.find_by(name: 'org_admin') + add_orgs = Role.find_by(name: 'add_organisations') + change_org_affiliation = Role.find_by(name: 'change_org_affiliation') + grant_api_to_orgs = Role.find_by(name: 'grant_api_to_orgs') + grant_permissions = Role.find_by(name: 'grant_permissions') + modify_templates = Role.find_by(name: 'modify_templates') + modify_guidance = Role.find_by(name: 'modify_guidance') + change_org_details = Role.find_by(name: 'change_org_detials') + User.includes(:roles).all.each do |user| + roles = user.roles + roles.each do |role| + if role.blank? + elsif role.name == 'admin' + #add admin roles + user.roles << add_orgs unless user.can_add_orgs? + user.roles << change_org_affiliation unless user.can_change_org? + user.roles << grant_api_to_orgs unless user.can_grant_api_to_orgs? + user.roles << grant_permissions unless user.can_grant_permissions? + elsif role.name == 'org_admin' + #add org-admin roles + user.roles << grant_permissions unless user.can_grant_permissions? + user.roles << modify_templates unless user.can_modify_templates? + user.roles << modify_guidance unless user.can_modify_guidance? + user.roles << change_org_details unless user.can_modify_org_details? + end + end + #rip roles from user + if user.roles.include?(admin) + user.roles.delete(admin) + end + if user.roles.include?(org_admin) + user.roles.delete(org_admin) + end + # save the user + user.save! + end + end + end diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb new file mode 100644 index 0000000..ea84308 --- /dev/null +++ b/app/policies/application_policy.rb @@ -0,0 +1,55 @@ +class ApplicationPolicy + attr_reader :user, :record + attr_reader :user, :record + + def initialize(user, record) + raise Pundit::NotAuthorizedError, "must be logged in" unless user + @user = user + @record = record + end + + def index? + false + end + + def show? + scope.where(:id => record.id).exists? + end + + def create? + false + end + + def new? + create? + end + + def update? + false + end + + def edit? + update? + end + + def destroy? + false + end + + def scope + Pundit.policy_scope!(user, record.class) + end + + class Scope + attr_reader :user, :scope + + def initialize(user, scope) + @user = user + @scope = scope + end + + def resolve + scope = [] + end + end +end \ No newline at end of file diff --git a/app/policies/dmptemplate_policy.rb b/app/policies/dmptemplate_policy.rb new file mode 100644 index 0000000..ea17c40 --- /dev/null +++ b/app/policies/dmptemplate_policy.rb @@ -0,0 +1,124 @@ +class DmptemplatePolicy < ApplicationPolicy + attr_reader :user, :dmptemplate + + def initialize(user, dmptemplate) + raise Pundit::NotAuthorizedError, "must be logged in" unless user + @user = user + @dmptemplate = dmptemplate + end + + def admin_index? + user.can_modify_templates? + end + + def admin_template? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_update? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_new? + user.can_modify_templates? + end + + def admin_create? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_destroy? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_phase? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_previewphase? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_addphase? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_createphase? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_updatephase? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_destroyphase? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_updateversion? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_cloneversion? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_destroyversion? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_createsection? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_updatesection? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_destroysection? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_createquestion? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_updatequestion? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_destroyquestion? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_createsuggestedanswer? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_updatesuggestedanswer? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_destroysuggestedanswer? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_createguidance? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_updateguidance? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + def admin_destroyguidance? + user.can_modify_templates? && (dmptemplate.organisation_id == user.organisation_id) + end + + class Scope < Scope + def resolve + scope.where(organisation_id: user.organisation_id) + end + end + +end \ No newline at end of file diff --git a/app/policies/guidance_group_policy.rb b/app/policies/guidance_group_policy.rb new file mode 100644 index 0000000..dd3725f --- /dev/null +++ b/app/policies/guidance_group_policy.rb @@ -0,0 +1,44 @@ +class GuidanceGroupPolicy < ApplicationPolicy + attr_reader :user, :guidance_group + + def initialize(user, guidance_group) + raise Pundit::NotAuthorizedError, "must be logged in" unless user + @user = user + @guidance_group = guidance_group + end + + def admin_show? + user.can_modify_guidance? && (guidance_group.organisation_id == user.organisation_id) + end + + def admin_edit? + user.can_modify_guidance? && (guidance_group.organisation_id == user.organisation_id) + end + + def admin_update? + user.can_modify_guidance? && (guidance_group.organisation_id == user.organisation_id) + end + + def admin_update_publish? + user.can_modify_guidance? && (guidance_group.organisation_id == user.organisation_id) + end + + def admin_new? + user.can_modify_guidance? && (guidance_group.organisation_id == user.organisation_id) + end + + def admin_create? + user.can_modify_guidance? && (guidance_group.organisation_id == user.organisation_id) + end + + def admin_destroy? + user.can_modify_guidance? && (guidance_group.organisation_id == user.organisation_id) + end + + class Scope < Scope + def resolve + scope.where(organisation_id: user.organisation_id) + end + end + +end \ No newline at end of file diff --git a/app/policies/guidance_policy.rb b/app/policies/guidance_policy.rb new file mode 100644 index 0000000..2b60f7a --- /dev/null +++ b/app/policies/guidance_policy.rb @@ -0,0 +1,43 @@ +class GuidancePolicy < ApplicationPolicy + attr_reader :user, :guidance + + def initialize(user, guidance) + raise Pundit::NotAuthorizedError, "must be logged in" unless user + @user = user + @guidance = guidance + end + + def admin_show? + user.can_modify_guidance? && guidance.in_group_belonging_to?(user.organisation_id) + end + + def admin_edit? + user.can_modify_guidance? && guidance.in_group_belonging_to?(user.organisation_id) + end + + def admin_update? + user.can_modify_guidance? && guidance.in_group_belonging_to?(user.organisation_id) + end + + def admin_index? + user.can_modify_guidance? + end + + def admin_new? + user.can_modify_guidance? + end + + def admin_create? + user.can_modify_guidance? + end + + def admin_destroy? + user.can_modify_guidance? && guidance.in_group_belonging_to?(user.organisation_id) + end + + class Scope < Scope + def resolve + scope = Guidance.by_organisation(user.organisation_id) + end + end +end \ No newline at end of file diff --git a/app/policies/organisation_policy.rb b/app/policies/organisation_policy.rb new file mode 100644 index 0000000..4326458 --- /dev/null +++ b/app/policies/organisation_policy.rb @@ -0,0 +1,22 @@ +class OrganisationPolicy < ApplicationPolicy + attr_reader :user, :organisation + + def initialize(user, organisation) + raise Pundit::NotAuthorizedError, "must be logged in" unless user + @user = user + @organisation = organisation + end + + def admin_show? + user.can_modify_org_details? && (user.organisation_id == organisation.id) + end + + def admin_edit? + user.can_modify_org_details? && (user.organisaiton_id == organisation.id) + end + + def admin_update? + user.can_modify_org_details? && (user.organisaiton_id == organisation.id) + end + +end \ No newline at end of file diff --git a/app/policies/token_permission_type_policy.rb b/app/policies/token_permission_type_policy.rb new file mode 100644 index 0000000..fb4699e --- /dev/null +++ b/app/policies/token_permission_type_policy.rb @@ -0,0 +1,15 @@ +class TokenPermissionTypePolicy < ApplicationPolicy + attr_reader :user, :token_permission_type + + def initialize(user, token_permission_type) + raise Pundit::NotAuthorizedError, "must be logged in" unless user + @user = user + @token_permission_type = token_permission_type + end + + def index? + user.can_use_api? && (user.organisation.token_permission_types.count > 0) + end + + +end \ No newline at end of file diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb new file mode 100644 index 0000000..bb44ae5 --- /dev/null +++ b/app/policies/user_policy.rb @@ -0,0 +1,28 @@ +class UserPolicy < ApplicationPolicy + attr_reader :user + + def initialize(user, users) + raise Pundit::NotAuthorizedError, "must be logged in" unless user + @user = user + @users = users + end + + def admin_index? + @user.can_grant_permissions? + end + + def admin_grant_permissions? + @user.can_grant_permissions? && (@users.organisation_id == @user.organisation_id) + end + + def admin_update_permissions? + @user.can_grant_permissions? && (@users.organisation_id == @user.organisation_id) + end + + class Scope < Scope + def resolve + scope.where(organisation_id: user.organisation_id) + end + end + +end \ No newline at end of file diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 9be1fed..bb25316 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -65,7 +65,7 @@ :autocomplete => "off" , :class => "text_field has-tooltip", "data-toggle" => "tooltip", "data-html" => "true", "title" => t("helpers.orcid_html") %> - <% unless @user.api_token.nil? %> + <% unless @user.api_token.blank? %> <%= t("helpers.api_token") %> <%= @user.api_token %> diff --git a/app/views/dmptemplates/_admin_nav_tabs.html.erb b/app/views/dmptemplates/_admin_nav_tabs.html.erb index 6974892..49c3c20 100644 --- a/app/views/dmptemplates/_admin_nav_tabs.html.erb +++ b/app/views/dmptemplates/_admin_nav_tabs.html.erb @@ -20,7 +20,7 @@
  • <% end %> - <% if current_user.is_org_admin? && (dmptemplate.org_type != constant("organisation_types.funder")|| current_user.org_type == constant("organisation_types.funder")) then %> + <% if current_user.can_org_admin? && (dmptemplate.org_type != constant("organisation_types.funder")|| current_user.org_type == constant("organisation_types.funder")) then %> <% if active == 'add_plan' then %>
  • <% else %> diff --git a/app/views/dmptemplates/admin_index.html.erb b/app/views/dmptemplates/admin_index.html.erb index 64a2097..b22018c 100644 --- a/app/views/dmptemplates/admin_index.html.erb +++ b/app/views/dmptemplates/admin_index.html.erb @@ -60,7 +60,7 @@ <%= l last_temp_updated.to_date, :formats => :short %> - <%if current_user.is_org_admin? then%> + <%if current_user.can_org_admin? then%> <% b_label = t('helpers.submit.edit')%> <%else%> <% b_label = t('helpers.view')%> @@ -129,7 +129,7 @@ - <%if current_user.is_org_admin? then%> + <%if current_user.can_org_admin? then%> <% if org_template.org_type == constant("organisation_types.funder") then %> <%if org_template.has_customisations?(current_user.organisation_id, org_template) then%> <% b_label = t("org_admin.templates.edit_customisation")%> diff --git a/app/views/dmptemplates/export.pdf.erb b/app/views/dmptemplates/export.pdf.erb new file mode 100644 index 0000000..3726b39 --- /dev/null +++ b/app/views/dmptemplates/export.pdf.erb @@ -0,0 +1,23 @@ + + + + + + <%= @template.title %> + + + + +

    <%= @template.title %>

    + + \ No newline at end of file diff --git a/app/views/layouts/_dmponline_navigation.html.erb b/app/views/layouts/_dmponline_navigation.html.erb index 7db4f41..b38673f 100644 --- a/app/views/layouts/_dmponline_navigation.html.erb +++ b/app/views/layouts/_dmponline_navigation.html.erb @@ -5,109 +5,116 @@ <% namespace = controller_path.split("/").first %> + <%= link_to language.name, {locale: language.abbreviation}, class: 'main_nav lang-dropdown-link'%> +
  • + <% end %> + + + <%end%> + + diff --git a/app/views/layouts/_dmponline_org_branding.html.erb b/app/views/layouts/_dmponline_org_branding.html.erb index e6f0af6..e91e51a 100644 --- a/app/views/layouts/_dmponline_org_branding.html.erb +++ b/app/views/layouts/_dmponline_org_branding.html.erb @@ -1,24 +1,23 @@ - -
    - <% if user_signed_in? %> - <% if !current_user.organisation.nil? %> - - - <% if current_user.organisation.logo.present? %> - - <% end %> - - - <% if current_user.organisation.banner_text.present? %> -
    - - <%= raw current_user.organisation.banner_text %> - -
    - <%end%> - - <%end%> - <%end%> + +
    + <% if user_signed_in? %> + <% if !current_user.organisation.present? %> + + <% if current_user.organisation.logo.present? %> + + <% end %> + + + <% if current_user.organisation.banner_text.present? %> +
    + + <%= raw current_user.organisation.banner_text %> + +
    + <%end%> + + <%end%> + <%end%>
    \ No newline at end of file diff --git a/app/views/layouts/_dmponline_signin_signout.html.erb b/app/views/layouts/_dmponline_signin_signout.html.erb index f649068..544aa16 100644 --- a/app/views/layouts/_dmponline_signin_signout.html.erb +++ b/app/views/layouts/_dmponline_signin_signout.html.erb @@ -1,33 +1,31 @@ - - + <% end %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    <%= t('org_admin.org_name') %><%= f.text_field :name, + :as => :string, + :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('org_admin.name_help_text') %>
    <%= t('org_admin.org_abbr') %> +
    + <%= f.text_field :abbreviation, + :as => :string, + :class => 'text_field' %> +
    +
    + <%= link_to(image_tag('help_button.png'), '#', :class => 'org_abbr_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.templates.desc_help_text_html')) %> +
    +
    +
    <%= t('org_admin.org_desc') %><%= f.text_area :description, { + :rows => 5, + :class => 'text_area has-tooltip', 'data-toggle' => "tooltip", 'data-html' => "true", 'title' => t('org_admin.desc_help_text_html')} %>
    <%= t('org_admin.org_banner_text') %> + <%= text_area_tag("org_banner_text", @organisation.banner_text, class: "tinymce") %> +
    <%= t('org_admin.org_target_url') %><%= f.text_field :target_url, + :as => :string, + :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('org_admin.target_url_help_text') %>
    <%= t('org_admin.org_default_language') %> +
    + <%= collection_select(:@organisation, + :language_id, Language.all.order("name"), + :id, :name, {selected: Language.where(default_language: true).first.id}, + {:class => "typeahead org_sign_up"}) %> +
    +
    + <%= link_to(image_tag('help_button.png'), '#', :class => 'org_abbr_popover', :rel => "popover", 'data-html' => "true", 'data-content' => t('org_admin.org_default_language_help_text')) %> +
    +
    +
    <%= t('org_admin.org_type') %><%= @organisation.organisation_type.name %>
    + +
    +
    + + + +
    + <%= f.submit t('helpers.submit.save'), :class => 'btn btn-primary' %> + <%= link_to t('helpers.submit.cancel'), :back, :class => 'btn btn-primary' %> +
    + +
    + <% end %> +
    + <%= tinymce :content_css => asset_path('application.css') %> diff --git a/app/views/organisations/admin_show.html.erb b/app/views/organisations/admin_show.html.erb index 91ac5ee..6c32864 100644 --- a/app/views/organisations/admin_show.html.erb +++ b/app/views/organisations/admin_show.html.erb @@ -76,4 +76,3 @@
    - diff --git a/app/views/plans/_answer_form.html.erb b/app/views/plans/_answer_form.html.erb index c6135bb..57198f7 100644 --- a/app/views/plans/_answer_form.html.erb +++ b/app/views/plans/_answer_form.html.erb @@ -19,7 +19,13 @@ <%= f.input :question_id, :as => :hidden, :input_html => { :class => "question_id" } %> - <%= label_tag("answer-text-#{question.id}".to_sym, question.text) %> + + <%= raw question.text %> <% suggested_answer = question.suggested_answers.find_by_organisation_id(@plan.project.organisation_id) %> diff --git a/app/views/plans/export.docx.caracal b/app/views/plans/export.docx.caracal index b75f64d..e6b4fbb 100644 --- a/app/views/plans/export.docx.caracal +++ b/app/views/plans/export.docx.caracal @@ -1,252 +1,251 @@ -#----------------------------------------------------- -# page settings -#----------------------------------------------------- - -docx.page_numbers true do - align :center -end - -docx.font do - name 'Arial' -end - -docx.p do - size 32 -end - - -#--------------------------------------------- -# Structure for docx format -#--------------------------------------------- - -docx.h1 @exported_plan.plan.project.title.upcase, font: 'Arial', color: '000000' -docx.h2 @exported_plan.plan.title.upcase, font: 'Arial', color: '000000' - -#---- PLAN ADMIN DETAILS ----- -if @exported_plan.admin_details.present? - docx.p - docx.h3 'Admin Details'.upcase , italic: false, font: 'Arial', color: '000000' - @exported_plan.admin_details.each do |field| - value = @exported_plan.send(field) - label = "helpers.plan.export.#{field}" - if value.present? - docx.p do - text I18n.t(label), bold: true, color: '000000' - text ': ', bold: true, color: '000000' - text value - end - end - end -end - - -#---- PLAN SECTIONS, QUESTIONS AND ANSWERS ----- -@exported_plan.sections.each do |section| - docx.p - docx.h3 section.title.upcase, italic: false, font: 'Arial', color: '000000' - - @exported_plan.questions_for_section(section.id).each do |question| - docx.p question.text, bold: true - - answer = @exported_plan.plan.answer(question.id, false) - if answer.nil? - docx.p 'Question not answered', italic: true - else - q_format = question.question_format - if q_format.title == I18n.t("helpers.checkbox") || q_format.title == I18n.t("helpers.multi_select_box") || - q_format.title == I18n.t("helpers.radio_buttons") || q_format.title == I18n.t("helpers.dropdown") then - answer.options.each do |option| - docx.ul do - if !option.text.nil? - li option.text - end - end - end - end - - if !answer.text.nil? && question.option_comment_display == true then - search_answer = Nokogiri::HTML::DocumentFragment.parse "
    " - search_answer.at(".//div").inner_html = answer.text - - if search_answer.css('table').present? then - table_content = search_answer.css('table').css('tbody') - - if table_content.size > 0 then - table_array = Array.new - - table_content.css('tr').each do |tr| - row_th_array = Array.new - row_td_array = Array.new - - if tr.search('th') then - tr.search('th').each do |cell| - row_th_array << cell.text.to_s - end - end - - if tr.search('td') then - tr.search('td').each do |td_cell| - if !td_cell.text.to_s.blank? then - new_val = Nokogiri::HTML::DocumentFragment.parse "

    " - new_val.at(".//p").inner_html = td_cell - td_tags = new_val.at_css('td').children.map {|x| x.name.strip} - td_text = new_val.at_css('td').children.map {|x| x.text.strip} - - start_c = 0 - end_c = td_tags.size - - c1 = Caracal::Core::Models::TableCellModel.new do - while start_c < end_c do - p do - #-- TEXT - if td_tags[start_c] == 'text' then - text td_text[start_c] - else - #-- LINK - if td_tags[start_c] == 'a' then - l_address = "" - l_text = td_text[start_c] - #-- GET HREF - td_cell.search('a').each do |link| - if link.content == td_text[start_c] then - l_address = link["href"] - end - end - link td_text[start_c], l_address - #-- BOLD TEXT - else - if td_tags[start_c] == 'strong' && td_text[start_c] != "" then - text td_text[start_c], bold: true - text ' ' - #-- ITALIC TEXT - else - if td_tags[start_c] == 'em' && td_text[start_c] != "" then - text td_text[start_c], italic: true - text ' ' - end - end - end - end - end - start_c += 1 - end - end - row_td_array << c1 - else - row_td_array << td_cell.text.to_s - end - end - end - - #--- check if all cells are empty - if row_td_array.size > 0 then - if row_td_array.all?(&:blank?) then - row_td_array = [] - end - end - - if !row_th_array.empty? then - table_array << row_th_array - end - if !row_td_array.empty? then - table_array << row_td_array - end - - end - - #--- build the table layout - docx.table table_array, border_size: 4 do - cell_style rows[0], bold: true, background: 'fbb400' - cell_style cells, size: 18, margins: { top: 100, bottom: 0, left: 100, right: 100 } - end - - end - - else - higher_level = search_answer.search('div.container').children.map {|x| x.name.strip} - all_text = search_answer.search('div.container').children.map {|x| x.inner_html.strip} - high_count = 0 - high_end_count = higher_level.size - - while high_count < high_end_count do - - if higher_level[high_count] == 'p' then - inner_txt_with_tags = Nokogiri::HTML::DocumentFragment.parse "

    " - inner_txt_with_tags.at(".//p").inner_html = all_text[high_count] - tags_type = inner_txt_with_tags.at_css('p').children.map {|x| x.name.strip} - inner_txt = inner_txt_with_tags.at_css('p').children.map {|x| x.text.strip} - - start_count = 0 - end_counter = tags_type.size - - docx.p do - while start_count < end_counter do - text_val = inner_txt[start_count].to_s - #-- TEXT - if tags_type[start_count] == 'text' && text_val != "" then - text text_val - text ' ' - #-- LINK - else - if tags_type[start_count] == 'a' && text_val != "" then - l_text = text_val - l_address = "" - # all links - search_answer.search('a').each do |link| - if link.content == text_val then - l_address = link["href"] - end - end - link text_val, l_address - #-- BOLD TEXT - else - if tags_type[start_count] == 'strong' && text_val != "" then - text text_val, bold: true - text ' ' - #-- ITALIC TEXT - else - if tags_type[start_count] == 'em' && text_val != "" then - text text_val, italic: true - text ' ' - end - end - end - end - start_count +=1 - end - end - #-- END OF P - else - if higher_level[high_count] == 'ul' then - ul_text = search_answer.search('ul').children.map {|x| x.text.strip} - docx.ul do - ul_text.each do |txt| - if !txt.blank? - li txt - end - end - end - else - if higher_level[high_count] == 'ol' then - ol_text = search_answer.search('ol').children.map {|x| x.text.strip} - docx.ol do - ol_text.each do |txt| - if !txt.blank? - li txt - end - end - end - end - end - end - - high_count += 1 - end - end - end - end - #-- add a new line - docx.p - end -end - +#----------------------------------------------------- +# page settings +#----------------------------------------------------- + +docx.page_numbers true do + align :center +end + +docx.font do + name 'Arial' +end + +docx.p do + size 32 +end + + +#--------------------------------------------- +# Structure for docx format +#--------------------------------------------- + +docx.h1 @exported_plan.plan.project.title.upcase, font: 'Arial', color: '000000' +docx.h2 @exported_plan.plan.title.upcase, font: 'Arial', color: '000000' + +#---- PLAN ADMIN DETAILS ----- +if @exported_plan.admin_details.present? + docx.p + docx.h3 'Admin Details'.upcase , italic: false, font: 'Arial', color: '000000' + @exported_plan.admin_details.each do |field| + value = @exported_plan.send(field) + label = "helpers.plan.export.#{field}" + if value.present? + docx.p do + text I18n.t(label), bold: true, color: '000000' + text ': ', bold: true, color: '000000' + text value + end + end + end +end + + +#---- PLAN SECTIONS, QUESTIONS AND ANSWERS ----- +@exported_plan.sections.each do |section| + docx.p + docx.h3 section.title.upcase, italic: false, font: 'Arial', color: '000000' + + @exported_plan.questions_for_section(section.id).each do |question| + docx.p strip_tags(question.text.gsub(/

  • /, ' * ')), bold: true + + answer = @exported_plan.plan.answer(question.id, false) + if answer.nil? + docx.p 'Question not answered', italic: true + else + q_format = question.question_format + if q_format.title == I18n.t("helpers.checkbox") || q_format.title == I18n.t("helpers.multi_select_box") || + q_format.title == I18n.t("helpers.radio_buttons") || q_format.title == I18n.t("helpers.dropdown") then + answer.options.each do |option| + docx.ul do + if !option.text.nil? + li option.text + end + end + end + end + + if !answer.text.nil? && question.option_comment_display == true then + search_answer = Nokogiri::HTML::DocumentFragment.parse "
    " + search_answer.at(".//div").inner_html = answer.text + + if search_answer.css('table').present? then + table_content = search_answer.css('table').css('tbody') + + if table_content.size > 0 then + table_array = Array.new + + table_content.css('tr').each do |tr| + row_th_array = Array.new + row_td_array = Array.new + + if tr.search('th') then + tr.search('th').each do |cell| + row_th_array << cell.text.to_s + end + end + + if tr.search('td') then + tr.search('td').each do |td_cell| + if !td_cell.text.to_s.blank? then + new_val = Nokogiri::HTML::DocumentFragment.parse "

    " + new_val.at(".//p").inner_html = td_cell + td_tags = new_val.at_css('td').children.map {|x| x.name.strip} + td_text = new_val.at_css('td').children.map {|x| x.text.strip} + + start_c = 0 + end_c = td_tags.size + + c1 = Caracal::Core::Models::TableCellModel.new do + while start_c < end_c do + p do + #-- TEXT + if td_tags[start_c] == 'text' then + text td_text[start_c] + else + #-- LINK + if td_tags[start_c] == 'a' then + l_address = "" + l_text = td_text[start_c] + #-- GET HREF + td_cell.search('a').each do |link| + if link.content == td_text[start_c] then + l_address = link["href"] + end + end + link td_text[start_c], l_address + #-- BOLD TEXT + else + if td_tags[start_c] == 'strong' && td_text[start_c] != "" then + text td_text[start_c], bold: true + text ' ' + #-- ITALIC TEXT + else + if td_tags[start_c] == 'em' && td_text[start_c] != "" then + text td_text[start_c], italic: true + text ' ' + end + end + end + end + end + start_c += 1 + end + end + row_td_array << c1 + else + row_td_array << td_cell.text.to_s + end + end + end + + #--- check if all cells are empty + if row_td_array.size > 0 then + if row_td_array.all?(&:blank?) then + row_td_array = [] + end + end + + if !row_th_array.empty? then + table_array << row_th_array + end + if !row_td_array.empty? then + table_array << row_td_array + end + + end + + #--- build the table layout + docx.table table_array, border_size: 4 do + cell_style rows[0], bold: true, background: 'fbb400' + cell_style cells, size: 18, margins: { top: 100, bottom: 0, left: 100, right: 100 } + end + + end + + else + higher_level = search_answer.search('div.container').children.map {|x| x.name.strip} + all_text = search_answer.search('div.container').children.map {|x| x.inner_html.strip} + high_count = 0 + high_end_count = higher_level.size + + while high_count < high_end_count do + + if higher_level[high_count] == 'p' then + inner_txt_with_tags = Nokogiri::HTML::DocumentFragment.parse "

    " + inner_txt_with_tags.at(".//p").inner_html = all_text[high_count] + tags_type = inner_txt_with_tags.at_css('p').children.map {|x| x.name.strip} + inner_txt = inner_txt_with_tags.at_css('p').children.map {|x| x.text.strip} + + start_count = 0 + end_counter = tags_type.size + + docx.p do + while start_count < end_counter do + text_val = inner_txt[start_count].to_s + #-- TEXT + if tags_type[start_count] == 'text' && text_val != "" then + text text_val + text ' ' + #-- LINK + else + if tags_type[start_count] == 'a' && text_val != "" then + l_text = text_val + l_address = "" + # all links + search_answer.search('a').each do |link| + if link.content == text_val then + l_address = link["href"] + end + end + link text_val, l_address + #-- BOLD TEXT + else + if tags_type[start_count] == 'strong' && text_val != "" then + text text_val, bold: true + text ' ' + #-- ITALIC TEXT + else + if tags_type[start_count] == 'em' && text_val != "" then + text text_val, italic: true + text ' ' + end + end + end + end + start_count +=1 + end + end + #-- END OF P + else + if higher_level[high_count] == 'ul' then + ul_text = search_answer.search('ul').children.map {|x| x.text.strip} + docx.ul do + ul_text.each do |txt| + if !txt.blank? + li txt + end + end + end + else + if higher_level[high_count] == 'ol' then + ol_text = search_answer.search('ol').children.map {|x| x.text.strip} + docx.ol do + ol_text.each do |txt| + if !txt.blank? + li txt + end + end + end + end + end + end + + high_count += 1 + end + end + end + end + #-- add a new line + docx.p + end +end diff --git a/app/views/plans/export.html.erb b/app/views/plans/export.html.erb index 2643963..fc991ec 100644 --- a/app/views/plans/export.html.erb +++ b/app/views/plans/export.html.erb @@ -1,77 +1,77 @@ -

    -

    <%= @plan.project.title %>

    -

    <%= @plan.version.phase.title %>

    -
    -
    - <% - details = @exported_plan.admin_details - if details.present? - %> -

    <%= t('org_admin.admin_details') %>

    - - - - - - - - - <% - details.each do |field| - value = @exported_plan.send(field) - if value.present? - %> - - - - - <% end %> - <% end %> - -
    <%= t('helpers.title')%><%= t('helpers.desc')%>

    - <%= t("helpers.plan.export.#{field}") -%>

    <%= value -%>
    - <% end %> - <% @exported_plan.sections.each do |section| %> -

    <%= section.title %>

    - - - - - - - - - <% questions = @exported_plan.questions_for_section(section.id) %> - <% questions.each do |question| %> - - - - - <% end %> - -
    <%= t('helpers.questions_label')%><%= t('helpers.answers_label')%>
    -

    - <%= question.text %>

    -
    - <% answer = @plan.answer(question.id, false) %> - <% if answer.nil? then %> -

    Question not answered.

    - <% else %> - <% 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%> -
      - <% answer.options.each do |option| %> -
    • <%= option.text %>
    • - <% end %> -
    - <% if question.option_comment_display == true then%> - <%= raw answer.text %> - <% end %> - <%else%> - <%= raw answer.text %> - <%end%> - <% end %> -
    - <% end %> -
    -
    -
    +
    +

    <%= @plan.project.title %>

    +

    <%= @plan.version.phase.title %>

    +
    +
    + <% + details = @exported_plan.admin_details + if details.present? + %> +

    <%= t('org_admin.admin_details') %>

    + + + + + + + + + <% + details.each do |field| + value = @exported_plan.send(field) + if value.present? + %> + + + + + <% end %> + <% end %> + +
    <%= t('helpers.title')%><%= t('helpers.desc')%>

    - <%= t("helpers.plan.export.#{field}") -%>

    <%= value -%>
    + <% end %> + <% @exported_plan.sections.each do |section| %> +

    <%= section.title %>

    + + + + + + + + + <% questions = @exported_plan.questions_for_section(section.id) %> + <% questions.each do |question| %> + + + + + <% end %> + +
    <%= t('helpers.questions_label')%><%= t('helpers.answers_label')%>
    +

    - <%= raw question.text %>

    +
    + <% answer = @plan.answer(question.id, false) %> + <% if answer.nil? then %> +

    Question not answered.

    + <% else %> + <% 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%> +
      + <% answer.options.each do |option| %> +
    • <%= option.text %>
    • + <% end %> +
    + <% if question.option_comment_display == true then%> + <%= raw answer.text %> + <% end %> + <%else%> + <%= raw answer.text %> + <%end%> + <% end %> +
    + <% end %> +
    +
    +
    diff --git a/app/views/plans/export.pdf.erb b/app/views/plans/export.pdf.erb index 9eca87a..77d68cb 100644 --- a/app/views/plans/export.pdf.erb +++ b/app/views/plans/export.pdf.erb @@ -1,72 +1,72 @@ - - - - - - <% if @plan.project.dmptemplate.phases.count > 1 then %> - <%= "#{@plan.project.title} - #{@plan.title}" %> - <% else %> - <%= @plan.project.title %> - <% end %> - - - - -

    <%= @plan.title %>

    - <% @exported_plan.admin_details.each do |field| - value = @exported_plan.send(field) - if value.present? - %> -

    <%= t("helpers.plan.export.#{field}") -%> <%= value -%>

    - <% end %> - <% end %> - - <% @exported_plan.sections.each do |section| %> -

    <%= section.title %>

    - <% questions = @exported_plan.questions_for_section(section.id) %> - <% questions.each_with_index do |question, idx| %> -
    - <% unless idx == 0 && question.text == section.title %> -

    <%= question.text %>

    - <% end %> - <% answer = @plan.answer(question.id, false) %> - <% if answer.nil? then %> -

    <%= t('helpers.plan.export.pdf.question_not_answered') -%>

    - <% else %> - <% 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%> -
      - <% answer.options.each do |option| %> -
    • <%= option.text %>
    • - <% end %> -
    - - <% if question.option_comment_display == true then%> - <% if !answer.text.nil? then %> - <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> - <%end%> - <%end%> - <%else%> - - <% if !answer.text.nil? then %> - <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> - <%end%> - <% end %> - <% end %> -
    - <% end %> - <% end %> - + + + + + + <% if @plan.project.dmptemplate.phases.count > 1 then %> + <%= "#{@plan.project.title} - #{@plan.title}" %> + <% else %> + <%= @plan.project.title %> + <% end %> + + + + +

    <%= @plan.title %>

    + <% @exported_plan.admin_details.each do |field| + value = @exported_plan.send(field) + if value.present? + %> +

    <%= t("helpers.plan.export.#{field}") -%> <%= value -%>

    + <% end %> + <% end %> + + <% @exported_plan.sections.each do |section| %> +

    <%= section.title %>

    + <% questions = @exported_plan.questions_for_section(section.id) %> + <% questions.each_with_index do |question, idx| %> +
    + <% unless idx == 0 && question.text == section.title %> +

    <%= raw question.text %>

    + <% end %> + <% answer = @plan.answer(question.id, false) %> + <% if answer.nil? then %> +

    <%= t('helpers.plan.export.pdf.question_not_answered') -%>

    + <% else %> + <% 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%> +
      + <% answer.options.each do |option| %> +
    • <%= option.text %>
    • + <% end %> +
    + + <% if question.option_comment_display == true then%> + <% if !answer.text.nil? then %> + <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> + <%end%> + <%end%> + <%else%> + + <% if !answer.text.nil? then %> + <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> + <%end%> + <% end %> + <% end %> +
    + <% end %> + <% end %> + \ No newline at end of file diff --git a/app/views/projects/_project_details.html.erb b/app/views/projects/_project_details.html.erb index aa8be11..dc62033 100644 --- a/app/views/projects/_project_details.html.erb +++ b/app/views/projects/_project_details.html.erb @@ -200,7 +200,7 @@
      <% questions.each do |ques|%>
    • - - <%= ques.text %> + <%= raw ques.text %>
    • <%end%>
    diff --git a/app/views/users/admin_grant_permissions.html.erb b/app/views/users/admin_grant_permissions.html.erb new file mode 100644 index 0000000..ee27a6d --- /dev/null +++ b/app/views/users/admin_grant_permissions.html.erb @@ -0,0 +1,29 @@ +<%= stylesheet_link_tag "admin" %> + +

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

    + +
    + <%= form_tag( admin_update_permissions_user_path(@user), method: :put) do %> + + + + <% @roles.each do |role| %> + + <% end %> + + + + + <% @roles.each do |role| %> + + <% end %> + + +
    <%= role.name %>
    + <%= check_box_tag "role_ids[]", role.id, @user.roles.include?(role) %> +
    + <%= submit_tag t('helpers.submit.save') %> + <% end %> +
    \ No newline at end of file diff --git a/app/views/users/admin_index.html.erb b/app/views/users/admin_index.html.erb index 3f26ec2..7e6a37f 100644 --- a/app/views/users/admin_index.html.erb +++ b/app/views/users/admin_index.html.erb @@ -5,56 +5,44 @@ <%= raw t('org_admin.user_text_html')%> -<% @users = current_user.organisation.users %> - - - - - - - - - <% if current_user.organisation.token_permission_types.count > 0 %> - - <% end %> - - - - - <%= form_tag( admin_api_update_users_path, method: :put) do %> - <% @users.each do |user| %> - <% if !user.nil? then%> - - - - - - - <% if current_user.organisation.token_permission_types.count > 0 %> - - <% end %> - - <% end %> - <% end %> - - <%= submit_tag "Update Users" %> +
    <%= t('org_admin.user_full_name') %><%= t('org_admin.user_name') %><%= t('org_admin.last_logged_in') %><%= t('org_admin.how_many_plans') %><%= t('org_admin.is_org_admin') %><%= t('org_admin.api_privleges') %>
    - <% if !user.name.nil? then%> - <%= user.name %> - <% end %> - - <%= user.email %> - - <% if !user.last_sign_in_at.nil? then%> - <%= l user.last_sign_in_at.to_date, :formats => :short %> - <% end %> - - <% if !user.project_groups.nil? then%> - <%= user.project_groups.count %> - <% end %> - - <%= check_box_tag "org_admin_ids[]", user.id, user.is_org_admin? %> - - <%= check_box_tag "api_user_ids[]", user.id, user.api_token !="" %> -
    + + + + + + + + + + + <% @users.each do |user| %> + <% if !user.nil? then%> + + + + + + + + <% end %> <% end %> -
    <%= t('org_admin.user_full_name') %><%= t('org_admin.user_name') %><%= t('org_admin.last_logged_in') %><%= t('org_admin.how_many_plans') %><%= t('org_admin.is_org_admin') %>
    + <% if !user.name.nil? then%> + <%= user.name %> + <% end %> + + <%= user.email %> + + <% if !user.last_sign_in_at.nil? then%> + <%= l user.last_sign_in_at.to_date, :formats => :short %> + <% end %> + + <% if !user.project_groups.nil? then%> + <%= user.project_groups.length %> + <% end %> + + <% b_label = t('helpers.submit.edit')%> + <%= link_to b_label, admin_grant_permissions_user_path(user), :class => "dmp_table_link"%> +
    \ No newline at end of file + + diff --git a/config/initializers/dragonfly.rb b/config/initializers/dragonfly.rb index bfaa4e5..7e74f09 100644 --- a/config/initializers/dragonfly.rb +++ b/config/initializers/dragonfly.rb @@ -23,4 +23,4 @@ if defined?(ActiveRecord::Base) ActiveRecord::Base.extend Dragonfly::Model ActiveRecord::Base.extend Dragonfly::Model::Validations -end \ No newline at end of file +end diff --git a/config/locales/en-UK.yml b/config/locales/en-UK.yml index c930f82..6d809eb 100644 --- a/config/locales/en-UK.yml +++ b/config/locales/en-UK.yml @@ -179,6 +179,7 @@ user_org_created: 'User org role was successfully created.' user_org_updated: 'User org role was successfully updated.' api_privleges: 'API Privleges?' + edit_user_privleges: 'Edit User Privleges' guidance: guidance_list: "Guidance list" @@ -955,6 +956,14 @@ super_admin: 'admin' organisational_admin: 'org_admin' user: 'user' + add_organisations: 'add_organisations' + change_org_affiliation: 'change_org_affiliation' + grant_permissions: 'grant_permissions' + modify_templates: 'modify_templates' + modify_guidance: 'modify_guidance' + use_api: 'use_api' + change_org_details: 'change_org_detials' + grant_api_to_orgs: 'grant_api_to_orgs' api_endpoint_types: guidances: 'guidances' plans: 'plans' diff --git a/config/routes.rb b/config/routes.rb index 154efc8..1d59a2b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,7 +20,10 @@ resources :users, :path => 'org/admin/users', only: [] do collection do get 'admin_index' - put 'admin_api_update' + end + member do + get 'admin_grant_permissions' + put 'admin_update_permissions' end end diff --git a/db/migrate/20130903123015_create_friendly_id_slugs.rb b/db/migrate/20130903123015_create_friendly_id_slugs.rb index d8577c3..91772b0 100644 --- a/db/migrate/20130903123015_create_friendly_id_slugs.rb +++ b/db/migrate/20130903123015_create_friendly_id_slugs.rb @@ -1,19 +1,19 @@ -class CreateFriendlyIdSlugs < ActiveRecord::Migration - - def self.up - create_table :friendly_id_slugs do |t| - t.string :slug, :null => false - t.integer :sluggable_id, :null => false - t.string :sluggable_type, :limit => 40 - t.datetime :created_at - end - add_index :friendly_id_slugs, :sluggable_id - add_index :friendly_id_slugs, [:slug, :sluggable_type], :unique => true - add_index :friendly_id_slugs, :sluggable_type - end - - def self.down - drop_table :friendly_id_slugs - end -end - +class CreateFriendlyIdSlugs < ActiveRecord::Migration + + def self.up + create_table :friendly_id_slugs do |t| + t.string :slug, :null => false + t.integer :sluggable_id, :null => false + t.string :sluggable_type, :limit => 40 + t.datetime :created_at + end + add_index :friendly_id_slugs, :sluggable_id + add_index :friendly_id_slugs, [:slug, :sluggable_type], :unique => true + add_index :friendly_id_slugs, :sluggable_type + end + + def self.down + drop_table :friendly_id_slugs + end +end + diff --git a/db/migrate/20140604092907_rails_settings_migration.rb b/db/migrate/20140604092907_rails_settings_migration.rb index 6a41dd2..3f7d041 100644 --- a/db/migrate/20140604092907_rails_settings_migration.rb +++ b/db/migrate/20140604092907_rails_settings_migration.rb @@ -1,15 +1,15 @@ -class RailsSettingsMigration < ActiveRecord::Migration - def self.up - create_table :settings do |t| - t.string :var, :null => false - t.text :value - t.references :target, :null => false, :polymorphic => true - t.timestamps - end - add_index :settings, [ :target_type, :target_id, :var ], :unique => true - end - - def self.down - drop_table :settings - end -end +class RailsSettingsMigration < ActiveRecord::Migration + def self.up + create_table :settings do |t| + t.string :var, :null => false + t.text :value + t.references :target, :null => false, :polymorphic => true + t.timestamps + end + add_index :settings, [ :target_type, :target_id, :var ], :unique => true + end + + def self.down + drop_table :settings + end +end diff --git a/db/schema.rb b/db/schema.rb index c14f575..4c22ef6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,7 @@ # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. - ActiveRecord::Schema.define(version: 20160822130701) do - create_table "answers", force: :cascade do |t| t.text "text", limit: 65535 t.integer "plan_id", limit: 4 @@ -126,15 +124,15 @@ t.string "abbreviation", limit: 255 t.string "description", limit: 255 t.string "name", limit: 255 - t.boolean "default_language" + t.boolean "default_language", limit: 1 end create_table "option_warnings", force: :cascade do |t| t.integer "organisation_id", limit: 4 t.integer "option_id", limit: 4 t.text "text", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "options", force: :cascade do |t| @@ -187,8 +185,8 @@ t.text "description", limit: 65535 t.integer "number", limit: 4 t.integer "dmptemplate_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "slug", limit: 255 end @@ -232,8 +230,8 @@ create_table "projects", force: :cascade do |t| t.string "title", limit: 255 t.integer "dmptemplate_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "slug", limit: 255 t.integer "organisation_id", limit: 4 t.string "grant_number", limit: 255 @@ -289,9 +287,9 @@ create_table "roles", force: :cascade do |t| t.string "name", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "role_in_plans" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "role_in_plans", limit: 1 t.integer "resource_id", limit: 4 t.string "resource_type", limit: 255 end @@ -315,8 +313,8 @@ t.text "value", limit: 65535 t.integer "target_id", limit: 4, null: false t.string "target_type", limit: 255, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true, using: :btree @@ -360,8 +358,8 @@ t.integer "user_id", limit: 4 t.integer "organisation_id", limit: 4 t.integer "user_role_type_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "user_role_types", force: :cascade do |t| @@ -393,8 +391,8 @@ t.string "shibboleth_id", limit: 255 t.integer "user_type_id", limit: 4 t.integer "user_status_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "encrypted_password", limit: 255, default: "" t.string "reset_password_token", limit: 255 t.datetime "reset_password_sent_at" diff --git a/db/seeds.rb b/db/seeds.rb index 6109e2a..37c7723 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -28,12 +28,14 @@ } languages.each do |l, details| - language = Language.new - language.abbreviation = details[:abbreviation] - language.description = details[:description] - language.name = details[:name] - language.default_language = details[:default_language] - language.save! + if Language.where(name: details[:name]).empty? + language = Language.new + language.abbreviation = details[:abbreviation] + language.description = details[:description] + language.name = details[:name] + language.default_language = details[:default_language] + language.save! + end end regions = { @@ -55,11 +57,13 @@ } regions.each do |l, details| - region = Region.new - region.abbreviation = details[:abbreviation] - region.description = details[:description] - region.name = details[:name] - region.save! + if Region.where(name: details[:name]).empty? + region = Region.new + region.abbreviation = details[:abbreviation] + region.description = details[:description] + region.name = details[:name] + region.save! + end end region_groups = { @@ -74,10 +78,12 @@ } region_groups.each do |l, details| - region_group = RegionGroup.new - region_group.super_region_id = Region.find_by_name(details[:super_region_name]).id - region_group.region_id = Region.find_by_name(details[:region_name]).id - region_group.save! + if RegionGroup.find_by(region_id: details[:region_name]).blank? + region_group = RegionGroup.new + region_group.super_region_id = Region.find_by_name(details[:super_region_name]).id + region_group.region_id = Region.find_by_name(details[:region_name]).id + region_group.save! + end end organisation_types = { @@ -169,13 +175,37 @@ roles = { 'admin' => { - name: "admin" + name: "admin" #depricated }, 'org_admin' => { - name: "org_admin" + name: "org_admin" #depricated }, 'user' => { - name: "user" + name: "user" #depricated + }, + 'add_organisations' => { + name: 'add_organisations' + }, + 'change_org_affiliation' => { + name: 'change_org_affiliation' + }, + 'grant_permissions' => { + name: 'grant_permissions' + }, + 'modify_templates' => { + name: 'modify_templates' + }, + 'modify_guidance' => { + name: 'modify_guidance' + }, + 'use_api' => { + name: 'use_api' + }, + 'change_org_detials' => { + name: 'change_org_detials' + }, + 'grant_api_to_orgs' => { + name: 'grant_api_to_orgs' } } @@ -214,7 +244,7 @@ password_confirmation: "password123", organisation: "RCC", language: 'English(UK)', - roles: ['admin','org_admin'], + roles: ['admin','org_admin','add_organisations','change_org_affiliation','grant_permissions','modify_templates','modify_guidance','use_api','change_org_detials','grant_api_to_orgs'], accept_terms: true, confirmed_at: Time.zone.now }, @@ -226,7 +256,7 @@ surname: "Admin", organisation: "RegSciFed", language: 'English(UK)', - roles: ['org_admin'], + roles: ['org_admin','grant_permissions','modify_templates','modify_guidance','change_org_detials'], accept_terms: true, confirmed_at: Time.zone.now }, @@ -238,7 +268,19 @@ surname: "Admin", organisation: "CapColl", language: 'English(UK)', - roles: ['org_admin'], + roles: ['org_admin','grant_permissions','modify_templates','modify_guidance','change_org_detials'], + accept_terms: true, + confirmed_at: Time.zone.now + }, + 'Organizational user' => { + email: "org_user@example.com", + password: "password123", + password_confirmation: "password123", + firstname: "Jane", + surname: "Researcher", + organisation: "CapColl", + language: 'English(UK)', + roles: ['user'], accept_terms: true, confirmed_at: Time.zone.now }, @@ -259,21 +301,20 @@ users.each do |user, details| if User.where(email: details[:email]).empty? usr = User.new + else + usr = User.where(email: details[:email]) + end usr.email = details[:email] usr.password = details[:password] usr.password_confirmation = details[:password_confirmation] usr.confirmed_at = details[:confirmed_at] usr.organisation_id = Organisation.find_by_abbreviation(details[:organisation]).id -# usr.user_org_roles << UserOrgRole.create(organisation: Organisation.find_by_abbreviation(details[:organisation]), -# user_role_type: UserRoleType.find_by_name('admin')) usr.language_id = Language.find_by_name(details[:language]).id details[:roles].each do |role| usr.roles << Role.find_by_name(role) end usr.accept_terms = details[:accept_terms] - usr.save! - end end themes = { @@ -637,6 +678,13 @@ guidance: "

    Things to consider:

    • What type(s) of data will you collect?
    • Will you need special software/tools to access the data?
    • How do you plan to store your data?
    • ", themes: ["Theme 4"] }, + "Data Overview" => { + text: "Overview of the Data", + section: "Data Overview", + number: 1, + guidance: "

      Things to consider:

      • What type(s) of data will you collect?
      • Will you need special software/tools to access the data?
      • How do you plan to store your data?
      • ", + themes: ["Theme 4"] + }, "How will you manage any ethical issues?" => { text: "How will you manage any ethical issues?", section: "Ethics and Legal Compliance", @@ -723,27 +771,10 @@ } token_permission_types.each do |title,settings| - token_permission_type = TokenPermissionType.new - token_permission_type.token_type = title - token_permission_type.text_desription = settings[:description] - token_permission_type.save! -end - -languages = { - 'en-UK': { - abbreviation: 'en-UK', name: 'en-UK', description: 'English - UK', default_language: 0 - }, - 'en-US': { - abbreviation: 'en-US', name: 'en-US', description: 'English - US', default_language: 1 - }, - 'fr': { - abbreviation: 'fr', name: 'fr', description: 'French', default_language: 0 - }, - 'de': { - abbreviation: 'de', name: 'de', description: 'German', default_language: 0 - } -} - -languages.each do |title,settings| - Language.new(settings).save! + if TokenPermissionType.where(token_type: title).empty? + token_permission_type = TokenPermissionType.new + token_permission_type.token_type = title + token_permission_type.text_desription = settings[:description] + token_permission_type.save! + end end diff --git a/html/ApplicationController.html b/html/ApplicationController.html index dfeacc1..6a420af 100644 --- a/html/ApplicationController.html +++ b/html/ApplicationController.html @@ -309,8 +309,8 @@
        # File app/controllers/application_controller.rb, line 32
        -def after_sign_in_error_path_for(resource)
        -  session[:previous_url] || root_path
        +def after_sign_in_error_path_for(resource)
        +  session[:previous_url] || root_path
         end
        @@ -339,8 +339,8 @@
        # File app/controllers/application_controller.rb, line 24
        -def after_sign_in_path_for(resource)
        -  session[:previous_url] || root_path
        +def after_sign_in_path_for(resource)
        +  session[:previous_url] || root_path
         end
        @@ -369,8 +369,8 @@
        # File app/controllers/application_controller.rb, line 36
        -def after_sign_up_error_path_for(resource)
        -  session[:previous_url] || root_path
        +def after_sign_up_error_path_for(resource)
        +  session[:previous_url] || root_path
         end
        @@ -399,8 +399,8 @@
        # File app/controllers/application_controller.rb, line 28
        -def after_sign_up_path_for(resource)
        -  session[:previous_url] || root_path
        +def after_sign_up_path_for(resource)
        +  session[:previous_url] || root_path
         end
        @@ -429,8 +429,8 @@
        # File app/controllers/application_controller.rb, line 40
        -def authenticate_admin!
        -        redirect_to root_path unless user_signed_in? && current_user.is_admin?
        +def authenticate_admin!
        +        redirect_to root_path unless user_signed_in? && current_user.can_super_admin?
         end
        @@ -459,11 +459,11 @@
        # File app/controllers/application_controller.rb, line 44
        -def get_plan_list_columns
        -        if user_signed_in?
        -                @selected_columns = current_user.settings(:plan_list).columns
        -                @all_columns = Settings::PlanList::ALL_COLUMNS
        -        end
        +def get_plan_list_columns
        +        if user_signed_in?
        +                @selected_columns = current_user.settings(:plan_list).columns
        +                @all_columns = Settings::PlanList::ALL_COLUMNS
        +        end
         end
        @@ -492,15 +492,17 @@
        # File app/controllers/application_controller.rb, line 13
        -def store_location
        - # store last url - this is needed for post-login redirect to whatever the user last visited.
        
        -        if (request.fullpath != "/users/sign_in" && \
        -                request.fullpath != "/users/sign_up" && \
        -                request.fullpath != "/users/password" && \
        -    request.fullpath != "/users/sign_up?nosplash=true" && \
        -                !request.xhr?) # don't store ajax calls
        
        -          session[:previous_url] = request.fullpath 
        -        end
        +def store_location
        + # store last url - this is needed for post-login redirect to whatever the user last visited.
        +
        +        if (request.fullpath != "/users/sign_in" && \
        +                request.fullpath != "/users/sign_up" && \
        +                request.fullpath != "/users/password" && \
        +    request.fullpath != "/users/sign_up?nosplash=true" && \
        +                !request.xhr?) # don't store ajax calls
        +
        +          session[:previous_url] = request.fullpath 
        +        end
         end
        diff --git a/html/DmptemplatesController.html b/html/DmptemplatesController.html index 228be4f..547fccf 100644 --- a/html/DmptemplatesController.html +++ b/html/DmptemplatesController.html @@ -355,20 +355,20 @@
        # File app/controllers/dmptemplates_controller.rb, line 187
        -def admin_addphase
        -        if user_signed_in? && current_user.is_org_admin? then
        -                @dmptemplate = Dmptemplate.find(params[:id])
        -                @phase = Phase.new
        -                if @dmptemplate.phases.count == 0 then
        -                        @phase.number = '1'
        -                else
        -                        @phase.number = @dmptemplate.phases.count + 1
        -                end
        -
        -                respond_to do |format|
        -      format.html
        -    end
        -        end
        +def admin_addphase
        +        if user_signed_in? && current_user.can_org_admin? then
        +                @dmptemplate = Dmptemplate.find(params[:id])
        +                @phase = Phase.new
        +                if @dmptemplate.phases.count == 0 then
        +                        @phase.number = '1'
        +                else
        +                        @phase.number = @dmptemplate.phases.count + 1
        +                end
        +
        +                respond_to do |format|
        +      format.html
        +    end
        +        end
         end
        @@ -397,22 +397,22 @@
        # File app/controllers/dmptemplates_controller.rb, line 293
        -def admin_cloneversion
        -        if user_signed_in? && current_user.is_org_admin? then
        -@old_version = Version.find(params[:version_id])
        -                @version = @old_version.amoeba_dup
        -                @phase = @version.phase
        -
        -    respond_to do |format|
        -      if @version.save
        -        format.html { redirect_to admin_phase_dmptemplate_path(@phase, :version_id => @version.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') }
        -        format.json { head :no_content }
        -      else
        -        format.html { render action: "admin_phase" }
        -        format.json { render json: @version.errors, status: :unprocessable_entity }
        -      end
        -    end
        -        end
        +def admin_cloneversion
        +        if user_signed_in? && current_user.can_org_admin? then
        +@old_version = Version.find(params[:version_id])
        +                @version = @old_version.amoeba_dup
        +                @phase = @version.phase
        +
        +    respond_to do |format|
        +      if @version.save
        +        format.html { redirect_to admin_phase_dmptemplate_path(@phase, :version_id => @version.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') }
        +        format.json { head :no_content }
        +      else
        +        format.html { render action: "admin_phase" }
        +        format.json { render json: @version.errors, status: :unprocessable_entity }
        +      end
        +    end
        +        end
         end
        @@ -441,24 +441,24 @@
        # File app/controllers/dmptemplates_controller.rb, line 81
        -def admin_create
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @dmptemplate = Dmptemplate.new(params[:dmptemplate])
        -          @dmptemplate.organisation_id = current_user.organisation.id
        -          @dmptemplate.description = params['template-desc']
        -
        -          respond_to do |format|
        -            if @dmptemplate.save
        -              format.html { redirect_to admin_template_dmptemplate_path(@dmptemplate), notice: I18n.t('org_admin.templates.created_message') }
        -              format.json { render json: @dmptemplate, status: :created, location: @dmptemplate }
        -            else
        -              format.html { render action: "admin_new" }
        -              format.json { render json: @dmptemplate.errors, status: :unprocessable_entity }
        -            end
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_create
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @dmptemplate = Dmptemplate.new(params[:dmptemplate])
        +          @dmptemplate.organisation_id = current_user.organisation.id
        +          @dmptemplate.description = params['template-desc']
        +
        +          respond_to do |format|
        +            if @dmptemplate.save
        +              format.html { redirect_to admin_template_dmptemplate_path(@dmptemplate), notice: I18n.t('org_admin.templates.created_message') }
        +              format.json { render json: @dmptemplate, status: :created, location: @dmptemplate }
        +            else
        +              format.html { render action: "admin_new" }
        +              format.json { render json: @dmptemplate.errors, status: :unprocessable_entity }
        +            end
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
         end
        @@ -487,26 +487,26 @@
        # File app/controllers/dmptemplates_controller.rb, line 204
        -      def admin_createphase
        -  if user_signed_in? && current_user.is_org_admin? then
        -             @phase = Phase.new(params[:phase])
        -          @phase.description = params["phase-desc"]
        -          @version = @phase.versions.build
        -          @version.title = "#{@phase.title} v.1"
        -          @version.phase_id = @phase.id
        -          @version.number = 1
        -          @version.published = false
        -
        -          respond_to do |format|
        -            if @phase.save
        -              format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') }
        -              format.json { head :no_content }
        -            else
        -              format.html { render action: "admin_phase" }
        -              format.json { render json: @phase.errors, status: :unprocessable_entity }
        -            end
        -                      end
        -              end
        +      def admin_createphase
        +  if user_signed_in? && current_user.can_org_admin? then
        +             @phase = Phase.new(params[:phase])
        +          @phase.description = params["phase-desc"]
        +          @version = @phase.versions.build
        +          @version.title = "#{@phase.title} v.1"
        +          @version.phase_id = @phase.id
        +          @version.number = 1
        +          @version.published = false
        +
        +          respond_to do |format|
        +            if @phase.save
        +              format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') }
        +              format.json { head :no_content }
        +            else
        +              format.html { render action: "admin_phase" }
        +              format.json { render json: @phase.errors, status: :unprocessable_entity }
        +            end
        +                      end
        +              end
         end
        @@ -535,23 +535,23 @@
        # File app/controllers/dmptemplates_controller.rb, line 386
        -      def admin_createquestion
        -  if user_signed_in? && current_user.is_org_admin? then
        -             @question = Question.new(params[:question])
        -          @question.guidance = params["new-question-guidance"]
        -          @question.default_value = params["new-question-default-value"]
        -
        -
        -          respond_to do |format|
        -            if @question.save
        -              format.html { redirect_to admin_phase_dmptemplate_path(:id => @question.section.version.phase_id, :version_id => @question.section.version_id, :section_id => @question.section_id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') }
        -              format.json { head :no_content }
        -            else
        -              format.html { render action: "admin_phase" }
        -              format.json { render json: @question.errors, status: :unprocessable_entity }
        -            end
        -                      end
        -              end
        +      def admin_createquestion
        +  if user_signed_in? && current_user.can_org_admin? then
        +             @question = Question.new(params[:question])
        +          @question.guidance = params["new-question-guidance"]
        +          @question.default_value = params["new-question-default-value"]
        +
        +
        +          respond_to do |format|
        +            if @question.save
        +              format.html { redirect_to admin_phase_dmptemplate_path(:id => @question.section.version.phase_id, :version_id => @question.section.version_id, :section_id => @question.section_id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') }
        +              format.json { head :no_content }
        +            else
        +              format.html { render action: "admin_phase" }
        +              format.json { render json: @question.errors, status: :unprocessable_entity }
        +            end
        +                      end
        +              end
         end
        @@ -580,21 +580,21 @@
        # File app/controllers/dmptemplates_controller.rb, line 328
        -      def admin_createsection
        -  if user_signed_in? && current_user.is_org_admin? then
        -             @section = Section.new(params[:section])
        -          @section.description = params["section-desc"]
        -
        -          respond_to do |format|
        -            if @section.save
        -              format.html { redirect_to admin_phase_dmptemplate_path(:id => @section.version.phase_id, :version_id => @section.version_id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') }
        -              format.json { head :no_content }
        -            else
        -              format.html { render action: "admin_phase" }
        -              format.json { render json: @section.errors, status: :unprocessable_entity }
        -            end
        -                      end
        -              end
        +      def admin_createsection
        +  if user_signed_in? && current_user.can_org_admin? then
        +             @section = Section.new(params[:section])
        +          @section.description = params["section-desc"]
        +
        +          respond_to do |format|
        +            if @section.save
        +              format.html { redirect_to admin_phase_dmptemplate_path(:id => @section.version.phase_id, :version_id => @section.version_id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') }
        +              format.json { head :no_content }
        +            else
        +              format.html { render action: "admin_phase" }
        +              format.json { render json: @section.errors, status: :unprocessable_entity }
        +            end
        +                      end
        +              end
         end
        @@ -623,20 +623,20 @@
        # File app/controllers/dmptemplates_controller.rb, line 446
        -   def admin_createsuggestedanswer
        -   if user_signed_in? && current_user.is_org_admin? then
        -           @suggested_answer = SuggestedAnswer.new(params[:suggested_answer])
        -
        -       respond_to do |format|
        -         if @suggested_answer.save
        -           format.html { redirect_to admin_phase_dmptemplate_path(:id => @suggested_answer.question.section.version.phase_id, :version_id => @suggested_answer.question.section.version_id, :section_id => @suggested_answer.question.section_id, :question_id => @suggested_answer.question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') }
        -           format.json { head :no_content }
        -         else
        -           format.html { render action: "admin_phase" }
        -           format.json { render json: @suggested_answer.errors, status: :unprocessable_entity }
        -         end
        -           end
        -    end
        +   def admin_createsuggestedanswer
        +   if user_signed_in? && current_user.can_org_admin? then
        +           @suggested_answer = SuggestedAnswer.new(params[:suggested_answer])
        +
        +       respond_to do |format|
        +         if @suggested_answer.save
        +           format.html { redirect_to admin_phase_dmptemplate_path(:id => @suggested_answer.question.section.version.phase_id, :version_id => @suggested_answer.question.section.version_id, :section_id => @suggested_answer.question.section_id, :question_id => @suggested_answer.question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.created_message') }
        +           format.json { head :no_content }
        +         else
        +           format.html { render action: "admin_phase" }
        +           format.json { render json: @suggested_answer.errors, status: :unprocessable_entity }
        +         end
        +           end
        +    end
         end
        @@ -665,18 +665,18 @@
        # File app/controllers/dmptemplates_controller.rb, line 105
        -def admin_destroy
        -      if user_signed_in? && current_user.is_org_admin? then
        -             @dmptemplate = Dmptemplate.find(params[:id])
        -          @dmptemplate.destroy
        -
        -          respond_to do |format|
        -            format.html { redirect_to admin_index_dmptemplate_path }
        -            format.json { head :no_content }
        -          end
        -             else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_destroy
        +      if user_signed_in? && current_user.can_org_admin? then
        +             @dmptemplate = Dmptemplate.find(params[:id])
        +          @dmptemplate.destroy
        +
        +          respond_to do |format|
        +            format.html { redirect_to admin_index_dmptemplate_path }
        +            format.json { head :no_content }
        +          end
        +             else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
               end
        @@ -705,17 +705,17 @@
        # File app/controllers/dmptemplates_controller.rb, line 246
        -def admin_destroyphase
        -if user_signed_in? && current_user.is_org_admin? then
        -       @phase = Phase.find(params[:phase_id])
        -       @dmptemplate = @phase.dmptemplate
        -    @phase.destroy
        -
        -    respond_to do |format|
        -      format.html { redirect_to admin_template_dmptemplate_path(@dmptemplate), notice: I18n.t('org_admin.templates.destroyed_message') }
        -      format.json { head :no_content }
        -    end
        -       end
        +def admin_destroyphase
        +if user_signed_in? && current_user.can_org_admin? then
        +       @phase = Phase.find(params[:phase_id])
        +       @dmptemplate = @phase.dmptemplate
        +    @phase.destroy
        +
        +    respond_to do |format|
        +      format.html { redirect_to admin_template_dmptemplate_path(@dmptemplate), notice: I18n.t('org_admin.templates.destroyed_message') }
        +      format.json { head :no_content }
        +    end
        +       end
         end
        @@ -744,19 +744,19 @@
        # File app/controllers/dmptemplates_controller.rb, line 428
        -def admin_destroyquestion
        -if user_signed_in? && current_user.is_org_admin? then
        -       @question = Question.find(params[:question_id])
        -       @section = @question.section
        -                @version = @section.version
        -       @phase = @version.phase
        -    @question.destroy
        -
        -    respond_to do |format|
        -      format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') }
        -      format.json { head :no_content }
        -    end
        -       end
        +def admin_destroyquestion
        +if user_signed_in? && current_user.can_org_admin? then
        +       @question = Question.find(params[:question_id])
        +       @section = @question.section
        +                @version = @section.version
        +       @phase = @version.phase
        +    @question.destroy
        +
        +    respond_to do |format|
        +      format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') }
        +      format.json { head :no_content }
        +    end
        +       end
         end
        @@ -785,18 +785,18 @@
        # File app/controllers/dmptemplates_controller.rb, line 368
        -def admin_destroysection
        -if user_signed_in? && current_user.is_org_admin? then
        -       @section = Section.find(params[:section_id])
        -       @version = @section.version
        -       @phase = @version.phase
        -    @section.destroy
        -
        -    respond_to do |format|
        -      format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id,  :edit => 'true' ), notice: I18n.t('org_admin.templates.destroyed_message') }
        -      format.json { head :no_content }
        -    end
        -       end
        +def admin_destroysection
        +if user_signed_in? && current_user.can_org_admin? then
        +       @section = Section.find(params[:section_id])
        +       @version = @section.version
        +       @phase = @version.phase
        +    @section.destroy
        +
        +    respond_to do |format|
        +      format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id,  :edit => 'true' ), notice: I18n.t('org_admin.templates.destroyed_message') }
        +      format.json { head :no_content }
        +    end
        +       end
         end
        @@ -825,20 +825,20 @@
        # File app/controllers/dmptemplates_controller.rb, line 484
        -def admin_destroysuggestedanswer
        -if user_signed_in? && current_user.is_org_admin? then
        -       @suggested_answer = SuggestedAnswer.find(params[:suggested_answer])
        -       @question = @suggested_answer.question
        -       @section = @question.section
        -                @version = @section.version
        -       @phase = @version.phase
        -    @suggested_answer.destroy
        -
        -    respond_to do |format|
        -      format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') }
        -      format.json { head :no_content }
        -    end
        -       end
        +def admin_destroysuggestedanswer
        +if user_signed_in? && current_user.can_org_admin? then
        +       @suggested_answer = SuggestedAnswer.find(params[:suggested_answer])
        +       @question = @suggested_answer.question
        +       @section = @question.section
        +                @version = @section.version
        +       @phase = @version.phase
        +    @suggested_answer.destroy
        +
        +    respond_to do |format|
        +      format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :edit => 'true'), notice: I18n.t('org_admin.templates.destroyed_message') }
        +      format.json { head :no_content }
        +    end
        +       end
         end
        @@ -867,17 +867,17 @@
        # File app/controllers/dmptemplates_controller.rb, line 312
        -def admin_destroyversion
        -if user_signed_in? && current_user.is_org_admin? then
        -       @version = Version.find(params[:version_id])
        -       @phase = @version.phase
        -    @version.destroy
        -
        -    respond_to do |format|
        -      format.html { redirect_to admin_phase_dmptemplate_path(@phase), notice: I18n.t('org_admin.templates.destroyed_message') }
        -      format.json { head :no_content }
        -    end
        -       end
        +def admin_destroyversion
        +if user_signed_in? && current_user.can_org_admin? then
        +       @version = Version.find(params[:version_id])
        +       @phase = @version.phase
        +    @version.destroy
        +
        +    respond_to do |format|
        +      format.html { redirect_to admin_phase_dmptemplate_path(@phase), notice: I18n.t('org_admin.templates.destroyed_message') }
        +      format.json { head :no_content }
        +    end
        +       end
         end
        @@ -906,20 +906,23 @@
        # File app/controllers/dmptemplates_controller.rb, line 9
        -def admin_index
        -  if user_signed_in? && current_user.is_org_admin? then
        -      #institutional templates
        
        -          @dmptemplates_own = Dmptemplate.own_institutional_templates(current_user.organisation_id)
        -
        -          #funders templates
        
        -          @dmptemplates_funders = Dmptemplate.funders_templates
        -
        -   respond_to do |format|
        -            format.html # index.html.erb
        
        -         end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_index
        +  if user_signed_in? && current_user.can_org_admin? then
        +      #institutional templates
        +
        +          @dmptemplates_own = Dmptemplate.own_institutional_templates(current_user.organisation_id)
        +
        +          #funders templates
        +
        +          @dmptemplates_funders = Dmptemplate.funders_templates
        +
        +   respond_to do |format|
        +            format.html # index.html.erb
        +
        +         end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
         end
        @@ -948,17 +951,18 @@
        # File app/controllers/dmptemplates_controller.rb, line 66
        -def admin_new
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @dmptemplate = Dmptemplate.new
        -
        -          respond_to do |format|
        -            format.html # new.html.erb
        
        -            format.json { render json: @dmptemplate }
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_new
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @dmptemplate = Dmptemplate.new
        +
        +          respond_to do |format|
        +            format.html # new.html.erb
        +
        +            format.json { render json: @dmptemplate }
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
         end
        @@ -987,52 +991,56 @@
        # File app/controllers/dmptemplates_controller.rb, line 124
        -def admin_phase
        -        if user_signed_in? && current_user.is_org_admin? then
        -
        -                @phase = Phase.find(params[:id])
        -
        -                if !params.has_key?(:version_id) then
        -                        @edit = 'false'
        -                        #check for the most recent published version, if none is available then return the most recent one
        
        -                        versions = @phase.versions.where('published = ?', true).order('updated_at DESC')
        -                        if versions.any?() then
        -                                @version = versions.first
        -                        else
        -                                @version = @phase.versions.order('updated_at DESC').first
        -                        end
        -                        # When the version_id is passed as an argument
        
        -                else
        -                        @edit = params[:edit]
        -                        @version = Version.find(params[:version_id])
        -                end
        -
        -                #verify if there are any sections if not create one
        
        -                @sections = @version.sections
        -                if !@sections.any?() || @sections.count == 0 then
        -                        @section = @version.sections.build
        -                        @section.title = ''
        -                        @section.version_id = params[:version_id]
        -                        @section.number = 1
        -                        @section.organisation_id = current_user.organisation.id
        -                        @section.published = true
        -                        @section.save
        -                end
        -
        -                #verify if section_id has been passed, if so then open that section
        
        -                if params.has_key?(:section_id) then
        -                        @open = true
        -                        @section_id = params[:section_id].to_i
        -                end
        -
        -                if params.has_key?(:question_id) then
        -                        @question_id = params[:question_id].to_i
        -                end
        -
        -                respond_to do |format|
        -                        format.html
        -                end
        -        end
        +def admin_phase
        +        if user_signed_in? && current_user.can_org_admin? then
        +
        +                @phase = Phase.find(params[:id])
        +
        +                if !params.has_key?(:version_id) then
        +                        @edit = 'false'
        +                        #check for the most recent published version, if none is available then return the most recent one
        +
        +                        versions = @phase.versions.where('published = ?', true).order('updated_at DESC')
        +                        if versions.any?() then
        +                                @version = versions.first
        +                        else
        +                                @version = @phase.versions.order('updated_at DESC').first
        +                        end
        +                        # When the version_id is passed as an argument
        +
        +                else
        +                        @edit = params[:edit]
        +                        @version = Version.find(params[:version_id])
        +                end
        +
        +                #verify if there are any sections if not create one
        +
        +                @sections = @version.sections
        +                if !@sections.any?() || @sections.count == 0 then
        +                        @section = @version.sections.build
        +                        @section.title = ''
        +                        @section.version_id = params[:version_id]
        +                        @section.number = 1
        +                        @section.organisation_id = current_user.organisation.id
        +                        @section.published = true
        +                        @section.save
        +                end
        +
        +                #verify if section_id has been passed, if so then open that section
        +
        +                if params.has_key?(:section_id) then
        +                        @open = true
        +                        @section_id = params[:section_id].to_i
        +                end
        +
        +                if params.has_key?(:question_id) then
        +                        @question_id = params[:question_id].to_i
        +                end
        +
        +                respond_to do |format|
        +                        format.html
        +                end
        +        end
         end
        @@ -1061,16 +1069,16 @@
        # File app/controllers/dmptemplates_controller.rb, line 173
        -def admin_previewphase
        -        if user_signed_in? && current_user.is_org_admin? then
        -                
        -                @version = Version.find(params[:id])
        -                
        -                        
        -                respond_to do |format|
        -                        format.html
        -                end
        -        end   
        +def admin_previewphase
        +        if user_signed_in? && current_user.can_org_admin? then
        +                
        +                @version = Version.find(params[:id])
        +                
        +                        
        +                respond_to do |format|
        +                        format.html
        +                end
        +        end   
         end
        @@ -1099,17 +1107,18 @@
        # File app/controllers/dmptemplates_controller.rb, line 27
        -def admin_template
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @dmptemplate = Dmptemplate.find(params[:id])
        -
        -          respond_to do |format|
        -            format.html # show.html.erb
        
        -            format.json { render json: @dmptemplate }
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_template
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @dmptemplate = Dmptemplate.find(params[:id])
        +
        +          respond_to do |format|
        +            format.html # show.html.erb
        +
        +            format.json { render json: @dmptemplate }
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
         end
        @@ -1138,23 +1147,23 @@
        # File app/controllers/dmptemplates_controller.rb, line 44
        -def admin_update
        -      if user_signed_in? && current_user.is_org_admin? then
        -              @dmptemplate = Dmptemplate.find(params[:id])
        -              @dmptemplate.description = params["template-desc"]
        -
        -                respond_to do |format|
        -            if @dmptemplate.update_attributes(params[:dmptemplate])
        -              format.html { redirect_to admin_template_dmptemplate_path(params[:dmptemplate]), notice: I18n.t('org_admin.templates.updated_message') }
        -              format.json { head :no_content }
        -            else
        -              format.html { render action: "edit" }
        -              format.json { render json: @dmptemplate.errors, status: :unprocessable_entity }
        -            end
        -             end
        -      else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -      end
        +def admin_update
        +      if user_signed_in? && current_user.can_org_admin? then
        +              @dmptemplate = Dmptemplate.find(params[:id])
        +              @dmptemplate.description = params["template-desc"]
        +
        +                respond_to do |format|
        +            if @dmptemplate.update_attributes(params[:dmptemplate])
        +              format.html { redirect_to admin_template_dmptemplate_path(params[:dmptemplate]), notice: I18n.t('org_admin.templates.updated_message') }
        +              format.json { head :no_content }
        +            else
        +              format.html { render action: "edit" }
        +              format.json { render json: @dmptemplate.errors, status: :unprocessable_entity }
        +            end
        +             end
        +      else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +      end
         end
        @@ -1183,21 +1192,21 @@
        # File app/controllers/dmptemplates_controller.rb, line 228
        -def admin_updatephase
        -        if user_signed_in? && current_user.is_org_admin? then
        -        @phase = Phase.find(params[:id])
        -        @phase.description = params["phase-desc"]
        -
        -    respond_to do |format|
        -      if @phase.update_attributes(params[:phase])
        -        format.html { redirect_to admin_phase_dmptemplate_path(@phase), notice: I18n.t('org_admin.templates.updated_message') }
        -        format.json { head :no_content }
        -      else
        -        format.html { render action: "admin_phase" }
        -        format.json { render json: @phase.errors, status: :unprocessable_entity }
        -      end
        -    end
        -        end
        +def admin_updatephase
        +        if user_signed_in? && current_user.can_org_admin? then
        +        @phase = Phase.find(params[:id])
        +        @phase.description = params["phase-desc"]
        +
        +    respond_to do |format|
        +      if @phase.update_attributes(params[:phase])
        +        format.html { redirect_to admin_phase_dmptemplate_path(@phase), notice: I18n.t('org_admin.templates.updated_message') }
        +        format.json { head :no_content }
        +      else
        +        format.html { render action: "admin_phase" }
        +        format.json { render json: @phase.errors, status: :unprocessable_entity }
        +      end
        +    end
        +        end
         end
        @@ -1226,25 +1235,25 @@
        # File app/controllers/dmptemplates_controller.rb, line 406
        -def admin_updatequestion
        -        if user_signed_in? && current_user.is_org_admin? then
        -               @question = Question.find(params[:id])
        -                        @question.guidance = params["question-guidance-#{params[:id]}"]
        -                        @question.default_value = params["question-default-value-#{params[:id]}"]
        -       @section = @question.section
        -                        @version = @section.version
        -                        @phase = @version.phase
        -
        -                        respond_to do |format|
        -              if @question.update_attributes(params[:question])
        -                format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') }
        -                format.json { head :no_content }
        -              else
        -                format.html { render action: "admin_phase" }
        -                format.json { render json: @question.errors, status: :unprocessable_entity }
        -              end
        -            end
        -                end
        +def admin_updatequestion
        +        if user_signed_in? && current_user.can_org_admin? then
        +               @question = Question.find(params[:id])
        +                        @question.guidance = params["question-guidance-#{params[:id]}"]
        +                        @question.default_value = params["question-default-value-#{params[:id]}"]
        +       @section = @question.section
        +                        @version = @section.version
        +                        @phase = @version.phase
        +
        +                        respond_to do |format|
        +              if @question.update_attributes(params[:question])
        +                format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') }
        +                format.json { head :no_content }
        +              else
        +                format.html { render action: "admin_phase" }
        +                format.json { render json: @question.errors, status: :unprocessable_entity }
        +              end
        +            end
        +                end
                 end
        @@ -1273,23 +1282,23 @@
        # File app/controllers/dmptemplates_controller.rb, line 347
        -def admin_updatesection
        -        if user_signed_in? && current_user.is_org_admin? then
        -               @section = Section.find(params[:id])
        -               @section.description = params["section-desc-#{params[:id]}"]
        -       @version = @section.version
        -                        @phase = @version.phase
        -
        -                        respond_to do |format|
        -              if @section.update_attributes(params[:section])
        -                format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id , :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') }
        -                format.json { head :no_content }
        -              else
        -                format.html { render action: "admin_phase" }
        -                format.json { render json: @section.errors, status: :unprocessable_entity }
        -              end
        -            end
        -                end
        +def admin_updatesection
        +        if user_signed_in? && current_user.can_org_admin? then
        +               @section = Section.find(params[:id])
        +               @section.description = params["section-desc-#{params[:id]}"]
        +       @version = @section.version
        +                        @phase = @version.phase
        +
        +                        respond_to do |format|
        +              if @section.update_attributes(params[:section])
        +                format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id , :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') }
        +                format.json { head :no_content }
        +              else
        +                format.html { render action: "admin_phase" }
        +                format.json { render json: @section.errors, status: :unprocessable_entity }
        +              end
        +            end
        +                end
         end
        @@ -1318,24 +1327,24 @@
        # File app/controllers/dmptemplates_controller.rb, line 463
        -def admin_updatesuggestedanswer
        -        if user_signed_in? && current_user.is_org_admin? then
        -               @suggested_answer = SuggestedAnswer.find(params[:id])
        -    @question = @suggested_answer.question
        -    @section = @question.section
        -    @version = @section.version
        -    @phase = @version.phase
        -
        -                        respond_to do |format|
        -              if @suggested_answer.update_attributes(params[:suggested_answer])
        -                format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') }
        -                format.json { head :no_content }
        -              else
        -                format.html { render action: "admin_phase" }
        -                format.json { render json: @suggested_answer.errors, status: :unprocessable_entity }
        -              end
        -            end
        -                end
        +def admin_updatesuggestedanswer
        +        if user_signed_in? && current_user.can_org_admin? then
        +               @suggested_answer = SuggestedAnswer.find(params[:id])
        +    @question = @suggested_answer.question
        +    @section = @question.section
        +    @version = @section.version
        +    @phase = @version.phase
        +
        +                        respond_to do |format|
        +              if @suggested_answer.update_attributes(params[:suggested_answer])
        +                format.html { redirect_to admin_phase_dmptemplate_path(:id => @phase.id, :version_id => @version.id, :section_id => @section.id, :question_id => @question.id, :edit => 'true'), notice: I18n.t('org_admin.templates.updated_message') }
        +                format.json { head :no_content }
        +              else
        +                format.html { render action: "admin_phase" }
        +                format.json { render json: @suggested_answer.errors, status: :unprocessable_entity }
        +              end
        +            end
        +                end
                 end
        @@ -1364,34 +1373,34 @@
        # File app/controllers/dmptemplates_controller.rb, line 262
        -def admin_updateversion
        -        if user_signed_in? && current_user.is_org_admin? then
        -               @version = Version.find(params[:id])
        -    @version.description = params["version-desc"]
        -    @phase = @version.phase
        -
        -    if @version.published && !@phase.dmptemplate.published then
        -        @phase.dmptemplate.published = true
        -    end
        -    
        -    @all_versions = @phase.versions.where('published = ?', true)
        -    @all_versions.each do |v|
        -        if v.id != @version.id && v.published == true then
        -            v.published = false
        -            v.save
        -        end
        -    end
        -
        -            respond_to do |format|
        -              if @version.update_attributes(params[:version])
        -                format.html { redirect_to admin_phase_dmptemplate_path(@phase, :version_id =>  @version.id, :edit => 'false'), notice: I18n.t('org_admin.templates.updated_message') }
        -                format.json { head :no_content }
        -              else
        -                format.html { render action: "admin_phase" }
        -                format.json { render json: @version.errors, status: :unprocessable_entity }
        -              end
        -            end
        -                end
        +def admin_updateversion
        +        if user_signed_in? && current_user.can_org_admin? then
        +               @version = Version.find(params[:id])
        +    @version.description = params["version-desc"]
        +    @phase = @version.phase
        +
        +    if @version.published && !@phase.dmptemplate.published then
        +        @phase.dmptemplate.published = true
        +    end
        +    
        +    @all_versions = @phase.versions.where('published = ?', true)
        +    @all_versions.each do |v|
        +        if v.id != @version.id && v.published == true then
        +            v.published = false
        +            v.save
        +        end
        +    end
        +
        +            respond_to do |format|
        +              if @version.update_attributes(params[:version])
        +                format.html { redirect_to admin_phase_dmptemplate_path(@phase, :version_id =>  @version.id, :edit => 'false'), notice: I18n.t('org_admin.templates.updated_message') }
        +                format.json { head :no_content }
        +              else
        +                format.html { render action: "admin_phase" }
        +                format.json { render json: @version.errors, status: :unprocessable_entity }
        +              end
        +            end
        +                end
                 end
        diff --git a/html/GuidanceGroupsController.html b/html/GuidanceGroupsController.html index db1ac12..ed9a143 100644 --- a/html/GuidanceGroupsController.html +++ b/html/GuidanceGroupsController.html @@ -307,23 +307,23 @@
        # File app/controllers/guidance_groups_controller.rb, line 34
        -def admin_create
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @guidance_group = GuidanceGroup.new(params[:guidance_group])
        -          @guidance_group.organisation_id = current_user.organisation_id
        -      
        -          respond_to do |format|
        -            if @guidance_group.save
        -              format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.created_message') }
        -              format.json { render json: @guidance_group, status: :created, location: @guidance_group }
        -            else
        -              format.html { render action: "new" }
        -              format.json { render json: @guidance_group.errors, status: :unprocessable_entity }
        -            end
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end 
        +def admin_create
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @guidance_group = GuidanceGroup.new(params[:guidance_group])
        +          @guidance_group.organisation_id = current_user.organisation_id
        +      
        +          respond_to do |format|
        +            if @guidance_group.save
        +              format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.created_message') }
        +              format.json { render json: @guidance_group, status: :created, location: @guidance_group }
        +            else
        +              format.html { render action: "new" }
        +              format.json { render json: @guidance_group.errors, status: :unprocessable_entity }
        +            end
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end 
         end
        @@ -352,19 +352,19 @@
        # File app/controllers/guidance_groups_controller.rb, line 87
        -def admin_destroy
        -      if user_signed_in? && current_user.is_org_admin? then
        -             @guidance_group = GuidanceGroup.find(params[:id])
        -          @guidance_group.destroy
        -      
        -          respond_to do |format|
        -            format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.destroyed_message') }
        -            format.json { head :no_content }
        -          end
        -             else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end 
        -      
        +def admin_destroy
        +      if user_signed_in? && current_user.can_org_admin? then
        +             @guidance_group = GuidanceGroup.find(params[:id])
        +          @guidance_group.destroy
        +      
        +          respond_to do |format|
        +            format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.destroyed_message') }
        +            format.json { head :no_content }
        +          end
        +             else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end 
        +      
               end
        @@ -393,12 +393,12 @@
        # File app/controllers/guidance_groups_controller.rb, line 55
        -def admin_edit
        -      if user_signed_in? && current_user.is_org_admin? then
        -    @guidance_group = GuidanceGroup.find(params[:id])
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end 
        +def admin_edit
        +      if user_signed_in? && current_user.can_org_admin? then
        +    @guidance_group = GuidanceGroup.find(params[:id])
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end 
         end
        @@ -427,15 +427,16 @@
        # File app/controllers/guidance_groups_controller.rb, line 21
        -    def admin_new
        -if user_signed_in? && current_user.is_org_admin? then
        -        @guidance_group = GuidanceGroup.new
        -           
        -        respond_to do |format|
        -          format.html # new.html.erb
        
        -          format.json { render json: @guidance }
        -        end
        -    end
        +    def admin_new
        +if user_signed_in? && current_user.can_org_admin? then
        +        @guidance_group = GuidanceGroup.new
        +           
        +        respond_to do |format|
        +          format.html # new.html.erb
        +
        +          format.json { render json: @guidance }
        +        end
        +    end
             end
        @@ -464,17 +465,17 @@
        # File app/controllers/guidance_groups_controller.rb, line 6
        -def admin_show
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @guidance_group = GuidanceGroup.find(params[:id])
        -      
        -          respond_to do |format|
        -            format.html 
        -            format.json { render json: @guidance_group }
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end 
        +def admin_show
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @guidance_group = GuidanceGroup.find(params[:id])
        +      
        +          respond_to do |format|
        +            format.html 
        +            format.json { render json: @guidance_group }
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end 
         end
        @@ -503,23 +504,23 @@
        # File app/controllers/guidance_groups_controller.rb, line 65
        -def admin_update
        -              if user_signed_in? && current_user.is_org_admin? then
        -              @guidance_group = GuidanceGroup.find(params[:id])
        -          @guidance_group.organisation_id = current_user.organisation_id
        -
        -          respond_to do |format|
        -            if @guidance_group.update_attributes(params[:guidance_group])
        -              format.html { redirect_to admin_index_guidance_path(params[:guidance_group]), notice: I18n.t('org_admin.guidance_group.updated_message') }
        -              format.json { head :no_content }
        -            else
        -              format.html { render action: "edit" }
        -              format.json { render json: @guidance_group.errors, status: :unprocessable_entity }
        -            end
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end 
        +def admin_update
        +              if user_signed_in? && current_user.can_org_admin? then
        +              @guidance_group = GuidanceGroup.find(params[:id])
        +          @guidance_group.organisation_id = current_user.organisation_id
        +
        +          respond_to do |format|
        +            if @guidance_group.update_attributes(params[:guidance_group])
        +              format.html { redirect_to admin_index_guidance_path(params[:guidance_group]), notice: I18n.t('org_admin.guidance_group.updated_message') }
        +              format.json { head :no_content }
        +            else
        +              format.html { render action: "edit" }
        +              format.json { render json: @guidance_group.errors, status: :unprocessable_entity }
        +            end
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end 
         end
        diff --git a/html/GuidancesController.html b/html/GuidancesController.html index 03ef0db..661593b 100644 --- a/html/GuidancesController.html +++ b/html/GuidancesController.html @@ -317,24 +317,24 @@
        # File app/controllers/guidances_controller.rb, line 155
        -def admin_create
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @guidance = Guidance.new(params[:guidance])
        -          @guidance.text = params["guidance-text"]
        -          @guidance.question_id = params["question_id"]
        -
        -          respond_to do |format|
        -            if @guidance.save
        -              format.html { redirect_to admin_show_guidance_path(@guidance), notice: I18n.t('org_admin.guidance.created_message') }
        -              format.json { render json: @guidance, status: :created, location: @guidance }
        -            else
        -              format.html { render action: "new" }
        -              format.json { render json: @guidance.errors, status: :unprocessable_entity }
        -            end
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_create
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @guidance = Guidance.new(params[:guidance])
        +          @guidance.text = params["guidance-text"]
        +          @guidance.question_id = params["question_id"]
        +
        +          respond_to do |format|
        +            if @guidance.save
        +              format.html { redirect_to admin_show_guidance_path(@guidance), notice: I18n.t('org_admin.guidance.created_message') }
        +              format.json { render json: @guidance, status: :created, location: @guidance }
        +            else
        +              format.html { render action: "new" }
        +              format.json { render json: @guidance.errors, status: :unprocessable_entity }
        +            end
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
         end
        @@ -363,19 +363,19 @@
        # File app/controllers/guidances_controller.rb, line 202
        -def admin_destroy
        -      if user_signed_in? && current_user.is_org_admin? then
        -             @guidance = Guidance.find(params[:id])
        -          @guidance.destroy
        -
        -          respond_to do |format|
        -            format.html { redirect_to admin_index_guidance_path }
        -            format.json { head :no_content }
        -          end
        -             else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        -
        +def admin_destroy
        +      if user_signed_in? && current_user.can_org_admin? then
        +             @guidance = Guidance.find(params[:id])
        +          @guidance.destroy
        +
        +          respond_to do |format|
        +            format.html { redirect_to admin_index_guidance_path }
        +            format.json { head :no_content }
        +          end
        +             else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
        +
               end
        @@ -404,45 +404,45 @@
        # File app/controllers/guidances_controller.rb, line 112
        -def admin_edit
        -      if user_signed_in? && current_user.is_org_admin? then
        -    @guidance = Guidance.find(params[:id])
        -    @dmptemplates = Dmptemplate.funders_and_own_templates(current_user.organisation_id)
        -                      @phases = nil
        -                      @dmptemplates.each do |template|
        -                              if @phases.nil? then
        -                                      @phases = template.phases.find(:all,:order => 'number ASC')
        -                              else
        -                                      @phases = @phases + template.phases.find(:all,:order => 'number ASC')
        -                              end
        -                      end
        -                      @versions = nil
        -                      @phases.each do |phase|
        -                              if @versions.nil? then
        -                                      @versions = phase.versions.find(:all,:order => 'title ASC')
        -                              else
        -                                      @versions = @versions + phase.versions.find(:all,:order => 'title ASC')
        -                              end
        -                      end
        -                      @sections = nil
        -                      @versions.each do |version|
        -                              if @sections.nil? then
        -                                      @sections = version.sections.find(:all,:order => 'number ASC')
        -                              else
        -                                      @sections = @sections + version.sections.find(:all,:order => 'number ASC')
        -                              end
        -                      end
        -                      @questions = nil
        -                      @sections.each do |section|
        -                              if @questions.nil? then
        -                                      @questions = section.questions.find(:all,:order => 'number ASC')
        -                              else
        -                                      @questions = @questions + section.questions.find(:all,:order => 'number ASC')
        -                              end
        -                      end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_edit
        +      if user_signed_in? && current_user.can_org_admin? then
        +    @guidance = Guidance.find(params[:id])
        +    @dmptemplates = Dmptemplate.funders_and_own_templates(current_user.organisation_id)
        +                      @phases = nil
        +                      @dmptemplates.each do |template|
        +                              if @phases.nil? then
        +                                      @phases = template.phases.find(:all,:order => 'number ASC')
        +                              else
        +                                      @phases = @phases + template.phases.find(:all,:order => 'number ASC')
        +                              end
        +                      end
        +                      @versions = nil
        +                      @phases.each do |phase|
        +                              if @versions.nil? then
        +                                      @versions = phase.versions.find(:all,:order => 'title ASC')
        +                              else
        +                                      @versions = @versions + phase.versions.find(:all,:order => 'title ASC')
        +                              end
        +                      end
        +                      @sections = nil
        +                      @versions.each do |version|
        +                              if @sections.nil? then
        +                                      @sections = version.sections.find(:all,:order => 'number ASC')
        +                              else
        +                                      @sections = @sections + version.sections.find(:all,:order => 'number ASC')
        +                              end
        +                      end
        +                      @questions = nil
        +                      @sections.each do |section|
        +                              if @questions.nil? then
        +                                      @questions = section.questions.find(:all,:order => 'number ASC')
        +                              else
        +                                      @questions = @questions + section.questions.find(:all,:order => 'number ASC')
        +                              end
        +                      end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
         end
        @@ -471,19 +471,20 @@
        # File app/controllers/guidances_controller.rb, line 5
        -def admin_index
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @guidances = Guidance.by_organisation(current_user.organisation_id)
        -          @guidance_groups = GuidanceGroup.where('organisation_id = ?', current_user.organisation_id )
        -
        -
        -          respond_to do |format|
        -            format.html # index.html.erb
        
        -            format.json { render json: @guidances }
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_index
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @guidances = Guidance.by_organisation(current_user.organisation_id)
        +          @guidance_groups = GuidanceGroup.where('organisation_id = ?', current_user.organisation_id )
        +
        +
        +          respond_to do |format|
        +            format.html # index.html.erb
        +
        +            format.json { render json: @guidances }
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
         end
        @@ -512,46 +513,46 @@
        # File app/controllers/guidances_controller.rb, line 33
        -def admin_new
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @guidance = Guidance.new
        -                      @dmptemplates = Dmptemplate.funders_and_own_templates(current_user.organisation_id)
        -                      @phases = nil
        -                      @dmptemplates.each do |template|
        -                              if @phases.nil? then
        -                                      @phases = template.phases.find(:all,:order => 'number ASC')
        -                              else
        -                                      @phases = @phases + template.phases.find(:all,:order => 'number ASC')
        -                              end
        -                      end
        -                      @versions = nil
        -                      @phases.each do |phase|
        -                              if @versions.nil? then
        -                                      @versions = phase.versions.find(:all,:order => 'title ASC')
        -                              else
        -                                      @versions = @versions + phase.versions.find(:all,:order => 'title ASC')
        -                              end
        -                      end
        -                      @sections = nil
        -                      @versions.each do |version|
        -                              if @sections.nil? then
        -                                      @sections = version.sections.find(:all,:order => 'number ASC')
        -                              else
        -                                      @sections = @sections + version.sections.find(:all,:order => 'number ASC')
        -                              end
        -                      end
        -                      @questions = nil
        -                      @sections.each do |section|
        -                              if @questions.nil? then
        -                                      @questions = section.questions.find(:all,:order => 'number ASC')
        -                              else
        -                                      @questions = @questions + section.questions.find(:all,:order => 'number ASC')
        -                              end
        -                      end
        -          respond_to do |format|
        -            format.html
        -          end
        -      end
        +def admin_new
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @guidance = Guidance.new
        +                      @dmptemplates = Dmptemplate.funders_and_own_templates(current_user.organisation_id)
        +                      @phases = nil
        +                      @dmptemplates.each do |template|
        +                              if @phases.nil? then
        +                                      @phases = template.phases.find(:all,:order => 'number ASC')
        +                              else
        +                                      @phases = @phases + template.phases.find(:all,:order => 'number ASC')
        +                              end
        +                      end
        +                      @versions = nil
        +                      @phases.each do |phase|
        +                              if @versions.nil? then
        +                                      @versions = phase.versions.find(:all,:order => 'title ASC')
        +                              else
        +                                      @versions = @versions + phase.versions.find(:all,:order => 'title ASC')
        +                              end
        +                      end
        +                      @sections = nil
        +                      @versions.each do |version|
        +                              if @sections.nil? then
        +                                      @sections = version.sections.find(:all,:order => 'number ASC')
        +                              else
        +                                      @sections = @sections + version.sections.find(:all,:order => 'number ASC')
        +                              end
        +                      end
        +                      @questions = nil
        +                      @sections.each do |section|
        +                              if @questions.nil? then
        +                                      @questions = section.questions.find(:all,:order => 'number ASC')
        +                              else
        +                                      @questions = @questions + section.questions.find(:all,:order => 'number ASC')
        +                              end
        +                      end
        +          respond_to do |format|
        +            format.html
        +          end
        +      end
               end
        @@ -580,15 +581,16 @@
        # File app/controllers/guidances_controller.rb, line 22
        -def admin_show
        -  if user_signed_in? && current_user.is_org_admin? then
        -          @guidance = Guidance.find(params[:id])
        -
        -          respond_to do |format|
        -            format.html # show.html.erb
        
        -            format.json { render json: @guidance }
        -          end
        - end
        +def admin_show
        +  if user_signed_in? && current_user.can_org_admin? then
        +          @guidance = Guidance.find(params[:id])
        +
        +          respond_to do |format|
        +            format.html # show.html.erb
        +
        +            format.json { render json: @guidance }
        +          end
        + end
         end
        @@ -617,26 +619,26 @@
        # File app/controllers/guidances_controller.rb, line 177
        -def admin_update
        -              if user_signed_in? && current_user.is_org_admin? then
        -              @guidance = Guidance.find(params[:id])
        -
        -                      @guidance.text = params["guidance-text"]
        -
        -                      @guidance.question_id = params["question_id"]
        -
        -          respond_to do |format|
        -            if @guidance.update_attributes(params[:guidance])
        -              format.html { redirect_to admin_show_guidance_path(params[:guidance]), notice: I18n.t('org_admin.guidance.updated_message') }
        -              format.json { head :no_content }
        -            else
        -              format.html { render action: "edit" }
        -              format.json { render json: @guidance.errors, status: :unprocessable_entity }
        -            end
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end
        +def admin_update
        +              if user_signed_in? && current_user.can_org_admin? then
        +              @guidance = Guidance.find(params[:id])
        +
        +                      @guidance.text = params["guidance-text"]
        +
        +                      @guidance.question_id = params["question_id"]
        +
        +          respond_to do |format|
        +            if @guidance.update_attributes(params[:guidance])
        +              format.html { redirect_to admin_show_guidance_path(params[:guidance]), notice: I18n.t('org_admin.guidance.updated_message') }
        +              format.json { head :no_content }
        +            else
        +              format.html { render action: "edit" }
        +              format.json { render json: @guidance.errors, status: :unprocessable_entity }
        +            end
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end
         end
        @@ -665,15 +667,17 @@
        # File app/controllers/guidances_controller.rb, line 76
        -      def update_phases
        -  # updates phases, versions, sections and questions based on template selected
        
        -  dmptemplate = Dmptemplate.find(params[:dmptemplate_id])
        -  # map to title and id for use in our options_for_select
        
        -  @phases = dmptemplate.phases.map{|a| [a.title, a.id]}.insert(0, "Select a phase")
        -  @versions = dmptemplate.versions.map{|s| [s.title, s.id]}.insert(0, "Select a version")
        -  @sections = dmptemplate.sections.map{|s| [s.title, s.id]}.insert(0, "Select a section")
        -  @questions = dmptemplate.questions.map{|s| [s.text, s.id]}.insert(0, "Select a question")
        -
        +      def update_phases
        +  # updates phases, versions, sections and questions based on template selected
        +
        +  dmptemplate = Dmptemplate.find(params[:dmptemplate_id])
        +  # map to title and id for use in our options_for_select
        +
        +  @phases = dmptemplate.phases.map{|a| [a.title, a.id]}.insert(0, "Select a phase")
        +  @versions = dmptemplate.versions.map{|s| [s.title, s.id]}.insert(0, "Select a version")
        +  @sections = dmptemplate.sections.map{|s| [s.title, s.id]}.insert(0, "Select a section")
        +  @questions = dmptemplate.questions.map{|s| [s.text, s.id]}.insert(0, "Select a question")
        +
         end
        @@ -702,10 +706,11 @@
        # File app/controllers/guidances_controller.rb, line 104
        -def update_questions
        -  # updates songs based on artist selected
        
        -  section = Section.find(params[:section_id])
        -  @questions = section.questions.map{|s| [s.text, s.id]}.insert(0, "Select a question")
        +def update_questions
        +  # updates songs based on artist selected
        +
        +  section = Section.find(params[:section_id])
        +  @questions = section.questions.map{|s| [s.text, s.id]}.insert(0, "Select a question")
         end
        @@ -734,12 +739,14 @@
        # File app/controllers/guidances_controller.rb, line 96
        -def update_sections
        -  # updates sections and questions based on version selected
        
        -  version = Version.find(params[:version_id])
        -  # map to name and id for use in our options_for_select
        
        -  @sections = version.sections.map{|s| [s.title, s.id]}.insert(0, "Select a section")
        -  @questions = version.questions.map{|s| [s.text, s.id]}.insert(0, "Select a question")
        +def update_sections
        +  # updates sections and questions based on version selected
        +
        +  version = Version.find(params[:version_id])
        +  # map to name and id for use in our options_for_select
        +
        +  @sections = version.sections.map{|s| [s.title, s.id]}.insert(0, "Select a section")
        +  @questions = version.questions.map{|s| [s.text, s.id]}.insert(0, "Select a question")
         end
        @@ -768,13 +775,15 @@
        # File app/controllers/guidances_controller.rb, line 87
        -def update_versions
        -   # updates versions, sections and questions based on phase selected
        
        -   phase = Phase.find(params[:phase_id])
        -   # map to name and id for use in our options_for_select
        
        -   @versions = phase.versions.map{|s| [s.title, s.id]}.insert(0, "Select a version")
        -   @sections = phase.sections.map{|s| [s.title, s.id]}.insert(0, "Select a section")
        -   @questions = phase.questions.map{|s| [s.text, s.id]}.insert(0, "Select a question")
        +def update_versions
        +   # updates versions, sections and questions based on phase selected
        +
        +   phase = Phase.find(params[:phase_id])
        +   # map to name and id for use in our options_for_select
        +
        +   @versions = phase.versions.map{|s| [s.title, s.id]}.insert(0, "Select a version")
        +   @sections = phase.sections.map{|s| [s.title, s.id]}.insert(0, "Select a section")
        +   @questions = phase.questions.map{|s| [s.text, s.id]}.insert(0, "Select a question")
          end
        diff --git a/html/OrganisationUsersController.html b/html/OrganisationUsersController.html index 70d20fc..5ffe280 100644 --- a/html/OrganisationUsersController.html +++ b/html/OrganisationUsersController.html @@ -297,16 +297,17 @@
        # File app/controllers/organisation_users_controller.rb, line 3
        -def admin_index
        -        if user_signed_in? && current_user.is_org_admin? then
        -                
        -                respond_to do |format|
        -                        format.html # index.html.erb
        
        -                        format.json { render json: @organisation_users }
        -                end
        -        else
        -                render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -        end 
        +def admin_index
        +        if user_signed_in? && current_user.can_org_admin? then
        +                
        +                respond_to do |format|
        +                        format.html # index.html.erb
        +
        +                        format.json { render json: @organisation_users }
        +                end
        +        else
        +                render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +        end 
         end
        diff --git a/html/OrganisationsController.html b/html/OrganisationsController.html index dcab811..0dd652a 100644 --- a/html/OrganisationsController.html +++ b/html/OrganisationsController.html @@ -315,13 +315,13 @@
        # File app/controllers/organisations_controller.rb, line 58
        -def admin_edit
        -      if user_signed_in? && current_user.is_org_admin? then
        -      @organisation = Organisation.find(params[:id])
        -  
        -  else
        -              render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -      end 
        +def admin_edit
        +      if user_signed_in? && current_user.can_org_admin? then
        +      @organisation = Organisation.find(params[:id])
        +  
        +  else
        +              render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +      end 
         end
        @@ -350,18 +350,19 @@
        # File app/controllers/organisations_controller.rb, line 43
        -def admin_show
        -      if user_signed_in? && current_user.is_org_admin? then
        -          @organisation = Organisation.find(params[:id])
        -      
        -          respond_to do |format|
        -            format.html # show.html.erb
        
        -            format.json { render json: @organisation }
        -          end
        -  else
        -                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -              end 
        -              
        +def admin_show
        +      if user_signed_in? && current_user.can_org_admin? then
        +          @organisation = Organisation.find(params[:id])
        +      
        +          respond_to do |format|
        +            format.html # show.html.erb
        +
        +            format.json { render json: @organisation }
        +          end
        +  else
        +                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +              end 
        +              
         end
        @@ -390,24 +391,24 @@
        # File app/controllers/organisations_controller.rb, line 70
        -def admin_update
        -  if user_signed_in? && current_user.is_org_admin? then
        -      @organisation = Organisation.find(params[:id])
        -      @organisation.banner_text = params["org_banner_text"]
        -              
        -              
        -          respond_to do |format|
        -            if @organisation.update_attributes(params[:organisation])
        -              format.html { redirect_to admin_show_organisation_path(params[:id]), notice: I18n.t("admin.org_updated_message")  }
        -              format.json { head :no_content }
        -            else
        -              format.html { render action: "edit" }
        -              format.json { render json: @organisation.errors, status: :unprocessable_entity }
        -            end
        -          end
        -      else
        -        render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        -  end         
        +def admin_update
        +  if user_signed_in? && current_user.can_org_admin? then
        +      @organisation = Organisation.find(params[:id])
        +      @organisation.banner_text = params["org_banner_text"]
        +              
        +              
        +          respond_to do |format|
        +            if @organisation.update_attributes(params[:organisation])
        +              format.html { redirect_to admin_show_organisation_path(params[:id]), notice: I18n.t("admin.org_updated_message")  }
        +              format.json { head :no_content }
        +            else
        +              format.html { render action: "edit" }
        +              format.json { render json: @organisation.errors, status: :unprocessable_entity }
        +            end
        +          end
        +      else
        +        render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +  end         
         end
        @@ -436,19 +437,23 @@
        # File app/controllers/organisations_controller.rb, line 108
        -        def children
        -                @organisation = Organisation.find(params[:id])
        -                #if user_signed_in? then
        
        -                children = {}
        -                @organisation.children.each do |child|
        -                        children[child.id] = child.name
        -                end
        -                respond_to do |format|
        -                        format.json { render json: children.to_json }
        -                end
        -#               else
        
        -#                       render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        
        -#               end
        
        +        def children
        +                @organisation = Organisation.find(params[:id])
        +                #if user_signed_in? then
        +
        +                children = {}
        +                @organisation.children.each do |child|
        +                        children[child.id] = child.name
        +                end
        +                respond_to do |format|
        +                        format.json { render json: children.to_json }
        +                end
        +#               else
        +
        +#                       render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +
        +#               end
        +
                 end
        @@ -477,18 +482,18 @@
        # File app/controllers/organisations_controller.rb, line 26
        -def create
        -  @organisation = Organisation.new(params[:organisation])
        -
        -  respond_to do |format|
        -    if @organisation.save
        -      format.html { redirect_to @organisation, notice: I18n.t("admin.org_created_message") }
        -      format.json { render json: @organisation, status: :created, location: @organisation }
        -    else
        -      format.html { render action: "new" }
        -      format.json { render json: @organisation.errors, status: :unprocessable_entity }
        -    end
        -  end
        +def create
        +  @organisation = Organisation.new(params[:organisation])
        +
        +  respond_to do |format|
        +    if @organisation.save
        +      format.html { redirect_to @organisation, notice: I18n.t("admin.org_created_message") }
        +      format.json { render json: @organisation, status: :created, location: @organisation }
        +    else
        +      format.html { render action: "new" }
        +      format.json { render json: @organisation.errors, status: :unprocessable_entity }
        +    end
        +  end
         end
        @@ -517,14 +522,14 @@
        # File app/controllers/organisations_controller.rb, line 92
        -def destroy
        -  @organisation = Organisation.find(params[:id])
        -  @organisation.destroy
        -
        -  respond_to do |format|
        -    format.html { redirect_to organisations_url }
        -    format.json { head :no_content }
        -  end
        +def destroy
        +  @organisation = Organisation.find(params[:id])
        +  @organisation.destroy
        +
        +  respond_to do |format|
        +    format.html { redirect_to organisations_url }
        +    format.json { head :no_content }
        +  end
         end
        @@ -553,13 +558,14 @@
        # File app/controllers/organisations_controller.rb, line 4
        -def index
        -  @organisations = Organisation.all
        -
        -  respond_to do |format|
        -    format.html # index.html.erb
        
        -    format.json { render json: @organisations }
        -  end
        +def index
        +  @organisations = Organisation.all
        +
        +  respond_to do |format|
        +    format.html # index.html.erb
        +
        +    format.json { render json: @organisations }
        +  end
         end
        @@ -588,13 +594,14 @@
        # File app/controllers/organisations_controller.rb, line 15
        -def new
        -  @organisation = Organisation.new
        -
        -  respond_to do |format|
        -    format.html # new.html.erb
        
        -    format.json { render json: @organisation }
        -  end
        +def new
        +  @organisation = Organisation.new
        +
        +  respond_to do |format|
        +    format.html # new.html.erb
        +
        +    format.json { render json: @organisation }
        +  end
         end
        @@ -623,10 +630,10 @@
        # File app/controllers/organisations_controller.rb, line 102
        -def parent
        -      @organisation = Organisation.find(params[:id])
        -      parent_org = @organisation.find_by {|o| o.parent_id }
        -      return parent_org
        +def parent
        +      @organisation = Organisation.find(params[:id])
        +      parent_org = @organisation.find_by {|o| o.parent_id }
        +      return parent_org
         end
        @@ -655,21 +662,25 @@
        # File app/controllers/organisations_controller.rb, line 123
        -        def templates
        -                @organisation = Organisation.find(params[:id])
        -                #if user_signed_in? then
        
        -                templates = {}
        -                @organisation.dmptemplates.each do |template|
        -                        if template.is_published? then
        -                                templates[template.id] = template.title
        -                        end
        -                end
        -                respond_to do |format|
        -                        format.json { render json: templates.to_json }
        -                end
        -#               else
        
        -#                       render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        
        -#               end
        
        +        def templates
        +                @organisation = Organisation.find(params[:id])
        +                #if user_signed_in? then
        +
        +                templates = {}
        +                @organisation.dmptemplates.each do |template|
        +                        if template.is_published? then
        +                                templates[template.id] = template.title
        +                        end
        +                end
        +                respond_to do |format|
        +                        format.json { render json: templates.to_json }
        +                end
        +#               else
        +
        +#                       render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
        +
        +#               end
        +
                 end
        diff --git a/html/User.html b/html/User.html index bfedcf0..8e5c259 100644 --- a/html/User.html +++ b/html/User.html @@ -74,9 +74,9 @@
      • #filter -
      • #is_admin? +
      • #can_super_admin? -
      • #is_org_admin? +
      • #can_org_admin?
      • #name @@ -378,7 +378,7 @@
        - is_admin?can_super_admin?() click to toggle source
        @@ -392,7 +392,7 @@
        # File app/models/user.rb, line 110
        -def is_admin?
        +def can_super_admin?
                 admin = roles.find_by_name("admin")
                 return !admin.nil?
         end
        @@ -409,7 +409,7 @@
        - is_org_admin?can_org_admin?() click to toggle source
        @@ -423,7 +423,7 @@
        # File app/models/user.rb, line 115
        -def is_org_admin?
        +def can_org_admin?
                 org_admin = roles.find_by_name("org_admin")
                 return !org_admin.nil?
         end
        diff --git a/html/js/search_index.js b/html/js/search_index.js index c4d1c60..c30a123 100644 --- a/html/js/search_index.js +++ b/html/js/search_index.js @@ -1 +1 @@ -var search_data = {"index":{"searchIndex":["ability","activeadmin","views","pages","base","answer","answerscontroller","applicationcontroller","applicationhelper","comment","commentscontroller","confirmationscontroller","contactscontroller","customfailure","dmponline4","application","dmptemplate","dmptemplatescontroller","existinguserscontroller","exportedplan","filetype","fileupload","guidance","guidancegroup","guidancegroupscontroller","guidancescontroller","homecontroller","object","option","optionwarning","organisation","organisationtype","organisationuserscontroller","organisationscontroller","passwordscontroller","phase","plan","plansection","planscontroller","planshelper","project","projectgroup","projectgroupscontroller","projectpartner","projectscontroller","question","questionformat","registrationscontroller","role","section","sessionscontroller","settings","dmptemplate","planlist","planscontroller","projectscontroller","settingscontroller","splashlog","splashlogscontroller","staticpagescontroller","suggestedanswer","theme","themescontroller","user","usermailer","userorgrole","userorgrolescontroller","userroletype","userroletypescontroller","userstatus","userstatusescontroller","usertype","usertypescontroller","users","omniauthcallbackscontroller","omniauthshibbolethrequestcontroller","userscontroller","version","about_us()","about_us()","access_level()","access_level=()","add_guidance_to_array()","add_user()","admin_addphase()","admin_cloneversion()","admin_create()","admin_create()","admin_create()","admin_createphase()","admin_createquestion()","admin_createsection()","admin_createsuggestedanswer()","admin_destroy()","admin_destroy()","admin_destroy()","admin_destroyphase()","admin_destroyquestion()","admin_destroysection()","admin_destroysuggestedanswer()","admin_destroyversion()","admin_details()","admin_edit()","admin_edit()","admin_edit()","admin_index()","admin_index()","admin_index()","admin_new()","admin_new()","admin_new()","admin_phase()","admin_previewphase()","admin_show()","admin_show()","admin_show()","admin_template()","admin_update()","admin_update()","admin_update()","admin_update()","admin_updatephase()","admin_updatequestion()","admin_updatesection()","admin_updatesuggestedanswer()","admin_updateversion()","administerable_by()","administerable_by()","after_confirmation_path_for()","after_resetting_password_path_for()","after_sign_in_error_path_for()","after_sign_in_path_for()","after_sign_up_error_path_for()","after_sign_up_path_for()","all_guidance_groups()","all_sections()","answer()","answer()","archive()","as_csv()","as_txt()","assign_administrator()","assign_creator()","assign_editor()","assign_reader()","associate()","authenticate_admin!()","build_footer()","by_organisation()","children()","contact_us()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create_plans()","created_by()","current_organisation()","delete_recent_locks()","delete_recent_locks()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","details()","devise_mapping()","display_name()","dmptemplate()","do_update()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","editable_by()","editable_by()","email()","email=()","estimate_space_used()","export()","export()","filter()","funder()","funder()","funder_id()","funder_id=()","funder_name()","funder_name=()","funders_and_own_templates()","funders_templates()","get_guidance_group_templates?()","get_plan_list_columns()","get_settings()","get_settings()","get_suggested_answer()","global_sections()","grant_title()","guidance_for_question()","guidance_for_question()","guidance_groups_excluding()","has_customisations?()","has_published_versions?()","has_sections()","height_of_text()","in_group_belonging_to?()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","institution()","institution_id()","institution_id=()","is_admin?()","is_org_admin?()","javascript()","last_edited()","latest_published_version()","latest_update()","latest_update()","latest_version()","link_to_add_object()","lock_all_sections()","lock_section()","lock_section()","locked()","locked()","name()","name()","needs_password?()","new()","new()","new()","new()","new()","new()","new()","new()","new()","org_type()","org_type()","organisation()","organisation=()","organisation_id()","organisation_id=()","orgs_of_type()","orgs_with_parent_of_type()","other_organisations()","own_institutional_templates()","owner()","parent()","permissions_change_notification()","plan()","plan_settings_indicator()","possible_guidance()","possible_templates()","principal_investigator()","project_access_removed_notification()","project_data_contact()","project_description()","project_identifier()","project_list_body()","project_list_head()","project_name()","projects_for_user()","published_templates()","question_themes?()","questions()","questions_for_section()","readable_by()","readable_by()","redirect()","redirect_url()","resource()","resource_name()","respond()","roadmap()","root()","sanitize_text()","scoped_collection()","section_answers()","section_answers()","sections()","sections()","settings()","settings_json()","settings_json()","share()","shared()","shared?()","sharing_notification()","shibboleth()","short_name()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","status()","status()","store_location()","super_settings()","template_owner()","templates()","templates_org_type()","title()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","unit_id()","unit_id=()","unlock_all_sections()","unlock_all_sections()","unlock_section()","unlock_section()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update_phases()","update_questions()","update_sections()","update_versions()","warning()","warning()","warning()","readme"],"longSearchIndex":["ability","activeadmin","activeadmin::views","activeadmin::views::pages","activeadmin::views::pages::base","answer","answerscontroller","applicationcontroller","applicationhelper","comment","commentscontroller","confirmationscontroller","contactscontroller","customfailure","dmponline4","dmponline4::application","dmptemplate","dmptemplatescontroller","existinguserscontroller","exportedplan","filetype","fileupload","guidance","guidancegroup","guidancegroupscontroller","guidancescontroller","homecontroller","object","option","optionwarning","organisation","organisationtype","organisationuserscontroller","organisationscontroller","passwordscontroller","phase","plan","plansection","planscontroller","planshelper","project","projectgroup","projectgroupscontroller","projectpartner","projectscontroller","question","questionformat","registrationscontroller","role","section","sessionscontroller","settings","settings::dmptemplate","settings::planlist","settings::planscontroller","settings::projectscontroller","settings::settingscontroller","splashlog","splashlogscontroller","staticpagescontroller","suggestedanswer","theme","themescontroller","user","usermailer","userorgrole","userorgrolescontroller","userroletype","userroletypescontroller","userstatus","userstatusescontroller","usertype","usertypescontroller","users","users::omniauthcallbackscontroller","users::omniauthshibbolethrequestcontroller","userscontroller","version","homecontroller#about_us()","staticpagescontroller#about_us()","projectgroup#access_level()","projectgroup#access_level=()","plan#add_guidance_to_array()","project#add_user()","dmptemplatescontroller#admin_addphase()","dmptemplatescontroller#admin_cloneversion()","dmptemplatescontroller#admin_create()","guidancegroupscontroller#admin_create()","guidancescontroller#admin_create()","dmptemplatescontroller#admin_createphase()","dmptemplatescontroller#admin_createquestion()","dmptemplatescontroller#admin_createsection()","dmptemplatescontroller#admin_createsuggestedanswer()","dmptemplatescontroller#admin_destroy()","guidancegroupscontroller#admin_destroy()","guidancescontroller#admin_destroy()","dmptemplatescontroller#admin_destroyphase()","dmptemplatescontroller#admin_destroyquestion()","dmptemplatescontroller#admin_destroysection()","dmptemplatescontroller#admin_destroysuggestedanswer()","dmptemplatescontroller#admin_destroyversion()","exportedplan#admin_details()","guidancegroupscontroller#admin_edit()","guidancescontroller#admin_edit()","organisationscontroller#admin_edit()","dmptemplatescontroller#admin_index()","guidancescontroller#admin_index()","organisationuserscontroller#admin_index()","dmptemplatescontroller#admin_new()","guidancegroupscontroller#admin_new()","guidancescontroller#admin_new()","dmptemplatescontroller#admin_phase()","dmptemplatescontroller#admin_previewphase()","guidancegroupscontroller#admin_show()","guidancescontroller#admin_show()","organisationscontroller#admin_show()","dmptemplatescontroller#admin_template()","dmptemplatescontroller#admin_update()","guidancegroupscontroller#admin_update()","guidancescontroller#admin_update()","organisationscontroller#admin_update()","dmptemplatescontroller#admin_updatephase()","dmptemplatescontroller#admin_updatequestion()","dmptemplatescontroller#admin_updatesection()","dmptemplatescontroller#admin_updatesuggestedanswer()","dmptemplatescontroller#admin_updateversion()","plan#administerable_by()","project#administerable_by()","confirmationscontroller#after_confirmation_path_for()","passwordscontroller#after_resetting_password_path_for()","applicationcontroller#after_sign_in_error_path_for()","applicationcontroller#after_sign_in_path_for()","applicationcontroller#after_sign_up_error_path_for()","applicationcontroller#after_sign_up_path_for()","organisation#all_guidance_groups()","organisation#all_sections()","plan#answer()","planscontroller#answer()","commentscontroller#archive()","exportedplan#as_csv()","exportedplan#as_txt()","project#assign_administrator()","project#assign_creator()","project#assign_editor()","project#assign_reader()","users::omniauthshibbolethrequestcontroller#associate()","applicationcontroller#authenticate_admin!()","activeadmin::views::pages::base#build_footer()","guidance::by_organisation()","organisationscontroller#children()","staticpagescontroller#contact_us()","answerscontroller#create()","commentscontroller#create()","contactscontroller#create()","organisationscontroller#create()","projectgroupscontroller#create()","projectscontroller#create()","registrationscontroller#create()","sessionscontroller#create()","splashlogscontroller#create()","themescontroller#create()","userorgrolescontroller#create()","userroletypescontroller#create()","userstatusescontroller#create()","usertypescontroller#create()","userscontroller#create()","project#create_plans()","project#created_by()","user#current_organisation()","plan#delete_recent_locks()","planscontroller#delete_recent_locks()","organisationscontroller#destroy()","projectgroupscontroller#destroy()","projectscontroller#destroy()","sessionscontroller#destroy()","themescontroller#destroy()","userorgrolescontroller#destroy()","userroletypescontroller#destroy()","userstatusescontroller#destroy()","usertypescontroller#destroy()","userscontroller#destroy()","plan#details()","applicationhelper#devise_mapping()","guidancegroup#display_name()","plan#dmptemplate()","registrationscontroller#do_update()","commentscontroller#edit()","planscontroller#edit()","projectscontroller#edit()","themescontroller#edit()","userorgrolescontroller#edit()","userroletypescontroller#edit()","userstatusescontroller#edit()","usertypescontroller#edit()","userscontroller#edit()","plan#editable_by()","project#editable_by()","projectgroup#email()","projectgroup#email=()","plan#estimate_space_used()","planscontroller#export()","projectscontroller#export()","user#filter()","exportedplan#funder()","project#funder()","project#funder_id()","project#funder_id=()","project#funder_name()","project#funder_name=()","dmptemplate::funders_and_own_templates()","dmptemplate::funders_templates()","guidance#get_guidance_group_templates?()","applicationcontroller#get_plan_list_columns()","settings::planscontroller#get_settings()","settings::projectscontroller#get_settings()","question#get_suggested_answer()","version#global_sections()","exportedplan#grant_title()","plan#guidance_for_question()","question#guidance_for_question()","guidancegroup::guidance_groups_excluding()","dmptemplate#has_customisations?()","dmptemplate#has_published_versions?()","phase#has_sections()","plan#height_of_text()","guidance#in_group_belonging_to?()","commentscontroller#index()","existinguserscontroller#index()","homecontroller#index()","organisationscontroller#index()","projectscontroller#index()","themescontroller#index()","userorgrolescontroller#index()","userroletypescontroller#index()","userstatusescontroller#index()","usertypescontroller#index()","exportedplan#institution()","project#institution_id()","project#institution_id=()","user#is_admin?()","user#is_org_admin?()","applicationhelper#javascript()","project#last_edited()","phase#latest_published_version()","plan#latest_update()","project#latest_update()","phase#latest_version()","applicationhelper#link_to_add_object()","plan#lock_all_sections()","plan#lock_section()","planscontroller#lock_section()","plan#locked()","planscontroller#locked()","project#name()","user#name()","registrationscontroller#needs_password?()","ability::new()","organisationscontroller#new()","projectscontroller#new()","themescontroller#new()","userorgrolescontroller#new()","userroletypescontroller#new()","userstatusescontroller#new()","usertypescontroller#new()","userscontroller#new()","dmptemplate#org_type()","user#org_type()","user#organisation()","user#organisation=()","user#organisation_id()","user#organisation_id=()","projectscontroller#orgs_of_type()","organisation::orgs_with_parent_of_type()","organisation::other_organisations()","dmptemplate::own_institutional_templates()","project#owner()","organisationscontroller#parent()","usermailer#permissions_change_notification()","settings::planscontroller#plan()","planshelper#plan_settings_indicator()","projectscontroller#possible_guidance()","projectscontroller#possible_templates()","exportedplan#principal_investigator()","usermailer#project_access_removed_notification()","exportedplan#project_data_contact()","exportedplan#project_description()","exportedplan#project_identifier()","planshelper#project_list_body()","planshelper#project_list_head()","exportedplan#project_name()","project::projects_for_user()","organisation#published_templates()","question#question_themes?()","exportedplan#questions()","exportedplan#questions_for_section()","plan#readable_by()","project#readable_by()","users::omniauthshibbolethrequestcontroller#redirect()","customfailure#redirect_url()","applicationhelper#resource()","applicationhelper#resource_name()","customfailure#respond()","staticpagescontroller#roadmap()","organisation#root()","exportedplan#sanitize_text()","object#scoped_collection()","plan#section_answers()","planscontroller#section_answers()","exportedplan#sections()","plan#sections()","plan#settings()","settings::planscontroller#settings_json()","settings::projectscontroller#settings_json()","projectscontroller#share()","project#shared()","project#shared?()","usermailer#sharing_notification()","users::omniauthcallbackscontroller#shibboleth()","organisation#short_name()","commentscontroller#show()","projectscontroller#show()","settings::planscontroller#show()","settings::projectscontroller#show()","themescontroller#show()","userorgrolescontroller#show()","userroletypescontroller#show()","userstatusescontroller#show()","usertypescontroller#show()","userscontroller#show()","plan#status()","planscontroller#status()","applicationcontroller#store_location()","plan#super_settings()","project#template_owner()","organisationscontroller#templates()","dmptemplate::templates_org_type()","plan#title()","comment#to_s()","dmptemplate#to_s()","guidancegroup#to_s()","option#to_s()","optionwarning#to_s()","organisation#to_s()","phase#to_s()","question#to_s()","questionformat#to_s()","section#to_s()","suggestedanswer#to_s()","theme#to_s()","version#to_s()","project#unit_id()","project#unit_id=()","plan#unlock_all_sections()","planscontroller#unlock_all_sections()","plan#unlock_section()","planscontroller#unlock_section()","commentscontroller#update()","planscontroller#update()","projectgroupscontroller#update()","projectscontroller#update()","registrationscontroller#update()","settings::planscontroller#update()","settings::projectscontroller#update()","themescontroller#update()","userorgrolescontroller#update()","userroletypescontroller#update()","userstatusescontroller#update()","usertypescontroller#update()","userscontroller#update()","guidancescontroller#update_phases()","guidancescontroller#update_questions()","guidancescontroller#update_sections()","guidancescontroller#update_versions()","organisation#warning()","plan#warning()","planscontroller#warning()",""],"info":[["Ability","","Ability.html","",""],["ActiveAdmin","","ActiveAdmin.html","",""],["ActiveAdmin::Views","","ActiveAdmin/Views.html","",""],["ActiveAdmin::Views::Pages","","ActiveAdmin/Views/Pages.html","",""],["ActiveAdmin::Views::Pages::Base","","ActiveAdmin/Views/Pages/Base.html","","

        lib/active_admin_views_pages_base.rb\n"],["Answer","","Answer.html","",""],["AnswersController","","AnswersController.html","",""],["ApplicationController","","ApplicationController.html","",""],["ApplicationHelper","","ApplicationHelper.html","",""],["Comment","","Comment.html","",""],["CommentsController","","CommentsController.html","",""],["ConfirmationsController","","ConfirmationsController.html","",""],["ContactsController","","ContactsController.html","",""],["CustomFailure","","CustomFailure.html","",""],["DMPonline4","","DMPonline4.html","",""],["DMPonline4::Application","","DMPonline4/Application.html","",""],["Dmptemplate","","Dmptemplate.html","",""],["DmptemplatesController","","DmptemplatesController.html","","

        Project: — DMPonline v4\n

        Description: — This controller is responsible for all the actions in the admin interface …\n"],["ExistingUsersController","","ExistingUsersController.html","",""],["ExportedPlan","","ExportedPlan.html","",""],["FileType","","FileType.html","",""],["FileUpload","","FileUpload.html","",""],["Guidance","","Guidance.html","","

        Project: — DMPonline v4\n

        Description: — This class keeps the information organisations enter to support users …\n"],["GuidanceGroup","","GuidanceGroup.html","",""],["GuidanceGroupsController","","GuidanceGroupsController.html","",""],["GuidancesController","","GuidancesController.html","",""],["HomeController","","HomeController.html","",""],["Object","","Object.html","",""],["Option","","Option.html","",""],["OptionWarning","","OptionWarning.html","",""],["Organisation","","Organisation.html","",""],["OrganisationType","","OrganisationType.html","",""],["OrganisationUsersController","","OrganisationUsersController.html","",""],["OrganisationsController","","OrganisationsController.html","",""],["PasswordsController","","PasswordsController.html","",""],["Phase","","Phase.html","","

        Project: — DMPonline v4\n

        Description: — This model describes informmation about the phase of a plan, it's …\n"],["Plan","","Plan.html","",""],["PlanSection","","PlanSection.html","",""],["PlansController","","PlansController.html","",""],["PlansHelper","","PlansHelper.html","",""],["Project","","Project.html","",""],["ProjectGroup","","ProjectGroup.html","",""],["ProjectGroupsController","","ProjectGroupsController.html","",""],["ProjectPartner","","ProjectPartner.html","",""],["ProjectsController","","ProjectsController.html","",""],["Question","","Question.html","",""],["QuestionFormat","","QuestionFormat.html","",""],["RegistrationsController","","RegistrationsController.html","","

        app/controllers/registrations_controller.rb\n"],["Role","","Role.html","",""],["Section","","Section.html","",""],["SessionsController","","SessionsController.html","","

        app/controllers/sessions_controller.rb\n"],["Settings","","Settings.html","",""],["Settings::Dmptemplate","","Settings/Dmptemplate.html","",""],["Settings::PlanList","","Settings/PlanList.html","",""],["Settings::PlansController","","Settings/PlansController.html","",""],["Settings::ProjectsController","","Settings/ProjectsController.html","",""],["Settings::SettingsController","","Settings/SettingsController.html","",""],["SplashLog","","SplashLog.html","",""],["SplashLogsController","","SplashLogsController.html","",""],["StaticPagesController","","StaticPagesController.html","",""],["SuggestedAnswer","","SuggestedAnswer.html","",""],["Theme","","Theme.html","",""],["ThemesController","","ThemesController.html","",""],["User","","User.html","",""],["UserMailer","","UserMailer.html","",""],["UserOrgRole","","UserOrgRole.html","",""],["UserOrgRolesController","","UserOrgRolesController.html","",""],["UserRoleType","","UserRoleType.html","",""],["UserRoleTypesController","","UserRoleTypesController.html","",""],["UserStatus","","UserStatus.html","",""],["UserStatusesController","","UserStatusesController.html","",""],["UserType","","UserType.html","",""],["UserTypesController","","UserTypesController.html","",""],["Users","","Users.html","",""],["Users::OmniauthCallbacksController","","Users/OmniauthCallbacksController.html","",""],["Users::OmniauthShibbolethRequestController","","Users/OmniauthShibbolethRequestController.html","",""],["UsersController","","UsersController.html","",""],["Version","","Version.html","",""],["about_us","HomeController","HomeController.html#method-i-about_us","()",""],["about_us","StaticPagesController","StaticPagesController.html#method-i-about_us","()",""],["access_level","ProjectGroup","ProjectGroup.html#method-i-access_level","()",""],["access_level=","ProjectGroup","ProjectGroup.html#method-i-access_level-3D","(new_access_level)",""],["add_guidance_to_array","Plan","Plan.html#method-i-add_guidance_to_array","(guidance_array, guidance_group, theme, guidance)",""],["add_user","Project","Project.html#method-i-add_user","(user_id, is_editor = false, is_administrator = false, is_creator = false)",""],["admin_addphase","DmptemplatesController","DmptemplatesController.html#method-i-admin_addphase","()","

        add a new phase to a template\n"],["admin_cloneversion","DmptemplatesController","DmptemplatesController.html#method-i-admin_cloneversion","()","

        clone a version of a template\n"],["admin_create","DmptemplatesController","DmptemplatesController.html#method-i-admin_create","()","

        POST /dmptemplates POST /dmptemplates.json\n"],["admin_create","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_create","()","

        POST /guidance_groups POST /guidance_groups.json\n"],["admin_create","GuidancesController","GuidancesController.html#method-i-admin_create","()","

        POST /guidances POST /guidances.json\n"],["admin_createphase","DmptemplatesController","DmptemplatesController.html#method-i-admin_createphase","()","

        create a phase\n"],["admin_createquestion","DmptemplatesController","DmptemplatesController.html#method-i-admin_createquestion","()","

        create a question\n"],["admin_createsection","DmptemplatesController","DmptemplatesController.html#method-i-admin_createsection","()","

        create a section\n"],["admin_createsuggestedanswer","DmptemplatesController","DmptemplatesController.html#method-i-admin_createsuggestedanswer","()","

        SUGGESTED ANSWERS create suggested answers\n"],["admin_destroy","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroy","()","

        DELETE /dmptemplates/1 DELETE /dmptemplates/1.json\n"],["admin_destroy","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_destroy","()","

        DELETE /guidance_groups/1 DELETE /guidance_groups/1.json\n"],["admin_destroy","GuidancesController","GuidancesController.html#method-i-admin_destroy","()","

        DELETE /guidances/1 DELETE /guidances/1.json\n"],["admin_destroyphase","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroyphase","()","

        delete a version, sections and questions\n"],["admin_destroyquestion","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroyquestion","()","

        delete a version, sections and questions\n"],["admin_destroysection","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroysection","()","

        delete a section and questions\n"],["admin_destroysuggestedanswer","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroysuggestedanswer","()","

        delete a suggested answer\n"],["admin_destroyversion","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroyversion","()","

        delete a version, sections and questions\n"],["admin_details","ExportedPlan","ExportedPlan.html#method-i-admin_details","()",""],["admin_edit","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_edit","()","

        GET /guidance_groups/1/edit\n"],["admin_edit","GuidancesController","GuidancesController.html#method-i-admin_edit","()","

        GET /guidances/1/edit\n"],["admin_edit","OrganisationsController","OrganisationsController.html#method-i-admin_edit","()","

        GET /organisations/1/edit\n"],["admin_index","DmptemplatesController","DmptemplatesController.html#method-i-admin_index","()","

        GET /dmptemplates GET /dmptemplates.json\n"],["admin_index","GuidancesController","GuidancesController.html#method-i-admin_index","()","

        GET /guidances GET /guidances.json\n"],["admin_index","OrganisationUsersController","OrganisationUsersController.html#method-i-admin_index","()",""],["admin_new","DmptemplatesController","DmptemplatesController.html#method-i-admin_new","()","

        GET /dmptemplates/new GET /dmptemplates/new.json\n"],["admin_new","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_new","()","

        GET add new guidance groups\n"],["admin_new","GuidancesController","GuidancesController.html#method-i-admin_new","()",""],["admin_phase","DmptemplatesController","DmptemplatesController.html#method-i-admin_phase","()","

        show and edit a phase of the template\n"],["admin_previewphase","DmptemplatesController","DmptemplatesController.html#method-i-admin_previewphase","()","

        preview a phase\n"],["admin_show","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_show","()","

        GET /guidance_groups/1 GET /guidance_groups/1.json\n"],["admin_show","GuidancesController","GuidancesController.html#method-i-admin_show","()","

        GET /guidances/1 GET /guidances/1.json\n"],["admin_show","OrganisationsController","OrganisationsController.html#method-i-admin_show","()","

        GET /organisations/1 GET /organisations/1.json\n"],["admin_template","DmptemplatesController","DmptemplatesController.html#method-i-admin_template","()","

        GET /dmptemplates/1 GET /dmptemplates/1.json\n"],["admin_update","DmptemplatesController","DmptemplatesController.html#method-i-admin_update","()","

        PUT /dmptemplates/1 PUT /dmptemplates/1.json\n"],["admin_update","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_update","()","

        PUT /guidance_groups/1 PUT /guidance_groups/1.json\n"],["admin_update","GuidancesController","GuidancesController.html#method-i-admin_update","()","

        PUT /guidances/1 PUT /guidances/1.json\n"],["admin_update","OrganisationsController","OrganisationsController.html#method-i-admin_update","()","

        PUT /organisations/1 PUT /organisations/1.json\n"],["admin_updatephase","DmptemplatesController","DmptemplatesController.html#method-i-admin_updatephase","()","

        update a phase of a template\n"],["admin_updatequestion","DmptemplatesController","DmptemplatesController.html#method-i-admin_updatequestion","()","

        update a question of a template\n"],["admin_updatesection","DmptemplatesController","DmptemplatesController.html#method-i-admin_updatesection","()","

        update a section of a template\n"],["admin_updatesuggestedanswer","DmptemplatesController","DmptemplatesController.html#method-i-admin_updatesuggestedanswer","()","

        update a suggested answer of a template\n"],["admin_updateversion","DmptemplatesController","DmptemplatesController.html#method-i-admin_updateversion","()","

        update a version of a template\n"],["administerable_by","Plan","Plan.html#method-i-administerable_by","(user_id)",""],["administerable_by","Project","Project.html#method-i-administerable_by","(user_id)",""],["after_confirmation_path_for","ConfirmationsController","ConfirmationsController.html#method-i-after_confirmation_path_for","(resource_name, resource)",""],["after_resetting_password_path_for","PasswordsController","PasswordsController.html#method-i-after_resetting_password_path_for","(resource)",""],["after_sign_in_error_path_for","ApplicationController","ApplicationController.html#method-i-after_sign_in_error_path_for","(resource)",""],["after_sign_in_path_for","ApplicationController","ApplicationController.html#method-i-after_sign_in_path_for","(resource)",""],["after_sign_up_error_path_for","ApplicationController","ApplicationController.html#method-i-after_sign_up_error_path_for","(resource)",""],["after_sign_up_path_for","ApplicationController","ApplicationController.html#method-i-after_sign_up_path_for","(resource)",""],["all_guidance_groups","Organisation","Organisation.html#method-i-all_guidance_groups","()",""],["all_sections","Organisation","Organisation.html#method-i-all_sections","(version_id)",""],["answer","Plan","Plan.html#method-i-answer","(qid, create_if_missing = true)",""],["answer","PlansController","PlansController.html#method-i-answer","()",""],["archive","CommentsController","CommentsController.html#method-i-archive","()","

        ARCHIVE /comments/1 ARCHIVE /comments/1.json\n"],["as_csv","ExportedPlan","ExportedPlan.html#method-i-as_csv","()","

        Export formats\n"],["as_txt","ExportedPlan","ExportedPlan.html#method-i-as_txt","()",""],["assign_administrator","Project","Project.html#method-i-assign_administrator","(user_id)",""],["assign_creator","Project","Project.html#method-i-assign_creator","(user_id)",""],["assign_editor","Project","Project.html#method-i-assign_editor","(user_id)",""],["assign_reader","Project","Project.html#method-i-assign_reader","(user_id)",""],["associate","Users::OmniauthShibbolethRequestController","Users/OmniauthShibbolethRequestController.html#method-i-associate","()",""],["authenticate_admin!","ApplicationController","ApplicationController.html#method-i-authenticate_admin-21","()",""],["build_footer","ActiveAdmin::Views::Pages::Base","ActiveAdmin/Views/Pages/Base.html#method-i-build_footer","()","

        Renders the content for the footer\n"],["by_organisation","Guidance","Guidance.html#method-c-by_organisation","(org_id)","

        all guidance that belong to an organisation\n"],["children","OrganisationsController","OrganisationsController.html#method-i-children","()",""],["contact_us","StaticPagesController","StaticPagesController.html#method-i-contact_us","()",""],["create","AnswersController","AnswersController.html#method-i-create","()","

        POST /answers POST /answers.json\n"],["create","CommentsController","CommentsController.html#method-i-create","()","

        POST /comments POST /comments.json\n"],["create","ContactsController","ContactsController.html#method-i-create","()",""],["create","OrganisationsController","OrganisationsController.html#method-i-create","()","

        POST /organisations POST /organisations.json\n"],["create","ProjectGroupsController","ProjectGroupsController.html#method-i-create","()",""],["create","ProjectsController","ProjectsController.html#method-i-create","()","

        POST /projects POST /projects.json\n"],["create","RegistrationsController","RegistrationsController.html#method-i-create","()","

        POST /resource\n"],["create","SessionsController","SessionsController.html#method-i-create","()",""],["create","SplashLogsController","SplashLogsController.html#method-i-create","()","

        POST /answers POST /answers.json\n"],["create","ThemesController","ThemesController.html#method-i-create","()","

        POST /themes POST /themes.json\n"],["create","UserOrgRolesController","UserOrgRolesController.html#method-i-create","()","

        POST /user_org_roles POST /user_org_roles.json\n"],["create","UserRoleTypesController","UserRoleTypesController.html#method-i-create","()","

        POST /user_role_types POST /user_role_types.json\n"],["create","UserStatusesController","UserStatusesController.html#method-i-create","()","

        POST /user_statuses POST /user_statuses.json\n"],["create","UserTypesController","UserTypesController.html#method-i-create","()","

        POST /user_types POST /user_types.json\n"],["create","UsersController","UsersController.html#method-i-create","()","

        POST /users POST /users.json\n"],["create_plans","Project","Project.html#method-i-create_plans","()",""],["created_by","Project","Project.html#method-i-created_by","(user_id)",""],["current_organisation","User","User.html#method-i-current_organisation","()",""],["delete_recent_locks","Plan","Plan.html#method-i-delete_recent_locks","(user_id)",""],["delete_recent_locks","PlansController","PlansController.html#method-i-delete_recent_locks","()",""],["destroy","OrganisationsController","OrganisationsController.html#method-i-destroy","()","

        DELETE /organisations/1 DELETE /organisations/1.json\n"],["destroy","ProjectGroupsController","ProjectGroupsController.html#method-i-destroy","()",""],["destroy","ProjectsController","ProjectsController.html#method-i-destroy","()","

        DELETE /projects/1 DELETE /projects/1.json\n"],["destroy","SessionsController","SessionsController.html#method-i-destroy","()",""],["destroy","ThemesController","ThemesController.html#method-i-destroy","()","

        DELETE /themes/1 DELETE /themes/1.json\n"],["destroy","UserOrgRolesController","UserOrgRolesController.html#method-i-destroy","()","

        DELETE /user_org_roles/1 DELETE /user_org_roles/1.json\n"],["destroy","UserRoleTypesController","UserRoleTypesController.html#method-i-destroy","()","

        DELETE /user_role_types/1 DELETE /user_role_types/1.json\n"],["destroy","UserStatusesController","UserStatusesController.html#method-i-destroy","()","

        DELETE /user_statuses/1 DELETE /user_statuses/1.json\n"],["destroy","UserTypesController","UserTypesController.html#method-i-destroy","()","

        DELETE /user_types/1 DELETE /user_types/1.json\n"],["destroy","UsersController","UsersController.html#method-i-destroy","()","

        DELETE /users/1 DELETE /users/1.json\n"],["details","Plan","Plan.html#method-i-details","()",""],["devise_mapping","ApplicationHelper","ApplicationHelper.html#method-i-devise_mapping","()",""],["display_name","GuidanceGroup","GuidanceGroup.html#method-i-display_name","()",""],["dmptemplate","Plan","Plan.html#method-i-dmptemplate","()",""],["do_update","RegistrationsController","RegistrationsController.html#method-i-do_update","(require_password = true, confirm = false)",""],["edit","CommentsController","CommentsController.html#method-i-edit","()","

        GET /comments/1/edit\n"],["edit","PlansController","PlansController.html#method-i-edit","()","

        GET /plans/1/edit\n"],["edit","ProjectsController","ProjectsController.html#method-i-edit","()","

        GET /projects/1/edit Should this be removed?\n"],["edit","ThemesController","ThemesController.html#method-i-edit","()","

        GET /themes/1/edit\n"],["edit","UserOrgRolesController","UserOrgRolesController.html#method-i-edit","()","

        GET /user_org_roles/1/edit\n"],["edit","UserRoleTypesController","UserRoleTypesController.html#method-i-edit","()","

        GET /user_role_types/1/edit\n"],["edit","UserStatusesController","UserStatusesController.html#method-i-edit","()","

        GET /user_statuses/1/edit\n"],["edit","UserTypesController","UserTypesController.html#method-i-edit","()","

        GET /user_types/1/edit\n"],["edit","UsersController","UsersController.html#method-i-edit","()","

        GET /users/1/edit\n"],["editable_by","Plan","Plan.html#method-i-editable_by","(user_id)",""],["editable_by","Project","Project.html#method-i-editable_by","(user_id)",""],["email","ProjectGroup","ProjectGroup.html#method-i-email","()",""],["email=","ProjectGroup","ProjectGroup.html#method-i-email-3D","(new_email)",""],["estimate_space_used","Plan","Plan.html#method-i-estimate_space_used","(used_height)","

        Based on the height of the text gathered so far and the available vertical\nspace of the pdf, estimate …\n"],["export","PlansController","PlansController.html#method-i-export","()",""],["export","ProjectsController","ProjectsController.html#method-i-export","()",""],["filter","User","User.html#method-i-filter","(query)",""],["funder","ExportedPlan","ExportedPlan.html#method-i-funder","()",""],["funder","Project","Project.html#method-i-funder","()",""],["funder_id","Project","Project.html#method-i-funder_id","()",""],["funder_id=","Project","Project.html#method-i-funder_id-3D","(new_funder_id)",""],["funder_name","Project","Project.html#method-i-funder_name","()",""],["funder_name=","Project","Project.html#method-i-funder_name-3D","(new_funder_name)",""],["funders_and_own_templates","Dmptemplate","Dmptemplate.html#method-c-funders_and_own_templates","(org_id)","

        returns an array with all funders and own institutional templates\n"],["funders_templates","Dmptemplate","Dmptemplate.html#method-c-funders_templates","()","

        returns all funders templates\n"],["get_guidance_group_templates?","Guidance","Guidance.html#method-i-get_guidance_group_templates-3F","(guidance_group)",""],["get_plan_list_columns","ApplicationController","ApplicationController.html#method-i-get_plan_list_columns","()",""],["get_settings","Settings::PlansController","Settings/PlansController.html#method-i-get_settings","()",""],["get_settings","Settings::ProjectsController","Settings/ProjectsController.html#method-i-get_settings","()",""],["get_suggested_answer","Question","Question.html#method-i-get_suggested_answer","(org_id)","

        get suggested answer belonging to the currents user for this question\n"],["global_sections","Version","Version.html#method-i-global_sections","()",""],["grant_title","ExportedPlan","ExportedPlan.html#method-i-grant_title","()",""],["guidance_for_question","Plan","Plan.html#method-i-guidance_for_question","(question)",""],["guidance_for_question","Question","Question.html#method-i-guidance_for_question","(question, org_admin)","

        guidance for question in the org admin\n"],["guidance_groups_excluding","GuidanceGroup","GuidanceGroup.html#method-c-guidance_groups_excluding","(excluded_orgs)",""],["has_customisations?","Dmptemplate","Dmptemplate.html#method-i-has_customisations-3F","(org_id, temp)","

        verify if a template has customisation by current user's org\n"],["has_published_versions?","Dmptemplate","Dmptemplate.html#method-i-has_published_versions-3F","()","

        verify if there are any publish version for the template\n"],["has_sections","Phase","Phase.html#method-i-has_sections","()","

        verify if a phase has a published version or a version with one or more\nsections\n"],["height_of_text","Plan","Plan.html#method-i-height_of_text","(text, font_size_inc = 0, vertical_margin = 0)","

        Take a guess at the vertical height (in mm) of the given text based on the\nfont-size and left/right margins …\n"],["in_group_belonging_to?","Guidance","Guidance.html#method-i-in_group_belonging_to-3F","(organisation_id)","

        verifies if one guidance belongs to a org\n"],["index","CommentsController","CommentsController.html#method-i-index","()","

        GET /comments GET /comments.json\n"],["index","ExistingUsersController","ExistingUsersController.html#method-i-index","()",""],["index","HomeController","HomeController.html#method-i-index","()",""],["index","OrganisationsController","OrganisationsController.html#method-i-index","()","

        GET /organisations GET /organisations.json\n"],["index","ProjectsController","ProjectsController.html#method-i-index","()","

        GET /projects GET /projects.json\n"],["index","ThemesController","ThemesController.html#method-i-index","()","

        GET /themes GET /themes.json\n"],["index","UserOrgRolesController","UserOrgRolesController.html#method-i-index","()","

        GET /user_org_roles GET /user_org_roles.json\n"],["index","UserRoleTypesController","UserRoleTypesController.html#method-i-index","()","

        GET /user_role_types GET /user_role_types.json\n"],["index","UserStatusesController","UserStatusesController.html#method-i-index","()","

        GET /user_statuses GET /user_statuses.json\n"],["index","UserTypesController","UserTypesController.html#method-i-index","()","

        GET /user_types GET /user_types.json\n"],["institution","ExportedPlan","ExportedPlan.html#method-i-institution","()",""],["institution_id","Project","Project.html#method-i-institution_id","()",""],["institution_id=","Project","Project.html#method-i-institution_id-3D","(new_institution_id)",""],["is_admin?","User","User.html#method-i-is_admin-3F","()",""],["is_org_admin?","User","User.html#method-i-is_org_admin-3F","()",""],["javascript","ApplicationHelper","ApplicationHelper.html#method-i-javascript","(*files)",""],["last_edited","Project","Project.html#method-i-last_edited","()",""],["latest_published_version","Phase","Phase.html#method-i-latest_published_version","()","

        Verify if this phase has any published versions\n"],["latest_update","Plan","Plan.html#method-i-latest_update","()",""],["latest_update","Project","Project.html#method-i-latest_update","()",""],["latest_version","Phase","Phase.html#method-i-latest_version","()",""],["link_to_add_object","ApplicationHelper","ApplicationHelper.html#method-i-link_to_add_object","(name, f, association, css_class, i)",""],["lock_all_sections","Plan","Plan.html#method-i-lock_all_sections","(user_id)",""],["lock_section","Plan","Plan.html#method-i-lock_section","(section_id, user_id, release_time = 60)",""],["lock_section","PlansController","PlansController.html#method-i-lock_section","()",""],["locked","Plan","Plan.html#method-i-locked","(section_id, user_id)",""],["locked","PlansController","PlansController.html#method-i-locked","()",""],["name","Project","Project.html#method-i-name","()","

        Getters to match 'My plans' columns\n"],["name","User","User.html#method-i-name","(use_email = true)",""],["needs_password?","RegistrationsController","RegistrationsController.html#method-i-needs_password-3F","(user, params)","

        check if we need password to update user data ie if password or email was\nchanged extend this as needed …\n"],["new","Ability","Ability.html#method-c-new","(user)",""],["new","OrganisationsController","OrganisationsController.html#method-i-new","()","

        GET /organisations/new GET /organisations/new.json\n"],["new","ProjectsController","ProjectsController.html#method-i-new","()","

        GET /projects/new GET /projects/new.json\n"],["new","ThemesController","ThemesController.html#method-i-new","()","

        GET /themes/new GET /themes/new.json\n"],["new","UserOrgRolesController","UserOrgRolesController.html#method-i-new","()","

        GET /user_org_roles/new GET /user_org_roles/new.json\n"],["new","UserRoleTypesController","UserRoleTypesController.html#method-i-new","()","

        GET /user_role_types/new GET /user_role_types/new.json\n"],["new","UserStatusesController","UserStatusesController.html#method-i-new","()","

        GET /user_statuses/new GET /user_statuses/new.json\n"],["new","UserTypesController","UserTypesController.html#method-i-new","()","

        GET /user_types/new GET /user_types/new.json\n"],["new","UsersController","UsersController.html#method-i-new","()","

        GET /users/new GET /users/new.json\n"],["org_type","Dmptemplate","Dmptemplate.html#method-i-org_type","()",""],["org_type","User","User.html#method-i-org_type","()",""],["organisation","User","User.html#method-i-organisation","()",""],["organisation=","User","User.html#method-i-organisation-3D","(new_organisation)",""],["organisation_id","User","User.html#method-i-organisation_id","()",""],["organisation_id=","User","User.html#method-i-organisation_id-3D","(new_organisation_id)",""],["orgs_of_type","ProjectsController","ProjectsController.html#method-i-orgs_of_type","(org_type_name, published_templates = false)",""],["orgs_with_parent_of_type","Organisation","Organisation.html#method-c-orgs_with_parent_of_type","(org_type)","

        retrieves info off a child org\n"],["other_organisations","Organisation","Organisation.html#method-c-other_organisations","()",""],["own_institutional_templates","Dmptemplate","Dmptemplate.html#method-c-own_institutional_templates","(org_id)","

        returns all institutional templates bellowing to the current user's org\n"],["owner","Project","Project.html#method-i-owner","()",""],["parent","OrganisationsController","OrganisationsController.html#method-i-parent","()",""],["permissions_change_notification","UserMailer","UserMailer.html#method-i-permissions_change_notification","(project_group)",""],["plan","Settings::PlansController","Settings/PlansController.html#method-i-plan","()",""],["plan_settings_indicator","PlansHelper","PlansHelper.html#method-i-plan_settings_indicator","(plan)","

        Shows whether the user has default, template-default or custom settings for\nthe given plan.\n"],["possible_guidance","ProjectsController","ProjectsController.html#method-i-possible_guidance","()",""],["possible_templates","ProjectsController","ProjectsController.html#method-i-possible_templates","()","

        GET /projects/possible_templates.json\n"],["principal_investigator","ExportedPlan","ExportedPlan.html#method-i-principal_investigator","()",""],["project_access_removed_notification","UserMailer","UserMailer.html#method-i-project_access_removed_notification","(user, project)",""],["project_data_contact","ExportedPlan","ExportedPlan.html#method-i-project_data_contact","()",""],["project_description","ExportedPlan","ExportedPlan.html#method-i-project_description","()",""],["project_identifier","ExportedPlan","ExportedPlan.html#method-i-project_identifier","()",""],["project_list_body","PlansHelper","PlansHelper.html#method-i-project_list_body","(column, project)",""],["project_list_head","PlansHelper","PlansHelper.html#method-i-project_list_head","(column)",""],["project_name","ExportedPlan","ExportedPlan.html#method-i-project_name","()","

        Getters to match Settings::Dmptemplate::VALID_ADMIN_FIELDS\n"],["projects_for_user","Project","Project.html#method-c-projects_for_user","(user_id)",""],["published_templates","Organisation","Organisation.html#method-i-published_templates","()",""],["question_themes?","Question","Question.html#method-i-question_themes-3F","()","

        def question_type?\n\n

        type_label = {}\nif self.is_text_field?\n  type_label = 'Text field'\nelsif self.multiple_choice? ...
        \n"],["questions","ExportedPlan","ExportedPlan.html#method-i-questions","()",""],["questions_for_section","ExportedPlan","ExportedPlan.html#method-i-questions_for_section","(section_id)",""],["readable_by","Plan","Plan.html#method-i-readable_by","(user_id)",""],["readable_by","Project","Project.html#method-i-readable_by","(user_id)",""],["redirect","Users::OmniauthShibbolethRequestController","Users/OmniauthShibbolethRequestController.html#method-i-redirect","()",""],["redirect_url","CustomFailure","CustomFailure.html#method-i-redirect_url","()",""],["resource","ApplicationHelper","ApplicationHelper.html#method-i-resource","()",""],["resource_name","ApplicationHelper","ApplicationHelper.html#method-i-resource_name","()",""],["respond","CustomFailure","CustomFailure.html#method-i-respond","()",""],["roadmap","StaticPagesController","StaticPagesController.html#method-i-roadmap","()",""],["root","Organisation","Organisation.html#method-i-root","()",""],["sanitize_text","ExportedPlan","ExportedPlan.html#method-i-sanitize_text","(text)",""],["scoped_collection","Object","Object.html#method-i-scoped_collection","()",""],["section_answers","Plan","Plan.html#method-i-section_answers","(section_id)",""],["section_answers","PlansController","PlansController.html#method-i-section_answers","()",""],["sections","ExportedPlan","ExportedPlan.html#method-i-sections","()","

        sections taken from fields settings\n"],["sections","Plan","Plan.html#method-i-sections","()",""],["settings","Plan","Plan.html#method-i-settings","(key)","

        Proxy through to the template settings (or defaults if this plan\ndoesn't have an associated template) …\n"],["settings_json","Settings::PlansController","Settings/PlansController.html#method-i-settings_json","()",""],["settings_json","Settings::ProjectsController","Settings/ProjectsController.html#method-i-settings_json","()",""],["share","ProjectsController","ProjectsController.html#method-i-share","()",""],["shared","Project","Project.html#method-i-shared","()",""],["shared?","Project","Project.html#method-i-shared-3F","()",""],["sharing_notification","UserMailer","UserMailer.html#method-i-sharing_notification","(project_group)",""],["shibboleth","Users::OmniauthCallbacksController","Users/OmniauthCallbacksController.html#method-i-shibboleth","()",""],["short_name","Organisation","Organisation.html#method-i-short_name","()",""],["show","CommentsController","CommentsController.html#method-i-show","()","

        GET /comments/1 GET /comments/1.json\n"],["show","ProjectsController","ProjectsController.html#method-i-show","()","

        GET /projects/1 GET /projects/1.json\n"],["show","Settings::PlansController","Settings/PlansController.html#method-i-show","()",""],["show","Settings::ProjectsController","Settings/ProjectsController.html#method-i-show","()",""],["show","ThemesController","ThemesController.html#method-i-show","()","

        GET /themes/1 GET /themes/1.json\n"],["show","UserOrgRolesController","UserOrgRolesController.html#method-i-show","()","

        GET /user_org_roles/1 GET /user_org_roles/1.json\n"],["show","UserRoleTypesController","UserRoleTypesController.html#method-i-show","()","

        GET /user_role_types/1 GET /user_role_types/1.json\n"],["show","UserStatusesController","UserStatusesController.html#method-i-show","()","

        GET /user_statuses/1 GET /user_statuses/1.json\n"],["show","UserTypesController","UserTypesController.html#method-i-show","()","

        GET /user_types/1 GET /user_types/1.json\n"],["show","UsersController","UsersController.html#method-i-show","()","

        GET /users/1 GET /users/1.json\n"],["status","Plan","Plan.html#method-i-status","()",""],["status","PlansController","PlansController.html#method-i-status","()","

        GET /status/1.json\n"],["store_location","ApplicationController","ApplicationController.html#method-i-store_location","()",""],["super_settings","Plan","Plan.html#method-i-super_settings","(key)",""],["template_owner","Project","Project.html#method-i-template_owner","()",""],["templates","OrganisationsController","OrganisationsController.html#method-i-templates","()",""],["templates_org_type","Dmptemplate","Dmptemplate.html#method-c-templates_org_type","(ot)",""],["title","Plan","Plan.html#method-i-title","()",""],["to_s","Comment","Comment.html#method-i-to_s","()",""],["to_s","Dmptemplate","Dmptemplate.html#method-i-to_s","()",""],["to_s","GuidanceGroup","GuidanceGroup.html#method-i-to_s","()",""],["to_s","Option","Option.html#method-i-to_s","()",""],["to_s","OptionWarning","OptionWarning.html#method-i-to_s","()",""],["to_s","Organisation","Organisation.html#method-i-to_s","()",""],["to_s","Phase","Phase.html#method-i-to_s","()",""],["to_s","Question","Question.html#method-i-to_s","()",""],["to_s","QuestionFormat","QuestionFormat.html#method-i-to_s","()",""],["to_s","Section","Section.html#method-i-to_s","()",""],["to_s","SuggestedAnswer","SuggestedAnswer.html#method-i-to_s","()",""],["to_s","Theme","Theme.html#method-i-to_s","()",""],["to_s","Version","Version.html#method-i-to_s","()",""],["unit_id","Project","Project.html#method-i-unit_id","()",""],["unit_id=","Project","Project.html#method-i-unit_id-3D","(new_unit_id)",""],["unlock_all_sections","Plan","Plan.html#method-i-unlock_all_sections","(user_id)",""],["unlock_all_sections","PlansController","PlansController.html#method-i-unlock_all_sections","()",""],["unlock_section","Plan","Plan.html#method-i-unlock_section","(section_id, user_id)",""],["unlock_section","PlansController","PlansController.html#method-i-unlock_section","()",""],["update","CommentsController","CommentsController.html#method-i-update","()","

        PUT /comments/1 PUT /comments/1.json\n"],["update","PlansController","PlansController.html#method-i-update","()","

        PUT /plans/1 PUT /plans/1.json\n"],["update","ProjectGroupsController","ProjectGroupsController.html#method-i-update","()",""],["update","ProjectsController","ProjectsController.html#method-i-update","()","

        PUT /projects/1 PUT /projects/1.json\n"],["update","RegistrationsController","RegistrationsController.html#method-i-update","()",""],["update","Settings::PlansController","Settings/PlansController.html#method-i-update","()",""],["update","Settings::ProjectsController","Settings/ProjectsController.html#method-i-update","()",""],["update","ThemesController","ThemesController.html#method-i-update","()","

        PUT /themes/1 PUT /themes/1.json\n"],["update","UserOrgRolesController","UserOrgRolesController.html#method-i-update","()","

        PUT /user_org_roles/1 PUT /user_org_roles/1.json\n"],["update","UserRoleTypesController","UserRoleTypesController.html#method-i-update","()","

        PUT /user_role_types/1 PUT /user_role_types/1.json\n"],["update","UserStatusesController","UserStatusesController.html#method-i-update","()","

        PUT /user_statuses/1 PUT /user_statuses/1.json\n"],["update","UserTypesController","UserTypesController.html#method-i-update","()","

        PUT /user_types/1 PUT /user_types/1.json\n"],["update","UsersController","UsersController.html#method-i-update","()","

        PUT /users/1 PUT /users/1.json\n"],["update_phases","GuidancesController","GuidancesController.html#method-i-update_phases","()","

        setup variables for use in the dynamic updating\n"],["update_questions","GuidancesController","GuidancesController.html#method-i-update_questions","()",""],["update_sections","GuidancesController","GuidancesController.html#method-i-update_sections","()",""],["update_versions","GuidancesController","GuidancesController.html#method-i-update_versions","()",""],["warning","Organisation","Organisation.html#method-i-warning","(option_id)",""],["warning","Plan","Plan.html#method-i-warning","(option_id)",""],["warning","PlansController","PlansController.html#method-i-warning","()",""],["README","","README_rdoc.html","","

        DMPonline v4\n

        DMPonline is the DCC's data management planning tool, available at\ndmponline.dcc.ac.uk …\n"]]}} \ No newline at end of file +var search_data = {"index":{"searchIndex":["ability","activeadmin","views","pages","base","answer","answerscontroller","applicationcontroller","applicationhelper","comment","commentscontroller","confirmationscontroller","contactscontroller","customfailure","dmponline4","application","dmptemplate","dmptemplatescontroller","existinguserscontroller","exportedplan","filetype","fileupload","guidance","guidancegroup","guidancegroupscontroller","guidancescontroller","homecontroller","object","option","optionwarning","organisation","organisationtype","organisationuserscontroller","organisationscontroller","passwordscontroller","phase","plan","plansection","planscontroller","planshelper","project","projectgroup","projectgroupscontroller","projectpartner","projectscontroller","question","questionformat","registrationscontroller","role","section","sessionscontroller","settings","dmptemplate","planlist","planscontroller","projectscontroller","settingscontroller","splashlog","splashlogscontroller","staticpagescontroller","suggestedanswer","theme","themescontroller","user","usermailer","userorgrole","userorgrolescontroller","userroletype","userroletypescontroller","userstatus","userstatusescontroller","usertype","usertypescontroller","users","omniauthcallbackscontroller","omniauthshibbolethrequestcontroller","userscontroller","version","about_us()","about_us()","access_level()","access_level=()","add_guidance_to_array()","add_user()","admin_addphase()","admin_cloneversion()","admin_create()","admin_create()","admin_create()","admin_createphase()","admin_createquestion()","admin_createsection()","admin_createsuggestedanswer()","admin_destroy()","admin_destroy()","admin_destroy()","admin_destroyphase()","admin_destroyquestion()","admin_destroysection()","admin_destroysuggestedanswer()","admin_destroyversion()","admin_details()","admin_edit()","admin_edit()","admin_edit()","admin_index()","admin_index()","admin_index()","admin_new()","admin_new()","admin_new()","admin_phase()","admin_previewphase()","admin_show()","admin_show()","admin_show()","admin_template()","admin_update()","admin_update()","admin_update()","admin_update()","admin_updatephase()","admin_updatequestion()","admin_updatesection()","admin_updatesuggestedanswer()","admin_updateversion()","administerable_by()","administerable_by()","after_confirmation_path_for()","after_resetting_password_path_for()","after_sign_in_error_path_for()","after_sign_in_path_for()","after_sign_up_error_path_for()","after_sign_up_path_for()","all_guidance_groups()","all_sections()","answer()","answer()","archive()","as_csv()","as_txt()","assign_administrator()","assign_creator()","assign_editor()","assign_reader()","associate()","authenticate_admin!()","build_footer()","by_organisation()","children()","contact_us()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create_plans()","created_by()","current_organisation()","delete_recent_locks()","delete_recent_locks()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","details()","devise_mapping()","display_name()","dmptemplate()","do_update()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","editable_by()","editable_by()","email()","email=()","estimate_space_used()","export()","export()","filter()","funder()","funder()","funder_id()","funder_id=()","funder_name()","funder_name=()","funders_and_own_templates()","funders_templates()","get_guidance_group_templates?()","get_plan_list_columns()","get_settings()","get_settings()","get_suggested_answer()","global_sections()","grant_title()","guidance_for_question()","guidance_for_question()","guidance_groups_excluding()","has_customisations?()","has_published_versions?()","has_sections()","height_of_text()","in_group_belonging_to?()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","institution()","institution_id()","institution_id=()","can_super_admin?()","can_org_admin?()","javascript()","last_edited()","latest_published_version()","latest_update()","latest_update()","latest_version()","link_to_add_object()","lock_all_sections()","lock_section()","lock_section()","locked()","locked()","name()","name()","needs_password?()","new()","new()","new()","new()","new()","new()","new()","new()","new()","org_type()","org_type()","organisation()","organisation=()","organisation_id()","organisation_id=()","orgs_of_type()","orgs_with_parent_of_type()","other_organisations()","own_institutional_templates()","owner()","parent()","permissions_change_notification()","plan()","plan_settings_indicator()","possible_guidance()","possible_templates()","principal_investigator()","project_access_removed_notification()","project_data_contact()","project_description()","project_identifier()","project_list_body()","project_list_head()","project_name()","projects_for_user()","published_templates()","question_themes?()","questions()","questions_for_section()","readable_by()","readable_by()","redirect()","redirect_url()","resource()","resource_name()","respond()","roadmap()","root()","sanitize_text()","scoped_collection()","section_answers()","section_answers()","sections()","sections()","settings()","settings_json()","settings_json()","share()","shared()","shared?()","sharing_notification()","shibboleth()","short_name()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","status()","status()","store_location()","super_settings()","template_owner()","templates()","templates_org_type()","title()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","unit_id()","unit_id=()","unlock_all_sections()","unlock_all_sections()","unlock_section()","unlock_section()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update_phases()","update_questions()","update_sections()","update_versions()","warning()","warning()","warning()","readme"],"longSearchIndex":["ability","activeadmin","activeadmin::views","activeadmin::views::pages","activeadmin::views::pages::base","answer","answerscontroller","applicationcontroller","applicationhelper","comment","commentscontroller","confirmationscontroller","contactscontroller","customfailure","dmponline4","dmponline4::application","dmptemplate","dmptemplatescontroller","existinguserscontroller","exportedplan","filetype","fileupload","guidance","guidancegroup","guidancegroupscontroller","guidancescontroller","homecontroller","object","option","optionwarning","organisation","organisationtype","organisationuserscontroller","organisationscontroller","passwordscontroller","phase","plan","plansection","planscontroller","planshelper","project","projectgroup","projectgroupscontroller","projectpartner","projectscontroller","question","questionformat","registrationscontroller","role","section","sessionscontroller","settings","settings::dmptemplate","settings::planlist","settings::planscontroller","settings::projectscontroller","settings::settingscontroller","splashlog","splashlogscontroller","staticpagescontroller","suggestedanswer","theme","themescontroller","user","usermailer","userorgrole","userorgrolescontroller","userroletype","userroletypescontroller","userstatus","userstatusescontroller","usertype","usertypescontroller","users","users::omniauthcallbackscontroller","users::omniauthshibbolethrequestcontroller","userscontroller","version","homecontroller#about_us()","staticpagescontroller#about_us()","projectgroup#access_level()","projectgroup#access_level=()","plan#add_guidance_to_array()","project#add_user()","dmptemplatescontroller#admin_addphase()","dmptemplatescontroller#admin_cloneversion()","dmptemplatescontroller#admin_create()","guidancegroupscontroller#admin_create()","guidancescontroller#admin_create()","dmptemplatescontroller#admin_createphase()","dmptemplatescontroller#admin_createquestion()","dmptemplatescontroller#admin_createsection()","dmptemplatescontroller#admin_createsuggestedanswer()","dmptemplatescontroller#admin_destroy()","guidancegroupscontroller#admin_destroy()","guidancescontroller#admin_destroy()","dmptemplatescontroller#admin_destroyphase()","dmptemplatescontroller#admin_destroyquestion()","dmptemplatescontroller#admin_destroysection()","dmptemplatescontroller#admin_destroysuggestedanswer()","dmptemplatescontroller#admin_destroyversion()","exportedplan#admin_details()","guidancegroupscontroller#admin_edit()","guidancescontroller#admin_edit()","organisationscontroller#admin_edit()","dmptemplatescontroller#admin_index()","guidancescontroller#admin_index()","organisationuserscontroller#admin_index()","dmptemplatescontroller#admin_new()","guidancegroupscontroller#admin_new()","guidancescontroller#admin_new()","dmptemplatescontroller#admin_phase()","dmptemplatescontroller#admin_previewphase()","guidancegroupscontroller#admin_show()","guidancescontroller#admin_show()","organisationscontroller#admin_show()","dmptemplatescontroller#admin_template()","dmptemplatescontroller#admin_update()","guidancegroupscontroller#admin_update()","guidancescontroller#admin_update()","organisationscontroller#admin_update()","dmptemplatescontroller#admin_updatephase()","dmptemplatescontroller#admin_updatequestion()","dmptemplatescontroller#admin_updatesection()","dmptemplatescontroller#admin_updatesuggestedanswer()","dmptemplatescontroller#admin_updateversion()","plan#administerable_by()","project#administerable_by()","confirmationscontroller#after_confirmation_path_for()","passwordscontroller#after_resetting_password_path_for()","applicationcontroller#after_sign_in_error_path_for()","applicationcontroller#after_sign_in_path_for()","applicationcontroller#after_sign_up_error_path_for()","applicationcontroller#after_sign_up_path_for()","organisation#all_guidance_groups()","organisation#all_sections()","plan#answer()","planscontroller#answer()","commentscontroller#archive()","exportedplan#as_csv()","exportedplan#as_txt()","project#assign_administrator()","project#assign_creator()","project#assign_editor()","project#assign_reader()","users::omniauthshibbolethrequestcontroller#associate()","applicationcontroller#authenticate_admin!()","activeadmin::views::pages::base#build_footer()","guidance::by_organisation()","organisationscontroller#children()","staticpagescontroller#contact_us()","answerscontroller#create()","commentscontroller#create()","contactscontroller#create()","organisationscontroller#create()","projectgroupscontroller#create()","projectscontroller#create()","registrationscontroller#create()","sessionscontroller#create()","splashlogscontroller#create()","themescontroller#create()","userorgrolescontroller#create()","userroletypescontroller#create()","userstatusescontroller#create()","usertypescontroller#create()","userscontroller#create()","project#create_plans()","project#created_by()","user#current_organisation()","plan#delete_recent_locks()","planscontroller#delete_recent_locks()","organisationscontroller#destroy()","projectgroupscontroller#destroy()","projectscontroller#destroy()","sessionscontroller#destroy()","themescontroller#destroy()","userorgrolescontroller#destroy()","userroletypescontroller#destroy()","userstatusescontroller#destroy()","usertypescontroller#destroy()","userscontroller#destroy()","plan#details()","applicationhelper#devise_mapping()","guidancegroup#display_name()","plan#dmptemplate()","registrationscontroller#do_update()","commentscontroller#edit()","planscontroller#edit()","projectscontroller#edit()","themescontroller#edit()","userorgrolescontroller#edit()","userroletypescontroller#edit()","userstatusescontroller#edit()","usertypescontroller#edit()","userscontroller#edit()","plan#editable_by()","project#editable_by()","projectgroup#email()","projectgroup#email=()","plan#estimate_space_used()","planscontroller#export()","projectscontroller#export()","user#filter()","exportedplan#funder()","project#funder()","project#funder_id()","project#funder_id=()","project#funder_name()","project#funder_name=()","dmptemplate::funders_and_own_templates()","dmptemplate::funders_templates()","guidance#get_guidance_group_templates?()","applicationcontroller#get_plan_list_columns()","settings::planscontroller#get_settings()","settings::projectscontroller#get_settings()","question#get_suggested_answer()","version#global_sections()","exportedplan#grant_title()","plan#guidance_for_question()","question#guidance_for_question()","guidancegroup::guidance_groups_excluding()","dmptemplate#has_customisations?()","dmptemplate#has_published_versions?()","phase#has_sections()","plan#height_of_text()","guidance#in_group_belonging_to?()","commentscontroller#index()","existinguserscontroller#index()","homecontroller#index()","organisationscontroller#index()","projectscontroller#index()","themescontroller#index()","userorgrolescontroller#index()","userroletypescontroller#index()","userstatusescontroller#index()","usertypescontroller#index()","exportedplan#institution()","project#institution_id()","project#institution_id=()","user#can_super_admin?()","user#can_org_admin?()","applicationhelper#javascript()","project#last_edited()","phase#latest_published_version()","plan#latest_update()","project#latest_update()","phase#latest_version()","applicationhelper#link_to_add_object()","plan#lock_all_sections()","plan#lock_section()","planscontroller#lock_section()","plan#locked()","planscontroller#locked()","project#name()","user#name()","registrationscontroller#needs_password?()","ability::new()","organisationscontroller#new()","projectscontroller#new()","themescontroller#new()","userorgrolescontroller#new()","userroletypescontroller#new()","userstatusescontroller#new()","usertypescontroller#new()","userscontroller#new()","dmptemplate#org_type()","user#org_type()","user#organisation()","user#organisation=()","user#organisation_id()","user#organisation_id=()","projectscontroller#orgs_of_type()","organisation::orgs_with_parent_of_type()","organisation::other_organisations()","dmptemplate::own_institutional_templates()","project#owner()","organisationscontroller#parent()","usermailer#permissions_change_notification()","settings::planscontroller#plan()","planshelper#plan_settings_indicator()","projectscontroller#possible_guidance()","projectscontroller#possible_templates()","exportedplan#principal_investigator()","usermailer#project_access_removed_notification()","exportedplan#project_data_contact()","exportedplan#project_description()","exportedplan#project_identifier()","planshelper#project_list_body()","planshelper#project_list_head()","exportedplan#project_name()","project::projects_for_user()","organisation#published_templates()","question#question_themes?()","exportedplan#questions()","exportedplan#questions_for_section()","plan#readable_by()","project#readable_by()","users::omniauthshibbolethrequestcontroller#redirect()","customfailure#redirect_url()","applicationhelper#resource()","applicationhelper#resource_name()","customfailure#respond()","staticpagescontroller#roadmap()","organisation#root()","exportedplan#sanitize_text()","object#scoped_collection()","plan#section_answers()","planscontroller#section_answers()","exportedplan#sections()","plan#sections()","plan#settings()","settings::planscontroller#settings_json()","settings::projectscontroller#settings_json()","projectscontroller#share()","project#shared()","project#shared?()","usermailer#sharing_notification()","users::omniauthcallbackscontroller#shibboleth()","organisation#short_name()","commentscontroller#show()","projectscontroller#show()","settings::planscontroller#show()","settings::projectscontroller#show()","themescontroller#show()","userorgrolescontroller#show()","userroletypescontroller#show()","userstatusescontroller#show()","usertypescontroller#show()","userscontroller#show()","plan#status()","planscontroller#status()","applicationcontroller#store_location()","plan#super_settings()","project#template_owner()","organisationscontroller#templates()","dmptemplate::templates_org_type()","plan#title()","comment#to_s()","dmptemplate#to_s()","guidancegroup#to_s()","option#to_s()","optionwarning#to_s()","organisation#to_s()","phase#to_s()","question#to_s()","questionformat#to_s()","section#to_s()","suggestedanswer#to_s()","theme#to_s()","version#to_s()","project#unit_id()","project#unit_id=()","plan#unlock_all_sections()","planscontroller#unlock_all_sections()","plan#unlock_section()","planscontroller#unlock_section()","commentscontroller#update()","planscontroller#update()","projectgroupscontroller#update()","projectscontroller#update()","registrationscontroller#update()","settings::planscontroller#update()","settings::projectscontroller#update()","themescontroller#update()","userorgrolescontroller#update()","userroletypescontroller#update()","userstatusescontroller#update()","usertypescontroller#update()","userscontroller#update()","guidancescontroller#update_phases()","guidancescontroller#update_questions()","guidancescontroller#update_sections()","guidancescontroller#update_versions()","organisation#warning()","plan#warning()","planscontroller#warning()",""],"info":[["Ability","","Ability.html","",""],["ActiveAdmin","","ActiveAdmin.html","",""],["ActiveAdmin::Views","","ActiveAdmin/Views.html","",""],["ActiveAdmin::Views::Pages","","ActiveAdmin/Views/Pages.html","",""],["ActiveAdmin::Views::Pages::Base","","ActiveAdmin/Views/Pages/Base.html","","

        lib/active_admin_views_pages_base.rb\n"],["Answer","","Answer.html","",""],["AnswersController","","AnswersController.html","",""],["ApplicationController","","ApplicationController.html","",""],["ApplicationHelper","","ApplicationHelper.html","",""],["Comment","","Comment.html","",""],["CommentsController","","CommentsController.html","",""],["ConfirmationsController","","ConfirmationsController.html","",""],["ContactsController","","ContactsController.html","",""],["CustomFailure","","CustomFailure.html","",""],["DMPonline4","","DMPonline4.html","",""],["DMPonline4::Application","","DMPonline4/Application.html","",""],["Dmptemplate","","Dmptemplate.html","",""],["DmptemplatesController","","DmptemplatesController.html","","

        Project: — DMPonline v4\n

        Description: — This controller is responsible for all the actions in the admin interface …\n"],["ExistingUsersController","","ExistingUsersController.html","",""],["ExportedPlan","","ExportedPlan.html","",""],["FileType","","FileType.html","",""],["FileUpload","","FileUpload.html","",""],["Guidance","","Guidance.html","","

        Project: — DMPonline v4\n

        Description: — This class keeps the information organisations enter to support users …\n"],["GuidanceGroup","","GuidanceGroup.html","",""],["GuidanceGroupsController","","GuidanceGroupsController.html","",""],["GuidancesController","","GuidancesController.html","",""],["HomeController","","HomeController.html","",""],["Object","","Object.html","",""],["Option","","Option.html","",""],["OptionWarning","","OptionWarning.html","",""],["Organisation","","Organisation.html","",""],["OrganisationType","","OrganisationType.html","",""],["OrganisationUsersController","","OrganisationUsersController.html","",""],["OrganisationsController","","OrganisationsController.html","",""],["PasswordsController","","PasswordsController.html","",""],["Phase","","Phase.html","","

        Project: — DMPonline v4\n

        Description: — This model describes informmation about the phase of a plan, it's …\n"],["Plan","","Plan.html","",""],["PlanSection","","PlanSection.html","",""],["PlansController","","PlansController.html","",""],["PlansHelper","","PlansHelper.html","",""],["Project","","Project.html","",""],["ProjectGroup","","ProjectGroup.html","",""],["ProjectGroupsController","","ProjectGroupsController.html","",""],["ProjectPartner","","ProjectPartner.html","",""],["ProjectsController","","ProjectsController.html","",""],["Question","","Question.html","",""],["QuestionFormat","","QuestionFormat.html","",""],["RegistrationsController","","RegistrationsController.html","","

        app/controllers/registrations_controller.rb\n"],["Role","","Role.html","",""],["Section","","Section.html","",""],["SessionsController","","SessionsController.html","","

        app/controllers/sessions_controller.rb\n"],["Settings","","Settings.html","",""],["Settings::Dmptemplate","","Settings/Dmptemplate.html","",""],["Settings::PlanList","","Settings/PlanList.html","",""],["Settings::PlansController","","Settings/PlansController.html","",""],["Settings::ProjectsController","","Settings/ProjectsController.html","",""],["Settings::SettingsController","","Settings/SettingsController.html","",""],["SplashLog","","SplashLog.html","",""],["SplashLogsController","","SplashLogsController.html","",""],["StaticPagesController","","StaticPagesController.html","",""],["SuggestedAnswer","","SuggestedAnswer.html","",""],["Theme","","Theme.html","",""],["ThemesController","","ThemesController.html","",""],["User","","User.html","",""],["UserMailer","","UserMailer.html","",""],["UserOrgRole","","UserOrgRole.html","",""],["UserOrgRolesController","","UserOrgRolesController.html","",""],["UserRoleType","","UserRoleType.html","",""],["UserRoleTypesController","","UserRoleTypesController.html","",""],["UserStatus","","UserStatus.html","",""],["UserStatusesController","","UserStatusesController.html","",""],["UserType","","UserType.html","",""],["UserTypesController","","UserTypesController.html","",""],["Users","","Users.html","",""],["Users::OmniauthCallbacksController","","Users/OmniauthCallbacksController.html","",""],["Users::OmniauthShibbolethRequestController","","Users/OmniauthShibbolethRequestController.html","",""],["UsersController","","UsersController.html","",""],["Version","","Version.html","",""],["about_us","HomeController","HomeController.html#method-i-about_us","()",""],["about_us","StaticPagesController","StaticPagesController.html#method-i-about_us","()",""],["access_level","ProjectGroup","ProjectGroup.html#method-i-access_level","()",""],["access_level=","ProjectGroup","ProjectGroup.html#method-i-access_level-3D","(new_access_level)",""],["add_guidance_to_array","Plan","Plan.html#method-i-add_guidance_to_array","(guidance_array, guidance_group, theme, guidance)",""],["add_user","Project","Project.html#method-i-add_user","(user_id, is_editor = false, is_administrator = false, is_creator = false)",""],["admin_addphase","DmptemplatesController","DmptemplatesController.html#method-i-admin_addphase","()","

        add a new phase to a template\n"],["admin_cloneversion","DmptemplatesController","DmptemplatesController.html#method-i-admin_cloneversion","()","

        clone a version of a template\n"],["admin_create","DmptemplatesController","DmptemplatesController.html#method-i-admin_create","()","

        POST /dmptemplates POST /dmptemplates.json\n"],["admin_create","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_create","()","

        POST /guidance_groups POST /guidance_groups.json\n"],["admin_create","GuidancesController","GuidancesController.html#method-i-admin_create","()","

        POST /guidances POST /guidances.json\n"],["admin_createphase","DmptemplatesController","DmptemplatesController.html#method-i-admin_createphase","()","

        create a phase\n"],["admin_createquestion","DmptemplatesController","DmptemplatesController.html#method-i-admin_createquestion","()","

        create a question\n"],["admin_createsection","DmptemplatesController","DmptemplatesController.html#method-i-admin_createsection","()","

        create a section\n"],["admin_createsuggestedanswer","DmptemplatesController","DmptemplatesController.html#method-i-admin_createsuggestedanswer","()","

        SUGGESTED ANSWERS create suggested answers\n"],["admin_destroy","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroy","()","

        DELETE /dmptemplates/1 DELETE /dmptemplates/1.json\n"],["admin_destroy","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_destroy","()","

        DELETE /guidance_groups/1 DELETE /guidance_groups/1.json\n"],["admin_destroy","GuidancesController","GuidancesController.html#method-i-admin_destroy","()","

        DELETE /guidances/1 DELETE /guidances/1.json\n"],["admin_destroyphase","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroyphase","()","

        delete a version, sections and questions\n"],["admin_destroyquestion","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroyquestion","()","

        delete a version, sections and questions\n"],["admin_destroysection","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroysection","()","

        delete a section and questions\n"],["admin_destroysuggestedanswer","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroysuggestedanswer","()","

        delete a suggested answer\n"],["admin_destroyversion","DmptemplatesController","DmptemplatesController.html#method-i-admin_destroyversion","()","

        delete a version, sections and questions\n"],["admin_details","ExportedPlan","ExportedPlan.html#method-i-admin_details","()",""],["admin_edit","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_edit","()","

        GET /guidance_groups/1/edit\n"],["admin_edit","GuidancesController","GuidancesController.html#method-i-admin_edit","()","

        GET /guidances/1/edit\n"],["admin_edit","OrganisationsController","OrganisationsController.html#method-i-admin_edit","()","

        GET /organisations/1/edit\n"],["admin_index","DmptemplatesController","DmptemplatesController.html#method-i-admin_index","()","

        GET /dmptemplates GET /dmptemplates.json\n"],["admin_index","GuidancesController","GuidancesController.html#method-i-admin_index","()","

        GET /guidances GET /guidances.json\n"],["admin_index","OrganisationUsersController","OrganisationUsersController.html#method-i-admin_index","()",""],["admin_new","DmptemplatesController","DmptemplatesController.html#method-i-admin_new","()","

        GET /dmptemplates/new GET /dmptemplates/new.json\n"],["admin_new","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_new","()","

        GET add new guidance groups\n"],["admin_new","GuidancesController","GuidancesController.html#method-i-admin_new","()",""],["admin_phase","DmptemplatesController","DmptemplatesController.html#method-i-admin_phase","()","

        show and edit a phase of the template\n"],["admin_previewphase","DmptemplatesController","DmptemplatesController.html#method-i-admin_previewphase","()","

        preview a phase\n"],["admin_show","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_show","()","

        GET /guidance_groups/1 GET /guidance_groups/1.json\n"],["admin_show","GuidancesController","GuidancesController.html#method-i-admin_show","()","

        GET /guidances/1 GET /guidances/1.json\n"],["admin_show","OrganisationsController","OrganisationsController.html#method-i-admin_show","()","

        GET /organisations/1 GET /organisations/1.json\n"],["admin_template","DmptemplatesController","DmptemplatesController.html#method-i-admin_template","()","

        GET /dmptemplates/1 GET /dmptemplates/1.json\n"],["admin_update","DmptemplatesController","DmptemplatesController.html#method-i-admin_update","()","

        PUT /dmptemplates/1 PUT /dmptemplates/1.json\n"],["admin_update","GuidanceGroupsController","GuidanceGroupsController.html#method-i-admin_update","()","

        PUT /guidance_groups/1 PUT /guidance_groups/1.json\n"],["admin_update","GuidancesController","GuidancesController.html#method-i-admin_update","()","

        PUT /guidances/1 PUT /guidances/1.json\n"],["admin_update","OrganisationsController","OrganisationsController.html#method-i-admin_update","()","

        PUT /organisations/1 PUT /organisations/1.json\n"],["admin_updatephase","DmptemplatesController","DmptemplatesController.html#method-i-admin_updatephase","()","

        update a phase of a template\n"],["admin_updatequestion","DmptemplatesController","DmptemplatesController.html#method-i-admin_updatequestion","()","

        update a question of a template\n"],["admin_updatesection","DmptemplatesController","DmptemplatesController.html#method-i-admin_updatesection","()","

        update a section of a template\n"],["admin_updatesuggestedanswer","DmptemplatesController","DmptemplatesController.html#method-i-admin_updatesuggestedanswer","()","

        update a suggested answer of a template\n"],["admin_updateversion","DmptemplatesController","DmptemplatesController.html#method-i-admin_updateversion","()","

        update a version of a template\n"],["administerable_by","Plan","Plan.html#method-i-administerable_by","(user_id)",""],["administerable_by","Project","Project.html#method-i-administerable_by","(user_id)",""],["after_confirmation_path_for","ConfirmationsController","ConfirmationsController.html#method-i-after_confirmation_path_for","(resource_name, resource)",""],["after_resetting_password_path_for","PasswordsController","PasswordsController.html#method-i-after_resetting_password_path_for","(resource)",""],["after_sign_in_error_path_for","ApplicationController","ApplicationController.html#method-i-after_sign_in_error_path_for","(resource)",""],["after_sign_in_path_for","ApplicationController","ApplicationController.html#method-i-after_sign_in_path_for","(resource)",""],["after_sign_up_error_path_for","ApplicationController","ApplicationController.html#method-i-after_sign_up_error_path_for","(resource)",""],["after_sign_up_path_for","ApplicationController","ApplicationController.html#method-i-after_sign_up_path_for","(resource)",""],["all_guidance_groups","Organisation","Organisation.html#method-i-all_guidance_groups","()",""],["all_sections","Organisation","Organisation.html#method-i-all_sections","(version_id)",""],["answer","Plan","Plan.html#method-i-answer","(qid, create_if_missing = true)",""],["answer","PlansController","PlansController.html#method-i-answer","()",""],["archive","CommentsController","CommentsController.html#method-i-archive","()","

        ARCHIVE /comments/1 ARCHIVE /comments/1.json\n"],["as_csv","ExportedPlan","ExportedPlan.html#method-i-as_csv","()","

        Export formats\n"],["as_txt","ExportedPlan","ExportedPlan.html#method-i-as_txt","()",""],["assign_administrator","Project","Project.html#method-i-assign_administrator","(user_id)",""],["assign_creator","Project","Project.html#method-i-assign_creator","(user_id)",""],["assign_editor","Project","Project.html#method-i-assign_editor","(user_id)",""],["assign_reader","Project","Project.html#method-i-assign_reader","(user_id)",""],["associate","Users::OmniauthShibbolethRequestController","Users/OmniauthShibbolethRequestController.html#method-i-associate","()",""],["authenticate_admin!","ApplicationController","ApplicationController.html#method-i-authenticate_admin-21","()",""],["build_footer","ActiveAdmin::Views::Pages::Base","ActiveAdmin/Views/Pages/Base.html#method-i-build_footer","()","

        Renders the content for the footer\n"],["by_organisation","Guidance","Guidance.html#method-c-by_organisation","(org_id)","

        all guidance that belong to an organisation\n"],["children","OrganisationsController","OrganisationsController.html#method-i-children","()",""],["contact_us","StaticPagesController","StaticPagesController.html#method-i-contact_us","()",""],["create","AnswersController","AnswersController.html#method-i-create","()","

        POST /answers POST /answers.json\n"],["create","CommentsController","CommentsController.html#method-i-create","()","

        POST /comments POST /comments.json\n"],["create","ContactsController","ContactsController.html#method-i-create","()",""],["create","OrganisationsController","OrganisationsController.html#method-i-create","()","

        POST /organisations POST /organisations.json\n"],["create","ProjectGroupsController","ProjectGroupsController.html#method-i-create","()",""],["create","ProjectsController","ProjectsController.html#method-i-create","()","

        POST /projects POST /projects.json\n"],["create","RegistrationsController","RegistrationsController.html#method-i-create","()","

        POST /resource\n"],["create","SessionsController","SessionsController.html#method-i-create","()",""],["create","SplashLogsController","SplashLogsController.html#method-i-create","()","

        POST /answers POST /answers.json\n"],["create","ThemesController","ThemesController.html#method-i-create","()","

        POST /themes POST /themes.json\n"],["create","UserOrgRolesController","UserOrgRolesController.html#method-i-create","()","

        POST /user_org_roles POST /user_org_roles.json\n"],["create","UserRoleTypesController","UserRoleTypesController.html#method-i-create","()","

        POST /user_role_types POST /user_role_types.json\n"],["create","UserStatusesController","UserStatusesController.html#method-i-create","()","

        POST /user_statuses POST /user_statuses.json\n"],["create","UserTypesController","UserTypesController.html#method-i-create","()","

        POST /user_types POST /user_types.json\n"],["create","UsersController","UsersController.html#method-i-create","()","

        POST /users POST /users.json\n"],["create_plans","Project","Project.html#method-i-create_plans","()",""],["created_by","Project","Project.html#method-i-created_by","(user_id)",""],["current_organisation","User","User.html#method-i-current_organisation","()",""],["delete_recent_locks","Plan","Plan.html#method-i-delete_recent_locks","(user_id)",""],["delete_recent_locks","PlansController","PlansController.html#method-i-delete_recent_locks","()",""],["destroy","OrganisationsController","OrganisationsController.html#method-i-destroy","()","

        DELETE /organisations/1 DELETE /organisations/1.json\n"],["destroy","ProjectGroupsController","ProjectGroupsController.html#method-i-destroy","()",""],["destroy","ProjectsController","ProjectsController.html#method-i-destroy","()","

        DELETE /projects/1 DELETE /projects/1.json\n"],["destroy","SessionsController","SessionsController.html#method-i-destroy","()",""],["destroy","ThemesController","ThemesController.html#method-i-destroy","()","

        DELETE /themes/1 DELETE /themes/1.json\n"],["destroy","UserOrgRolesController","UserOrgRolesController.html#method-i-destroy","()","

        DELETE /user_org_roles/1 DELETE /user_org_roles/1.json\n"],["destroy","UserRoleTypesController","UserRoleTypesController.html#method-i-destroy","()","

        DELETE /user_role_types/1 DELETE /user_role_types/1.json\n"],["destroy","UserStatusesController","UserStatusesController.html#method-i-destroy","()","

        DELETE /user_statuses/1 DELETE /user_statuses/1.json\n"],["destroy","UserTypesController","UserTypesController.html#method-i-destroy","()","

        DELETE /user_types/1 DELETE /user_types/1.json\n"],["destroy","UsersController","UsersController.html#method-i-destroy","()","

        DELETE /users/1 DELETE /users/1.json\n"],["details","Plan","Plan.html#method-i-details","()",""],["devise_mapping","ApplicationHelper","ApplicationHelper.html#method-i-devise_mapping","()",""],["display_name","GuidanceGroup","GuidanceGroup.html#method-i-display_name","()",""],["dmptemplate","Plan","Plan.html#method-i-dmptemplate","()",""],["do_update","RegistrationsController","RegistrationsController.html#method-i-do_update","(require_password = true, confirm = false)",""],["edit","CommentsController","CommentsController.html#method-i-edit","()","

        GET /comments/1/edit\n"],["edit","PlansController","PlansController.html#method-i-edit","()","

        GET /plans/1/edit\n"],["edit","ProjectsController","ProjectsController.html#method-i-edit","()","

        GET /projects/1/edit Should this be removed?\n"],["edit","ThemesController","ThemesController.html#method-i-edit","()","

        GET /themes/1/edit\n"],["edit","UserOrgRolesController","UserOrgRolesController.html#method-i-edit","()","

        GET /user_org_roles/1/edit\n"],["edit","UserRoleTypesController","UserRoleTypesController.html#method-i-edit","()","

        GET /user_role_types/1/edit\n"],["edit","UserStatusesController","UserStatusesController.html#method-i-edit","()","

        GET /user_statuses/1/edit\n"],["edit","UserTypesController","UserTypesController.html#method-i-edit","()","

        GET /user_types/1/edit\n"],["edit","UsersController","UsersController.html#method-i-edit","()","

        GET /users/1/edit\n"],["editable_by","Plan","Plan.html#method-i-editable_by","(user_id)",""],["editable_by","Project","Project.html#method-i-editable_by","(user_id)",""],["email","ProjectGroup","ProjectGroup.html#method-i-email","()",""],["email=","ProjectGroup","ProjectGroup.html#method-i-email-3D","(new_email)",""],["estimate_space_used","Plan","Plan.html#method-i-estimate_space_used","(used_height)","

        Based on the height of the text gathered so far and the available vertical\nspace of the pdf, estimate …\n"],["export","PlansController","PlansController.html#method-i-export","()",""],["export","ProjectsController","ProjectsController.html#method-i-export","()",""],["filter","User","User.html#method-i-filter","(query)",""],["funder","ExportedPlan","ExportedPlan.html#method-i-funder","()",""],["funder","Project","Project.html#method-i-funder","()",""],["funder_id","Project","Project.html#method-i-funder_id","()",""],["funder_id=","Project","Project.html#method-i-funder_id-3D","(new_funder_id)",""],["funder_name","Project","Project.html#method-i-funder_name","()",""],["funder_name=","Project","Project.html#method-i-funder_name-3D","(new_funder_name)",""],["funders_and_own_templates","Dmptemplate","Dmptemplate.html#method-c-funders_and_own_templates","(org_id)","

        returns an array with all funders and own institutional templates\n"],["funders_templates","Dmptemplate","Dmptemplate.html#method-c-funders_templates","()","

        returns all funders templates\n"],["get_guidance_group_templates?","Guidance","Guidance.html#method-i-get_guidance_group_templates-3F","(guidance_group)",""],["get_plan_list_columns","ApplicationController","ApplicationController.html#method-i-get_plan_list_columns","()",""],["get_settings","Settings::PlansController","Settings/PlansController.html#method-i-get_settings","()",""],["get_settings","Settings::ProjectsController","Settings/ProjectsController.html#method-i-get_settings","()",""],["get_suggested_answer","Question","Question.html#method-i-get_suggested_answer","(org_id)","

        get suggested answer belonging to the currents user for this question\n"],["global_sections","Version","Version.html#method-i-global_sections","()",""],["grant_title","ExportedPlan","ExportedPlan.html#method-i-grant_title","()",""],["guidance_for_question","Plan","Plan.html#method-i-guidance_for_question","(question)",""],["guidance_for_question","Question","Question.html#method-i-guidance_for_question","(question, org_admin)","

        guidance for question in the org admin\n"],["guidance_groups_excluding","GuidanceGroup","GuidanceGroup.html#method-c-guidance_groups_excluding","(excluded_orgs)",""],["has_customisations?","Dmptemplate","Dmptemplate.html#method-i-has_customisations-3F","(org_id, temp)","

        verify if a template has customisation by current user's org\n"],["has_published_versions?","Dmptemplate","Dmptemplate.html#method-i-has_published_versions-3F","()","

        verify if there are any publish version for the template\n"],["has_sections","Phase","Phase.html#method-i-has_sections","()","

        verify if a phase has a published version or a version with one or more\nsections\n"],["height_of_text","Plan","Plan.html#method-i-height_of_text","(text, font_size_inc = 0, vertical_margin = 0)","

        Take a guess at the vertical height (in mm) of the given text based on the\nfont-size and left/right margins …\n"],["in_group_belonging_to?","Guidance","Guidance.html#method-i-in_group_belonging_to-3F","(organisation_id)","

        verifies if one guidance belongs to a org\n"],["index","CommentsController","CommentsController.html#method-i-index","()","

        GET /comments GET /comments.json\n"],["index","ExistingUsersController","ExistingUsersController.html#method-i-index","()",""],["index","HomeController","HomeController.html#method-i-index","()",""],["index","OrganisationsController","OrganisationsController.html#method-i-index","()","

        GET /organisations GET /organisations.json\n"],["index","ProjectsController","ProjectsController.html#method-i-index","()","

        GET /projects GET /projects.json\n"],["index","ThemesController","ThemesController.html#method-i-index","()","

        GET /themes GET /themes.json\n"],["index","UserOrgRolesController","UserOrgRolesController.html#method-i-index","()","

        GET /user_org_roles GET /user_org_roles.json\n"],["index","UserRoleTypesController","UserRoleTypesController.html#method-i-index","()","

        GET /user_role_types GET /user_role_types.json\n"],["index","UserStatusesController","UserStatusesController.html#method-i-index","()","

        GET /user_statuses GET /user_statuses.json\n"],["index","UserTypesController","UserTypesController.html#method-i-index","()","

        GET /user_types GET /user_types.json\n"],["institution","ExportedPlan","ExportedPlan.html#method-i-institution","()",""],["institution_id","Project","Project.html#method-i-institution_id","()",""],["institution_id=","Project","Project.html#method-i-institution_id-3D","(new_institution_id)",""],["can_super_admin?","User","User.html#method-i-is_admin-3F","()",""],["can_org_admin?","User","User.html#method-i-is_org_admin-3F","()",""],["javascript","ApplicationHelper","ApplicationHelper.html#method-i-javascript","(*files)",""],["last_edited","Project","Project.html#method-i-last_edited","()",""],["latest_published_version","Phase","Phase.html#method-i-latest_published_version","()","

        Verify if this phase has any published versions\n"],["latest_update","Plan","Plan.html#method-i-latest_update","()",""],["latest_update","Project","Project.html#method-i-latest_update","()",""],["latest_version","Phase","Phase.html#method-i-latest_version","()",""],["link_to_add_object","ApplicationHelper","ApplicationHelper.html#method-i-link_to_add_object","(name, f, association, css_class, i)",""],["lock_all_sections","Plan","Plan.html#method-i-lock_all_sections","(user_id)",""],["lock_section","Plan","Plan.html#method-i-lock_section","(section_id, user_id, release_time = 60)",""],["lock_section","PlansController","PlansController.html#method-i-lock_section","()",""],["locked","Plan","Plan.html#method-i-locked","(section_id, user_id)",""],["locked","PlansController","PlansController.html#method-i-locked","()",""],["name","Project","Project.html#method-i-name","()","

        Getters to match 'My plans' columns\n"],["name","User","User.html#method-i-name","(use_email = true)",""],["needs_password?","RegistrationsController","RegistrationsController.html#method-i-needs_password-3F","(user, params)","

        check if we need password to update user data ie if password or email was\nchanged extend this as needed …\n"],["new","Ability","Ability.html#method-c-new","(user)",""],["new","OrganisationsController","OrganisationsController.html#method-i-new","()","

        GET /organisations/new GET /organisations/new.json\n"],["new","ProjectsController","ProjectsController.html#method-i-new","()","

        GET /projects/new GET /projects/new.json\n"],["new","ThemesController","ThemesController.html#method-i-new","()","

        GET /themes/new GET /themes/new.json\n"],["new","UserOrgRolesController","UserOrgRolesController.html#method-i-new","()","

        GET /user_org_roles/new GET /user_org_roles/new.json\n"],["new","UserRoleTypesController","UserRoleTypesController.html#method-i-new","()","

        GET /user_role_types/new GET /user_role_types/new.json\n"],["new","UserStatusesController","UserStatusesController.html#method-i-new","()","

        GET /user_statuses/new GET /user_statuses/new.json\n"],["new","UserTypesController","UserTypesController.html#method-i-new","()","

        GET /user_types/new GET /user_types/new.json\n"],["new","UsersController","UsersController.html#method-i-new","()","

        GET /users/new GET /users/new.json\n"],["org_type","Dmptemplate","Dmptemplate.html#method-i-org_type","()",""],["org_type","User","User.html#method-i-org_type","()",""],["organisation","User","User.html#method-i-organisation","()",""],["organisation=","User","User.html#method-i-organisation-3D","(new_organisation)",""],["organisation_id","User","User.html#method-i-organisation_id","()",""],["organisation_id=","User","User.html#method-i-organisation_id-3D","(new_organisation_id)",""],["orgs_of_type","ProjectsController","ProjectsController.html#method-i-orgs_of_type","(org_type_name, published_templates = false)",""],["orgs_with_parent_of_type","Organisation","Organisation.html#method-c-orgs_with_parent_of_type","(org_type)","

        retrieves info off a child org\n"],["other_organisations","Organisation","Organisation.html#method-c-other_organisations","()",""],["own_institutional_templates","Dmptemplate","Dmptemplate.html#method-c-own_institutional_templates","(org_id)","

        returns all institutional templates bellowing to the current user's org\n"],["owner","Project","Project.html#method-i-owner","()",""],["parent","OrganisationsController","OrganisationsController.html#method-i-parent","()",""],["permissions_change_notification","UserMailer","UserMailer.html#method-i-permissions_change_notification","(project_group)",""],["plan","Settings::PlansController","Settings/PlansController.html#method-i-plan","()",""],["plan_settings_indicator","PlansHelper","PlansHelper.html#method-i-plan_settings_indicator","(plan)","

        Shows whether the user has default, template-default or custom settings for\nthe given plan.\n"],["possible_guidance","ProjectsController","ProjectsController.html#method-i-possible_guidance","()",""],["possible_templates","ProjectsController","ProjectsController.html#method-i-possible_templates","()","

        GET /projects/possible_templates.json\n"],["principal_investigator","ExportedPlan","ExportedPlan.html#method-i-principal_investigator","()",""],["project_access_removed_notification","UserMailer","UserMailer.html#method-i-project_access_removed_notification","(user, project)",""],["project_data_contact","ExportedPlan","ExportedPlan.html#method-i-project_data_contact","()",""],["project_description","ExportedPlan","ExportedPlan.html#method-i-project_description","()",""],["project_identifier","ExportedPlan","ExportedPlan.html#method-i-project_identifier","()",""],["project_list_body","PlansHelper","PlansHelper.html#method-i-project_list_body","(column, project)",""],["project_list_head","PlansHelper","PlansHelper.html#method-i-project_list_head","(column)",""],["project_name","ExportedPlan","ExportedPlan.html#method-i-project_name","()","

        Getters to match Settings::Dmptemplate::VALID_ADMIN_FIELDS\n"],["projects_for_user","Project","Project.html#method-c-projects_for_user","(user_id)",""],["published_templates","Organisation","Organisation.html#method-i-published_templates","()",""],["question_themes?","Question","Question.html#method-i-question_themes-3F","()","

        def question_type?\n\n

        type_label = {}\nif self.is_text_field?\n  type_label = 'Text field'\nelsif self.multiple_choice? ...
        \n"],["questions","ExportedPlan","ExportedPlan.html#method-i-questions","()",""],["questions_for_section","ExportedPlan","ExportedPlan.html#method-i-questions_for_section","(section_id)",""],["readable_by","Plan","Plan.html#method-i-readable_by","(user_id)",""],["readable_by","Project","Project.html#method-i-readable_by","(user_id)",""],["redirect","Users::OmniauthShibbolethRequestController","Users/OmniauthShibbolethRequestController.html#method-i-redirect","()",""],["redirect_url","CustomFailure","CustomFailure.html#method-i-redirect_url","()",""],["resource","ApplicationHelper","ApplicationHelper.html#method-i-resource","()",""],["resource_name","ApplicationHelper","ApplicationHelper.html#method-i-resource_name","()",""],["respond","CustomFailure","CustomFailure.html#method-i-respond","()",""],["roadmap","StaticPagesController","StaticPagesController.html#method-i-roadmap","()",""],["root","Organisation","Organisation.html#method-i-root","()",""],["sanitize_text","ExportedPlan","ExportedPlan.html#method-i-sanitize_text","(text)",""],["scoped_collection","Object","Object.html#method-i-scoped_collection","()",""],["section_answers","Plan","Plan.html#method-i-section_answers","(section_id)",""],["section_answers","PlansController","PlansController.html#method-i-section_answers","()",""],["sections","ExportedPlan","ExportedPlan.html#method-i-sections","()","

        sections taken from fields settings\n"],["sections","Plan","Plan.html#method-i-sections","()",""],["settings","Plan","Plan.html#method-i-settings","(key)","

        Proxy through to the template settings (or defaults if this plan\ndoesn't have an associated template) …\n"],["settings_json","Settings::PlansController","Settings/PlansController.html#method-i-settings_json","()",""],["settings_json","Settings::ProjectsController","Settings/ProjectsController.html#method-i-settings_json","()",""],["share","ProjectsController","ProjectsController.html#method-i-share","()",""],["shared","Project","Project.html#method-i-shared","()",""],["shared?","Project","Project.html#method-i-shared-3F","()",""],["sharing_notification","UserMailer","UserMailer.html#method-i-sharing_notification","(project_group)",""],["shibboleth","Users::OmniauthCallbacksController","Users/OmniauthCallbacksController.html#method-i-shibboleth","()",""],["short_name","Organisation","Organisation.html#method-i-short_name","()",""],["show","CommentsController","CommentsController.html#method-i-show","()","

        GET /comments/1 GET /comments/1.json\n"],["show","ProjectsController","ProjectsController.html#method-i-show","()","

        GET /projects/1 GET /projects/1.json\n"],["show","Settings::PlansController","Settings/PlansController.html#method-i-show","()",""],["show","Settings::ProjectsController","Settings/ProjectsController.html#method-i-show","()",""],["show","ThemesController","ThemesController.html#method-i-show","()","

        GET /themes/1 GET /themes/1.json\n"],["show","UserOrgRolesController","UserOrgRolesController.html#method-i-show","()","

        GET /user_org_roles/1 GET /user_org_roles/1.json\n"],["show","UserRoleTypesController","UserRoleTypesController.html#method-i-show","()","

        GET /user_role_types/1 GET /user_role_types/1.json\n"],["show","UserStatusesController","UserStatusesController.html#method-i-show","()","

        GET /user_statuses/1 GET /user_statuses/1.json\n"],["show","UserTypesController","UserTypesController.html#method-i-show","()","

        GET /user_types/1 GET /user_types/1.json\n"],["show","UsersController","UsersController.html#method-i-show","()","

        GET /users/1 GET /users/1.json\n"],["status","Plan","Plan.html#method-i-status","()",""],["status","PlansController","PlansController.html#method-i-status","()","

        GET /status/1.json\n"],["store_location","ApplicationController","ApplicationController.html#method-i-store_location","()",""],["super_settings","Plan","Plan.html#method-i-super_settings","(key)",""],["template_owner","Project","Project.html#method-i-template_owner","()",""],["templates","OrganisationsController","OrganisationsController.html#method-i-templates","()",""],["templates_org_type","Dmptemplate","Dmptemplate.html#method-c-templates_org_type","(ot)",""],["title","Plan","Plan.html#method-i-title","()",""],["to_s","Comment","Comment.html#method-i-to_s","()",""],["to_s","Dmptemplate","Dmptemplate.html#method-i-to_s","()",""],["to_s","GuidanceGroup","GuidanceGroup.html#method-i-to_s","()",""],["to_s","Option","Option.html#method-i-to_s","()",""],["to_s","OptionWarning","OptionWarning.html#method-i-to_s","()",""],["to_s","Organisation","Organisation.html#method-i-to_s","()",""],["to_s","Phase","Phase.html#method-i-to_s","()",""],["to_s","Question","Question.html#method-i-to_s","()",""],["to_s","QuestionFormat","QuestionFormat.html#method-i-to_s","()",""],["to_s","Section","Section.html#method-i-to_s","()",""],["to_s","SuggestedAnswer","SuggestedAnswer.html#method-i-to_s","()",""],["to_s","Theme","Theme.html#method-i-to_s","()",""],["to_s","Version","Version.html#method-i-to_s","()",""],["unit_id","Project","Project.html#method-i-unit_id","()",""],["unit_id=","Project","Project.html#method-i-unit_id-3D","(new_unit_id)",""],["unlock_all_sections","Plan","Plan.html#method-i-unlock_all_sections","(user_id)",""],["unlock_all_sections","PlansController","PlansController.html#method-i-unlock_all_sections","()",""],["unlock_section","Plan","Plan.html#method-i-unlock_section","(section_id, user_id)",""],["unlock_section","PlansController","PlansController.html#method-i-unlock_section","()",""],["update","CommentsController","CommentsController.html#method-i-update","()","

        PUT /comments/1 PUT /comments/1.json\n"],["update","PlansController","PlansController.html#method-i-update","()","

        PUT /plans/1 PUT /plans/1.json\n"],["update","ProjectGroupsController","ProjectGroupsController.html#method-i-update","()",""],["update","ProjectsController","ProjectsController.html#method-i-update","()","

        PUT /projects/1 PUT /projects/1.json\n"],["update","RegistrationsController","RegistrationsController.html#method-i-update","()",""],["update","Settings::PlansController","Settings/PlansController.html#method-i-update","()",""],["update","Settings::ProjectsController","Settings/ProjectsController.html#method-i-update","()",""],["update","ThemesController","ThemesController.html#method-i-update","()","

        PUT /themes/1 PUT /themes/1.json\n"],["update","UserOrgRolesController","UserOrgRolesController.html#method-i-update","()","

        PUT /user_org_roles/1 PUT /user_org_roles/1.json\n"],["update","UserRoleTypesController","UserRoleTypesController.html#method-i-update","()","

        PUT /user_role_types/1 PUT /user_role_types/1.json\n"],["update","UserStatusesController","UserStatusesController.html#method-i-update","()","

        PUT /user_statuses/1 PUT /user_statuses/1.json\n"],["update","UserTypesController","UserTypesController.html#method-i-update","()","

        PUT /user_types/1 PUT /user_types/1.json\n"],["update","UsersController","UsersController.html#method-i-update","()","

        PUT /users/1 PUT /users/1.json\n"],["update_phases","GuidancesController","GuidancesController.html#method-i-update_phases","()","

        setup variables for use in the dynamic updating\n"],["update_questions","GuidancesController","GuidancesController.html#method-i-update_questions","()",""],["update_sections","GuidancesController","GuidancesController.html#method-i-update_sections","()",""],["update_versions","GuidancesController","GuidancesController.html#method-i-update_versions","()",""],["warning","Organisation","Organisation.html#method-i-warning","(option_id)",""],["warning","Plan","Plan.html#method-i-warning","(option_id)",""],["warning","PlansController","PlansController.html#method-i-warning","()",""],["README","","README_rdoc.html","","

        DMPonline v4\n

        DMPonline is the DCC's data management planning tool, available at\ndmponline.dcc.ac.uk …\n"]]}} \ No newline at end of file diff --git a/html/table_of_contents.html b/html/table_of_contents.html index 627c6b2..8d505d3 100644 --- a/html/table_of_contents.html +++ b/html/table_of_contents.html @@ -616,9 +616,9 @@

      • #institution_id= — Project -
      • #is_admin? — User +
      • #can_super_admin? — User -
      • #is_org_admin? — User +
      • #can_org_admin? — User
      • #javascript — ApplicationHelper diff --git a/public/403.html b/public/403.html index 88188d7..19bd2ca 100644 --- a/public/403.html +++ b/public/403.html @@ -2,7 +2,7 @@ -DMPonline +DMP Roadmap