JSCS How to disable for a specific part of code rule requireDotNotation? - jscs

I am using JSCS to validate my code and I have requireDotNotation set to on for all my code base, but for a specific part of code I need to disable this rule.
Basically I would need to do something similar (example working for JSHint) but for JSCS:
/*jshint sub:true*/
//some code here
/*jshint sub:false*/

I was able to solve this issue using the following code:
//jscs:disable requireDotNotation
//some code here
//jscs:enable requireDotNotation
I am adding this answer hope can help others.

Related

How to set 'currentNavItem' default in the view

I know its easy to do from the model, as done here:
http://codepen.io/next1/pen/yJaojP
function AppCtrl($scope) {
$scope.currentNavItem = 'page1';
}
but how would you do it from the view?
CodePen
Edit: In answer to your comment below you could use ng-init
<md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="navigation links" ng-init="currentNavItem='page2'">
However, it's worth noting in the ngInit docs the following:
You should be okay to use it though.

MVC 4 VB Additional view data

Trying to find help for this problem has taken me to a whole new one: complete lack of ressources, books and samples vor MVC 4 in VB.NET. I am having to choose between learn by experience (and the associated feeling of banging your head against a wall) or give it up and move to C# alltogether.
No company should ship a product if they are not willing to give it the same support as its sibling pruduct. They should drop VB for MVC completely or give us the means to learn it.
With that out of the way, here's my question. This line:
#Html.EditorFor(Function(x) x.UsersData(temp).Roles(Role))
Is a nice line of code. Works wonders. But How can I add a class to it, so I can change the style on my css files?
Well, it seems that this should do the trick:
#Html.EditorFor(Function(x) x.UsersData(temp).Roles(Role), New With {.class = "users-manage-check-box"})
But guess what, it doesn't. Ever. The result is the same.
What is wrong and how can I fix it?
And to be completely honest, I did come up with a solution. One that makes me feel dirty.
Looking at the output from that code, i see that the boxes classes are "check-box".
So what I've been doing is this:
#html.Raw(Html.EditorFor(Function(x) x.UsersData(temp).Roles(Role), New With {.class = "users-manage-textbox"}).ToHtmlString.Replace("check-box", "user-manage-checkbox"))
This feels wrong. So wrong. And not only is it a sad piece of code, it introduces security risks, which I'll have to fix before my solution is out of the development phase.
Any clues on why the additional view data is not working as it should? Am I getting something wrong? Am I asking too much?
Thanks a lot!
I don't think EditorFor allows that. So you need to create a custom editor template yourself.
You can read more about creating custom templates in this blog post
Update:
Take a look at the answer for this issue from http://aspnetwebstack.codeplex.com/
This behavior is by design.
The overload that you are calling accepts an object parameter called
additionalViewData (http://msdn.microsoft.com/en-us/library/ff406462).
The default implementation of EditorFor ignores this value. You would
have to write a custom editor template to be able to access that
information.

How do I link to a LABEL in org-mode?

In org-mode, I have defined a figure+caption like this:
#+CAPTION: My great figure
#+LABEL: fig:myfigure
[[myfigure.png]]
How do I write "See figure [myfigure]"? I've found the following syntax:
See figure \ref{fig:myfigure}
but this looks ugly in the source file. In particular, you cannot use it for actually jumping to the figure.
You actually don't need '#+NAME', it works fine if you use '#+LABEL', which won't break your short-caption for list of figures.
Orgmode does now offer a 'jumpable', enumerated or link with name of your choice in the exported (latex, html) text if you link with:
see figure [[fig:myfigure]].
or
see figure [[fig:myfigure][figurenameintext]].
I would have added this as a comment, but I don't have the reputation yet.
--
In response to your comment (still can't comment): you do need the '#+NAME' for it to jump within the .org source file; as mentioned in the manual, and i also just confirmed that works. Not sure about the short-captions in the latest version.
With a very recent org-mode, you can use #+name:, see:
http://thread.gmane.org/gmane.emacs.orgmode/62644/focus=62646
#+CAPTION: My great figure
#+LABEL: fig:myfigure
#+name: fig:myfigure
[[test.png]]
See figure [[fig:myfigure][test]].
This works for me to jump from the link , but has no effect when exporting, I'm afraid...

DNN jQuery conflict - pop up window won't close

I'm working on a DNN site that has been set up before my time here.
There's some conflict with the jQuery I believe, which prevents the modal pop up window in the attached calendar (link) events to not close properly:
http://www.sim-one.ca/NewsandEvents/calendar-of-events.aspx
I tried eliminating one script call at a time to see which one could be messing this up to no avail.
When I test this with the default theme it works like a charm.
Any ideas? Anyone came across something like this before?
Thank you!
You've got plenty of 404 errors on that page, ensure first, that files are in their place.
For example, http://www.sim-one.ca/NewsandEvents/Portals/_default/Skins/SimTwo/includes/js/jquery.listnav-2.1.js was not found. Ensure this path exists.
I agree with Anrie that your references are broken. For example, http://www.sim-one.ca/NewsandEvents/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css is showing 404 but http://www.sim-one.ca/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css
You can just use links like :
/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css in order to fix this in skin file or use <%= SkinPath %>.
Try adding return false; on your event after calling the dnnModal.show()

MVC3 Razor and Javascript - lots of syntax errors in green

I am starting to notice problems when I try and code my javascript and use functions that are in my viewmodel. Things like this:
case 37:
#if (Model.GoLeft)
{
Here I get a syntax error and the words "expected constant" for Model. Is there some solution to this? Do I need to upgrade something so it works?
I checked around on stackoverflow. Someone else suggested that I should separate my js but that doesn't help me as for example in this case where I want the keypress to do something if on a certain type of page where the Model allows it. If the js is in another file I can't code this way.
thanks
your approach is just wrong. Dont generate JS code in views by ifs. You defintely should keep your JS separetly (so that browser can efectively cache and reuse it). If you need to change behaviour of client-side code according to model values, do that by generation only some king of "flags" (JS have multiple ways to do that, i am not expert in JS - for example global variable works always, but there are more elegant and recommended ways) and in your client-side method test for their presence and fork your code by that.

Resources