From 9adcd1579db5609b8c17c9ef611fb0edeaf16a67 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 24 Oct 2013 12:36:46 -0400 Subject: [PATCH] Renamed `components` to `lib` in the JS project, as Ember has components and they mean something different. --- app/assets/javascripts/application.js.erb | 2 +- .../discourse/{components => lib}/autocomplete.js | 0 .../discourse/{components => lib}/caret_position.js | 0 .../discourse/{components => lib}/click_track.js | 0 .../discourse/{components => lib}/computed.js | 0 .../discourse/{components => lib}/debounce.js | 0 .../discourse/{components => lib}/development.js | 0 .../discourse/{components => lib}/div_resizer.js | 0 .../javascripts/discourse/{components => lib}/eyeline.js | 0 .../discourse/{components => lib}/formatter.js | 0 .../discourse/{components => lib}/key_value_store.js | 0 .../discourse/{components => lib}/lightbox.js | 0 .../discourse/{components => lib}/markdown.js | 0 .../javascripts/discourse/{components => lib}/mention.js | 0 .../discourse/{components => lib}/message_bus.js | 0 .../javascripts/discourse/{components => lib}/mobile.js | 0 .../javascripts/discourse/{components => lib}/onebox.js | 0 .../javascripts/discourse/{components => lib}/probes.js | 0 .../javascripts/discourse/{components => lib}/quote.js | 0 .../discourse/{components => lib}/screen_track.js | 0 .../javascripts/discourse/{components => lib}/search.js | 0 .../discourse/{components => lib}/syntax_highlighting.js | 0 .../discourse/{components => lib}/transition_helper.js | 0 .../javascripts/discourse/{components => lib}/url.js | 0 .../discourse/{components => lib}/user_search.js | 0 .../discourse/{components => lib}/utilities.js | 0 app/assets/javascripts/main_include.js | 9 +++++---- config/projections.json | 3 +++ lib/pretty_text.rb | 4 ++-- test/javascripts/{components => lib}/bbcode_test.js | 0 test/javascripts/{components => lib}/click_track_test.js | 0 test/javascripts/{components => lib}/computed_test.js | 0 .../{components => lib}/debounce_promise_test.js | 0 test/javascripts/{components => lib}/debounce_test.js | 0 test/javascripts/{components => lib}/formatter_test.js | 0 .../{components => lib}/key_value_store_test.js | 0 test/javascripts/{components => lib}/markdown_test.js | 0 test/javascripts/{components => lib}/onebox_test.js | 0 .../{components => lib}/preload_store_test.js | 0 test/javascripts/{components => lib}/utilities_test.js | 4 ++-- test/javascripts/test_helper.js | 3 ++- 41 files changed, 15 insertions(+), 10 deletions(-) rename app/assets/javascripts/discourse/{components => lib}/autocomplete.js (100%) rename app/assets/javascripts/discourse/{components => lib}/caret_position.js (100%) rename app/assets/javascripts/discourse/{components => lib}/click_track.js (100%) rename app/assets/javascripts/discourse/{components => lib}/computed.js (100%) rename app/assets/javascripts/discourse/{components => lib}/debounce.js (100%) rename app/assets/javascripts/discourse/{components => lib}/development.js (100%) rename app/assets/javascripts/discourse/{components => lib}/div_resizer.js (100%) rename app/assets/javascripts/discourse/{components => lib}/eyeline.js (100%) rename app/assets/javascripts/discourse/{components => lib}/formatter.js (100%) rename app/assets/javascripts/discourse/{components => lib}/key_value_store.js (100%) rename app/assets/javascripts/discourse/{components => lib}/lightbox.js (100%) rename app/assets/javascripts/discourse/{components => lib}/markdown.js (100%) rename app/assets/javascripts/discourse/{components => lib}/mention.js (100%) rename app/assets/javascripts/discourse/{components => lib}/message_bus.js (100%) rename app/assets/javascripts/discourse/{components => lib}/mobile.js (100%) rename app/assets/javascripts/discourse/{components => lib}/onebox.js (100%) rename app/assets/javascripts/discourse/{components => lib}/probes.js (100%) rename app/assets/javascripts/discourse/{components => lib}/quote.js (100%) rename app/assets/javascripts/discourse/{components => lib}/screen_track.js (100%) rename app/assets/javascripts/discourse/{components => lib}/search.js (100%) rename app/assets/javascripts/discourse/{components => lib}/syntax_highlighting.js (100%) rename app/assets/javascripts/discourse/{components => lib}/transition_helper.js (100%) rename app/assets/javascripts/discourse/{components => lib}/url.js (100%) rename app/assets/javascripts/discourse/{components => lib}/user_search.js (100%) rename app/assets/javascripts/discourse/{components => lib}/utilities.js (100%) rename test/javascripts/{components => lib}/bbcode_test.js (100%) rename test/javascripts/{components => lib}/click_track_test.js (100%) rename test/javascripts/{components => lib}/computed_test.js (100%) rename test/javascripts/{components => lib}/debounce_promise_test.js (100%) rename test/javascripts/{components => lib}/debounce_test.js (100%) rename test/javascripts/{components => lib}/formatter_test.js (100%) rename test/javascripts/{components => lib}/key_value_store_test.js (100%) rename test/javascripts/{components => lib}/markdown_test.js (100%) rename test/javascripts/{components => lib}/onebox_test.js (100%) rename test/javascripts/{components => lib}/preload_store_test.js (100%) rename test/javascripts/{components => lib}/utilities_test.js (97%) diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index d81c2f245c8..eabbd1ea23a 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -7,7 +7,7 @@ //= require ./env // probe framework first -//= require ./discourse/components/probes.js +//= require ./discourse/lib/probes.js // Externals we need to load first diff --git a/app/assets/javascripts/discourse/components/autocomplete.js b/app/assets/javascripts/discourse/lib/autocomplete.js similarity index 100% rename from app/assets/javascripts/discourse/components/autocomplete.js rename to app/assets/javascripts/discourse/lib/autocomplete.js diff --git a/app/assets/javascripts/discourse/components/caret_position.js b/app/assets/javascripts/discourse/lib/caret_position.js similarity index 100% rename from app/assets/javascripts/discourse/components/caret_position.js rename to app/assets/javascripts/discourse/lib/caret_position.js diff --git a/app/assets/javascripts/discourse/components/click_track.js b/app/assets/javascripts/discourse/lib/click_track.js similarity index 100% rename from app/assets/javascripts/discourse/components/click_track.js rename to app/assets/javascripts/discourse/lib/click_track.js diff --git a/app/assets/javascripts/discourse/components/computed.js b/app/assets/javascripts/discourse/lib/computed.js similarity index 100% rename from app/assets/javascripts/discourse/components/computed.js rename to app/assets/javascripts/discourse/lib/computed.js diff --git a/app/assets/javascripts/discourse/components/debounce.js b/app/assets/javascripts/discourse/lib/debounce.js similarity index 100% rename from app/assets/javascripts/discourse/components/debounce.js rename to app/assets/javascripts/discourse/lib/debounce.js diff --git a/app/assets/javascripts/discourse/components/development.js b/app/assets/javascripts/discourse/lib/development.js similarity index 100% rename from app/assets/javascripts/discourse/components/development.js rename to app/assets/javascripts/discourse/lib/development.js diff --git a/app/assets/javascripts/discourse/components/div_resizer.js b/app/assets/javascripts/discourse/lib/div_resizer.js similarity index 100% rename from app/assets/javascripts/discourse/components/div_resizer.js rename to app/assets/javascripts/discourse/lib/div_resizer.js diff --git a/app/assets/javascripts/discourse/components/eyeline.js b/app/assets/javascripts/discourse/lib/eyeline.js similarity index 100% rename from app/assets/javascripts/discourse/components/eyeline.js rename to app/assets/javascripts/discourse/lib/eyeline.js diff --git a/app/assets/javascripts/discourse/components/formatter.js b/app/assets/javascripts/discourse/lib/formatter.js similarity index 100% rename from app/assets/javascripts/discourse/components/formatter.js rename to app/assets/javascripts/discourse/lib/formatter.js diff --git a/app/assets/javascripts/discourse/components/key_value_store.js b/app/assets/javascripts/discourse/lib/key_value_store.js similarity index 100% rename from app/assets/javascripts/discourse/components/key_value_store.js rename to app/assets/javascripts/discourse/lib/key_value_store.js diff --git a/app/assets/javascripts/discourse/components/lightbox.js b/app/assets/javascripts/discourse/lib/lightbox.js similarity index 100% rename from app/assets/javascripts/discourse/components/lightbox.js rename to app/assets/javascripts/discourse/lib/lightbox.js diff --git a/app/assets/javascripts/discourse/components/markdown.js b/app/assets/javascripts/discourse/lib/markdown.js similarity index 100% rename from app/assets/javascripts/discourse/components/markdown.js rename to app/assets/javascripts/discourse/lib/markdown.js diff --git a/app/assets/javascripts/discourse/components/mention.js b/app/assets/javascripts/discourse/lib/mention.js similarity index 100% rename from app/assets/javascripts/discourse/components/mention.js rename to app/assets/javascripts/discourse/lib/mention.js diff --git a/app/assets/javascripts/discourse/components/message_bus.js b/app/assets/javascripts/discourse/lib/message_bus.js similarity index 100% rename from app/assets/javascripts/discourse/components/message_bus.js rename to app/assets/javascripts/discourse/lib/message_bus.js diff --git a/app/assets/javascripts/discourse/components/mobile.js b/app/assets/javascripts/discourse/lib/mobile.js similarity index 100% rename from app/assets/javascripts/discourse/components/mobile.js rename to app/assets/javascripts/discourse/lib/mobile.js diff --git a/app/assets/javascripts/discourse/components/onebox.js b/app/assets/javascripts/discourse/lib/onebox.js similarity index 100% rename from app/assets/javascripts/discourse/components/onebox.js rename to app/assets/javascripts/discourse/lib/onebox.js diff --git a/app/assets/javascripts/discourse/components/probes.js b/app/assets/javascripts/discourse/lib/probes.js similarity index 100% rename from app/assets/javascripts/discourse/components/probes.js rename to app/assets/javascripts/discourse/lib/probes.js diff --git a/app/assets/javascripts/discourse/components/quote.js b/app/assets/javascripts/discourse/lib/quote.js similarity index 100% rename from app/assets/javascripts/discourse/components/quote.js rename to app/assets/javascripts/discourse/lib/quote.js diff --git a/app/assets/javascripts/discourse/components/screen_track.js b/app/assets/javascripts/discourse/lib/screen_track.js similarity index 100% rename from app/assets/javascripts/discourse/components/screen_track.js rename to app/assets/javascripts/discourse/lib/screen_track.js diff --git a/app/assets/javascripts/discourse/components/search.js b/app/assets/javascripts/discourse/lib/search.js similarity index 100% rename from app/assets/javascripts/discourse/components/search.js rename to app/assets/javascripts/discourse/lib/search.js diff --git a/app/assets/javascripts/discourse/components/syntax_highlighting.js b/app/assets/javascripts/discourse/lib/syntax_highlighting.js similarity index 100% rename from app/assets/javascripts/discourse/components/syntax_highlighting.js rename to app/assets/javascripts/discourse/lib/syntax_highlighting.js diff --git a/app/assets/javascripts/discourse/components/transition_helper.js b/app/assets/javascripts/discourse/lib/transition_helper.js similarity index 100% rename from app/assets/javascripts/discourse/components/transition_helper.js rename to app/assets/javascripts/discourse/lib/transition_helper.js diff --git a/app/assets/javascripts/discourse/components/url.js b/app/assets/javascripts/discourse/lib/url.js similarity index 100% rename from app/assets/javascripts/discourse/components/url.js rename to app/assets/javascripts/discourse/lib/url.js diff --git a/app/assets/javascripts/discourse/components/user_search.js b/app/assets/javascripts/discourse/lib/user_search.js similarity index 100% rename from app/assets/javascripts/discourse/components/user_search.js rename to app/assets/javascripts/discourse/lib/user_search.js diff --git a/app/assets/javascripts/discourse/components/utilities.js b/app/assets/javascripts/discourse/lib/utilities.js similarity index 100% rename from app/assets/javascripts/discourse/components/utilities.js rename to app/assets/javascripts/discourse/lib/utilities.js diff --git a/app/assets/javascripts/main_include.js b/app/assets/javascripts/main_include.js index 6b93ef4e6c3..5d02310384a 100644 --- a/app/assets/javascripts/main_include.js +++ b/app/assets/javascripts/main_include.js @@ -43,11 +43,11 @@ // Stuff we need to load first //= require ./discourse/mixins/scrolling //= require_tree ./discourse/mixins -//= require ./discourse/components/markdown -//= require ./discourse/components/computed +//= require ./discourse/lib/markdown +//= require ./discourse/lib/computed //= require ./discourse/views/view //= require ./discourse/views/container_view -//= require ./discourse/components/debounce +//= require ./discourse/lib/debounce //= require ./discourse/models/model //= require ./discourse/models/user_action //= require ./discourse/models/composer @@ -63,9 +63,10 @@ //= require ./discourse/dialects/dialect //= require_tree ./discourse/dialects //= require_tree ./discourse/controllers -//= require_tree ./discourse/components +//= require_tree ./discourse/lib //= require_tree ./discourse/models //= require_tree ./discourse/views +//= require_tree ./discourse/components //= require_tree ./discourse/helpers //= require_tree ./discourse/templates //= require_tree ./discourse/routes diff --git a/config/projections.json b/config/projections.json index 0952b3e19b2..c6426bf8a33 100644 --- a/config/projections.json +++ b/config/projections.json @@ -2,6 +2,9 @@ "app/assets/javascripts/discourse/components/*.js": { "command": "dcomponent" }, + "app/assets/javascripts/discourse/lib/*.js": { + "command": "dlib" + }, "app/assets/javascripts/discourse/routes/*.js": { "command": "droute" }, diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb index 7cfe7c93a67..7ccdeae13e6 100644 --- a/lib/pretty_text.rb +++ b/lib/pretty_text.rb @@ -70,8 +70,8 @@ module PrettyText "vendor/assets/javascripts/better_markdown.js", "app/assets/javascripts/defer/html-sanitizer-bundle.js", "app/assets/javascripts/discourse/dialects/dialect.js", - "app/assets/javascripts/discourse/components/utilities.js", - "app/assets/javascripts/discourse/components/markdown.js") + "app/assets/javascripts/discourse/lib/utilities.js", + "app/assets/javascripts/discourse/lib/markdown.js") Dir["#{Rails.root}/app/assets/javascripts/discourse/dialects/**.js"].each do |dialect| unless dialect =~ /\/dialect\.js$/ diff --git a/test/javascripts/components/bbcode_test.js b/test/javascripts/lib/bbcode_test.js similarity index 100% rename from test/javascripts/components/bbcode_test.js rename to test/javascripts/lib/bbcode_test.js diff --git a/test/javascripts/components/click_track_test.js b/test/javascripts/lib/click_track_test.js similarity index 100% rename from test/javascripts/components/click_track_test.js rename to test/javascripts/lib/click_track_test.js diff --git a/test/javascripts/components/computed_test.js b/test/javascripts/lib/computed_test.js similarity index 100% rename from test/javascripts/components/computed_test.js rename to test/javascripts/lib/computed_test.js diff --git a/test/javascripts/components/debounce_promise_test.js b/test/javascripts/lib/debounce_promise_test.js similarity index 100% rename from test/javascripts/components/debounce_promise_test.js rename to test/javascripts/lib/debounce_promise_test.js diff --git a/test/javascripts/components/debounce_test.js b/test/javascripts/lib/debounce_test.js similarity index 100% rename from test/javascripts/components/debounce_test.js rename to test/javascripts/lib/debounce_test.js diff --git a/test/javascripts/components/formatter_test.js b/test/javascripts/lib/formatter_test.js similarity index 100% rename from test/javascripts/components/formatter_test.js rename to test/javascripts/lib/formatter_test.js diff --git a/test/javascripts/components/key_value_store_test.js b/test/javascripts/lib/key_value_store_test.js similarity index 100% rename from test/javascripts/components/key_value_store_test.js rename to test/javascripts/lib/key_value_store_test.js diff --git a/test/javascripts/components/markdown_test.js b/test/javascripts/lib/markdown_test.js similarity index 100% rename from test/javascripts/components/markdown_test.js rename to test/javascripts/lib/markdown_test.js diff --git a/test/javascripts/components/onebox_test.js b/test/javascripts/lib/onebox_test.js similarity index 100% rename from test/javascripts/components/onebox_test.js rename to test/javascripts/lib/onebox_test.js diff --git a/test/javascripts/components/preload_store_test.js b/test/javascripts/lib/preload_store_test.js similarity index 100% rename from test/javascripts/components/preload_store_test.js rename to test/javascripts/lib/preload_store_test.js diff --git a/test/javascripts/components/utilities_test.js b/test/javascripts/lib/utilities_test.js similarity index 97% rename from test/javascripts/components/utilities_test.js rename to test/javascripts/lib/utilities_test.js index a2fc7037e30..1c9f804fca5 100644 --- a/test/javascripts/components/utilities_test.js +++ b/test/javascripts/lib/utilities_test.js @@ -26,8 +26,8 @@ test("new user cannot upload images", function() { Discourse.SiteSettings.newuser_max_images = 0; this.stub(bootbox, "alert"); - ok(!validUpload([{name: "image.png"}])); - ok(bootbox.alert.calledWith(I18n.t('post.errors.image_upload_not_allowed_for_new_user'))); + ok(!validUpload([{name: "image.png"}]), 'the upload is not valid'); + ok(bootbox.alert.calledWith(I18n.t('post.errors.image_upload_not_allowed_for_new_user')), 'the alert is called'); }); test("new user cannot upload attachments", function() { diff --git a/test/javascripts/test_helper.js b/test/javascripts/test_helper.js index 37cf2bb550b..40855d3fd16 100644 --- a/test/javascripts/test_helper.js +++ b/test/javascripts/test_helper.js @@ -6,7 +6,7 @@ //= require ../../app/assets/javascripts/preload_store.js // probe framework first -//= require ../../app/assets/javascripts/discourse/components/probes.js +//= require ../../app/assets/javascripts/discourse/lib/probes.js // Externals we need to load first //= require development/jquery-2.0.3.js @@ -65,6 +65,7 @@ //= require helpers/assertions //= require_tree ./fixtures +//= require_tree ./lib //= require_tree . //= require_self //= require jshint_all