I'm a novice at Durandal but familiar with mvc4. I'm attempting to port an existing application that heavily uses knockout to a SPA framework.
I've been able to get the standard View / ViewModel convention working with the information from this post: https://stackoverflow.com/a/15636715/1693081
I'd like to extend this to a feature based structure because each page has multiple reusable components, I'd like to set up my application directory as follows:
App
|
|--- Pages
| |
| |---Shell
| | |
| | |---Shell.chtml
| | |---Shell.js
| | |---web.config
| |
| |---Dashboard
|
|---Dashboard.chtml
|---Dashboard.js
|--web.config
I thought it would be as simple as commenting out viewLocator.userConvention() and added a new route but this throws a failed to load root module exception.
from my main.js:
app.start().then(function () {
//Replace 'viewmodels' in the moduleId with 'views' to locate the view.
//Look for partial views in a 'views' folder in the root.
//viewLocator.useConvention();
//Show the app by setting the root view model for our application with a transition.
app.setRoot('pages/shell/shell', 'entrance');
});
from my Routeconfig.cs:
routes.MapRoute(
name: "Durandal Page Level Views",
url: "App/Pages/{viewFolder}/{viewName}.html",
defaults: new { controller = "DurandalView", action = "Get" }
);
Am I missing something obvious? The documentation for Durandal suggests that their defaults aren't best for a large application but doesn't give me an idea as to how to solve it out of the box.
Thanks!
I had a work around for this. It turns out that dropping the web.config interferes with the ability to load the js files in each directory. I ended up splitting each page into model and view model folders.
|
|---Pages
|
|---Shell
|
|---View
| |
| |---Shell.html
| |---web.config
|
|---ViewModel
|
|---Shell.js
Related
Trying to create a wiki site similar to gramex help document.
For that, I have gramex.yaml that reads
url:
main:
pattern: /$YAMLURL/
handler: FileHandler
kwargs:
index: false
path:
"": $YAMLPATH/{dir}/readme.md
transform:
"*.md":
encoding: utf-8
function: markdown.markdown(content)
headers:
Content-Type: text/html; charset=UTF-8
File tree looks like:
$ tree
.
├── behave
│ └── readme.md
├── gramex.yaml
└── readme.md
But it does not seem to render any MARKDOWN files as HTML.
Do I need to create this markdown.markdown function?
or Is this function readily available in gramex?
Edit 1:
The render issue came because of {dir} in path.
Solution:
Remove {dir} and make the new path as :- $YAMLPATH/readme.md
EDIT 2: NEW PROBLEM
Markdown tables are not rendered
I have a table in the markdown as:
| Criteria | Behave | Pytest |
| --- | --- | --- |
| Readability | Tests are written in natural language format, making them easier to understand by both technical and non-technical stakeholders. | Tests are written in code format, which can be challenging for non-technical stakeholders to understand. |
That must be rendered as:
but the webpage shows:
If you change
function: markdown.markdown(content)
... to
function: markdown.markdown(content, extensions=['extra'])
... it starts working, thanks to the tables extension which is part of the extra extension.
For more Python markdown options, see https://python-markdown.github.io/reference/.
For extensions, see https://python-markdown.github.io/extensions/
I configured HighCharts on our Zeppelin Tool to implement a drill down functionality.
We placed the below jar files and stated the same in the Dependencies
Zeppelin-highcharts-0.6.4.jar
lift-json_2.11-2.6.3.jar
paranamer-2.4.1.jar
We tried executing the below code-
val bank = spark.read.option("header",true).csv("/u01/zepplin/bank/bank2.csv")
bank.show()
+---+-------+
|age|balance|
+---+-------+
| 20| 40000|
| 30| 60000|
| 50| 70000|
| 80| 90000|
+---+-------+
import com.knockdata.spark.highcharts._
import com.knockdata.spark.highcharts.model._
highcharts(bank.series("x" -> "age", "y" -> sum(col("balance"))).orderBy(col("age"))).plot()
But this code is not able to plot anything, giving a blank out put.It just shows the tile(Chart Title).
To rule out the browser compatibility issue I tried this on all the browsers too.
Am I missing something here.Do we have any alternative for High-charts for custom visualization like drill down etc.
Thanks in Advance
I have an Xcode project set up with multiple frameworks. The file structure is as follows:
Project
|
-workspace
|
-framework_1
|
- framework_1.xcodeproj
|
-framework_2
|
- framework_2.xcodeproj
framework_1 depends on framework_2. How do I set up the framework search paths in framework_1 to correctly see framework_2?
Not exactly sure what you are trying to do but I drag each project into the workspace and they find each other just fine.
I want to cite inside Wikipedia sources which are stored in my JabRef Database. According to the jabref-documentation I need a custom exportfilter which is a file like
wikipediacitation.layout. This layout file converts a JabRef database into the wikipedia-syntax for pasting it at the end of an article. The description of the output format is given here. My problem is, that the creation of a Jabref-layout-file seems to be complicated. Can anybody help?
I've found the answer by myself.
The following files have to be created:
wikicite.layout:
<ref name=\bibtexkey>{{cite journal
| author = \author
| title = \title
| year = \year
| journal = \journal
| volume = \volume
| pages = \pages
| url = \url
}}</ref>
wikicite.begin.layout:
==References==
<references>
wikicite.end.layout
</references>
Then, a new export filter has to be added into Jabref (options -> manage custom exports -> add new). But even I've found myself the answer, thanks to Stackoverflow for listening to my problem.
I am trying to build a library that currently has the following structure
lib
| src (contains some internal .dart files)
| | private_parts.dart
| strategies (contains sample strategies for applications)
| | scoring.dart
| | time.dart
| mylib.dart (the main library file to include)
My problem occurs when I try to write an application that uses the sample strategies. I get the error/warning The imported libraries 'scoring.dart' and 'time.dart' should not have the same name ''.
My main file looks something like this (placed in the web folder)
import 'package:mylib/mylib.dart';
import 'package:mylib/strategies/scoring.dart';
import 'package:mylib/strategies/time.dart';
main() {
game = new Engine(new StandardTime(), new StandardScoring());
}
How should I restructure the library to make it correct? What is best practice?
Your code doesn't show a library directive so I suppose more than one library has the library name 'NONE'.
Add a library directive at the top of your dart source file
library my_library.my_sublibrary; // <= this should differ for each library
In dart each source file is a library as long as you don't add
part of some_library
instead of the library directive. Adding no library or part of directive makes it implicitely a library without a name.