From 8e6bde04c373b93e6dae9ee69e3da78197888fca Mon Sep 17 00:00:00 2001 From: Florian Kraft Date: Wed, 20 May 2015 16:33:01 +0200 Subject: [PATCH 1/2] fix locking of used blocks in select menu --- app/assets/javascripts/my_project_page/my_project_page.js | 4 +++- app/views/my_projects_overviews/index.html.erb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/my_project_page/my_project_page.js b/app/assets/javascripts/my_project_page/my_project_page.js index 2967702a91..d4addbb7af 100644 --- a/app/assets/javascripts/my_project_page/my_project_page.js +++ b/app/assets/javascripts/my_project_page/my_project_page.js @@ -79,7 +79,9 @@ return; } for (var i = 0; i < s.options.length; i++) { - if ($('block_' + s.options[i].value)) { + var name = s.options[i].value || ''; + name = name.replace(/\-/g, '_'); + if ($('block_' + name)) { s.options[i].disabled = true; } else { s.options[i].disabled = false; diff --git a/app/views/my_projects_overviews/index.html.erb b/app/views/my_projects_overviews/index.html.erb index 545f908e32..fdbd3a06f4 100644 --- a/app/views/my_projects_overviews/index.html.erb +++ b/app/views/my_projects_overviews/index.html.erb @@ -30,7 +30,7 @@ See doc/COPYRIGHT.md for more details. <%= toolbar title: l(:label_overview) do %> <% if User.current.allowed_to?(:add_subprojects, project) %>
  • - <%= link_to new_project_path(parent_id: project), class: 'button -highlight' do %> + <%= link_to new_project_path(parent_id: project), class: 'button -alt-highlight' do %> <%= l(:label_subproject_new) %> <% end %>
  • From 16b33211596c0c7c15458ee3bf13fcdad2bf6957 Mon Sep 17 00:00:00 2001 From: Florian Kraft Date: Wed, 20 May 2015 16:55:32 +0200 Subject: [PATCH 2/2] add comment on dash replace in updateSelect --- app/assets/javascripts/my_project_page/my_project_page.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/javascripts/my_project_page/my_project_page.js b/app/assets/javascripts/my_project_page/my_project_page.js index d4addbb7af..41dc89e221 100644 --- a/app/assets/javascripts/my_project_page/my_project_page.js +++ b/app/assets/javascripts/my_project_page/my_project_page.js @@ -80,6 +80,9 @@ } for (var i = 0; i < s.options.length; i++) { var name = s.options[i].value || ''; + // this becomes necessary as the block names are saved with dashes in the db, + // but their ids use underscores in the frontend - this changes the name to find + // the block in the DOM name = name.replace(/\-/g, '_'); if ($('block_' + name)) { s.options[i].disabled = true;