diff --git a/Gemfile b/Gemfile index 2d9b5b9..77acae3 100644 --- a/Gemfile +++ b/Gemfile @@ -60,7 +60,6 @@ gem 'less-rails' # WE SHOULD PROBABLY USE SASS OR LESS NOT BOTH gem 'jquery-rails' gem 'font-awesome-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 'recaptcha', '>= 4.0' diff --git a/Gemfile.lock b/Gemfile.lock index 53bf3cf..8e7f5a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -174,7 +174,7 @@ activerecord (>= 3.1) less (2.6.0) commonjs (~> 0.2.7) - less-rails (2.7.1) + less-rails (2.8.0) actionpack (>= 4.0) less (~> 2.6.0) sprockets (> 2, < 4) @@ -322,11 +322,6 @@ tilt (2.0.5) tinymce-rails (4.4.3) railties (>= 3.1.1) - twitter-bootstrap-rails (2.2.8) - actionpack (>= 3.1) - execjs - rails (>= 3.1) - railties (>= 3.1) tzinfo (1.2.2) thread_safe (~> 0.1) uglifier (3.0.2) @@ -399,7 +394,6 @@ therubyracer (>= 0.11.4) thin tinymce-rails - twitter-bootstrap-rails (= 2.2.8) uglifier web-console (~> 2.0) webmock diff --git a/app/controllers/guidances_controller.rb b/app/controllers/guidances_controller.rb index 2356ef0..2bbf7ec 100644 --- a/app/controllers/guidances_controller.rb +++ b/app/controllers/guidances_controller.rb @@ -10,13 +10,6 @@ @guidance_groups = GuidanceGroup.where(org_id: current_user.org_id) end - ## - # GET /guidances/1 - def admin_show - @guidance = Guidance.eager_load(:guidance_group, :themes).find(params[:id]) - authorize @guidance - end - def admin_new @guidance = Guidance.new authorize @guidance @@ -54,7 +47,7 @@ end if @guidance.save - redirect_to admin_show_guidance_path(@guidance), notice: _('Guidance was successfully created.') + redirect_to admin_edit_guidance_path(@guidance), notice: _('Guidance was successfully created.') else flash[:notice] = failed_create_error(@guidance, _('guidance')) @themes = Theme.all.order('title') @@ -71,7 +64,7 @@ @guidance.text = params["guidance-text"] if @guidance.save(guidance_params) - redirect_to admin_show_guidance_path(params[:guidance]), notice: _('Guidance was successfully updated.') + redirect_to admin_edit_guidance_path(params[:guidance]), notice: _('Guidance was successfully updated.') else flash[:notice] = failed_update_error(@guidance, _('guidance')) @themes = Theme.all.order('title') diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index 7b4397e..43f2c54 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -3,13 +3,6 @@ respond_to :html ## - # GET /organisations/1 - def admin_show - @org = Org.find(params[:id]) - authorize @org - end - - ## # GET /organisations/1/edit def admin_edit @org = Org.find(params[:id]) @@ -28,18 +21,19 @@ begin if @org.update_attributes(org_params) - redirect_to admin_show_org_path(params[:id]), notice: _('Organisation was successfully updated.') + flash[:notice] = _('Organisation was successfully updated.') + render action: "admin_edit" else # For some reason our custom validator returns as a string and not a hash like normal activerecord # errors. We followed the example provided in the Rails guides when building the validator so # its unclear why its doing this. Placing a check here for the data type. We should reasses though # when doing a broader eval of the look/feel of the site and we come up with a standardized way of # displaying errors - flash[:notice] = failed_update_error(@org, _('organisation')) + flash[:alert] = failed_update_error(@org, _('organisation')) render action: "admin_edit" end rescue Dragonfly::Job::Fetch::NotFound => dflye - flash[:notice] = _('There seems to be a problem with your logo. Please upload it again.') + flash[:alert] = _('There seems to be a problem with your logo. Please upload it again.') render action: "admin_edit" end end @@ -89,6 +83,6 @@ private def org_params params.require(:org).permit(:name, :abbreviation, :target_url, :is_other, :banner_text, :language_id, - :region_id, :logo, :contact_email) + :region_id, :logo, :contact_email, :remove_logo) end end diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 0a4ae70..41e502d 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -28,6 +28,7 @@ # Get the current user's org @default_org = current_user.org if @orgs.include?(current_user.org) + flash[:notice] = "#{_('This is a')} #{_('test plan')}" if params[:test] @is_test = params[:test] ||= false respond_to :html @@ -141,7 +142,6 @@ end - # we can go into this with the user able to edit or not able to edit # the same edit form gets rendered but then different partials get used # to render the answers depending on whether it is readonly or not @@ -156,7 +156,30 @@ authorize @plan # If there was no phase specified use the template's 1st phase @phase = (params[:phase].nil? ? @plan.template.phases.first : Phase.find(params[:phase])) - @readonly = !@plan.editable_by?(current_user.id) + + # Get all Guidance Groups applicable for the plan and group them by org + @all_guidance_groups = @plan.get_guidance_group_options + @all_ggs_grouped_by_org = @all_guidance_groups.sort.group_by(&:org) + + # Important ones come first on the page - we grab the user's org's GGs and "Organisation" org type GGs + @important_ggs = [] + @important_ggs << [current_user.org, @all_ggs_grouped_by_org.delete(current_user.org)] + @all_ggs_grouped_by_org.each do |org, ggs| + if org.organisation? + @important_ggs << [org,ggs] + @all_ggs_grouped_by_org.delete(org) + end + end + + # Sort the rest by org name for the accordion + @all_ggs_grouped_by_org = @all_ggs_grouped_by_org.sort_by {|org,gg| org.name} + + @selected_guidance_groups = @plan.guidance_groups.pluck(:id) + @based_on = (@plan.template.customization_of.nil? ? @plan.template : Template.where(dmptemplate: @plan.template.customization_of).first) + + flash[:notice] = "#{_('This is a')} #{_('test plan')}" if params[:test] + @is_test = params[:test] ||= false + respond_to :html end diff --git a/app/helpers/plans_helper.rb b/app/helpers/plans_helper.rb index 1575bce..2377439 100644 --- a/app/helpers/plans_helper.rb +++ b/app/helpers/plans_helper.rb @@ -39,11 +39,11 @@ def display_visibility(val) case val when 'organisationally_visible' - return "#{_('Institutional')}" + return "#{_('Institution: anyone at my institution can view')}" when 'publicly_visible' - return "#{_('Public')}" + return "#{_('Public: anyone can view')}" else - return "#{_('Private')}" # Both Test and Private + return "#{_('Private: restricted to me and people I invite')}" # Both Test and Private end end diff --git a/app/views/contact_us/contacts/new.html.erb b/app/views/contact_us/contacts/new.html.erb index 4d704f0..645fa50 100644 --- a/app/views/contact_us/contacts/new.html.erb +++ b/app/views/contact_us/contacts/new.html.erb @@ -1,99 +1,95 @@ -<% javascript "contacts/new_contact.js" %> +<% javascript "views/contacts/new_contact.js" %>

<%= _("Contact Us") %>

- <%= raw _('%{application_name} is provided by the %{organisation_name}. You can find out more about us on our website. If you would like to contact us about %{application_name}, please fill out the form below.') % {organisation_name: Rails.configuration.branding[:organisation][:name], + <%= raw _('%{application_name} is provided by the %{organisation_name}.
You can find out more about us on our website. If you would like to contact us about %{application_name}, please fill out the form below.') % {organisation_name: Rails.configuration.branding[:organisation][:name], organisation_url: Rails.configuration.branding[:organisation][:url], application_name: Rails.configuration.branding[:application][:name]} %>

-
- -
-
- <%= form_for @contact, url: contacts_path, html: {class: "roadmap-form"} do |f| %> -
- <% if ContactUs.require_name %> -
- - /> -
- <% end %> - -
- - /> - -
- - <% if ContactUs.require_subject %> -
- - -
- <% end %> - -
- - -
- - <% if !user_signed_in? then %> -
- -
- <%= recaptcha_tags %> -
-
- <% end %> - -
- - <%= render partial: 'shared/accessible_submit_button', - locals: {id: 'create_contact_submit', - val: 'Submit', - disabled_initially: true, - tooltip: _('Fill in the required fields')} %> -
-
- <% end %> -
+
+ +
+ <%= form_for @contact, url: contacts_path, html: {class: "roadmap-form"} do |f| %> +
+ <% if ContactUs.require_name %> +
+ + /> +
+ <% end %> + +
+ + /> + +
+ + <% if ContactUs.require_subject %> +
+ + +
+ <% end %> + +
+ + +
+ + <% if !user_signed_in? then %> +
+ +
+ <%= recaptcha_tags %> +
+
+ <% end %> + +
+ + <%= render partial: 'shared/accessible_submit_button', + locals: {id: 'create_contact_submit', + val: 'Submit', + disabled_initially: true, + tooltip: _('Fill in the required fields'), + classes: 'left-indent'} %> +
+
+ + <% end %>
-
-
- <%= raw _("
  • %{organisation_name}
  • -
  • %{organisation_address_line1}
  • -
  • %{organisation_address_line2}
  • -
  • %{organisation_address_line3}
  • -
  • %{organisation_address_line4}
  • -
  • %{organisation_address_country}
  • -
-

Helpline: %{organisation_telephone}

-

Email %{organisation_email}

") % - { organisation_name: Rails.configuration.branding[:organisation][:name], - organisation_address_line1: Rails.configuration.branding[:organisation][:address_line1], - organisation_address_line2: Rails.configuration.branding[:organisation][:address_line2], - organisation_address_line3: Rails.configuration.branding[:organisation][:address_line3], - organisation_address_line4: Rails.configuration.branding[:organisation][:address_line4], - organisation_address_country: Rails.configuration.branding[:organisation][:address_country], - organisation_telephone: Rails.configuration.branding[:organisation][:telephone], - organisation_email: Rails.configuration.branding[:organisation][:email], - application_name: Rails.configuration.branding[:application][:name]} %> - -
- +
+
    + <% [Rails.configuration.branding[:organisation][:name], + Rails.configuration.branding[:organisation][:address_line1], + Rails.configuration.branding[:organisation][:address_line2], + Rails.configuration.branding[:organisation][:address_line3], + Rails.configuration.branding[:organisation][:address_line4], + Rails.configuration.branding[:organisation][:address_country]].each do |addr_line| %> + + <% if addr_line %> +
  • <%= addr_line %>
  • + <% end %> + <% end %> +
+ +

<%= "#{_('Helpline')} #{Rails.configuration.branding[:organisation][:telephone]}" %>

+

<%= _('Email') %> <%= Rails.configuration.branding[:organisation][:email] %>

-
-
+ +
+ + +
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 109a108..201002d 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,4 +1,4 @@ -<% javascript "devise/passwords/new.js" %> +<% javascript "views/devise/passwords/new.js" %> <% unless @user.errors[:email].empty? %>

<%= _('The email address you entered is not registered.') %>

@@ -8,14 +8,14 @@

<%= _('Please enter your email below and we will send you instructions on how to reset your password.') %>

-
+
<%= form_for resource, as: 'user', url: user_password_path, html: {class: "password-reset roadmap-form", method: :post} do |f| %>
+ class="left-indent required input-small" />
@@ -24,7 +24,7 @@ locals: {id: 'password-reset-button', val: _('Send'), disabled_initially: true, - classes: 'small-input-button', + classes: 'left-indent', tooltip: _('Enter a valid email.')} %>
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index c145576..ca84c15 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,7 +1,6 @@ -<% javascript "devise/registrations/edit.js" %> -
-

<%= _('Edit profile') %>

+<% javascript "views/devise/registrations/edit.js" %> +

<%= _('Edit profile') %>

- +
diff --git a/app/views/guidance_groups/admin_edit.html.erb b/app/views/guidance_groups/admin_edit.html.erb index 4edeb0f..c1f9779 100644 --- a/app/views/guidance_groups/admin_edit.html.erb +++ b/app/views/guidance_groups/admin_edit.html.erb @@ -2,78 +2,47 @@

<%= _('Guidance group') %> - -
- <%= link_to _('View all guidance'), - admin_index_guidance_path, - class: 'btn btn-primary' %> -

-
- -
- -
-
- <%= form_for(@guidance_group, url: admin_update_guidance_group_path(@guidance_group), html: {method: :put}) do |f| %> - - - - - - - - <% if @guidance_group.published == true then %> - - - - - <% end %> - - - - - - -
<%= _('Name') %> -
- <%= f.text_field :name, - as: :string, - class: 'text_field' %> - -
-
- <%= link_to(image_tag('help_button.png'), '#', class: 'guidance_group_title_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Add an appropriate name for your guidance group. This name will be used to tell the end user where the guidance has come from. It will be appended to text identifying the theme e.g. "[guidance group name]: guidance on data sharing" so we suggest you just use the institution or department name.')) %> -
-
<%= _('Published') %> -
- <%= f.check_box :published %> -
-
- -
-
<%= _('Optional subset') %> -
- <%= f.check_box :optional_subset %> <%= _('e.g. School/ Department') %> -
-
- <%= link_to(image_tag('help_button.png'), '#', class: 'guidance_group_subset_popover', rel: "popover", 'data-html' => "true", 'data-content' => _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard.")) %> -
-
- - - -
- <%= f.submit _('Save'), class: 'btn btn-primary' %> - <% if @guidance_group.published == false then %> - <%= f.submit _('Publish'), name: "save_publish", class: "btn btn-primary" %> - <% end %> - <%= link_to _('Cancel'), :back, class: 'btn cancel' %> +
+ <%= form_for(@guidance_group, url: admin_update_guidance_group_path(@guidance_group), html: {method: :put, class: 'roadmap-form bordered'}) do |f| %> +
+
+ <%= f.label :name %> + <%= f.text_field :name, as: :string, class: 'input-medium required' %> +
+ <%= link_to(image_tag('help_button.png'), '#', class: 'guidance_group_title_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Add an appropriate name for your guidance group. This name will be used to tell the end user where the guidance has come from. It will be appended to text identifying the theme e.g. "[guidance group name]: guidance on data sharing" so we suggest you just use the institution or department name.')) %>
+
+ + + <% if @guidance_group.published == true then %> +
+ <%= f.label :published %> + <%= f.check_box :published %> +
+ +
+
+ <% end %> -
- <% end %> -
-
+
+ <%= f.label :optional_subset %> + <%= f.check_box :optional_subset %> <%= _('e.g. School/ Department') %> +
+ <%= link_to(image_tag('help_button.png'), '#', class: 'guidance_group_subset_popover', rel: "popover", 'data-html' => "true", 'data-content' => _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard.")) %> +
+
+ + +
+
+ + <%= f.submit _('Save'), class: 'btn btn-primary' %> + <% if @guidance_group.published == false then %> + <%= f.submit _('Publish'), name: "save_publish", class: "btn btn-primary" %> + <% end %> +
+ + <% end %>
diff --git a/app/views/guidance_groups/admin_new.html.erb b/app/views/guidance_groups/admin_new.html.erb index 922ab5d..539fa1f 100644 --- a/app/views/guidance_groups/admin_new.html.erb +++ b/app/views/guidance_groups/admin_new.html.erb @@ -2,52 +2,32 @@

<%= _('Guidance group') %> - -
- <%= link_to _('View all guidance'), - admin_index_guidance_path, - class: "btn btn-primary" %> -

-
- -
- -
-
- <%= form_for :guidance_group, url: {action: "admin_create"} do |f| %> - - - - - - - - - - -
<%= _('Name') %>
- <%= f.text_field :name, as: :string, class: "text_field" %> -
-
- <%= link_to( image_tag("help_button.png"), "#", class: 'guidance_group_title_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Add an appropriate name for your guidance group. This name will be used to tell the end user where the guidance has come from. It will be appended to text identifying the theme e.g. "[guidance group name]: guidance on data sharing" so we suggest you just use the institution or department name.'))%> -
-
<%= _('Optional subset') %>
- <%= f.check_box :optional_subset %> <%= _('e.g. School/ Department') %> -
-
- <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_group_subset_popover', rel: "popover", 'data-html' => "true", 'data-content' => _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard."))%> -
-
- - -
- <%= f.submit _('Save'), name: "draft", class: "btn btn-primary" %> - <%= link_to _('Cancel'), :back, class: "btn cancel btn-secondary" %> +
+ <%= form_for :guidance_group, url: {action: "admin_create"}, html: {class: 'roadmap-form bordered'} do |f| %> +
+
+ <%= f.label :name %> + <%= f.text_field :name, as: :string, class: "input-medium required" %> +
+ <%= link_to( image_tag("help_button.png"), "#", class: 'guidance_group_title_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Add an appropriate name for your guidance group. This name will be used to tell the end user where the guidance has come from. It will be appended to text identifying the theme e.g. "[guidance group name]: guidance on data sharing" so we suggest you just use the institution or department name.'))%>
-
- <% end %> -
-
+
+
+ <%= f.label :optional_subset %> + <%= f.check_box :optional_subset %> <%= _('e.g. School/ Department') %> +
+ <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_group_subset_popover', rel: "popover", 'data-html' => "true", 'data-content' => _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard."))%> +
+
+ + +
+
+ + <%= f.submit _('Save'), name: "draft", class: "btn btn-primary" %> +
+ + <% end %>
diff --git a/app/views/guidance_groups/admin_show.html.erb b/app/views/guidance_groups/admin_show.html.erb deleted file mode 100644 index 318e8f9..0000000 --- a/app/views/guidance_groups/admin_show.html.erb +++ /dev/null @@ -1,61 +0,0 @@ -

- <%= _('Guidance group') %> - - -
- <%= link_to _('View all guidance'), - admin_index_guidance_path, - class: "btn btn-primary" %> -
-

- -
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - -
<%= _('Name') %><%= raw @guidance_group.name %>
<%= _('Published') %> - <% if @guidance_group.published.nil? || !@guidance_group.published then %> - <%= _('No') %> - <% else %> - <%= _('Yes') %> - <% end %> -
<%= _('Optional subset') %> - <% if @guidance_group.optional_subset.nil? || !@guidance_group.optional_subset then %> - <%= _('No') %> - <% else %> - <%= _('Yes') %> - <% end %> -
<%= _('Created') %><%= l @guidance_group.created_at.to_date, formats: :short %>
<%= _('Last updated') %><%= l @guidance_group.updated_at.to_date, formats: :short %>
-
- <%= link_to _('Edit'), admin_edit_guidance_group_path(@guidance_group.id), class: "btn btn-primary" %> - <%= link_to _('Back'), :back, class: "btn cancel" %> -
-
-
-
-
\ No newline at end of file diff --git a/app/views/guidances/admin_edit.html.erb b/app/views/guidances/admin_edit.html.erb index bbf7cd9..c8e7e47 100644 --- a/app/views/guidances/admin_edit.html.erb +++ b/app/views/guidances/admin_edit.html.erb @@ -1,101 +1,51 @@ -<% javascript 'admin.js' %> +<% javascript 'views/guidances/admin_edit.js' %>

- <%= _('Guidance') %> - -
- <%= link_to _('Add guidance'), - admin_new_guidance_path, - class: 'btn btn-primary' %> - <%= link_to _('View all guidance'), - admin_index_guidance_path, - class: 'btn btn-primary' %> -
+ <%= _('Guidance') %>

-
- -
- -
- <%= form_for(@guidance, url: admin_update_guidance_path(@guidance), html: { method: :put , id: 'edit_guidance_form'}) do |f| %> - - - - - - - - - +
+ <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_by_themes_popover input-medium', rel: "popover", 'data-html' => "true", 'data-content' => _('Select which theme(s) this guidance relates to.'))%> +
+ +
+ <%= f.label :published %> + <%= f.check_box :published , as: :check_boxes%> +
+
+ <%= f.label _('Guidance group'), for: :guidance_group_id %> + <%= f.collection_select(:guidance_group_id, @guidance_groups, + :id, :name, {prompt: false, include_blank: 'None'}, {multiple: false})%> +
+ <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_group_select_popover input-medium', rel: "popover", 'data-html' => "true", 'data-content' => _('Select which group this guidance relates to.'))%> +
+
+ +
+
+ + +
+ +<%end%> - - - - - - - - - - -
<%= _('Text') %> -
- <%= text_area_tag("guidance-text", @guidance.text, class: "tinymce") %> -
-
- <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_text_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Enter your guidance here. You can include links where needed.'))%> -
-
-
<%= _('Themes') %> -
-
- <%= f.collection_select(:theme_ids, @themes, :id, :title, +
+ <%= form_for(@guidance, url: admin_update_guidance_path(@guidance), html: { method: :put , id: 'edit_guidance_form', class: 'roadmap-form bordered'}) do |f| %> +
+
+ <%= f.label _('Text'), for: @guidance.text %> + <%= text_area_tag("guidance-text", @guidance.text, class: "tinymce") %> +
+ <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_text_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Enter your guidance here. You can include links where needed.'))%> +
+
+
+ <%= f.label _('Themes'), for: :theme_ids %> + <%= f.collection_select(:theme_ids, @themes, :id, :title, {prompt: false, include_blank: 'None'}, {multiple: true})%> -
-
- <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_by_themes_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Select which theme(s) this guidance relates to.'))%> -
-
-
-
<%= _('Published') %>
- <%= f.check_box :published , as: :check_boxes%> -
-
<%= _('Guidance group') %> -
- <%= f.collection_select(:guidance_group_id, @guidance_groups, - :id, :name, {prompt: false, include_blank: 'None'}, {multiple: false})%> -
-
- <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_group_select_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Select which group this guidance relates to.'))%> -
-
- -
- - - -
- <%= _('Save')%> - <%= link_to _('Cancel'), :back, class: 'btn cancel' %> -
- -
- <%= tinymce :content_css => asset_path('application.css') %> - <%end%> -
-
- +<%= tinymce :content_css => asset_path('application.css') %> - + \ No newline at end of file diff --git a/app/views/guidances/admin_index.html.erb b/app/views/guidances/admin_index.html.erb index ebd3bd6..b610abf 100644 --- a/app/views/guidances/admin_index.html.erb +++ b/app/views/guidances/admin_index.html.erb @@ -1,139 +1,141 @@ <% javascript "admin.js" %> -

- <%= _('Guidance group list') %> + <%= _('Guidance') %>

-
- <%= raw _("

First create a guidance group. This could be institution wide or a subset e.g. a particular College / School, Institute or department. When you create guidance you'll be asked to assign it to a guidance group.

")%> -
-
-
- <%= link_to _('Add guidance group'), admin_new_guidance_group_path(), class: "btn btn-primary" %> -
-
+

+ <%= _("First create a guidance group. This could be institution wide or a subset e.g. a particular College / School, Institute or department. When you create guidance you'll be asked to assign it to a guidance group.") %> +

- -<% if @guidance_groups.length > 0 then%> - - - - - - - - - - - - <% !@guidance_groups.each do |guidance_gr| %> - - - - - - - - - <% end %> - -
<%= _('Name') %><%= _('Published') %><%= _('Optional subset') %><%= _('Last updated') %><%= _('Actions') %>
- <%= guidance_gr.name %> - - <% if guidance_gr.published.nil? || guidance_gr.published == false then%> - <%= _('No')%> - <% else %> - <%= _('Yes')%> - <% end %> - - <% if guidance_gr.optional_subset.nil? || guidance_gr.optional_subset == false then%> - <%= _('No')%> - <% else %> - <%= _('Yes')%> - <% end %> - - <%= l guidance_gr.updated_at.to_date, formats: :short %> - - <%= link_to _('View'), admin_show_guidance_group_path(guidance_gr), class: "dmp_table_link"%>
- <%= link_to _('Edit'), admin_edit_guidance_group_path(guidance_gr), class: "dmp_table_link"%>
- <%= link_to _('Delete'), admin_destroy_guidance_group_path(guidance_gr), data: {confirm: _("You are about to delete '%{guidance_group_name}'. This will affect guidance. Are you sure?") % { :guidance_group_name => guidance_gr.name }}, method: :delete, class: "dmp_table_link"%> -
-<%end%> - -
-
- -

- <%= _('Guidance list') %> -

- -
- <%= raw _('

You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.

If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.

')%> -
-
- -
- <%= link_to _('Add guidance'), - admin_new_guidance_path(), - class: "btn btn-primary" %> -
-
- -
- - -<% if @guidances.length > 0 then%> - - - - - - - - - - - - <% @guidances.each do |guidance| %> - <% if guidance.in_group_belonging_to?(current_user.org_id) then %> - - - <% if guidance.themes.present? then %> - - <% else %> - - <% end %> - <% if guidance.guidance_group.present? then %> - + + + + + + <% end %> + +
<%= _('Text') %><%= _('Themes') %><%= _('Guidance group') %><%= _('Last updated') %><%= _('Actions') %>
- <%= guidance.text.html_safe%> - - <% guidance.themes.each do |th| %> - <%= th.title %> - <% end %> - - - - - <%= guidance.guidance_group.name %> +
+

<%= _('Guidance group list') %>

+ + + <% if @guidance_groups.length > 0 then%> + + + + + + + + + + + <% !@guidance_groups.each do |guidance_gr| %> + + - <% else %> - - <% end %> - - - - <% end %> - <% end %> - -
<%= _('Name') %><%= _('Published') %><%= _('Optional subset') %><%= _('Last updated') %><%= _('Actions') %> +
+ <%= guidance_gr.name %> - - - - <%= l guidance.updated_at.to_date, formats: :short %> - - <%= link_to _('View'), admin_show_guidance_path(guidance), class: "dmp_table_link"%>
- <%= link_to _('Edit'), admin_edit_guidance_path(guidance), class: "dmp_table_link"%>
- <%= link_to _('Delete'), admin_destroy_guidance_path(guidance), - data: {confirm: _("You are about to delete '%{guidance_summary}'. Are you sure?") % { :guidance_summary => truncate(sanitize(guidance.text,tags: %w(br a)), length: 20 , omission: _('... (continued)'))} }, method: :delete, class: "dmp_table_link"%> -
-<% end %> +
+ <% if guidance_gr.published.nil? || guidance_gr.published == false then%> + <%= _('No')%> + <% else %> + <%= _('Yes')%> + <% end %> + + <% if guidance_gr.optional_subset.nil? || guidance_gr.optional_subset == false then%> + <%= _('No')%> + <% else %> + <%= _('Yes')%> + <% end %> + + <%= l guidance_gr.updated_at.to_date, formats: :short %> + + <%= link_to _('Edit'), admin_edit_guidance_group_path(guidance_gr), class: "dmp_table_link"%>
+ <%= link_to _('Delete'), admin_destroy_guidance_group_path(guidance_gr), data: {confirm: _("You are about to delete '%{guidance_group_name}'. This will affect guidance. Are you sure?") % { :guidance_group_name => guidance_gr.name }}, method: :delete, class: "dmp_table_link"%> +
+ <%end%> + + +
+ +

<%= _('Guidance list') %>

+ +

+ <%= _('You can write pieces of guidance to be displayed by theme (e.g. generic guidance on storage and backup that should present across the board). Writing generic guidance by theme saves you time and effort as your advice will be automatically displayed across all templates rather than having to write guidance to accompany each.') %> +

+

+ <%= _('If you do have a need to provide guidance for specific funders that would not be useful to a wider audience (e.g. if you have specific instructions for applicants to BBSRC for example), you can do so by adding guidance to a specific question when you edit your template.') %> +

+ + + <% if @guidances.length > 0 then%> + + + <% if @guidances.count > 10 %> + + + + <% end %> + + + + + + + + + <% @guidances.each do |guidance| %> + <% if guidance.in_group_belonging_to?(current_user.org_id) then %> + + + <% if guidance.themes.present? then %> + + <% else %> + + <% end %> + <% if guidance.guidance_group.present? then %> + + <% else %> + + <% end %> + + + + <% end %> + <% end %> + +
+ <%= render(partial: "shared/table_filter", + locals: {path: admin_index_guidance_path, + placeholder: _('Filter guidance')}) %> +
<%= _('Text') %><%= _('Themes') %><%= _('Guidance group') %><%= _('Last updated') %><%= _('Actions') %> +
+ <%= guidance.text.html_safe%> + + <% guidance.themes.each do |th| %> + <%= th.title %> + <% end %> + + - + + <%= guidance.guidance_group.name %> + + - + + <%= l guidance.updated_at.to_date, formats: :short %> + + <%= link_to _('Edit'), admin_edit_guidance_path(guidance), class: "dmp_table_link"%>
+ <%= link_to _('Delete'), admin_destroy_guidance_path(guidance), + data: {confirm: _("You are about to delete '%{guidance_summary}'. Are you sure?") % { :guidance_summary => truncate(sanitize(guidance.text,tags: %w(br a)), length: 20 , omission: _('... (continued)'))} }, method: :delete, class: "dmp_table_link"%> +
+ <% end %> + + +
diff --git a/app/views/guidances/admin_new.html.erb b/app/views/guidances/admin_new.html.erb index d6e7ded..6a2f7de 100644 --- a/app/views/guidances/admin_new.html.erb +++ b/app/views/guidances/admin_new.html.erb @@ -1,98 +1,56 @@ -<% javascript 'admin.js' %> + +<% javascript 'views/guidances/admin_edit.js' %>

<%= _('New guidance') %> - -
- <%= link_to _('View all guidance'), - admin_index_guidance_path, - class: 'btn btn-primary' %> -

-
-
- -
- <%= form_for :guidance, url: {action: 'admin_create'}, html: {id: 'new_guidance_form'} do |f| %> - - - - - - - - - - - - - - - - - -
<%= _('Text') %> -
- <%= text_area_tag("guidance-text", "", class: "tinymce") %> -
-
- <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_text_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Enter your guidance here. You can include links where needed.'))%> -
-
-
<%= _('Themes') %> -
-
- <%= f.collection_select(:theme_ids, @themes, - :id, :title, {prompt: false, include_blank: 'None'}, {multiple: true})%> -
-
- <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_by_themes_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Select which theme(s) this guidance relates to.'))%> -
-
-
- -
<%= _('Published') %>
- <%= f.check_box :published , as: :check_boxes%> -
-
- <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_group_subset_popover', rel: "popover", 'data-html' => "true", 'data-content' => _("Check this box when you are ready for this guidance to appear on user's plans."))%> -
-
<%= _('Guidance group') %>
- <%= f.collection_select(:guidance_group_id, @guidance_groups, - :id, :name, {prompt: false, include_blank: 'None'}, {multiple: false})%> -
-
- <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_group_select_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Select which group this guidance relates to.'))%> -
-
- -
- - - -
- <%= _('Save')%> - - <%= link_to _('Cancel'), :back, class: 'btn cancel' %> +
+ <%= form_for :guidance, url: {action: 'admin_create'}, html: {id: 'edit_guidance_form', class: 'roadmap-form bordered'} do |f| %> +
+
+ <%= f.label :text %> + <%= text_area_tag("guidance-text", "", class: "tinymce") %> +
+ <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_text_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Enter your guidance here. You can include links where needed.'))%>
- -
- <%= tinymce :content_css => asset_path('application.css') %> - <%end%> -
+
+
+ <%= f.label _('Themes'), for: :theme_ids %> + <%= f.collection_select(:theme_ids, @themes, + :id, :title, {prompt: false, include_blank: 'None'}, {multiple: true}) %> +
+ <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_by_themes_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Select which theme(s) this guidance relates to.'))%> +
+
+
+ <%= f.label :published %> + <%= f.check_box :published , as: :check_boxes%> +
+ <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_group_subset_popover', rel: "popover", 'data-html' => "true", 'data-content' => _("Check this box when you are ready for this guidance to appear on user's plans."))%> +
+
+
+ <%= f.label _('Guidance group'), for: :guidance_group_id %> + <%= f.collection_select(:guidance_group_id, @guidance_groups, + :id, :name, {prompt: false, include_blank: 'None'}, {multiple: false})%> +
+ <%= link_to( image_tag('help_button.png'), '#', class: 'guidance_group_select_popover', rel: "popover", 'data-html' => "true", 'data-content' => _('Select which group this guidance relates to.'))%> +
+
+ +
+
+ + +
+ + <% end %>
+<%= tinymce :content_css => asset_path('application.css') %> - diff --git a/app/views/layouts/_branding.html.erb b/app/views/layouts/_branding.html.erb index 4774bee..3fb80c2 100644 --- a/app/views/layouts/_branding.html.erb +++ b/app/views/layouts/_branding.html.erb @@ -1,23 +1,23 @@ -
- <% if user_signed_in? %> - <% if !current_user.org.nil? %> - +
+ <% if user_signed_in? %> + <% if !current_user.org.nil? %> + <% if current_user.org.logo.present? %> - + <% end %> - - <% if current_user.org.banner_text.present? %> -
- - <%= raw current_user.org.banner_text %> - -
- <%end%> - - <%end%> - <%end%> + + <% if current_user.org.banner_text.present? %> +
+ + <%= raw current_user.org.banner_text %> + +
+ <%end%> + + <%end%> + <%end%>
\ No newline at end of file diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index 1e8c57a..a76bf89 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -1,44 +1,17 @@ -
- - - -
+ -<% if !user_signed_in? then %> - - -<% end %> + + diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 4c6cbec..a3754c9 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,22 +1,18 @@ - -
-
- -
-
-
- <%= render "layouts/branding" %> -
- - - -
- -
+
+ +
+
+
+ <%= render "layouts/branding" %> +
+ + +
+ diff --git a/app/views/layouts/_navigation.html.erb b/app/views/layouts/_navigation.html.erb index 75d285a..90e759f 100644 --- a/app/views/layouts/_navigation.html.erb +++ b/app/views/layouts/_navigation.html.erb @@ -1,76 +1,74 @@ - + <% if current_user.can_modify_guidance? %> +
  • > + <%= link_to _('Guidance'), admin_index_guidance_path(current_user.org_id) %> +
  • + <% end %> + <% if current_user.can_modify_org_details? %> +
  • > + <%= link_to _('Organisation details'), admin_edit_org_path(current_user.org_id) %> +
  • + <% end %> + <% if current_user.can_grant_permissions? %> +
  • > + <%= link_to _('Users'), admin_index_users_path, class: 'main_nav_last_li' %> +
  • + <% end %> + <% else %> + <% if user_signed_in? %> +
  • > + <%= link_to _('View plans'), plans_path %> +
  • +
  • > + <%= link_to _('Create plan'), new_plan_path %> +
  • + <% else %> + +
  • > + <%= link_to _('Home'), root_path %> +
  • + <% end %> + +
  • > + <%= link_to _('Public DMPs'), public_plans_path %> +
  • + +
  • > + <%= link_to _('About'), about_us_path %> +
  • + +
  • > + <%= link_to _('Future plans'), roadmap_path %> +
  • + +
  • > + <%= link_to _('Help'), help_path %> +
  • + + <% if !user_signed_in? %> + <% if MANY_LANGUAGES %> + +
  • + + <%= _('Change language') %> + + + +
  • + <% end %> + <% end %> + <% end %> + diff --git a/app/views/layouts/_signin_signout.html.erb b/app/views/layouts/_signin_signout.html.erb index e7c3d6c..66a6515 100644 --- a/app/views/layouts/_signin_signout.html.erb +++ b/app/views/layouts/_signin_signout.html.erb @@ -1,48 +1,44 @@ - \ No newline at end of file +<% else %> + <% if !isActivePage(root_path) %> + <%= _('Sign in')%> / + <%= _('Create account')%> + <% end %> +<% end %> + +<% if !user_signed_in? && !isActivePage(root_path) then %> + + +<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b569d9c..3654077 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,5 +1,5 @@ - + <%= _('%{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %> <%= favicon_link_tag "favicon.ico" %> @@ -21,18 +21,15 @@ + <%= stylesheet_link_tag "vendor/jquery-ui.min" %> + <%= stylesheet_link_tag "vendor/jquery-ui.structure.min" %> + <%= stylesheet_link_tag "vendor/jquery-ui.theme.min" %> + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application"%> - <%= javascript_include_tag "jquery.tablesorter"%> -