← Winnitude! Search  ·  Reader Mode (1993 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 54 LINKS

frame-common.ts is missing the code to automagically load the page.css by NathanaelA · Pull Request #620 · NativeScript/NativeScript

Repository navigation

frame-common.ts is missing the code to automagically load the page.css - #620


Merged
hshristov merged 4 commits into NativeScript:master from NathanaelA:createPage_autoload_page_css Aug 26, 2015
Merged

frame-common.ts is missing the code to automagically load the page.css #620 hshristov merged 4 commits into NativeScript:master from NathanaelA:createPage_autoload_page_css

Conversation

NathanaelA commented Aug 24, 2015



Copy link Copy Markdown
Contributor

frame-common.ts is missing the code to automagically load the page.css file if it exists on a page that is created via the JavaScript createPage() function. The expected behavior is that the page.css file is always loaded if it exists, no matter how the page is created.

frame-common.ts is missing the code to automagically load the page.cs... a81ee1b
...s file if it exists on a page that is created via JavaScript createPage function. The expected behavior should be that the page.css file is always loaded if it exists.

ns-bot commented Aug 24, 2015



Copy link Copy Markdown

Can one of the admins verify this patch?

Added a safe guard in case somehow the createPage does not return a v... 43a954f
...alid page component.
ns-bot added cla: yes and removed cla: no labels Aug 24, 2015

This comment was marked as abuse.

Sign in to view

atanasovg commented Aug 24, 2015



Copy link Copy Markdown
Contributor

I would extract the css code from the pageFromBuilder method and add it to the resolvePageFromEntry one. This will save you copy-and-paste:

if (moduleExports && moduleExports.createPage) {
    trace.write("Calling createPage()", trace.categories.Navigation);
    page = moduleExports.createPage();
}
else {
    page = pageFromBuilder(moduleNamePath, moduleExports);
}

if (!(page && page instanceof pages.Page)) {
    throw new Error("Failed to load Page from entry.moduleName: " + entry.moduleName);
}

// Possible CSS file path.
var cssFileName = fileResolverModule.resolveFileName(moduleNamePath, "css");
if (cssFileName) {
    page.addCssFile(cssFileName);
}

This comment was marked as abuse.

Sign in to view Changed the patch to eliminate duplicate code now it only has the css... a95dafd
... loaded in one spot.

This comment was marked as abuse.

Sign in to view

enchev commented Aug 25, 2015



Copy link Copy Markdown
Contributor

👍

hshristov commented Aug 25, 2015



Copy link Copy Markdown
Contributor

@NathanaelA ,

patch looks good. Could you add some simple unit test that verifies this change?
You could place it in https://github.com/NativeScript/NativeScript/tree/master/apps/tests/ui/page

This comment was marked as abuse.

Sign in to view

hshristov commented Aug 26, 2015



Copy link Copy Markdown
Contributor

Simple createPage method with some css in the same folder which applies Page.background would be fine :)

Tests to test both a Declarative UI w/ CSS and a createPage w/ CSS fi... a67e46f
...le to verify CSS file is loaded

This comment was marked as abuse.

Sign in to view

hshristov commented Aug 26, 2015



Copy link Copy Markdown
Contributor

Great. Thank you for your continuous support :)
I though that we had Declarative UI with CSS test but apparently we didn't.

hshristov pushed a commit that referenced this pull request Aug 26, 2015 Merge pull request #620 from NathanaelA/createPage_autoload_page_css 2b204f4
frame-common.ts is missing the code to automagically load the page.css
hshristov merged commit 2b204f4 into NativeScript : master Aug 26, 2015

lock
Bot
commented Aug 29, 2019



Copy link Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock
Bot
locked and limited conversation to collaborators Aug 29, 2019 Sign up for free to subscribe to this conversation on GitHub . Already have an account? Sign in .

Labels

cla: yes

5 participants